Commit 26a35a891d for strongswan.org
commit 26a35a891d914c3d97abc42fc751011ff8355d0d
Author: Tobias Brunner <tobias@strongswan.org>
Date: Mon Jul 27 16:47:17 2026 +0200
testing: Add ikev2/rw-eap-ttls-only-mschapv2 scenario
This does not test anything specific that changed with the recent commit,
it just mirrors the ikev2/rw-eap-peap-mschapv2 scenario to make sure
nothing fundamental broke when an inner method that implements
`get_auth()` is used (the renamed ikev2/rw-eap-ttls-only-md5 scenario
uses eap-md5, which doesn't implement it).
The issue with testing the fixes is that our client implementations don't
support using a different identity during EAP-MSCHAPv2 than the already
negotiated IKE or EAP identities.
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/description.txt b/testing/tests/ikev2/rw-eap-ttls-only-md5/description.txt
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/description.txt
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/description.txt
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/evaltest.dat b/testing/tests/ikev2/rw-eap-ttls-only-md5/evaltest.dat
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/evaltest.dat
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/evaltest.dat
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/hosts/carol/etc/strongswan.conf b/testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/carol/etc/strongswan.conf
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/hosts/carol/etc/strongswan.conf
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/carol/etc/strongswan.conf
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/hosts/carol/etc/swanctl/swanctl.conf b/testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/carol/etc/swanctl/swanctl.conf
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/hosts/carol/etc/swanctl/swanctl.conf
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/carol/etc/swanctl/swanctl.conf
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/hosts/dave/etc/strongswan.conf b/testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/dave/etc/strongswan.conf
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/hosts/dave/etc/strongswan.conf
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/dave/etc/strongswan.conf
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/hosts/dave/etc/swanctl/swanctl.conf b/testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/dave/etc/swanctl/swanctl.conf
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/hosts/dave/etc/swanctl/swanctl.conf
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/dave/etc/swanctl/swanctl.conf
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/hosts/moon/etc/strongswan.conf b/testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/moon/etc/strongswan.conf
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/hosts/moon/etc/strongswan.conf
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/moon/etc/strongswan.conf
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/hosts/moon/etc/swanctl/swanctl.conf b/testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/moon/etc/swanctl/swanctl.conf
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/hosts/moon/etc/swanctl/swanctl.conf
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/hosts/moon/etc/swanctl/swanctl.conf
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/posttest.dat b/testing/tests/ikev2/rw-eap-ttls-only-md5/posttest.dat
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/posttest.dat
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/posttest.dat
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/pretest.dat b/testing/tests/ikev2/rw-eap-ttls-only-md5/pretest.dat
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/pretest.dat
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/pretest.dat
diff --git a/testing/tests/ikev2/rw-eap-ttls-only/test.conf b/testing/tests/ikev2/rw-eap-ttls-only-md5/test.conf
similarity index 100%
rename from testing/tests/ikev2/rw-eap-ttls-only/test.conf
rename to testing/tests/ikev2/rw-eap-ttls-only-md5/test.conf
diff --git a/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/description.txt b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/description.txt
new file mode 100644
index 0000000000..187e176b53
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/description.txt
@@ -0,0 +1,8 @@
+The roadwarriors <b>carol</b> and <b>dave</b> set up a connection each to gateway <b>moon</b>.
+The strong mutual authentication is based on <b>EAP-TTLS</b> only (without a separate IKEv2
+authentication) with the gateway being authenticated by a server certificate during the
+EAP-TLS tunnel setup (phase1 of EAP-TTLS). This tunnel protects the ensuing weak client
+authentication based on <b>EAP-MSCHAPv2</b> (phase2 of EAP-TTLS).
+<p/>
+Client <b>carol</b> presents the correct MSCHAPv2 password and succeeds whereas client
+<b>dave</b> chooses the wrong password and fails.
diff --git a/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/evaltest.dat b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/evaltest.dat
new file mode 100644
index 0000000000..88a21060eb
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/evaltest.dat
@@ -0,0 +1,19 @@
+carol::cat /var/log/daemon.log::server requested EAP_TTLS authentication::YES
+carol::cat /var/log/daemon.log::allow mutual EAP-only authentication::YES
+carol::cat /var/log/daemon.log::negotiated TLS 1.3 using suite TLS_AES_256_GCM_SHA384::YES
+carol::cat /var/log/daemon.log::server requested EAP_MSCHAPV2 authentication::YES
+carol::cat /var/log/daemon.log::EAP method EAP_TTLS succeeded, MSK established::YES
+carol::cat /var/log/daemon.log::authentication of 'C=CH, O=strongSwan Project, CN=moon.strongswan.org' with EAP successful::YES
+dave:: cat /var/log/daemon.log::server requested EAP_TTLS authentication::YES
+dave:: cat /var/log/daemon.log::allow mutual EAP-only authentication::YES
+dave:: cat /var/log/daemon.log::negotiated TLS 1.2 using suite TLS_DHE_RSA_WITH_AES_256_GCM_SHA384::YES
+dave:: cat /var/log/daemon.log::server requested EAP_MSCHAPV2 authentication::YES
+dave:: cat /var/log/daemon.log::received EAP_FAILURE, EAP authentication failed::YES
+moon:: cat /var/log/daemon.log::EAP_TTLS phase2 authentication of 'carol@strongswan.org' with EAP_MSCHAPV2 successful::YES
+moon:: cat /var/log/daemon.log::authentication of 'carol@strongswan.org' with EAP successful::YES
+moon:: cat /var/log/daemon.log::EAP method EAP_TTLS failed for peer dave@strongswan.org::YES
+carol::ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
+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@strongswan.org remote-host=192.168.0.1 remote-port=4500 remote-id=C=CH, O=strongSwan Project, CN=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
+moon:: swanctl --list-sas --ike-id 1 --raw 2> /dev/null::rw-eap.*version=2 state=ESTABLISHED local-host=192.168.0.1 local-port=4500 local-id=C=CH, O=strongSwan Project, CN=moon.strongswan.org remote-host=192.168.0.100 remote-port=4500 remote-id=carol@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=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::tcpdump::IP carol.strongswan.org > moon.strongswan.org: ESP::YES
+moon::tcpdump::IP moon.strongswan.org > carol.strongswan.org: ESP::YES
diff --git a/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/carol/etc/strongswan.conf b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/carol/etc/strongswan.conf
new file mode 100644
index 0000000000..ddea9e94f6
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/carol/etc/strongswan.conf
@@ -0,0 +1,21 @@
+# /etc/strongswan.conf - strongSwan configuration file
+
+ swanctl {
+ load = pem pkcs1 pubkey openssl random
+}
+
+charon-systemd {
+ load = random nonce openssl pem pkcs1 curl revocation vici kernel-netlink socket-default eap-identity eap-mschapv2 eap-ttls updown
+
+ multiple_authentication=no
+ syslog {
+ daemon {
+ tls = 2
+ }
+ }
+}
+
+libtls {
+ version_max = 1.3
+ suites = TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384
+}
diff --git a/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/carol/etc/swanctl/swanctl.conf b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/carol/etc/swanctl/swanctl.conf
new file mode 100755
index 0000000000..96c30e3403
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/carol/etc/swanctl/swanctl.conf
@@ -0,0 +1,35 @@
+connections {
+
+ home {
+ local_addrs = 192.168.0.100
+ remote_addrs = 192.168.0.1
+
+ local {
+ auth = eap
+ id = carol@strongswan.org
+ }
+ remote {
+ auth = eap-ttls
+ id = "C=CH, O=strongSwan Project, CN=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
+ send_certreq = no
+ proposals = aes128-sha256-x25519
+ }
+}
+
+secrets {
+
+ eap-carol {
+ id = carol@strongswan.org
+ secret = Ar3etTnp
+ }
+}
diff --git a/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/dave/etc/strongswan.conf b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/dave/etc/strongswan.conf
new file mode 100644
index 0000000000..c72dd24288
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/dave/etc/strongswan.conf
@@ -0,0 +1,20 @@
+# /etc/strongswan.conf - strongSwan configuration file
+
+ swanctl {
+ load = pem pkcs1 pubkey openssl random
+}
+
+charon-systemd {
+ load = random nonce openssl pem pkcs1 curl revocation vici kernel-netlink socket-default eap-identity eap-mschapv2 eap-ttls updown
+
+ multiple_authentication=no
+ syslog {
+ daemon {
+ tls = 2
+ }
+ }
+}
+
+libtls {
+ suites = TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
+}
diff --git a/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/dave/etc/swanctl/swanctl.conf b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/dave/etc/swanctl/swanctl.conf
new file mode 100755
index 0000000000..64b711db44
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/dave/etc/swanctl/swanctl.conf
@@ -0,0 +1,35 @@
+connections {
+
+ home {
+ local_addrs = 192.168.0.200
+ remote_addrs = 192.168.0.1
+
+ local {
+ auth = eap
+ id = dave@strongswan.org
+ }
+ remote {
+ auth = eap-ttls
+ id = "C=CH, O=strongSwan Project, CN=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
+ send_certreq = no
+ proposals = aes128-sha256-x25519
+ }
+}
+
+secrets {
+
+ eap-dave {
+ id = dave@strongswan.org
+ secret = UgaM65Va
+ }
+}
diff --git a/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/moon/etc/strongswan.conf b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/moon/etc/strongswan.conf
new file mode 100644
index 0000000000..1c27b6a3dc
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/moon/etc/strongswan.conf
@@ -0,0 +1,25 @@
+# /etc/strongswan.conf - strongSwan configuration file
+
+ swanctl {
+ load = pem pkcs1 pubkey openssl random
+}
+
+charon-systemd {
+ load = random nonce openssl pem pkcs1 curl revocation vici kernel-netlink socket-default eap-identity eap-mschapv2 eap-ttls updown
+
+ multiple_authentication=no
+ syslog {
+ daemon {
+ tls = 2
+ }
+ }
+ plugins {
+ eap-ttls {
+ phase2_method = mschapv2
+ }
+ }
+}
+
+libtls {
+ version_max = 1.3
+}
diff --git a/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/moon/etc/swanctl/swanctl.conf b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/moon/etc/swanctl/swanctl.conf
new file mode 100755
index 0000000000..5ee0c57a32
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/hosts/moon/etc/swanctl/swanctl.conf
@@ -0,0 +1,37 @@
+connections {
+
+ rw-eap {
+ local_addrs = 192.168.0.1
+
+ local {
+ auth = eap-ttls
+ certs = moonCert.pem
+ }
+ remote {
+ auth = eap-ttls
+ }
+ children {
+ net {
+ local_ts = 10.1.0.0/16
+
+ updown = /usr/local/libexec/ipsec/_updown iptables
+ esp_proposals = aes128gcm128-x25519
+ }
+ }
+ version = 2
+ send_certreq = no
+ proposals = aes128-sha256-x25519
+ }
+}
+
+secrets {
+
+ eap-carol {
+ id = carol@strongswan.org
+ secret = Ar3etTnp
+ }
+ eap-dave {
+ id = dave@strongswan.org
+ secret = W7R0g3do
+ }
+}
diff --git a/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/posttest.dat b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/posttest.dat
new file mode 100644
index 0000000000..e5c82ef20d
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/posttest.dat
@@ -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-ttls-only-mschapv2/pretest.dat b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/pretest.dat
new file mode 100644
index 0000000000..69f83f67ae
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/pretest.dat
@@ -0,0 +1,13 @@
+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/*
+dave::cd /etc/swanctl; rm rsa/* x509/*
+moon::systemctl start strongswan
+carol::systemctl start strongswan
+dave::systemctl start strongswan
+moon::expect-connection rw-eap
+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-ttls-only-mschapv2/test.conf b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/test.conf
new file mode 100644
index 0000000000..1227b9d1c0
--- /dev/null
+++ b/testing/tests/ikev2/rw-eap-ttls-only-mschapv2/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 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