Skip to content

Instantly share code, notes, and snippets.

Created June 6, 2014 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/fed516158ec76d3167a8 to your computer and use it in GitHub Desktop.
Save anonymous/fed516158ec76d3167a8 to your computer and use it in GitHub Desktop.
i=/sbin/iptables
# Flush all rules
$i -F
$i -X
# Setup default filter policy
$i -P INPUT DROP
$i -P OUTPUT DROP
$i -P FORWARD DROP
# Allow established connections
$i -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow unlimited traffic on loopback
$i -A INPUT -i lo -j ACCEPT
$i -A OUTPUT -o lo -j ACCEPT
# Open nginx
$i -A INPUT -p tcp --dport 443 -j ACCEPT
$i -A INPUT -p tcp --dport 80 -j ACCEPT
# Open SSH
$i -A INPUT -p tcp --dport 22 -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment