#!/bin/sh
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2013 #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+# Author: Alexander Marx (amarx@ipfire.org) #
+###############################################################################
+
+
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
-IFACE=`cat /var/ipfire/red/iface`
+
+if [ -f "/var/ipfire/red/iface" ]; then
+ IFACE=`cat /var/ipfire/red/iface`
+fi
#FORWARDFW
if [ "$POLICY" == "MODE1" ]; then
/sbin/iptables -A POLICYFWD -j DROP -m comment --comment "DROP_FORWARD"
fi
else
- /sbin/iptables -A POLICYFWD -i blue0 ! -o $IFACE -j DROP
+ if [ "$BLUE_DEV" ] && [ "$IFACE" ]; then
+ /sbin/iptables -A POLICYFWD -i blue0 ! -o $IFACE -j DROP
+ fi
+ /sbin/iptables -A POLICYFWD -i orange0 ! -o $IFACE -j DROP
/sbin/iptables -A POLICYFWD -j ACCEPT
+ /sbin/iptables -A POLICYFWD -m comment --comment "DROP_FORWARD" -j DROP
fi
#OUTGOINGFW
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
fi
/sbin/iptables -A POLICYIN -j DROP -m comment --comment "DROP_INPUT"
fi
+
+exit 0