Last active
December 17, 2015 16:39
-
-
Save codingfoo/5640180 to your computer and use it in GitHub Desktop.
Basic iptables config
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
https://help.ubuntu.com/community/IptablesHowTo | |
Place the scripts in | |
/etc/network/if-pre-up.d and /etc/network/if-post-down.d |
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
*filter | |
:INPUT ACCEPT [0:0] | |
:FORWARD ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
[0:0] -A INPUT -i lo -j ACCEPT | |
[0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT | |
[0:0] -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT | |
[0:0] -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT | |
[0:0] -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT | |
[0:0] -A INPUT -j DROP | |
COMMIT |
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
#!/bin/sh | |
iptables-restore < /etc/iptables.rules | |
exit 0 |
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
#!/bin/sh | |
iptables-save -c > /etc/iptables.rules | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment