Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mrverrall/ac6aa97c427faf7ebab1616018115ff5 to your computer and use it in GitHub Desktop.
Save mrverrall/ac6aa97c427faf7ebab1616018115ff5 to your computer and use it in GitHub Desktop.
# Local and established are just fine
-A INPUT -i lo -j ACCEPT
-A INPUT -d 127.0.0.0/8 ! -i lo -j REJECT --reject-with icmp-port-unreachable
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# SSH Rate Limiting
-I INPUT -p tcp --dport 22 -m state --state NEW -m recent --set
-I INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 3 -j DROP
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
# Pings
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
# To hell with the rest
-A INPUT -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -j REJECT --reject-with icmp-port-unreachable
-A OUTPUT -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment