]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
testing: Add rw-eap-id-switch scenario master
authorTobias Brunner <tobias@strongswan.org>
Tue, 4 Mar 2025 12:18:21 +0000 (13:18 +0100)
committerTobias Brunner <tobias@strongswan.org>
Mon, 14 Apr 2025 10:18:24 +0000 (12:18 +0200)
testing/tests/ikev2/rw-eap-id-switch/description.txt [new file with mode: 0644]
testing/tests/ikev2/rw-eap-id-switch/evaltest.dat [new file with mode: 0644]
testing/tests/ikev2/rw-eap-id-switch/hosts/carol/etc/strongswan.conf [new file with mode: 0644]
testing/tests/ikev2/rw-eap-id-switch/hosts/carol/etc/swanctl/swanctl.conf [new file with mode: 0755]
testing/tests/ikev2/rw-eap-id-switch/hosts/dave/etc/strongswan.conf [new file with mode: 0644]
testing/tests/ikev2/rw-eap-id-switch/hosts/dave/etc/swanctl/swanctl.conf [new file with mode: 0755]
testing/tests/ikev2/rw-eap-id-switch/hosts/moon/etc/strongswan.conf [new file with mode: 0644]
testing/tests/ikev2/rw-eap-id-switch/hosts/moon/etc/swanctl/swanctl.conf [new file with mode: 0755]
testing/tests/ikev2/rw-eap-id-switch/posttest.dat [new file with mode: 0644]
testing/tests/ikev2/rw-eap-id-switch/pretest.dat [new file with mode: 0644]
testing/tests/ikev2/rw-eap-id-switch/test.conf [new file with mode: 0644]

