Created
December 3, 2013 12:00
-
-
Save madwork/7768009 to your computer and use it in GitHub Desktop.
My generic iptables rule set
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
iptables -F | |
iptables -X | |
iptables -t nat -F | |
iptables -t nat -X | |
iptables -t mangle -F | |
iptables -t mangle -X | |
iptables -P INPUT ACCEPT | |
iptables -P FORWARD ACCEPT | |
iptables -P OUTPUT ACCEPT |
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
iptables -A INPUT -i lo -j ACCEPT | |
iptables -A INPUT -i eth0 -p tcp ! --syn -m conntrack --ctstate NEW -j DROP | |
iptables -A INPUT -i eth0 -p tcp --tcp-flags ALL ALL -j DROP | |
iptables -A INPUT -i eth0 -p tcp --tcp-flags ALL NONE -j DROP | |
iptables -A INPUT -i eth0 -p tcp --dport ssh -m conntrack --ctstate NEW -m recent --set --name SSH | |
iptables -A INPUT -i eth0 -p tcp --dport ssh -m conntrack --ctstate NEW -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP | |
iptables -A INPUT -i eth0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
iptables -A INPUT -i eth0 -m conntrack --ctstate NEW -p tcp -m multiport --dports ssh,http,https -j ACCEPT | |
iptables -A INPUT -i eth0 -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT | |
iptables -A INPUT -i eth0 -p icmp --icmp-type echo-reply -m limit --limit 1/s -j ACCEPT | |
iptables -A INPUT -i eth0 -p udp -m limit --limit 10/s -j ACCEPT | |
iptables -A INPUT -i eth0 -j DROP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment