]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/initscripts/init.d/firewall
firewall: Make sure that only packets that go through the tunnel are passing OVPNBLOCK.
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / firewall
index 4c9d875f9fc8e610808c17e12df9812f4a21bf66..dd678893738ff22b4ecba6ab886910ef01aeb598 100644 (file)
@@ -106,9 +106,10 @@ iptables_init() {
 
        # Block OpenVPN transfer networks
        iptables -N OVPNBLOCK
-       for i in INPUT FORWARD; do
-               iptables -A ${i} -j OVPNBLOCK
-       done
+       iptables -A INPUT   -i tun+ -j OVPNBLOCK
+       iptables -A OUTPUT  -o tun+ -j OVPNBLOCK
+       iptables -A FORWARD -i tun+ -j OVPNBLOCK
+       iptables -A FORWARD -o tun+ -j OVPNBLOCK
 
        # OpenVPN transfer network translation
        iptables -t nat -N OVPNNAT
@@ -196,8 +197,6 @@ iptables_init() {
        iptables -t nat -N REDNAT
        iptables -t nat -A POSTROUTING -j REDNAT
 
-       iptables_red
-
        # Custom prerouting chains (for transparent proxy)
        iptables -t nat -N SQUID
        iptables -t nat -A PREROUTING -j SQUID
@@ -226,19 +225,11 @@ iptables_init() {
        iptables -N POLICYOUT
        iptables -A OUTPUT -j POLICYOUT
 
+       # Initialize firewall policies.
        /usr/sbin/firewall-policy
 
-       # read new firewall
-       /usr/local/bin/firewallctrl
-
-       if [ "$DROPINPUT" == "on" ]; then
-               iptables -A INPUT   -m limit --limit 10/minute -j LOG --log-prefix "DROP_INPUT"
-       fi
-       iptables -A INPUT -j DROP -m comment --comment "DROP_INPUT"
-       if [ "$DROPFORWARD" == "on" ]; then
-               iptables -A FORWARD -m limit --limit 10/minute -j LOG --log-prefix "DROP_FORWARD"
-       fi
-       iptables -A FORWARD -j DROP -m comment --comment "DROP_FORWARD"
+       # Install firewall rules for the red interface.
+       iptables_red
 }
 
 iptables_red() {
@@ -290,6 +281,9 @@ iptables_red() {
                iptables -t nat -A REDNAT -o $IFACE -j MASQUERADE
 
        fi
+
+       # Reload all rules.
+       /usr/local/bin/firewallctrl
 }
 
 # See how we were called.