Forward Firewall: added /var/ipfire/forward/bin to backup-exclude script
[people/teissler/ipfire-2.x.git] / config / forwardfw / firewall-policy
CommitLineData
5d7faa45
AM
1#!/bin/sh
2
3eval $(/usr/local/bin/readhash /var/ipfire/forward/settings)
4eval $(/usr/local/bin/readhash /var/ipfire/optionsfw/settings)
53f4c74d 5eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
5d7faa45
AM
6
7iptables -F POLICYFWD
8iptables -F POLICYOUT
d47bb8a1 9iptables -F POLICYIN
53f4c74d
AM
10
11if [ -f "/var/ipfire/red/iface" ]; then
12 IFACE=`cat /var/ipfire/red/iface`
13fi
5d7faa45 14
ef6f983b 15#FORWARDFW
5d7faa45
AM
16if [ "$POLICY" == "MODE1" ]; then
17 if [ "$FWPOLICY" == "REJECT" ]; then
18 if [ "$DROPFORWARD" == "on" ]; then
19 /sbin/iptables -A POLICYFWD -m limit --limit 10/minute -j LOG --log-prefix "REJECT_FORWARD"
20 fi
93b75f31 21 /sbin/iptables -A POLICYFWD -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_FORWARD"
5d7faa45
AM
22 fi
23 if [ "$FWPOLICY" == "DROP" ]; then
24 if [ "$DROPFORWARD" == "on" ]; then
25 /sbin/iptables -A POLICYFWD -m limit --limit 10/minute -j LOG --log-prefix "DROP_FORWARD"
26 fi
27 /sbin/iptables -A POLICYFWD -j DROP -m comment --comment "DROP_FORWARD"
28 fi
93b75f31 29else
53f4c74d
AM
30 if [ "$BLUE_DEV" ] && [ "$IFACE" ]; then
31 /sbin/iptables -A POLICYFWD -i blue0 ! -o $IFACE -j DROP
32 fi
a6485463 33 /sbin/iptables -A POLICYFWD -i orange0 ! -o $IFACE -j DROP
94ea1f03 34 /sbin/iptables -A POLICYFWD -j ACCEPT
aff15def 35 /sbin/iptables -A POLICYFWD -m comment --comment "DROP_FORWARD" -j DROP
5d7faa45 36fi
93b75f31 37
ef6f983b 38#OUTGOINGFW
5d7faa45 39if [ "$POLICY1" == "MODE1" ]; then
ef6f983b
AM
40 if [ "$FWPOLICY1" == "REJECT" ]; then
41 if [ "$DROPOUTGOING" == "on" ]; then
42 /sbin/iptables -A POLICYOUT -m limit --limit 10/minute -j LOG --log-prefix "REJECT_OUTPUT"
5d7faa45 43 fi
93b75f31 44 /sbin/iptables -A POLICYOUT -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_OUTPUT"
ef6f983b
AM
45 fi
46 if [ "$FWPOLICY1" == "DROP" ]; then
47 if [ "$DROPOUTGOING" == "on" ]; then
48 /sbin/iptables -A POLICYOUT -m limit --limit 10/minute -j LOG --log-prefix "DROP_OUTPUT"
5d7faa45 49 fi
ef6f983b
AM
50 /sbin/iptables -A POLICYOUT -j DROP -m comment --comment "DROP_OUTPUT"
51 fi
93b75f31 52else
94ea1f03 53 /sbin/iptables -A POLICYOUT -j ACCEPT
aff15def 54 /sbin/iptables -A POLICYOUT -m comment --comment "DROP_OUTPUT" -j DROP
5d7faa45 55fi
d47bb8a1
AM
56#INPUT
57if [ "$FWPOLICY2" == "REJECT" ]; then
58 if [ "$DROPINPUT" == "on" ]; then
59 /sbin/iptables -A POLICYIN -m limit --limit 10/minute -j LOG --log-prefix "REJECT_INPUT"
60 fi
93b75f31 61 /sbin/iptables -A POLICYIN -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_INPUT"
d47bb8a1
AM
62fi
63if [ "$FWPOLICY2" == "DROP" ]; then
64 if [ "$DROPINPUT" == "on" ]; then
93b75f31 65 /sbin/iptables -A POLICYIN -m limit --limit 10/minute -j LOG --log-prefix "DROP_INPUT"
d47bb8a1 66 fi
93b75f31 67 /sbin/iptables -A POLICYIN -j DROP -m comment --comment "DROP_INPUT"
d47bb8a1 68fi
aff15def
AM
69
70exit 0