Created
April 1, 2010 16:18
-
-
Save anveo/352023 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
# Flush all current rules from iptables | |
iptables -F | |
# Set default policies for INPUT, FORWARD and OUTPUT chains | |
iptables -P INPUT DROP | |
iptables -P FORWARD DROP | |
iptables -P OUTPUT ACCEPT | |
# | |
# Permit packets in to firewall itself that are part of existing and related connections. | |
# | |
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT | |
# | |
# Allow all inputs to firewall from the internal network and local interfaces | |
# | |
iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT | |
iptables -A INPUT -i lo -s 0/0 -d 0/0 -j ACCEPT | |
# SSH | |
iptables -A INPUT -p tcp --dport 22 -j ACCEPT | |
# HTTP/Apache | |
iptables -A INPUT -p tcp --dport 80 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 443 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 25 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 110 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 465 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 993 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 995 -j ACCEPT | |
# Drop anything else | |
iptables -A INPUT -s 0/0 -d 0/0 -p udp -j DROP | |
iptables -A INPUT -s 0/0 -d 0/0 -p tcp --syn -j DROP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment