Last active
December 19, 2015 00:19
-
-
Save QueuingKoala/5867909 to your computer and use it in GitHub Desktop.
Simple example of piping a dynamically-generated fw ruleset into iptables-restore
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
cat <<-EOF | iptables-restore | |
*nat | |
:PREROUTING ACCEPT | |
:INPUT ACCEPT | |
:OUTPUT ACCEPT | |
:POSTROUTING ACCEPT | |
-A POSTROUTING -o $WAN_IFACE_HERE -j MASQUERADE | |
COMMIT | |
*filter | |
:INPUT DROP | |
:FORWARD DROP | |
:OUTPUT ACCEPT | |
-A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
-A FORWARD -i $LAN_IFACE_HERE -j ACCEPT | |
-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
-A INPUT -i lo+ -j ACCEPT | |
COMMIT | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment