Skip to content

Instantly share code, notes, and snippets.

@piscis
Created February 26, 2013 14:41
Show Gist options
  • Save piscis/5038892 to your computer and use it in GitHub Desktop.
Save piscis/5038892 to your computer and use it in GitHub Desktop.
Its a start :-)
# Allow outgoing traffic and disallow any passthroughs
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
# Allow traffic already established to continue
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow ssh, web services
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# Allow local loopback services and internal network
iptables -A INPUT -i lo -j ACCEPT
# Allow pings
iptables -I INPUT -p icmp --icmp-type destination-unreachable -j ACCEPT
iptables -I INPUT -p icmp --icmp-type source-quench -j ACCEPT
iptables -I INPUT -p icmp --icmp-type time-exceeded -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment