Created
April 22, 2014 19:59
-
-
Save unixpickle/11192317 to your computer and use it in GitHub Desktop.
My iptables configuration script
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
#!/bin/bash | |
setupAccept () { | |
$1 -P INPUT ACCEPT | |
$1 -P OUTPUT ACCEPT | |
$1 --flush | |
$1 -A INPUT -i lo -j ACCEPT | |
$1 -A OUTPUT -o lo -j ACCEPT | |
$1 -A INPUT -p tcp --dport 80 -j ACCEPT | |
$1 -A INPUT -p tcp --dport 22 -j ACCEPT | |
$1 -A INPUT -p tcp --dport 443 -j ACCEPT | |
$1 -A INPUT -p udp --sport 53 -j ACCEPT | |
$1 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
$1 -P INPUT DROP | |
} | |
setupAccept iptables | |
setupAccept ip6tables |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment