Last active
December 16, 2015 18:39
-
-
Save changtimwu/5479194 to your computer and use it in GitHub Desktop.
DROP everything except web & ssh.
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
| iptables -A INPUT -i lo -j ACCEPT | |
| iptables -A OUTPUT -o lo -j ACCEPT | |
| iptables -A INPUT -p tcp --dport 22 -j ACCEPT | |
| iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT | |
| iptables -A INPUT -p tcp --dport 80 -j ACCEPT | |
| iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT | |
| iptables -A INPUT -p tcp --dport 443 -j ACCEPT | |
| iptables -A OUTPUT -p tcp --sport 443 -j ACCEPT | |
| iptables -A INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT | |
| iptables -A OUTPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT | |
| #uncomment the following if you want ping | |
| #iptables -A INPUT -p ICMP --icmp-type 8 -j ACCEPT | |
| #iptables -A OUTPUT -p ICMP --icmp-type 8 -j ACCEPT | |
| #iptables -A INPUT -p ICMP --icmp-type 0 -j ACCEPT | |
| #iptables -A OUTPUT -p ICMP --icmp-type 0 -j ACCEPT | |
| iptables -A INPUT -j DROP | |
| iptables -A OUTPUT -j DROP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment