From a520e4a010eea0fc3836d4fcfa45140434ff605f Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Mon, 28 Jan 2013 10:44:19 +0100 Subject: [PATCH] Implement net2net-xfrmproxy integration test --- .../tkm/net2net-xfrmproxy/description.txt | 6 +++++ .../tests/tkm/net2net-xfrmproxy/evaltest.dat | 13 ++++++++++ .../hosts/moon/etc/tkm/moonKey.der | Bin 0 -> 1191 bytes .../hosts/moon/etc/tkm/strongswanCert.der | Bin 0 -> 956 bytes .../hosts/moon/etc/tkm/tkm.conf | 23 ++++++++++++++++++ .../hosts/sun/etc/ipsec.conf | 23 ++++++++++++++++++ .../hosts/sun/etc/strongswan.conf | 6 +++++ .../tests/tkm/net2net-xfrmproxy/posttest.dat | 4 +++ .../tests/tkm/net2net-xfrmproxy/pretest.dat | 12 +++++++++ testing/tests/tkm/net2net-xfrmproxy/test.conf | 21 ++++++++++++++++ 10 files changed, 108 insertions(+) create mode 100644 testing/tests/tkm/net2net-xfrmproxy/description.txt create mode 100644 testing/tests/tkm/net2net-xfrmproxy/evaltest.dat create mode 100644 testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/tkm/moonKey.der create mode 100644 testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/tkm/strongswanCert.der create mode 100644 testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/tkm/tkm.conf create mode 100644 testing/tests/tkm/net2net-xfrmproxy/hosts/sun/etc/ipsec.conf create mode 100644 testing/tests/tkm/net2net-xfrmproxy/hosts/sun/etc/strongswan.conf create mode 100644 testing/tests/tkm/net2net-xfrmproxy/posttest.dat create mode 100644 testing/tests/tkm/net2net-xfrmproxy/pretest.dat create mode 100644 testing/tests/tkm/net2net-xfrmproxy/test.conf diff --git a/testing/tests/tkm/net2net-xfrmproxy/description.txt b/testing/tests/tkm/net2net-xfrmproxy/description.txt new file mode 100644 index 000000000..b42c89c52 --- /dev/null +++ b/testing/tests/tkm/net2net-xfrmproxy/description.txt @@ -0,0 +1,6 @@ +A connection between the subnets behind the gateways moon and sun +is set up. The host moon starts the Trusted Key Manager (TKM) and the Ada +XFRM proxy, which relays XFRM kernel messages to charon. The authentication is +based on X.509 certificates. In order to test the tunnel, client alice +behind gateway moon pings client bob located behind gateway +sun. diff --git a/testing/tests/tkm/net2net-xfrmproxy/evaltest.dat b/testing/tests/tkm/net2net-xfrmproxy/evaltest.dat new file mode 100644 index 000000000..a38dba0ee --- /dev/null +++ b/testing/tests/tkm/net2net-xfrmproxy/evaltest.dat @@ -0,0 +1,13 @@ +moon::ipsec stroke status 2> /dev/null::conn1.*ESTABLISHED.*moon.strongswan.org.*sun.strongswan.org::YES +sun::ipsec status 2> /dev/null::net-net.*ESTABLISHED.*sun.strongswan.org.*moon.strongswan.org::YES +moon::ipsec stroke status 2> /dev/null::conn1.*INSTALLED, TUNNEL::YES +sun::ipsec status 2> /dev/null::net-net.*INSTALLED, TUNNEL::YES +alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_req=1::YES +sun::tcpdump::IP moon.strongswan.org > sun.strongswan.org: ESP::YES +sun::tcpdump::IP sun.strongswan.org > moon.strongswan.org: ESP::YES +moon::cat /tmp/tkm.log::RSA private key '/etc/tkm/moonKey.der' loaded::YES +moon::cat /tmp/tkm.log::Adding policy \[ 1, 10.1.0.0/16 > 192.168.0.1 <=> 192.168.0.2 < 10.2.0.0/16 \]::YES +moon::cat /tmp/tkm.log::Checked CA certificate of CC context 1::YES +moon::cat /tmp/tkm.log::Authentication of ISA context 1 successful::YES +moon::cat /tmp/tkm.log::Adding SA \[ 1, 10.1.0.0/16 > 192.168.0.1 <=> 192.168.0.2 < 10.2.0.0/16, SPI_in.*, SPI_out.*, soft 30, hard 60 \]::YES +moon::cat /tmp/xfrm_proxy.log::Initiating ESA acquire for reqid 1::YES diff --git a/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/tkm/moonKey.der b/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/tkm/moonKey.der new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C3S5W`} literal 0 HcmV?d00001 diff --git a/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/tkm/strongswanCert.der b/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/tkm/strongswanCert.der new file mode 100644 index 0000000000000000000000000000000000000000..a5a631f4b5f8b29a990ab4b075e44e0d961c6286 GIT binary patch literal 956 zcmXqLV%}lU#I#@mGZP~d6C;BGFB_*;n@8JsUPeZ4Rt5uCLv903Hs(+kHen`b4?{@< zaS(?~SimPUue3s;xTGjQFFm+CG0#xiKoTUyEG&c&R0zt?FHvxIG>{YLH83%-G&C?Y zFfcTDv^20ZFo$xfWla;K60!#vSs9p{82K3tni#p5niv@w_J4{`dSx4y7qR(7 zmFKC?YZA||OfE0>ZPDHQ<8R&qVr3m&D^Z!e>5hr^J|7ip;*q&X7;J9nJMy%`F{u86ZU_r zKi%fNl%kd_PMW94}Puv*8AYCiO2emHylag=VxMO zWMEv}xXGY#y@3!gwq%7F8UM3z7_b2;CPqdBZjcy13kxtYuo=jLID9N(EF!VX?-sBH z8r41Dmb-cD(+3H!^nBkN;%VE(+*PTKbXwG3(qzs@zZJ zGO5X|urkr(i+z5@#=OMO{@h~8a)ncZEmz)8dA9F0uZpn zO<5(yvOZRAu^X3LC!@PVa?^LSM*f5(vbm~p5 zWc{Ll0keeWtb7-8Uz_hvj;%$Qzkq7qpBwv{HoZxiUT2jb_hH7X + + moon.strongswan.org + moonCert.pem + + + tunnel + + 1 + 192.168.0.1 + 10.1.0.0 + + + sun.strongswan.org + 192.168.0.2 + 10.2.0.0 + + + 30 + 60 + + + diff --git a/testing/tests/tkm/net2net-xfrmproxy/hosts/sun/etc/ipsec.conf b/testing/tests/tkm/net2net-xfrmproxy/hosts/sun/etc/ipsec.conf new file mode 100644 index 000000000..21b613d20 --- /dev/null +++ b/testing/tests/tkm/net2net-xfrmproxy/hosts/sun/etc/ipsec.conf @@ -0,0 +1,23 @@ +# /etc/ipsec.conf - strongSwan IPsec configuration file + +config setup + +conn %default + ikelifetime=60m + keylife=20m + rekeymargin=3m + keyingtries=1 + keyexchange=ikev2 + mobike=no + +conn net-net + left=PH_IP_SUN + leftcert=sunCert.pem + leftid=sun.strongswan.org + leftsubnet=10.2.0.0/16 + right=PH_IP_MOON + rightid=moon.strongswan.org + rightsubnet=10.1.0.0/16 + ike=aes256-sha512-modp4096! + esp=aes256-sha512-modp4096! + auto=add diff --git a/testing/tests/tkm/net2net-xfrmproxy/hosts/sun/etc/strongswan.conf b/testing/tests/tkm/net2net-xfrmproxy/hosts/sun/etc/strongswan.conf new file mode 100644 index 000000000..94e0b2a62 --- /dev/null +++ b/testing/tests/tkm/net2net-xfrmproxy/hosts/sun/etc/strongswan.conf @@ -0,0 +1,6 @@ +# /etc/strongswan.conf - strongSwan configuration file + +charon { + load = curl aes des sha1 sha2 md5 pem pkcs1 gmp random nonce x509 revocation hmac stroke kernel-netlink socket-default updown + multiple_authentication = no +} diff --git a/testing/tests/tkm/net2net-xfrmproxy/posttest.dat b/testing/tests/tkm/net2net-xfrmproxy/posttest.dat new file mode 100644 index 000000000..24544307a --- /dev/null +++ b/testing/tests/tkm/net2net-xfrmproxy/posttest.dat @@ -0,0 +1,4 @@ +moon::DAEMON_NAME=charon-tkm ipsec stop +moon::killall tkm_keymanager +moon::rm -f /tmp/tkm.rpc.ike /tmp/tkm.rpc.ees /tmp/tkm.log /tmp/xfrm_proxy.log +sun::ipsec stop diff --git a/testing/tests/tkm/net2net-xfrmproxy/pretest.dat b/testing/tests/tkm/net2net-xfrmproxy/pretest.dat new file mode 100644 index 000000000..4732a37f6 --- /dev/null +++ b/testing/tests/tkm/net2net-xfrmproxy/pretest.dat @@ -0,0 +1,12 @@ +sun::ipsec start +moon::rm /etc/ipsec.secrets +moon::tkm_cfgtool -c /etc/tkm/tkm.conf -i /etc/ipsec.conf -t /etc/tkm/tkm.bin -s /usr/local/share/tkm/tkmconfig.xsd +moon::cat /etc/ipsec.conf +moon::tkm_keymanager -c /etc/tkm/tkm.bin -k /etc/tkm/moonKey.der -r /etc/tkm/strongswanCert.der >/tmp/tkm.log 2>&1 & +moon::expect-file /tmp/tkm.rpc.ike +moon::DAEMON_NAME=charon-tkm ipsec start +moon::expect-file /tmp/tkm.rpc.ees +moon::xfrm_proxy >/tmp/xfrm_proxy.log 2>&1 & +moon::DAEMON_NAME=charon-tkm expect-connection conn1 +sun::expect-connection net-net +alice::ping -c 3 PH_IP_BOB diff --git a/testing/tests/tkm/net2net-xfrmproxy/test.conf b/testing/tests/tkm/net2net-xfrmproxy/test.conf new file mode 100644 index 000000000..afa2accbe --- /dev/null +++ b/testing/tests/tkm/net2net-xfrmproxy/test.conf @@ -0,0 +1,21 @@ +#!/bin/bash +# +# This configuration file provides information on the +# guest instances used for this test + +# All guest instances that are required for this test +# +VIRTHOSTS="alice moon winnetou sun bob" + +# Corresponding block diagram +# +DIAGRAM="a-m-w-s-b.png" + +# Guest instances on which tcpdump is to be started +# +TCPDUMPHOSTS="sun" + +# Guest instances on which IPsec is started +# Used for IPsec logging purposes +# +IPSECHOSTS="moon sun"