PRE-TEST

moon# iptables-restore < /etc/iptables.rules

carol# iptables-restore < /etc/iptables.rules

moon# cat /etc/ipsec.d/triplets.dat
carol@strongswan.org,30000000000000000000000000000000,30112233,305566778899AABB
carol@strongswan.org,31000000000000000000000000000000,31112233,315566778899AABB
carol@strongswan.org,32000000000000000000000000000000,32112233,325566778899AABB

carol# cat /etc/ipsec.d/triplets.dat
carol@strongswan.org,30000000000000000000000000000000,30112233,305566778899AABB
carol@strongswan.org,31000000000000000000000000000000,31112233,315566778899AABB
carol@strongswan.org,32000000000000000000000000000000,32112233,325566778899AABB

moon# ipsec start
Starting strongSwan 6.0.1 IPsec [starter]...

carol# ipsec start
Starting strongSwan 6.0.1 IPsec [starter]...

moon# expect-connection rw-eap-sim

carol# expect-connection home

carol# ipsec up home
initiating IKE_SA home[1] to 192.168.0.1
generating IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(HASH_ALG) N(REDIR_SUP) ]
sending packet: from 192.168.0.100[500] to 192.168.0.1[500] (924 bytes)
received packet: from 192.168.0.1[500] to 192.168.0.100[500] (280 bytes)
parsed IKE_SA_INIT response 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(HASH_ALG) N(CHDLESS_SUP) N(MULT_AUTH) ]
selected proposal: IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/ECP_256
sending cert request for "C=CH, O=strongSwan Project, CN=strongSwan Root CA"
establishing CHILD_SA home{1}
generating IKE_AUTH request 1 [ IDi N(INIT_CONTACT) CERTREQ IDr SA TSi TSr N(MOBIKE_SUP) N(ADD_6_ADDR) N(MULT_AUTH) N(EAP_ONLY) N(MSG_ID_SYN_SUP) ]
sending packet: from 192.168.0.100[4500] to 192.168.0.1[4500] (416 bytes)
received packet: from 192.168.0.1[4500] to 192.168.0.100[4500] (1236 bytes)
parsed IKE_AUTH response 1 [ EF(1/2) ]
received fragment #1 of 2, waiting for complete IKE message
received packet: from 192.168.0.1[4500] to 192.168.0.100[4500] (532 bytes)
parsed IKE_AUTH response 1 [ EF(2/2) ]
received fragment #2 of 2, reassembled fragmented IKE message (1696 bytes)
parsed IKE_AUTH response 1 [ IDr CERT AUTH EAP/REQ/SIM ]
received end entity cert "C=CH, O=strongSwan Project, CN=moon.strongswan.org"
  using certificate "C=CH, O=strongSwan Project, CN=moon.strongswan.org"
  using trusted ca certificate "C=CH, O=strongSwan Project, CN=strongSwan Root CA"
  reached self-signed root ca with a path length of 0
checking certificate status of "C=CH, O=strongSwan Project, CN=moon.strongswan.org"
  fetching crl from 'http://crl.strongswan.org/strongswan.crl' ...
  using trusted certificate "C=CH, O=strongSwan Project, CN=strongSwan Root CA"
  crl correctly signed by "C=CH, O=strongSwan Project, CN=strongSwan Root CA"
  crl is valid: until Mar 25 18:47:43 2025
