Skip to content

Instantly share code, notes, and snippets.

@nobuh
Last active August 29, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nobuh/30a768eef66ecd5183b0 to your computer and use it in GitHub Desktop.
Save nobuh/30a768eef66ecd5183b0 to your computer and use it in GitHub Desktop.
/etc/sysconfig/iptables basic template
*filter
# deny all inbound
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
# accept all outbound
:OUTPUT ACCEPT [0:0]
# accept already connected sessions
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# accept all loopback
-A INPUT -i lo -j ACCEPT
# accept http port from anywhere
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# accept ssh port from anywhere
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
# deny from specific IP address
-A INPUT -m state --state NEW -s 1.2.3.4 -j DROP
COMMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment