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 # default policy is DROP
16 /sbin/iptables -P INPUT DROP
17 /sbin/iptables -P OUTPUT DROP
18 /sbin/iptables -P FORWARD DROP
21 iptables -A INPUT -i eth0 -p 50 -j ACCEPT
22 iptables -A OUTPUT -o eth0 -p 50 -j ACCEPT
25 iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
26 iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
28 # allow NAT-T including P2P
29 iptables -A INPUT -i eth0 -p udp --dport 4500 -j ACCEPT
30 iptables -A OUTPUT -o eth0 -p udp --sport 4500 -j ACCEPT
33 # allow crl fetch from winnetou
34 iptables -A INPUT -i eth0 -p tcp --sport 80 -s 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
45 ebegin "Stopping firewall"
46 for a in `cat /proc/net/ip_tables_names`; do
47 /sbin/iptables -F -t $a
48 /sbin/iptables -X -t $a
50 if [ $a == nat ]; then
51 /sbin/iptables -t nat -P PREROUTING ACCEPT
52 /sbin/iptables -t nat -P POSTROUTING ACCEPT
53 /sbin/iptables -t nat -P OUTPUT ACCEPT
54 elif [ $a == mangle ]; then
55 /sbin/iptables -t mangle -P PREROUTING ACCEPT
56 /sbin/iptables -t mangle -P INPUT ACCEPT
57 /sbin/iptables -t mangle -P FORWARD ACCEPT
58 /sbin/iptables -t mangle -P OUTPUT ACCEPT
59 /sbin/iptables -t mangle -P POSTROUTING ACCEPT
60 elif [ $a == filter ]; then
61 /sbin/iptables -t filter -P INPUT ACCEPT
62 /sbin/iptables -t filter -P FORWARD ACCEPT
63 /sbin/iptables -t filter -P OUTPUT ACCEPT
70 ebegin "Flushing firewall"
71 for a in `cat /proc/net/ip_tables_names`; do
72 /sbin/iptables -F -t $a
73 /sbin/iptables -X -t $a