From b0d8ed94fe9e74afb49fdf5f11e4add29879c65c Mon Sep 17 00:00:00 2001 From: Rene Mayrhofer Date: Thu, 12 Apr 2007 20:30:08 +0000 Subject: [svn-upgrade] Integrating new upstream version, strongswan (4.1.1) --- testing/tests/ikev2/double-nat-net/description.txt | 7 +++++++ testing/tests/ikev2/double-nat-net/evaltest.dat | 5 +++++ .../double-nat-net/hosts/alice/etc/ipsec.conf | 23 ++++++++++++++++++++++ .../ikev2/double-nat-net/hosts/bob/etc/ipsec.conf | 23 ++++++++++++++++++++++ testing/tests/ikev2/double-nat-net/posttest.dat | 9 +++++++++ testing/tests/ikev2/double-nat-net/pretest.dat | 15 ++++++++++++++ testing/tests/ikev2/double-nat-net/test.conf | 21 ++++++++++++++++++++ 7 files changed, 103 insertions(+) create mode 100644 testing/tests/ikev2/double-nat-net/description.txt create mode 100644 testing/tests/ikev2/double-nat-net/evaltest.dat create mode 100755 testing/tests/ikev2/double-nat-net/hosts/alice/etc/ipsec.conf create mode 100755 testing/tests/ikev2/double-nat-net/hosts/bob/etc/ipsec.conf create mode 100644 testing/tests/ikev2/double-nat-net/posttest.dat create mode 100644 testing/tests/ikev2/double-nat-net/pretest.dat create mode 100644 testing/tests/ikev2/double-nat-net/test.conf (limited to 'testing/tests/ikev2/double-nat-net') diff --git a/testing/tests/ikev2/double-nat-net/description.txt b/testing/tests/ikev2/double-nat-net/description.txt new file mode 100644 index 000000000..ff09155f6 --- /dev/null +++ b/testing/tests/ikev2/double-nat-net/description.txt @@ -0,0 +1,7 @@ +The roadwarrior alice sitting behind the NAT router moon sets up a +tunnel to the subnet hiding behind the NAT router sun. All IKE and ESP traffic +directed to the router sun is forwarded to the VPN gateway bob +using destination NAT. UDP encapsulation is used to traverse the NAT routers. +leftfirewall=yes automatically inserts iptables-based firewall rules that +let pass the tunneled traffic. In order to test the double NAT-ed IPsec +tunnel alice pings the inner IP address of the router sun. diff --git a/testing/tests/ikev2/double-nat-net/evaltest.dat b/testing/tests/ikev2/double-nat-net/evaltest.dat new file mode 100644 index 000000000..aa69dabfa --- /dev/null +++ b/testing/tests/ikev2/double-nat-net/evaltest.dat @@ -0,0 +1,5 @@ +alice::ipsec statusall::nat-t.*INSTALLED::YES +bob::ipsec statusall::nat-t.*INSTALLED::YES +alice::ping -c 1 PH_IP_SUN1::64 bytes from PH_IP_SUN1: icmp_seq=1::YES +moon::tcpdump::IP moon.strongswan.org.* > sun.strongswan.org.ipsec-nat-t: UDP::YES +moon::tcpdump::IP sun.strongswan.org.ipsec-nat-t > moon.strongswan.org.*: UDP::YES diff --git a/testing/tests/ikev2/double-nat-net/hosts/alice/etc/ipsec.conf b/testing/tests/ikev2/double-nat-net/hosts/alice/etc/ipsec.conf new file mode 100755 index 000000000..c8aa460cf --- /dev/null +++ b/testing/tests/ikev2/double-nat-net/hosts/alice/etc/ipsec.conf @@ -0,0 +1,23 @@ +# /etc/ipsec.conf - strongSwan IPsec configuration file + +config setup + crlcheckinterval=180 + strictcrlpolicy=no + plutostart=no + +conn %default + ikelifetime=60m + keylife=20m + rekeymargin=3m + keyingtries=1 + keyexchange=ikev2 + +conn nat-t + left=%defaultroute + leftcert=aliceCert.pem + leftid=alice@strongswan.org + leftfirewall=yes + right=PH_IP_SUN + rightid=bob@strongswan.org + rightsubnet=10.2.0.0/16 + auto=add diff --git a/testing/tests/ikev2/double-nat-net/hosts/bob/etc/ipsec.conf b/testing/tests/ikev2/double-nat-net/hosts/bob/etc/ipsec.conf new file mode 100755 index 000000000..f0c5b6f15 --- /dev/null +++ b/testing/tests/ikev2/double-nat-net/hosts/bob/etc/ipsec.conf @@ -0,0 +1,23 @@ +# /etc/ipsec.conf - strongSwan IPsec configuration file + +config setup + crlcheckinterval=180 + strictcrlpolicy=no + plutostart=no + +conn %default + ikelifetime=60m + keylife=20m + rekeymargin=3m + keyingtries=1 + keyexchange=ikev2 + +conn nat-t + left=%defaultroute + leftsubnet=10.2.0.0/16 + leftcert=bobCert.pem + leftid=bob@strongswan.org + leftfirewall=yes + right=%any + rightsubnet=10.1.0.0/16 + auto=add diff --git a/testing/tests/ikev2/double-nat-net/posttest.dat b/testing/tests/ikev2/double-nat-net/posttest.dat new file mode 100644 index 000000000..484297418 --- /dev/null +++ b/testing/tests/ikev2/double-nat-net/posttest.dat @@ -0,0 +1,9 @@ +bob::ipsec stop +alice::ipsec stop +alice::/etc/init.d/iptables stop 2> /dev/null +bob::/etc/init.d/iptables stop 2> /dev/null +moon::iptables -t nat -F +sun::iptables -t nat -F +moon::conntrack -F +sun::conntrack -F +sun::ip route del 10.1.0.0/16 via PH_IP_BOB diff --git a/testing/tests/ikev2/double-nat-net/pretest.dat b/testing/tests/ikev2/double-nat-net/pretest.dat new file mode 100644 index 000000000..41b69aed6 --- /dev/null +++ b/testing/tests/ikev2/double-nat-net/pretest.dat @@ -0,0 +1,15 @@ +alice::/etc/init.d/iptables start 2> /dev/null +bob::/etc/init.d/iptables start 2> /dev/null +bob::echo 1 > /proc/sys/net/ipv4/ip_forward +moon::echo 1 > /proc/sys/net/ipv4/ip_forward +sun::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 +sun::iptables -t nat -A POSTROUTING -o eth0 -s 10.2.0.0/16 -p tcp -j SNAT --to-source PH_IP_SUN:2000-2100 +sun::iptables -t nat -A PREROUTING -i eth0 -s PH_IP_MOON -p udp -j DNAT --to-destination PH_IP_BOB +sun::ip route add 10.1.0.0/16 via PH_IP_BOB +alice::ipsec start +bob::ipsec start +alice::sleep 2 +alice::ipsec up nat-t +alice::sleep 1 diff --git a/testing/tests/ikev2/double-nat-net/test.conf b/testing/tests/ikev2/double-nat-net/test.conf new file mode 100644 index 000000000..1ca2ffe5a --- /dev/null +++ b/testing/tests/ikev2/double-nat-net/test.conf @@ -0,0 +1,21 @@ +#!/bin/bash +# +# This configuration file provides information on the +# UML instances used for this test + +# All UML instances that are required for this test +# +UMLHOSTS="alice moon winnetou sun bob" + +# Corresponding block diagram +# +DIAGRAM="a-m-w-s-b.png" + +# UML instances on which tcpdump is to be started +# +TCPDUMPHOSTS="moon" + +# UML instances on which IPsec is started +# Used for IPsec logging purposes +# +IPSECHOSTS="alice bob" -- cgit v1.2.3