Last active
July 28, 2016 14:54
-
-
Save russianryebread/8455c0ef420e01a2fb0e to your computer and use it in GitHub Desktop.
Default Basic iptables ruleset.
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
| # Set up the firewall rules / Policies | |
| iptables -P OUTPUT ACCEPT | |
| iptables -P INPUT ACCEPT | |
| iptables -P FORWARD ACCEPT | |
| # Block common attacks | |
| iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP | |
| iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP | |
| iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP | |
| # Allow localhost | |
| iptables -A INPUT -i lo -j ACCEPT | |
| # Allow related traffic | |
| iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | |
| # Services | |
| iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT | |
| iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT | |
| iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT | |
| # drop everything else. | |
| iptables -A INPUT -j DROP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment