Forward Firewall: clean up some files
[people/teissler/ipfire-2.x.git] / config / forwardfw / firewall-policy
1 #!/bin/sh
2
3 eval $(/usr/local/bin/readhash /var/ipfire/forward/settings)
4 eval $(/usr/local/bin/readhash /var/ipfire/optionsfw/settings)
5
6 iptables -F POLICYFWD
7 iptables -F POLICYOUT
8 iptables -F POLICYIN
9
10 #FORWARDFW
11 if [ "$POLICY" == "MODE1" ]; then
12 if [ "$FWPOLICY" == "REJECT" ]; then
13 if [ "$DROPFORWARD" == "on" ]; then
14 /sbin/iptables -A POLICYFWD -m limit --limit 10/minute -j LOG --log-prefix "REJECT_FORWARD"
15 fi
16 /sbin/iptables -A POLICYFWD -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_FORWARD"
17 fi
18 if [ "$FWPOLICY" == "DROP" ]; then
19 if [ "$DROPFORWARD" == "on" ]; then
20 /sbin/iptables -A POLICYFWD -m limit --limit 10/minute -j LOG --log-prefix "DROP_FORWARD"
21 fi
22 /sbin/iptables -A POLICYFWD -j DROP -m comment --comment "DROP_FORWARD"
23 fi
24 else
25 /sbin/iptables -A POLICYFWD -j DROP -m comment --comment "DROP_FORWARD"
26 fi
27
28 #OUTGOINGFW
29 if [ "$POLICY1" == "MODE1" ]; then
30 if [ "$FWPOLICY1" == "REJECT" ]; then
31 if [ "$DROPOUTGOING" == "on" ]; then
32 /sbin/iptables -A POLICYOUT -m limit --limit 10/minute -j LOG --log-prefix "REJECT_OUTPUT"
33 fi
34 /sbin/iptables -A POLICYOUT -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_OUTPUT"
35 fi
36 if [ "$FWPOLICY1" == "DROP" ]; then
37 if [ "$DROPOUTGOING" == "on" ]; then
38 /sbin/iptables -A POLICYOUT -m limit --limit 10/minute -j LOG --log-prefix "DROP_OUTPUT"
39 fi
40 /sbin/iptables -A POLICYOUT -j DROP -m comment --comment "DROP_OUTPUT"
41 fi
42 else
43 /sbin/iptables -A POLICYOUT -j DROP -m comment --comment "DROP_OUTPUT"
44 fi
45 #INPUT
46 if [ "$FWPOLICY2" == "REJECT" ]; then
47 if [ "$DROPINPUT" == "on" ]; then
48 /sbin/iptables -A POLICYIN -m limit --limit 10/minute -j LOG --log-prefix "REJECT_INPUT"
49 fi
50 /sbin/iptables -A POLICYIN -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_INPUT"
51 fi
52 if [ "$FWPOLICY2" == "DROP" ]; then
53 if [ "$DROPINPUT" == "on" ]; then
54 /sbin/iptables -A POLICYIN -m limit --limit 10/minute -j LOG --log-prefix "DROP_INPUT"
55 fi
56 /sbin/iptables -A POLICYIN -j DROP -m comment --comment "DROP_INPUT"
57 fi