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
24 # allow IKE behind NAT
25 iptables -A INPUT -i eth0 -p udp --dport 500 -j ACCEPT
26 iptables -A OUTPUT -o eth0 -p udp --sport 500 -j ACCEPT
29 iptables -A INPUT -i eth0 -p udp --dport 4500 -j ACCEPT
30 iptables -A OUTPUT -o eth0 -p udp --sport 4500 -j ACCEPT
32 # allow crl fetch from winnetou
33 iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
34 iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
37 iptables -A INPUT -p tcp --dport 22 -j ACCEPT
38 iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
44 ebegin "Stopping firewall"
45 for a in `cat /proc/net/ip_tables_names`; do
46 /sbin/iptables -F -t $a
47 /sbin/iptables -X -t $a
49 if [ $a == nat ]; then
50 /sbin/iptables -t nat -P PREROUTING ACCEPT
51 /sbin/iptables -t nat -P POSTROUTING ACCEPT
52 /sbin/iptables -t nat -P OUTPUT ACCEPT
53 elif [ $a == mangle ]; then
54 /sbin/iptables -t mangle -P PREROUTING ACCEPT
55 /sbin/iptables -t mangle -P INPUT ACCEPT
56 /sbin/iptables -t mangle -P FORWARD ACCEPT
57 /sbin/iptables -t mangle -P OUTPUT ACCEPT
58 /sbin/iptables -t mangle -P POSTROUTING ACCEPT
59 elif [ $a == filter ]; then
60 /sbin/iptables -t filter -P INPUT ACCEPT
61 /sbin/iptables -t filter -P FORWARD ACCEPT
62 /sbin/iptables -t filter -P OUTPUT ACCEPT
69 ebegin "Flushing firewall"
70 for a in `cat /proc/net/ip_tables_names`; do
71 /sbin/iptables -F -t $a
72 /sbin/iptables -X -t $a