Skip to content

Instantly share code, notes, and snippets.

@randallknutson
Created February 28, 2013 21:42
Show Gist options
  • Save randallknutson/5060367 to your computer and use it in GitHub Desktop.
Save randallknutson/5060367 to your computer and use it in GitHub Desktop.
iptables only allow web traffic. Stored in /etc/iptables.rules iptables-restore < /etc/iptables.downrules sudo sh -c "iptables-save -c > /etc/iptables.rules"
# Generated by iptables-save v1.4.12 on Fri Jan 4 21:46:44 2013
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [247:293129]
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s 127.0.0.1/32 -p tcp -j ACCEPT
-A INPUT -j DROP
COMMIT
# Completed on Fri Jan 4 21:46:44 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment