Created
April 18, 2013 21:23
-
-
Save RichardBarrell/5416343 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Incoming, allow TCP 22, 80, 443 and all ICMP except redirect. | |
# Outgoing, allow everything. | |
iptables -P INPUT DROP | |
iptables -P OUTPUT ACCEPT | |
iptables -P FORWARD DROP | |
iptables -F | |
iptables -A INPUT -i lo -j ACCEPT | |
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
iptables -A INPUT -p tcp --dport 22 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 80 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 443 -j ACCEPT | |
iptables -A INPUT -p icmp --icmp-type redirect -j REJECT | |
iptables -A INPUT -p icmp -j ACCEPT | |
# REJECT is better than DROP. With DROP, people can tell the difference between | |
# a port that's blocked and a port that's open but doesn't have a listener yet. | |
iptables -A INPUT -j REJECT | |
/sbin/service iptables save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment