Skip to content

fix: harden fck-nat bootstrap against IMDS/interface race#16

Closed
leonardosul wants to merge 2 commits intomainfrom
fix/fck-nat-bootstrap-guard
Closed

fix: harden fck-nat bootstrap against IMDS/interface race#16
leonardosul wants to merge 2 commits intomainfrom
fix/fck-nat-bootstrap-guard

Conversation

@leonardosul
Copy link
Contributor

@leonardosul leonardosul commented Mar 4, 2026

Summary

  • add launch template user_data that installs a small on-instance guard (nat-zero-fck-nat-guard)
  • guard retries IMDSv2 + public interface resolution, restarts fck-nat.service, and verifies iptables SNAT MASQUERADE exists on the resolved public interface
  • keep ENI/EIP lifecycle and Lambda behavior unchanged; no new IAM permissions
  • include bootstrap guard version in CONFIG_VERSION so existing NATs roll forward via normal reconciliation
  • add focused integration assertion that launch template latest version includes guard user-data markers

Why

Observed failure mode in us-east-2a had NAT instance running with EIP attached while fck-nat failed during boot (IMDS unreachable, empty interface, missing SNAT rule). This change hardens startup locally on the instance and ensures SNAT is actually present before guard success.

Validation

  • terraform fmt
  • terraform fmt -check
  • terraform validate
  • cd cmd/lambda && go test -run '^$' ./...
  • cd tests/integration && go test -run '^$' ./...

(Full live AWS integration test not run in this pass.)

@leonardosul leonardosul closed this Mar 4, 2026
@leonardosul leonardosul deleted the fix/fck-nat-bootstrap-guard branch March 4, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant