Created
May 13, 2010 21:34
-
-
Save andrewvc/400491 to your computer and use it in GitHub Desktop.
Simple iptables rules presets
This file contains 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
*filter | |
# Internal interfaces | |
-A INPUT -i lo -j ACCEPT | |
-A OUTPUT -o lo -j ACCEPT | |
#Allow all established traffic | |
-A INPUT -m state --state ESTABLISHED -j ACCEPT | |
#SSH | |
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT | |
-I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set | |
-I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 5 -j DROP | |
#HTTP | |
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT | |
#HTTPS | |
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT | |
# smtp server | |
#-A INPUT -p tcp -m tcp --dport smtp -m state --state NEW,ESTABLISHED -j ACCEPT | |
#-A INPUT -p tcp -m tcp --sport auth -m state --state ESTABLISHED -j ACCEPT | |
#SNMP Monitoring, enable only for monitor server ip | |
-A INPUT -s 127.0.0.1 -p udp -m udp --dport 161 -j ACCEPT | |
#ICMP | |
-A INPUT -p icmp -j ACCEPT | |
#Drop everything not mentioned | |
-A INPUT -j DROP | |
COMMIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment