From 0e950903edb97300f37d9b3d7437c51a8466eaf7 Mon Sep 17 00:00:00 2001 From: Andreas Steffen Date: Tue, 10 Mar 2009 21:48:37 +0000 Subject: added ikev1/dpd-restart scenario --- testing/tests/ikev1/dpd-restart/description.txt | 13 ++++++++++ testing/tests/ikev1/dpd-restart/evaltest.dat | 10 ++++++++ .../ikev1/dpd-restart/hosts/carol/etc/ipsec.conf | 25 +++++++++++++++++++ .../ikev1/dpd-restart/hosts/moon/etc/ipsec.conf | 29 ++++++++++++++++++++++ testing/tests/ikev1/dpd-restart/posttest.dat | 5 ++++ testing/tests/ikev1/dpd-restart/pretest.dat | 5 ++++ testing/tests/ikev1/dpd-restart/test.conf | 21 ++++++++++++++++ 7 files changed, 108 insertions(+) create mode 100644 testing/tests/ikev1/dpd-restart/description.txt create mode 100644 testing/tests/ikev1/dpd-restart/evaltest.dat create mode 100755 testing/tests/ikev1/dpd-restart/hosts/carol/etc/ipsec.conf create mode 100755 testing/tests/ikev1/dpd-restart/hosts/moon/etc/ipsec.conf create mode 100644 testing/tests/ikev1/dpd-restart/posttest.dat create mode 100644 testing/tests/ikev1/dpd-restart/pretest.dat create mode 100644 testing/tests/ikev1/dpd-restart/test.conf (limited to 'testing/tests/ikev1/dpd-restart') diff --git a/testing/tests/ikev1/dpd-restart/description.txt b/testing/tests/ikev1/dpd-restart/description.txt new file mode 100644 index 000000000..0a309cf52 --- /dev/null +++ b/testing/tests/ikev1/dpd-restart/description.txt @@ -0,0 +1,13 @@ +The peer carol and moon both have dynamic IP addresses, so that the remote end +is defined symbolically by right=%<hostname>. The ipsec starter resolves the +fully-qualified hostname into the current IP address via a DNS lookup (simulated by an +/etc/hosts entry). Since the peer IP addresses are expected to change over time, the option +rightallowany=yes will allow an IKE main mode rekeying to arrive from an arbitrary +IP address under the condition that the peer identity remains unchanged. When this happens +the old tunnel is replaced by an IPsec connection to the new origin. +

+In this scenario moon first initiates a tunnel to carol. After some time +the responder carol disconnects (simulated by iptables blocking IKE and ESP traffic). +moon detects via Dead Peer Detection (DPD) that the connection is down and tries to +reconnect. After a few seconds the firewall is opened again and the connection is +reestablished. diff --git a/testing/tests/ikev1/dpd-restart/evaltest.dat b/testing/tests/ikev1/dpd-restart/evaltest.dat new file mode 100644 index 000000000..016524dd9 --- /dev/null +++ b/testing/tests/ikev1/dpd-restart/evaltest.dat @@ -0,0 +1,10 @@ +moon::ipsec status::STATE_MAIN_I4 (ISAKMP SA established)::YES +carol::iptables -I INPUT 1 -i eth0 -s PH_IP_MOON -j DROP::no output expected::NO +moon::sleep 35::no output expected::NO +carol::iptables -D INPUT 1::no output expected::NO +moon::cat /var/log/auth.log::inserting event EVENT_DPD::YES +moon::cat /var/log/auth.log::DPD: No response from peer - declaring peer dead::YES +moon::cat /var/log/auth.log::DPD: Terminating all SAs using this connection::YES +moon::cat /var/log/auth.log::DPD: Restarting connection::YES +moon::sleep 5::no output expected::NO +moon::ipsec status::STATE_MAIN_I4 (ISAKMP SA established)::YES diff --git a/testing/tests/ikev1/dpd-restart/hosts/carol/etc/ipsec.conf b/testing/tests/ikev1/dpd-restart/hosts/carol/etc/ipsec.conf new file mode 100755 index 000000000..e6938e79a --- /dev/null +++ b/testing/tests/ikev1/dpd-restart/hosts/carol/etc/ipsec.conf @@ -0,0 +1,25 @@ +# /etc/ipsec.conf - strongSwan IPsec configuration file + +config setup + plutodebug=control + crlcheckinterval=180 + strictcrlpolicy=no + charonstart=no + +conn %default + ikelifetime=60m + keylife=20m + rekeymargin=3m + keyingtries=1 + +conn moon + left=%defaultroute + leftnexthop=%direct + leftsourceip=PH_IP_CAROL1 + leftcert=carolCert.pem + leftid=carol@strongswan.org + leftfirewall=yes + right=%moon.strongswan.org + rightsubnet=10.1.0.0/16 + rightid=@moon.strongswan.org + auto=add diff --git a/testing/tests/ikev1/dpd-restart/hosts/moon/etc/ipsec.conf b/testing/tests/ikev1/dpd-restart/hosts/moon/etc/ipsec.conf new file mode 100755 index 000000000..ae9b35e97 --- /dev/null +++ b/testing/tests/ikev1/dpd-restart/hosts/moon/etc/ipsec.conf @@ -0,0 +1,29 @@ +# /etc/ipsec.conf - strongSwan IPsec configuration file + +config setup + plutodebug=control + crlcheckinterval=180 + strictcrlpolicy=no + charonstart=no + +conn %default + ikelifetime=60m + keylife=20m + rekeymargin=3m + keyingtries=1 + dpdaction=restart + dpddelay=5 + dpdtimeout=25 + +conn carol + left=%defaultroute + leftnexthop=%direct + leftsubnet=10.1.0.0/16 + leftsourceip=PH_IP_MOON1 + leftcert=moonCert.pem + leftid=@moon.strongswan.org + leftfirewall=yes + right=%carol.strongswan.org + rightid=carol@strongswan.org + rightsubnet=PH_IP_CAROL1/32 + auto=start diff --git a/testing/tests/ikev1/dpd-restart/posttest.dat b/testing/tests/ikev1/dpd-restart/posttest.dat new file mode 100644 index 000000000..e092608cb --- /dev/null +++ b/testing/tests/ikev1/dpd-restart/posttest.dat @@ -0,0 +1,5 @@ +carol::ipsec stop +moon::ipsec stop +moon::/etc/init.d/iptables stop 2> /dev/null +carol::/etc/init.d/iptables stop 2> /dev/null +carol::ip addr del PH_IP_CAROL1/32 dev eth0 diff --git a/testing/tests/ikev1/dpd-restart/pretest.dat b/testing/tests/ikev1/dpd-restart/pretest.dat new file mode 100644 index 000000000..caf89d6c6 --- /dev/null +++ b/testing/tests/ikev1/dpd-restart/pretest.dat @@ -0,0 +1,5 @@ +moon::/etc/init.d/iptables start 2> /dev/null +carol::/etc/init.d/iptables start 2> /dev/null +carol::ipsec start +moon::ipsec start +moon::sleep 4 diff --git a/testing/tests/ikev1/dpd-restart/test.conf b/testing/tests/ikev1/dpd-restart/test.conf new file mode 100644 index 000000000..4d648102b --- /dev/null +++ b/testing/tests/ikev1/dpd-restart/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 carol winnetou dave" + +# Corresponding block diagram +# +DIAGRAM="a-m-c-w-d.png" + +# UML instances on which tcpdump is to be started +# +TCPDUMPHOSTS="moon alice" + +# UML instances on which IPsec is started +# Used for IPsec logging purposes +# +IPSECHOSTS="moon carol" -- cgit v1.2.3