certificate status is good
authentication of 'moon.strongswan.org' with RSA_EMSA_PKCS1_SHA2_256 successful
server requested EAP_SIM authentication (id 0x9E)
generating IKE_AUTH request 2 [ EAP/RES/SIM ]
sending packet: from 192.168.0.100[4500] to 192.168.0.1[4500] (128 bytes)
received packet: from 192.168.0.1[4500] to 192.168.0.100[4500] (160 bytes)
parsed IKE_AUTH response 2 [ EAP/REQ/SIM ]
generating IKE_AUTH request 3 [ EAP/RES/SIM ]
sending packet: from 192.168.0.100[4500] to 192.168.0.1[4500] (112 bytes)
received packet: from 192.168.0.1[4500] to 192.168.0.100[4500] (80 bytes)
parsed IKE_AUTH response 3 [ EAP/SUCC ]
EAP method EAP_SIM succeeded, MSK established
authentication of 'carol@strongswan.org' (myself) with EAP
generating IKE_AUTH request 4 [ AUTH ]
sending packet: from 192.168.0.100[4500] to 192.168.0.1[4500] (112 bytes)
received packet: from 192.168.0.1[4500] to 192.168.0.100[4500] (288 bytes)
parsed IKE_AUTH response 4 [ AUTH SA TSi TSr N(AUTH_LFT) N(MOBIKE_SUP) N(ADD_4_ADDR) N(ADD_6_ADDR) N(ADD_6_ADDR) ]
authentication of 'moon.strongswan.org' with EAP successful
received AUTH_LIFETIME of 3393s, scheduling reauthentication in 3213s
peer supports MOBIKE
IKE_SA home[1] established between 192.168.0.100[carol@strongswan.org]...192.168.0.1[moon.strongswan.org]
reauthentication already scheduled in 3213s
maximum IKE_SA lifetime 3393s
selected proposal: ESP:AES_CBC_128/HMAC_SHA2_256_128/NO_EXT_SEQ
CHILD_SA home{1} established with SPIs c451994e_i c92f79b9_o and TS 192.168.0.100/32 === 10.1.0.0/16
connection 'home' established successfully


TEST

carol# cat /var/log/daemon.log | grep 'authentication of 'moon.strongswan.org' with RSA.* successful' [YES]
Mar 10 19:41:29 carol charon: 02[IKE] authentication of 'moon.strongswan.org' with RSA_EMSA_PKCS1_SHA2_256 successful

carol# cat /var/log/daemon.log | grep 'authentication of 'moon.strongswan.org' with EAP successful' [YES]
Mar 10 19:41:29 carol charon: 05[IKE] authentication of 'moon.strongswan.org' with EAP successful

moon# cat /var/log/daemon.log | grep 'authentication of 'carol@strongswan.org' with EAP successful' [YES]
Mar 10 19:41:29 moon charon: 09[IKE] authentication of 'carol@strongswan.org' with EAP successful

moon# ipsec status 2> /dev/null | grep 'rw-eap-sim.*ESTABLISHED.*moon.strongswan.org.*carol@strongswan.org' [YES]
  rw-eap-sim[1]: ESTABLISHED 0 seconds ago, 192.168.0.1[moon.strongswan.org]...192.168.0.100[carol@strongswan.org]

carol# ipsec status 2> /dev/null | grep 'home.*ESTABLISHED.*carol@strongswan.org.*moon.strongswan.org' [YES]
        home[1]: ESTABLISHED 1 second ago, 192.168.0.100[carol@strongswan.org]...192.168.0.1[moon.strongswan.org]

moon# ipsec status 2> /dev/null | grep 'rw-eap-sim.*INSTALLED, TUNNEL' [YES]
  rw-eap-sim{1}:  INSTALLED, TUNNEL, reqid 1, ESP SPIs: c92f79b9_i c451994e_o

carol# ipsec status 2> /dev/null | grep 'home.*INSTALLED, TUNNEL' [YES]
        home{1}:  INSTALLED, TUNNEL, reqid 1, ESP SPIs: c451994e_i c92f79b9_o

carol# ping -c 1 10.1.0.10 | grep '64 bytes from 10.1.0.10: icmp_.eq=1' [YES]
64 bytes from 10.1.0.10: icmp_seq=1 ttl=63 time=1.07 ms

moon# killall tcpdump

moon# cat /tmp/tcpdump.log | grep 'IP carol.strongswan.org > moon.strongswan.org: ESP' [YES]
19:41:29.802640 IP carol.strongswan.org > moon.strongswan.org: ESP(spi=0xc92f79b9,seq=0x1), length 136

moon# cat /tmp/tcpdump.log | grep 'IP moon.strongswan.org > carol.strongswan.org: ESP' [YES]
19:41:29.803223 IP moon.strongswan.org > carol.strongswan.org: ESP(spi=0xc451994e,seq=0x1), length 136


POST-TEST

moon# ipsec stop
Stopping strongSwan IPsec...

carol# ipsec stop
Stopping strongSwan IPsec...

moon# iptables-restore < /etc/iptables.flush

carol# iptables-restore < /etc/iptables.flush