]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/forwardfw/firewall-policy
Forward Firewall: rules for collectd now in firewall-policy instead of /etc/init...
[people/teissler/ipfire-2.x.git] / config / forwardfw / firewall-policy
index e96278a16570989b8a2fe9dd02eb20edddf2d4f0..0a5cd14b0c9366938f57434daaa780b54627433d 100755 (executable)
@@ -2,11 +2,17 @@
 
 eval $(/usr/local/bin/readhash /var/ipfire/forward/settings)
 eval $(/usr/local/bin/readhash /var/ipfire/optionsfw/settings)
+eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
 
 iptables -F POLICYFWD
 iptables -F POLICYOUT
+iptables -F POLICYIN
 
+if [ -f "/var/ipfire/red/iface" ]; then
+       IFACE=`cat /var/ipfire/red/iface`
+fi
 
+#FORWARDFW
 if [ "$POLICY" == "MODE1" ]; then
                if [ "$FWPOLICY" == "REJECT" ]; then
                        if [ "$DROPFORWARD" == "on" ]; then
@@ -20,20 +26,44 @@ if [ "$POLICY" == "MODE1" ]; then
                        fi
                        /sbin/iptables -A POLICYFWD -j DROP -m comment --comment "DROP_FORWARD"
                fi
+else
+       if [  "$BLUE_DEV" ] && [ "$IFACE" ]; then
+               /sbin/iptables -A POLICYFWD -i blue0 ! -o $IFACE -j DROP 
+       fi
+       /sbin/iptables -A POLICYFWD -j ACCEPT 
+       /sbin/iptables -A POLICYFWD -m comment --comment "DROP_FORWARD" -j DROP
 fi
+
+#OUTGOINGFW
 if [ "$POLICY1" == "MODE1" ]; then
-       /sbin/iptables -A OUTGOINGFW -m state --state ESTABLISHED,RELATED -j ACCEPT
-               if [ "$FWPOLICY1" == "REJECT" ]; then
-                       if [ "$DROPOUTGOING" == "on" ]; then
-                               /sbin/iptables -A POLICYOUT -m limit --limit 10/minute -j LOG --log-prefix "REJECT_OUTPUT"
-                       fi
-                               /sbin/iptables -A POLICYOUT -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_OUTPUT"
+       if [ "$FWPOLICY1" == "REJECT" ]; then
+               if [ "$DROPOUTGOING" == "on" ]; then
+                       /sbin/iptables -A POLICYOUT -m limit --limit 10/minute -j LOG --log-prefix "REJECT_OUTPUT"
                fi
-               if [ "$FWPOLICY1" == "DROP" ]; then
-                       if [ "$DROPOUTGOING" == "on" ]; then
-                               /sbin/iptables -A POLICYOUT -m limit --limit 10/minute -j LOG --log-prefix "DROP_OUTPUT"
-                       fi
-                               /sbin/iptables -A POLICYOUT -j DROP -m comment --comment "DROP_OUTPUT"
+               /sbin/iptables -A POLICYOUT -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_OUTPUT"
+       fi
+       if [ "$FWPOLICY1" == "DROP" ]; then
+               if [ "$DROPOUTGOING" == "on" ]; then
+                       /sbin/iptables -A POLICYOUT -m limit --limit 10/minute -j LOG --log-prefix "DROP_OUTPUT"
                fi
+                       /sbin/iptables -A POLICYOUT -j DROP -m comment --comment "DROP_OUTPUT"
+       fi
+else
+       /sbin/iptables -A POLICYOUT -j ACCEPT 
+       /sbin/iptables -A POLICYOUT -m comment --comment "DROP_OUTPUT" -j DROP
+fi
+#INPUT
+if [ "$FWPOLICY2" == "REJECT" ]; then
+       if [ "$DROPINPUT" == "on" ]; then
+               /sbin/iptables -A POLICYIN -m limit --limit 10/minute -j LOG --log-prefix "REJECT_INPUT"
+       fi
+       /sbin/iptables -A POLICYIN -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_INPUT"
+fi
+if [ "$FWPOLICY2" == "DROP" ]; then
+       if [ "$DROPINPUT" == "on" ]; then
+               /sbin/iptables -A POLICYIN -m limit --limit 10/minute -j LOG --log-prefix "DROP_INPUT"
+       fi
+       /sbin/iptables -A POLICYIN -j DROP -m comment --comment "DROP_INPUT"
 fi
 
+exit 0