Skip to content

Commit

Permalink
fix: add missing iptables rule for default network namespace forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrwatson committed Jan 11, 2024
1 parent a11254a commit 82cb80b
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ execute_configuration_management() {
if ! iptables -t nat -C POSTROUTING -o $(ip route get 8.8.8.8 | awk -- '{printf $5}') -j MASQUERADE; then
iptables -t nat -A POSTROUTING -o $(ip route get 8.8.8.8 | awk -- '{printf $5}') -j MASQUERADE
fi

# Allow forwarding in the default network namespace to allow NAT'ed traffic leave
# NB: iptables doesn't support -C for the rule checking of protocols
iptables -P FORWARD ACCEPT

# Block calls to AWS Metadata not coming from the primary network
if ! iptables -C FORWARD -d 169.254.169.254 -j DROP; then
iptables -A FORWARD -d 169.254.169.254 -j DROP
Expand Down

0 comments on commit 82cb80b

Please sign in to comment.