diff options
Diffstat (limited to 'testing/tests/route-based/net2net-vti')
9 files changed, 152 insertions, 0 deletions
diff --git a/testing/tests/route-based/net2net-vti/description.txt b/testing/tests/route-based/net2net-vti/description.txt new file mode 100644 index 000000000..fc35caf6f --- /dev/null +++ b/testing/tests/route-based/net2net-vti/description.txt @@ -0,0 +1,12 @@ +A connection between the subnets behind the gateways <b>moon</b> and <b>sun</b> +is set up using VTI interfaces. +<p/> +The gateways use <b>route-based forwarding</b> with <b>VTI tunnels</b>, with +firewall rules to allow traffic to pass. The IPsec traffic selector used is +0.0.0.0/0, however specific routing is achieved with routes on the VTI +interfaces. The IKE daemon is configured to not install routes with +<em>charon.install_routes=0</em>, and static routes are installed for the +target subnets on the VTI interfaces. +<p/> +Client <b>alice</b> behind gateway <b>moon</b> pings client <b>bob</b> located +behind gateway <b>sun</b>. diff --git a/testing/tests/route-based/net2net-vti/evaltest.dat b/testing/tests/route-based/net2net-vti/evaltest.dat new file mode 100644 index 000000000..0bf5cdb5a --- /dev/null +++ b/testing/tests/route-based/net2net-vti/evaltest.dat @@ -0,0 +1,5 @@ +moon::swanctl --list-sas --ike-id 1 --raw 2> /dev/null::gw.*version=2 state=ESTABLISHED local-host=PH_IP_MOON local-port=4500 local-id=moon.strongswan.org remote-host=PH_IP_SUN remote-port=4500 remote-id=sun.strongswan.org.*child-sas.*net.*reqid=1 state=INSTALLED mode=TUNNEL.*ESP.*local-ts=\[0.0.0.0/0] remote-ts=\[0.0.0.0/0]::YES +sun::swanctl --list-sas --ike-id 1 --raw 2> /dev/null::gw.*version=2 state=ESTABLISHED local-host=PH_IP_SUN local-port=4500 local-id=sun.strongswan.org remote-host=PH_IP_MOON remote-port=4500 remote-id=moon.strongswan.org.*child-sas.*net.*reqid=1 state=INSTALLED mode=TUNNEL.*ESP.*local-ts=\[0.0.0.0/0] remote-ts=\[0.0.0.0/0]::YES +alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_.eq=1::YES +sun::tcpdump::IP moon.strongswan.org > sun.strongswan.org: ESP::YES +sun::tcpdump::IP sun.strongswan.org > moon.strongswan.org: ESP::YES diff --git a/testing/tests/route-based/net2net-vti/hosts/moon/etc/strongswan.conf b/testing/tests/route-based/net2net-vti/hosts/moon/etc/strongswan.conf new file mode 100644 index 000000000..136dbe84f --- /dev/null +++ b/testing/tests/route-based/net2net-vti/hosts/moon/etc/strongswan.conf @@ -0,0 +1,13 @@ +# /etc/strongswan.conf - strongSwan configuration file + +swanctl { + load = pem pkcs1 x509 revocation constraints pubkey openssl random +} + +charon-systemd { + load = random nonce aes sha1 sha2 pem pkcs1 curve25519 gmp x509 curl revocation hmac vici kernel-netlink socket-default updown +} + +charon { + install_routes = 0 +} diff --git a/testing/tests/route-based/net2net-vti/hosts/moon/etc/swanctl/swanctl.conf b/testing/tests/route-based/net2net-vti/hosts/moon/etc/swanctl/swanctl.conf new file mode 100755 index 000000000..e8beec307 --- /dev/null +++ b/testing/tests/route-based/net2net-vti/hosts/moon/etc/swanctl/swanctl.conf @@ -0,0 +1,29 @@ +connections { + + gw-gw { + local_addrs = PH_IP_MOON + remote_addrs = PH_IP_SUN + + local { + auth = pubkey + certs = moonCert.pem + id = moon.strongswan.org + } + remote { + auth = pubkey + id = sun.strongswan.org + } + children { + net-net { + local_ts = 0.0.0.0/0 + remote_ts = 0.0.0.0/0 + mark_in = 42 + mark_out = 42 + + esp_proposals = aes128gcm128-x25519 + } + } + version = 2 + proposals = aes128-sha256-x25519 + } +} diff --git a/testing/tests/route-based/net2net-vti/hosts/sun/etc/strongswan.conf b/testing/tests/route-based/net2net-vti/hosts/sun/etc/strongswan.conf new file mode 100644 index 000000000..136dbe84f --- /dev/null +++ b/testing/tests/route-based/net2net-vti/hosts/sun/etc/strongswan.conf @@ -0,0 +1,13 @@ +# /etc/strongswan.conf - strongSwan configuration file + +swanctl { + load = pem pkcs1 x509 revocation constraints pubkey openssl random +} + +charon-systemd { + load = random nonce aes sha1 sha2 pem pkcs1 curve25519 gmp x509 curl revocation hmac vici kernel-netlink socket-default updown +} + +charon { + install_routes = 0 +} diff --git a/testing/tests/route-based/net2net-vti/hosts/sun/etc/swanctl/swanctl.conf b/testing/tests/route-based/net2net-vti/hosts/sun/etc/swanctl/swanctl.conf new file mode 100755 index 000000000..df213159f --- /dev/null +++ b/testing/tests/route-based/net2net-vti/hosts/sun/etc/swanctl/swanctl.conf @@ -0,0 +1,29 @@ +connections { + + gw-gw { + local_addrs = PH_IP_SUN + remote_addrs = PH_IP_MOON + + local { + auth = pubkey + certs = sunCert.pem + id = sun.strongswan.org + } + remote { + auth = pubkey + id = moon.strongswan.org + } + children { + net-net { + local_ts = 0.0.0.0/0 + remote_ts = 0.0.0.0/0 + mark_in = 1337 + mark_out = 1337 + + esp_proposals = aes128gcm128-x25519 + } + } + version = 2 + proposals = aes128-sha256-x25519 + } +} diff --git a/testing/tests/route-based/net2net-vti/posttest.dat b/testing/tests/route-based/net2net-vti/posttest.dat new file mode 100644 index 000000000..47b3dff06 --- /dev/null +++ b/testing/tests/route-based/net2net-vti/posttest.dat @@ -0,0 +1,7 @@ +moon::swanctl --terminate --ike gw-gw +moon::systemctl stop strongswan-swanctl +sun::systemctl stop strongswan-swanctl +moon::iptables-restore < /etc/iptables.flush +sun::iptables-restore < /etc/iptables.flush +moon::ip tunnel del vti-moon +sun::ip tunnel del vti-sun diff --git a/testing/tests/route-based/net2net-vti/pretest.dat b/testing/tests/route-based/net2net-vti/pretest.dat new file mode 100644 index 000000000..24b285edb --- /dev/null +++ b/testing/tests/route-based/net2net-vti/pretest.dat @@ -0,0 +1,19 @@ +moon::iptables-restore < /etc/iptables.rules +sun::iptables-restore < /etc/iptables.rules +moon::ip tunnel add vti-moon local PH_IP_MOON remote PH_IP_SUN mode vti key 42 +moon::sysctl -w net.ipv4.conf.vti-moon.disable_policy=1 +moon::ip link set vti-moon up +moon::ip route add 10.2.0.0/16 dev vti-moon +moon::iptables -A FORWARD -i vti-moon -j ACCEPT +moon::iptables -A FORWARD -o vti-moon -j ACCEPT +sun::ip tunnel add vti-sun local PH_IP_SUN remote PH_IP_MOON mode vti key 1337 +sun::sysctl -w net.ipv4.conf.vti-sun.disable_policy=1 +sun::ip link set vti-sun up +sun::ip route add 10.1.0.0/16 dev vti-sun +sun::iptables -A FORWARD -i vti-sun -j ACCEPT +sun::iptables -A FORWARD -o vti-sun -j ACCEPT +moon::systemctl start strongswan-swanctl +sun::systemctl start strongswan-swanctl +moon::expect-connection gw-gw +sun::expect-connection gw-gw +moon::swanctl --initiate --child net-net diff --git a/testing/tests/route-based/net2net-vti/test.conf b/testing/tests/route-based/net2net-vti/test.conf new file mode 100644 index 000000000..87abc763b --- /dev/null +++ b/testing/tests/route-based/net2net-vti/test.conf @@ -0,0 +1,25 @@ +#!/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" + +# charon controlled by swanctl +# +SWANCTL=1 |