Skip to content

Instantly share code, notes, and snippets.

@crashGoBoom
Created August 4, 2021 16:25
Show Gist options
  • Save crashGoBoom/3efe7084882b82441010dbe31b55c43c to your computer and use it in GitHub Desktop.
Save crashGoBoom/3efe7084882b82441010dbe31b55c43c to your computer and use it in GitHub Desktop.
Block non root users from accessing ec2 metadata
#!/bin/bash
# This will block users that are not root from accessing ec2 metadata
# Prevents users from grabbing the instance credentials
iptables -A OUTPUT -m owner ! --uid-owner root -d 169.254.169.254 -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment