]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
converted all pfkey iptables scenarios
authorAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 8 Jan 2013 07:22:59 +0000 (08:22 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 17 Jan 2013 15:55:01 +0000 (16:55 +0100)
25 files changed:
testing/tests/pfkey/alg-aes-xcbc/posttest.dat
testing/tests/pfkey/alg-aes-xcbc/pretest.dat
testing/tests/pfkey/alg-sha384/posttest.dat
testing/tests/pfkey/alg-sha384/pretest.dat
testing/tests/pfkey/alg-sha512/posttest.dat
testing/tests/pfkey/alg-sha512/pretest.dat
testing/tests/pfkey/esp-alg-null/posttest.dat
testing/tests/pfkey/esp-alg-null/pretest.dat
testing/tests/pfkey/host2host-transport/posttest.dat
testing/tests/pfkey/host2host-transport/pretest.dat
testing/tests/pfkey/nat-rw/hosts/sun/etc/iptables.rules [new file with mode: 0644]
testing/tests/pfkey/nat-rw/posttest.dat
testing/tests/pfkey/nat-rw/pretest.dat
testing/tests/pfkey/net2net-route/posttest.dat
testing/tests/pfkey/net2net-route/pretest.dat
testing/tests/pfkey/protoport-dual/posttest.dat
testing/tests/pfkey/protoport-dual/pretest.dat
testing/tests/pfkey/protoport-route/posttest.dat
testing/tests/pfkey/protoport-route/pretest.dat
testing/tests/pfkey/rw-cert/posttest.dat
testing/tests/pfkey/rw-cert/pretest.dat
testing/tests/pfkey/shunt-policies/hosts/moon/etc/init.d/iptables [deleted file]
testing/tests/pfkey/shunt-policies/hosts/moon/etc/iptables.rules [new file with mode: 0644]
testing/tests/pfkey/shunt-policies/posttest.dat
testing/tests/pfkey/shunt-policies/pretest.dat

index 94a400606a7a7e9d41f50100471b0d2c27501d1d..046d4cfdc4678f1e7553cba9f099f029f7f6617f 100644 (file)
@@ -1,4 +1,4 @@
 moon::ipsec stop
 carol::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-carol::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+carol::iptables-restore < /etc/iptables.flush
index f360351e108998c72f0e05ef5cbd07a760f3c994..4fc25772b7c3f20f6b17663fed073169c6daffbe 100644 (file)
@@ -1,5 +1,5 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-carol::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+carol::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 carol::ipsec start
 carol::sleep 1 
index 94a400606a7a7e9d41f50100471b0d2c27501d1d..046d4cfdc4678f1e7553cba9f099f029f7f6617f 100644 (file)
@@ -1,4 +1,4 @@
 moon::ipsec stop
 carol::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-carol::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+carol::iptables-restore < /etc/iptables.flush
index f360351e108998c72f0e05ef5cbd07a760f3c994..4fc25772b7c3f20f6b17663fed073169c6daffbe 100644 (file)
@@ -1,5 +1,5 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-carol::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+carol::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 carol::ipsec start
 carol::sleep 1 
index 94a400606a7a7e9d41f50100471b0d2c27501d1d..046d4cfdc4678f1e7553cba9f099f029f7f6617f 100644 (file)
@@ -1,4 +1,4 @@
 moon::ipsec stop
 carol::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-carol::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+carol::iptables-restore < /etc/iptables.flush
index f360351e108998c72f0e05ef5cbd07a760f3c994..4fc25772b7c3f20f6b17663fed073169c6daffbe 100644 (file)
@@ -1,5 +1,5 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-carol::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+carol::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 carol::ipsec start
 carol::sleep 1 
index 94a400606a7a7e9d41f50100471b0d2c27501d1d..046d4cfdc4678f1e7553cba9f099f029f7f6617f 100644 (file)
@@ -1,4 +1,4 @@
 moon::ipsec stop
 carol::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-carol::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+carol::iptables-restore < /etc/iptables.flush
index f360351e108998c72f0e05ef5cbd07a760f3c994..4fc25772b7c3f20f6b17663fed073169c6daffbe 100644 (file)
@@ -1,5 +1,5 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-carol::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+carol::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 carol::ipsec start
 carol::sleep 1 
index 5a9150bc846aed86eb07ab437a2daeefeefc0228..1f7aa73a15246c938c27f4e67da2edcfc068f43e 100644 (file)
@@ -1,4 +1,4 @@
 moon::ipsec stop
 sun::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-sun::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+sun::iptables-restore < /etc/iptables.flush
index e2d98f2eb730c312e106fb46bda54b4682d70f4a..99789b90f67d8fd9ea98426fcf7913d2a6a60088 100644 (file)
@@ -1,5 +1,5 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-sun::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+sun::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 sun::ipsec start
 moon::sleep 2
diff --git a/testing/tests/pfkey/nat-rw/hosts/sun/etc/iptables.rules b/testing/tests/pfkey/nat-rw/hosts/sun/etc/iptables.rules
new file mode 100644 (file)
index 0000000..ae8f9a6
--- /dev/null
@@ -0,0 +1,24 @@
+*filter
+
+# default policy is DROP
+-P INPUT DROP
+-P OUTPUT DROP
+-P FORWARD DROP
+
+# allow IKE
+-A INPUT  -i eth0 -p udp --dport 500 -j ACCEPT
+-A OUTPUT -o eth0 -p udp --sport 500 -j ACCEPT
+
+# allow MobIKE
+-A INPUT  -i eth0 -p udp --dport 4500 -j ACCEPT
+-A OUTPUT -o eth0 -p udp --sport 4500 -j ACCEPT
+
+# allow ssh
+-A INPUT  -p tcp --dport 22 -j ACCEPT
+-A OUTPUT -p tcp --sport 22 -j ACCEPT
+
+# allow crl fetch from winnetou
+-A INPUT  -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
+-A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
+
+COMMIT
index 52572ece86bd717ca836a3e15436f2a7952e0b09..4643a3a7bc06d6503b8bce5f1d684f81cf7a5702 100644 (file)
@@ -1,8 +1,8 @@
 sun::ipsec stop
 alice::ipsec stop
 venus::ipsec stop
-alice::/etc/init.d/iptables stop 2> /dev/null
-venus::/etc/init.d/iptables stop 2> /dev/null
-sun::/etc/init.d/iptables stop 2> /dev/null
+alice::iptables-restore < /etc/iptables.flush
+venus::iptables-restore < /etc/iptables.flush
+sun::iptables-restore < /etc/iptables.flush
 moon::iptables -t nat -F
 moon::conntrack -F
index e365ff5c500dcd1ab12f2525430040736fef400d..c569c236e9151388cddc63dc1b0ea764177d823a 100644 (file)
@@ -1,6 +1,6 @@
-alice::/etc/init.d/iptables start 2> /dev/null
-venus::/etc/init.d/iptables start 2> /dev/null
-sun::/etc/init.d/iptables start 2> /dev/null
+alice::iptables-restore < /etc/iptables.rules
+venus::iptables-restore < /etc/iptables.rules
+sun::iptables-restore < /etc/iptables.rules
 moon::echo 1 > /proc/sys/net/ipv4/ip_forward
 moon::iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p udp -j SNAT --to-source PH_IP_MOON:1024-1100
 moon::iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p tcp -j SNAT --to-source PH_IP_MOON:2000-2100
index 5a9150bc846aed86eb07ab437a2daeefeefc0228..1f7aa73a15246c938c27f4e67da2edcfc068f43e 100644 (file)
@@ -1,4 +1,4 @@
 moon::ipsec stop
 sun::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-sun::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+sun::iptables-restore < /etc/iptables.flush
index 2eef7de1991a38dd87df227a914b04ecb3cf4388..e4ee3fac2bc577ff8e8ffb07415447852339e9b9 100644 (file)
@@ -1,5 +1,5 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-sun::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+sun::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 sun::ipsec start
 moon::sleep 2 
index 94a400606a7a7e9d41f50100471b0d2c27501d1d..046d4cfdc4678f1e7553cba9f099f029f7f6617f 100644 (file)
@@ -1,4 +1,4 @@
 moon::ipsec stop
 carol::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-carol::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+carol::iptables-restore < /etc/iptables.flush
index d3d0061c31605e5bb130b672af57a7c050326a47..efb2e5712c7e2be3ab1934f709acd42a6b3fc2ae 100644 (file)
@@ -1,5 +1,5 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-carol::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+carol::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 carol::ipsec start
 carol::sleep 2
index 94a400606a7a7e9d41f50100471b0d2c27501d1d..046d4cfdc4678f1e7553cba9f099f029f7f6617f 100644 (file)
@@ -1,4 +1,4 @@
 moon::ipsec stop
 carol::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-carol::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+carol::iptables-restore < /etc/iptables.flush
index 0aded0f4d09c66b70167e8ee0c5e6b38e3d5c70e..5a15574d6acd5e50050f77f76d6bc38bf8ea3b49 100644 (file)
@@ -1,5 +1,5 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-carol::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+carol::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 carol::ipsec start
 carol::sleep 1
index 7cebd7f25714c188fdaeb180dc8d53f5774848e3..1865a1c60eb1dcb5867d6c1d9bf6605f054c4757 100644 (file)
@@ -1,6 +1,6 @@
 moon::ipsec stop
 carol::ipsec stop
 dave::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-carol::/etc/init.d/iptables stop 2> /dev/null
-dave::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+carol::iptables-restore < /etc/iptables.flush
+dave::iptables-restore < /etc/iptables.flush
index 42e9d7c242fe5979b4aba4366d70b10b0c171bc6..8bbea141208ee2522aa2c991cbddde064a1c8452 100644 (file)
@@ -1,6 +1,6 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-carol::/etc/init.d/iptables start 2> /dev/null
-dave::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+carol::iptables-restore < /etc/iptables.rules
+dave::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 carol::ipsec start
 dave::ipsec start
diff --git a/testing/tests/pfkey/shunt-policies/hosts/moon/etc/init.d/iptables b/testing/tests/pfkey/shunt-policies/hosts/moon/etc/init.d/iptables
deleted file mode 100755 (executable)
index 2b90a14..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-opts="start stop reload"
-
-depend() {
-       before net
-       need logger
-}
-
-start() {
-       ebegin "Starting firewall"
-
-       # enable IP forwarding
-       echo 1 > /proc/sys/net/ipv4/ip_forward
-       
-       # default policy is DROP
-       /sbin/iptables -P INPUT DROP
-       /sbin/iptables -P OUTPUT DROP
-       /sbin/iptables -P FORWARD DROP
-
-       # allow esp
-       iptables -A INPUT  -i eth0 -p 50 -j ACCEPT
-       iptables -A OUTPUT -o eth0 -p 50 -j ACCEPT
-
-       # allow IKE
-       iptables -A INPUT  -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
-       iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
-
-       # allow MobIKE
-       iptables -A INPUT  -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT
-       iptables -A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT
-
-       # allow crl fetch from winnetou
-       iptables -A INPUT  -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
-       iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
-
-       # allow ssh
-       iptables -A INPUT  -p tcp --dport 22 -j ACCEPT
-       iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
-
-       # allow icmp in local net
-       iptables -A INPUT  -i eth1 -p icmp -j ACCEPT
-       iptables -A OUTPUT -o eth1 -p icmp -j ACCEPT
-
-       eend $?
-}
-
-stop() {
-       ebegin "Stopping firewall"
-               for a in `cat /proc/net/ip_tables_names`; do
-                       /sbin/iptables -F -t $a
-                       /sbin/iptables -X -t $a
-       
-                       if [ $a == nat ]; then
-                               /sbin/iptables -t nat -P PREROUTING ACCEPT
-                               /sbin/iptables -t nat -P POSTROUTING ACCEPT
-                               /sbin/iptables -t nat -P OUTPUT ACCEPT
-                       elif [ $a == mangle ]; then
-                               /sbin/iptables -t mangle -P PREROUTING ACCEPT
-                               /sbin/iptables -t mangle -P INPUT ACCEPT
-                               /sbin/iptables -t mangle -P FORWARD ACCEPT
-                               /sbin/iptables -t mangle -P OUTPUT ACCEPT
-                               /sbin/iptables -t mangle -P POSTROUTING ACCEPT
-                       elif [ $a == filter ]; then
-                               /sbin/iptables -t filter -P INPUT ACCEPT
-                               /sbin/iptables -t filter -P FORWARD ACCEPT
-                               /sbin/iptables -t filter -P OUTPUT ACCEPT
-                       fi
-               done
-       eend $?
-}
-
-reload() {
-       ebegin "Flushing firewall"
-               for a in `cat /proc/net/ip_tables_names`; do
-                       /sbin/iptables -F -t $a
-                       /sbin/iptables -X -t $a
-               done;
-        eend $?
-       start
-}
-
diff --git a/testing/tests/pfkey/shunt-policies/hosts/moon/etc/iptables.rules b/testing/tests/pfkey/shunt-policies/hosts/moon/etc/iptables.rules
new file mode 100644 (file)
index 0000000..af0f252
--- /dev/null
@@ -0,0 +1,32 @@
+*filter
+
+# default policy is DROP
+-P INPUT DROP
+-P OUTPUT DROP
+-P FORWARD DROP
+
+# allow esp
+-A INPUT  -i eth0 -p 50 -j ACCEPT
+-A OUTPUT -o eth0 -p 50 -j ACCEPT
+
+# allow IKE
+-A INPUT  -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
+-A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
+
+# allow MobIKE
+-A INPUT  -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT
+-A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT
+
+# allow ssh
+-A INPUT  -p tcp --dport 22 -j ACCEPT
+-A OUTPUT -p tcp --sport 22 -j ACCEPT
+
+# allow crl fetch from winnetou
+-A INPUT  -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
+-A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
+
+# allow icmp in local net
+-A INPUT  -i eth1 -p icmp -j ACCEPT
+-A OUTPUT -o eth1 -p icmp -j ACCEPT
+
+COMMIT
index a4c96e10f86000ef40060387526dde87f4126cc0..837738fc6ac7661098219147901d0be4dbfa24f2 100644 (file)
@@ -1,5 +1,5 @@
 moon::ipsec stop
 sun::ipsec stop
-moon::/etc/init.d/iptables stop 2> /dev/null
-sun::/etc/init.d/iptables stop 2> /dev/null
+moon::iptables-restore < /etc/iptables.flush
+sun::iptables-restore < /etc/iptables.flush
 
index 2d7a78acb27a5be87950f5cea8ea773a5f921ee3..c724e5df857ed8974c4858b03334e0ba8af22e87 100644 (file)
@@ -1,5 +1,5 @@
-moon::/etc/init.d/iptables start 2> /dev/null
-sun::/etc/init.d/iptables start 2> /dev/null
+moon::iptables-restore < /etc/iptables.rules
+sun::iptables-restore < /etc/iptables.rules
 moon::ipsec start
 sun::ipsec start
 moon::sleep 1