Skip to content

Commit

Permalink
Merge pull request #37 from picatz/iptables-block-metadata-endpoint
Browse files Browse the repository at this point in the history
Block access to the metadata endpoint with NOMAD-AMDIN
  • Loading branch information
picatz authored May 31, 2021
2 parents 3cfd6b6 + ea421dd commit f06f592
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions templates/client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,15 @@ systemctl restart docker
# Start and enable Nomad
systemctl start nomad
systemctl enable nomad

# Block access to the metadata endpoint in four easy steps
# https://github.com/picatz/terraform-google-nomad/issues/19
#
# 1. Create NOAMD-ADMIN chain
sudo iptables --new NOMAD-ADMIN
# 2. Add default rule (this is appended by Nomad by default to the end of the chain as well... maye not needed?)
sudo iptables --append NOMAD-ADMIN --destination 172.26.64.0/20 --jump ACCEPT
# 3. Allow access to metadata endpoint for DNS resolution (UDP only)
sudo iptables --append NOMAD-ADMIN --destination 169.254.169.254/32 --protocol udp --dport 53 --jump ACCEPT
# 4. Block access to metadata endpoint
sudo iptables --append NOMAD-ADMIN --destination 169.254.169.254/32 --jump DROP

0 comments on commit f06f592

Please sign in to comment.