diff --git a/testing/tests/ikev2/rw-eap-id-switch/description.txt b/testing/tests/ikev2/rw-eap-id-switch/description.txt
new file mode 100644 (file)
index 0000000..92ad49d
--- /dev/null
@@ -0,0 +1,5 @@
+The roadwarriors <b>carol</b> and <b>dave</b> set up a connection each to gateway <b>moon</b>.
+The gateway requests an EAP-Identity and uses it to select an appropriate connection.
+Based on <b>dave</b>'s identity, the gateway requests an <i>EAP-TLS</i> certificate-based
+client authentication. For <b>carol</b>, the gateway switches to a default config
+that uses the <i>EAP-MD5</i> password-based client authentication method.
diff --git a/testing/tests/ikev2/rw-eap-id-switch/evaltest.dat b/testing/tests/ikev2/rw-eap-id-switch/evaltest.dat
new file mode 100644 (file)
index 0000000..18e1b3a
--- /dev/null
@@ -0,0 +1,19 @@
+carol::swanctl --list-sas --raw 2> /dev/null::home.*version=2 state=ESTABLISHED local-host=192.168.0.100 local-port=4500 local-id=carol remote-host=192.168.0.1 remote-port=4500 remote-id=moon.strongswan.org initiator=yes.*encr-alg=AES_CBC encr-keysize=128 integ-alg=HMAC_SHA2_256_128 prf-alg=PRF_HMAC_SHA2_256 dh-group=CURVE_25519.*child-sas.*home.*state=INSTALLED mode=TUNNEL.*ESP.*encr-alg=AES_GCM_16 encr-keysize=128.*local-ts=\[192.168.0.100/32] remote-ts=\[10.1.0.0/16]::YES
+dave::swanctl --list-sas --raw 2> /dev/null::home.*version=2 state=ESTABLISHED local-host=192.168.0.200 local-port=4500 local-id=C=CH, O=strongSwan Project, OU=Accounting, CN=dave@strongswan.org remote-host=192.168.0.1 remote-port=4500 remote-id=moon.strongswan.org initiator=yes.*encr-alg=AES_CBC encr-keysize=128 integ-alg=HMAC_SHA2_256_128 prf-alg=PRF_HMAC_SHA2_256 dh-group=CURVE_25519.*child-sas.*home.*state=INSTALLED mode=TUNNEL.*ESP.*encr-alg=AES_GCM_16 encr-keysize=128.*local-ts=\[192.168.0.200/32] remote-ts=\[10.1.0.0/16]::YES
+moon:: swanctl --list-sas --ike-id 1 --raw 2> /dev/null::rw-eap-md5.*version=2 state=ESTABLISHED local-host=192.168.0.1 local-port=4500 local-id=moon.strongswan.org remote-host=192.168.0.100 remote-port=4500 remote-id=carol.*encr-alg=AES_CBC encr-keysize=128 integ-alg=HMAC_SHA2_256_128 prf-alg=PRF_HMAC_SHA2_256 dh-group=CURVE_25519.*child-sas.*net.*reqid=1 state=INSTALLED mode=TUNNEL.*ESP.*encr-alg=AES_GCM_16 encr-keysize=128.*local-ts=\[10.1.0.0/16] remote-ts=\[192.168.0.100/32]::YES
+moon:: swanctl --list-sas --ike-id 2 --raw 2> /dev/null::rw-eap-tls.*version=2 state=ESTABLISHED local-host=192.168.0.1 local-port=4500 local-id=moon.strongswan.org remote-host=192.168.0.200 remote-port=4500 remote-id=C=CH, O=strongSwan Project, OU=Accounting, CN=dave@strongswan.org.*encr-alg=AES_CBC encr-keysize=128 integ-alg=HMAC_SHA2_256_128 prf-alg=PRF_HMAC_SHA2_256 dh-group=CURVE_25519.*child-sas.*net.*reqid=2 state=INSTALLED mode=TUNNEL.*ESP.*encr-alg=AES_GCM_16 encr-keysize=128.*local-ts=\[10.1.0.0/16] remote-ts=\[192.168.0.200/32]::YES
+carol::cat /var/log/daemon.log::authentication of 'moon.strongswan.org' with RSA.* successful::YES
+carol::cat /var/log/daemon.log::authentication of 'moon.strongswan.org' with EAP successful::YES
+carol::cat /var/log/daemon.log::EAP method EAP_MD5 succeeded, no MSK established::YES
+dave:: cat /var/log/daemon.log::authentication of 'moon.strongswan.org' with RSA.* successful::YES
+dave:: cat /var/log/daemon.log::authentication of 'moon.strongswan.org' with EAP successful::YES
+dave:: cat /var/log/daemon.log::EAP method EAP_TLS succeeded, MSK established::YES
+moon:: cat /var/log/daemon.log::constraint check failed: EAP identity 'C=CH, O=strongSwan Project, OU=Accounting, CN=.*' (ID_DER_ASN1_DN) required, not matched by 'carol' (ID_FQDN)::YES
+moon:: cat /var/log/daemon.log::authentication of 'carol' with EAP successful::YES
+moon:: cat /var/log/daemon.log::authentication of 'C=CH, O=strongSwan Project, OU=Accounting, CN=dave@strongswan.org' with EAP successful::YES
+carol::ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
+dave:: ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
+moon::tcpdump::IP carol.strongswan.org > moon.strongswan.org: ESP::YES
+moon::tcpdump::IP moon.strongswan.org > carol.strongswan.org: ESP::YES
+moon::tcpdump::IP dave.strongswan.org > moon.strongswan.org: ESP::YES
+moon::tcpdump::IP moon.strongswan.org > dave.strongswan.org: ESP::YES
diff --git a/testing/tests/ikev2/rw-eap-id-switch/hosts/carol/etc/strongswan.conf b/testing/tests/ikev2/rw-eap-id-switch/hosts/carol/etc/strongswan.conf
new file mode 100644 (file)
index 0000000..30536f7
--- /dev/null
@@ -0,0 +1,9 @@
+# /etc/strongswan.conf - strongSwan configuration file
+
+swanctl {
+  load = pem pkcs1 revocation constraints pubkey openssl random
+}
+
+charon-systemd {
+  load = random nonce openssl pem pkcs1 curl revocation vici kernel-netlink socket-default eap-identity eap-md5 updown
+}
diff --git a/testing/tests/ikev2/rw-eap-id-switch/hosts/carol/etc/swanctl/swanctl.conf b/testing/tests/ikev2/rw-eap-id-switch/hosts/carol/etc/swanctl/swanctl.conf
new file mode 100755 (executable)
index 0000000..451945e
--- /dev/null
@@ -0,0 +1,34 @@
+connections {
+
+   home {
+      local_addrs  = 192.168.0.100
+      remote_addrs = 192.168.0.1
+
+      local {
+         auth = eap-md5
+         id = carol
+      }
+      remote {
+         auth = pubkey
+         id = moon.strongswan.org
+      }
+      children {
+         home {
+            remote_ts = 10.1.0.0/16
+
+            updown = /usr/local/libexec/ipsec/_updown iptables
+            esp_proposals = aes128gcm128-x25519
+         }
+      }
+      version = 2
+      proposals = aes128-sha256-x25519
+   }
+}
+
+secrets {
+
+   eap-carol {
+      id = carol
+      secret = Ar3etTnp
+   }
+}
diff --git a/testing/tests/ikev2/rw-eap-id-switch/hosts/dave/etc/strongswan.conf b/testing/tests/ikev2/rw-eap-id-switch/hosts/dave/etc/strongswan.conf
new file mode 100644 (file)
index 0000000..0ac5d70
--- /dev/null
@@ -0,0 +1,9 @@
+# /etc/strongswan.conf - strongSwan configuration file
+
+swanctl {
+  load = pem pkcs1 revocation constraints pubkey openssl random
+}
+
+charon-systemd {
+  load = random nonce openssl pem pkcs1 curl revocation vici kernel-netlink socket-default eap-identity eap-tls updown
+}
diff --git a/testing/tests/ikev2/rw-eap-id-switch/hosts/dave/etc/swanctl/swanctl.conf b/testing/tests/ikev2/rw-eap-id-switch/hosts/dave/etc/swanctl/swanctl.conf
new file mode 100755 (executable)
index 0000000..fe0e7c3
--- /dev/null
@@ -0,0 +1,26 @@
+connections {
+
+   home {
+      local_addrs  = 192.168.0.200
+      remote_addrs = 192.168.0.1
+
+      local {
+         auth = eap-tls
+         certs = daveCert.pem
+      }
+      remote {
+         auth = pubkey
+         id = moon.strongswan.org
+      }
+      children {
+         home {
+            remote_ts = 10.1.0.0/16
+
+            updown = /usr/local/libexec/ipsec/_updown iptables
+            esp_proposals = aes128gcm128-x25519
+         }
+      }
+      version = 2
+       proposals = aes128-sha256-x25519
+   }
+}
diff --git a/testing/tests/ikev2/rw-eap-id-switch/hosts/moon/etc/strongswan.conf b/testing/tests/ikev2/rw-eap-id-switch/hosts/moon/etc/strongswan.conf
new file mode 100644 (file)
index 0000000..8b74972
--- /dev/null
@@ -0,0 +1,9 @@
+# /etc/strongswan.conf - strongSwan configuration file
+
+swanctl {
+  load = pem pkcs1 revocation constraints pubkey openssl random
+}
+
+charon-systemd {
+  load = random nonce openssl pem pkcs1 curl revocation vici kernel-netlink socket-default eap-identity eap-md5 eap-tls updown
+}
diff --git a/testing/tests/ikev2/rw-eap-id-switch/hosts/moon/etc/swanctl/swanctl.conf b/testing/tests/ikev2/rw-eap-id-switch/hosts/moon/etc/swanctl/swanctl.conf
new file mode 100755 (executable)
index 0000000..7e0ac03
--- /dev/null
@@ -0,0 +1,41 @@
+connections {
+
+   rw-eap-tls {
+      local_addrs  = 192.168.0.1
+
+      local {
+         auth = pubkey
+         certs = moonCert.pem
+         id = moon.strongswan.org
+      }
+      remote {
+         eap_id = "C=CH, O=strongSwan Project, OU=Accounting, CN=*"
+         auth = eap-tls
+      }
+      children {
+         net {
+            local_ts  = 10.1.0.0/16
+
+            updown = /usr/local/libexec/ipsec/_updown iptables
+            esp_proposals = aes128gcm128-x25519
+         }
+      }
+      version = 2
+      proposals = aes128-sha256-x25519
+   }
+
+   rw-eap-md5 : connections.rw-eap-tls {
+      remote {
+         eap_id = %any
+         auth = eap-md5
+      }
+   }
+}
+
+secrets {
+
+   eap-carol {
+      id = carol
+      secret = Ar3etTnp
+   }
+}
diff --git a/testing/tests/ikev2/rw-eap-id-switch/posttest.dat b/testing/tests/ikev2/rw-eap-id-switch/posttest.dat
new file mode 100644 (file)
index 0000000..e5c82ef
--- /dev/null
@@ -0,0 +1,6 @@
+carol::systemctl stop strongswan
+dave::systemctl stop strongswan
+moon::systemctl stop strongswan
+moon::iptables-restore < /etc/iptables.flush
+carol::iptables-restore < /etc/iptables.flush
+dave::iptables-restore < /etc/iptables.flush
diff --git a/testing/tests/ikev2/rw-eap-id-switch/pretest.dat b/testing/tests/ikev2/rw-eap-id-switch/pretest.dat
new file mode 100644 (file)
index 0000000..becb716
--- /dev/null
@@ -0,0 +1,12 @@
+moon::iptables-restore < /etc/iptables.rules
+carol::iptables-restore < /etc/iptables.rules
+dave::iptables-restore < /etc/iptables.rules
+carol::cd /etc/swanctl; rm rsa/* x509/*
+moon::systemctl start strongswan
+carol::systemctl start strongswan
+dave::systemctl start strongswan
+moon::expect-connection rw-eap-md5
+carol::expect-connection home
+carol::swanctl --initiate --child home 2> /dev/null
+dave::expect-connection home
+dave::swanctl --initiate --child home 2> /dev/null
diff --git a/testing/tests/ikev2/rw-eap-id-switch/test.conf b/testing/tests/ikev2/rw-eap-id-switch/test.conf
new file mode 100644 (file)
index 0000000..1227b9d
--- /dev/null
@@ -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 carol winnetou dave"
+
+# Corresponding block diagram
+#
+DIAGRAM="a-m-c-w-d.png"
+
+# Guest instances on which tcpdump is to be started
+#
+TCPDUMPHOSTS="moon"
+
+# Guest instances on which IPsec is started
+# Used for IPsec logging purposes
+#
+IPSECHOSTS="moon carol dave"
+
+# charon controlled by swanctl
+#
+SWANCTL=1