Skip to content

Instantly share code, notes, and snippets.

@oko
Last active August 29, 2015 14:11
Show Gist options
  • Save oko/8103bb276dbc12ea0ad8 to your computer and use it in GitHub Desktop.
Save oko/8103bb276dbc12ea0ad8 to your computer and use it in GitHub Desktop.
iptables basic rules
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [332:50026]
:ICMP - [0:0]
:TCP - [0:0]
:UDP - [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp -j ICMP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j TCP
-A INPUT -p udp -m conntrack --ctstate NEW -j UDP
-A TCP -p tcp -m tcp --dport 80 -j ACCEPT
-A TCP -p tcp -m tcp --dport 443 -j ACCEPT
-A ICMP -j DROP
-A TCP -j REJECT --reject-with icmp-port-unreachable
-A UDP -j REJECT --reject-with icmp-port-unreachable
COMMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment