2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
5 opts="start stop reload"
13 ebegin "Starting firewall"
15 # enable IP forwarding
16 echo 1 > /proc/sys/net/ipv4/ip_forward
18 # default policy is DROP
19 /sbin/iptables -P INPUT DROP
20 /sbin/iptables -P OUTPUT DROP
21 /sbin/iptables -P FORWARD DROP
24 iptables -A INPUT -i eth1 -p 50 -j ACCEPT
25 iptables -A OUTPUT -o eth1 -p 50 -j ACCEPT
28 iptables -A INPUT -i eth1 -p udp --sport 500 --dport 500 -j ACCEPT
29 iptables -A OUTPUT -o eth1 -p udp --dport 500 --sport 500 -j ACCEPT
31 # allow crl fetch from winnetou
32 iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
33 iptables -A FORWARD -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
34 iptables -A FORWARD -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
35 iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
38 iptables -A INPUT -p tcp --dport 22 -j ACCEPT
39 iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
42 iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p icmp -j SNAT --to-source PH_IP_MOON
43 iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p tcp -j SNAT --to-source PH_IP_MOON:2000-2100
49 ebegin "Stopping firewall"
50 for a in `cat /proc/net/ip_tables_names`; do
51 /sbin/iptables -F -t $a
52 /sbin/iptables -X -t $a
54 if [ $a == nat ]; then
55 /sbin/iptables -t nat -P PREROUTING ACCEPT
56 /sbin/iptables -t nat -P POSTROUTING ACCEPT
57 /sbin/iptables -t nat -P OUTPUT ACCEPT
58 elif [ $a == mangle ]; then
59 /sbin/iptables -t mangle -P PREROUTING ACCEPT
60 /sbin/iptables -t mangle -P INPUT ACCEPT
61 /sbin/iptables -t mangle -P FORWARD ACCEPT
62 /sbin/iptables -t mangle -P OUTPUT ACCEPT
63 /sbin/iptables -t mangle -P POSTROUTING ACCEPT
64 elif [ $a == filter ]; then
65 /sbin/iptables -t filter -P INPUT ACCEPT
66 /sbin/iptables -t filter -P FORWARD ACCEPT
67 /sbin/iptables -t filter -P OUTPUT ACCEPT
74 ebegin "Flushing firewall"
75 for a in `cat /proc/net/ip_tables_names`; do
76 /sbin/iptables -F -t $a
77 /sbin/iptables -X -t $a