testing: Migrated ikev2 scenarios to swanctl

This commit is contained in:
Andreas Steffen
2018-12-09 13:16:41 +01:00
parent be1c7e3815
commit 030de21b7b
361 changed files with 5989 additions and 214 deletions
@@ -1,4 +1,6 @@
A connection between the hosts <b>moon</b> and <b>sun</b> is successfully set up.
The authentication is based on X.509 certificates. <b>leftfirewall=yes</b> automatically
inserts iptables-based firewall rules that let pass the tunneled traffic.
The authentication is based on X.509 certificates.
<p/>
Upon the successful establishment of the IPsec tunnel, <b>leftfirewall=yes</b>
automatically inserts iptables-based firewall rules that let pass the tunneled traffic.
In order to test the host-to-host tunnel <b>moon</b> pings <b>sun</b>.
@@ -1,6 +1,7 @@
The roadwarriors <b>alice</b> and <b>venus</b> sitting behind the NAT router <b>moon</b> set up
tunnels to gateway <b>sun</b>. UDP encapsulation is used to traverse the NAT router.
Both roadwarriors share the same Pre-Shared Key (PSK) with the gateway <b>sun</b>.
Each roadwarrior shares its own Pre-Shared Key (PSK) with the gateway <b>sun</b>.
<p/>
<b>leftfirewall=yes</b> automatically inserts iptables-based firewall rules that let pass
the tunneled traffic. In order to test the tunnel, the NAT-ed hosts <b>alice</b> and <b>venus</b>
ping the client <b>bob</b> behind the gateway <b>sun</b>.
@@ -1,5 +1,7 @@
The roadwarriors <b>alice</b> and <b>venus</b> sitting behind the NAT router <b>moon</b> set up
tunnels to gateway <b>sun</b>. UDP encapsulation is used to traverse the NAT router.
Authentication is based on X.509 certificates.
<p/>
<b>leftfirewall=yes</b> automatically inserts iptables-based firewall rules that let pass
the tunneled traffic. In order to test the tunnel, the NAT-ed hosts <b>alice</b> and <b>venus</b>
ping the client <b>bob</b> behind the gateway <b>sun</b>.
@@ -1,6 +1,7 @@
A connection between the subnets behind the gateways <b>moon</b> and <b>sun</b> is set up.
The authentication is based on <b>Preshared Keys</b> (PSK). Upon the successful
establishment of the IPsec tunnel, <b>leftfirewall=yes</b> automatically
The authentication is based on <b>Preshared Keys</b> (PSK).
<p/>
Upon the successful establishment of the IPsec tunnel, <b>leftfirewall=yes</b> automatically
inserts iptables-based firewall rules that let pass the tunneled traffic.
In order to test both tunnel and firewall, client <b>alice</b> behind gateway <b>moon</b>
pings client <b>bob</b> located behind gateway <b>sun</b>.
@@ -1,9 +1,11 @@
at the outset the gateway authenticates itself to the client by sending an
IKEv2 <b>RSA signature</b> accompanied by a certificate.
The roadwarrior <b>carol</b> sets up a connection to gateway <b>moon</b>.
<b>carol</b> uses the <i>Extensible Authentication Protocol</i>
in association with the <i>Authentication and Key Agreement</i> protocol
(<b>EAP-AKA</b>) to authenticate against the gateway. This protocol is used
in UMTS, but here a secret from <b>ipsec.secrets</b> is used instead of a USIM/(R)UIM.
At the outset the gateway authenticates itself to the client by sending
an IKEv2 <b>digital signature</b> accompanied by an X.509 certificate.
<p/>
Next <b>carol</b> uses the <i>Authentication and Key Agreement</i> (<b>EAP-AKA</b>)
method of the <i>Extensible Authentication Protocol</i> to authenticate herself.
This EAP method used in UMTS, but here a secret defined in <b>ipsec.secrets</b>
is used instead of a USIM/(R)UIM device.
<p/>
In addition to her IKEv2 identity <b>[email protected]</b>, roadwarrior <b>carol</b>
uses the EAP identity <b>carol</b>.
@@ -1,7 +1,8 @@
The roadwarrior <b>carol</b> sets up a connection to gateway <b>moon</b>.
<b>carol</b> uses the <i>Extensible Authentication Protocol</i>
in association with the <i>Authentication and Key Agreement</i> protocol
(<b>EAP-AKA</b>) to authenticate against the gateway. This protocol is used
in UMTS, but here a secret from <b>ipsec.secrets</b> is used instead of a USIM/(R)UIM.
Gateway <b>moon</b> additionally uses an <b>RSA signature</b> to authenticate itself
against <b>carol</b>.
At the outset the gateway authenticates itself to the client by sending
an IKEv2 <b>digital signature</b> accompanied by an X.509 certificate.
<p/>
Next <b>carol</b> uses the <i>Authentication and Key Agreement</i> (<b>EAP-AKA</b>)
method of the <i>Extensible Authentication Protocol</i> to authenticate herself.
This EAP method used in UMTS, but here a secret defined in <b>ipsec.secrets</b>
is used instead of a USIM/(R)UIM device.
@@ -1,7 +1,7 @@
The roadwarrior <b>carol</b> sets up a connection to gateway <b>moon</b>.
<b>carol</b> uses the <i>Extensible Authentication Protocol</i>
in association with an <i>MD5</i> challenge and response protocol
(<b>EAP-MD5</b>) to authenticate against the gateway. The user password
is kept in <b>ipsec.secrets</b> on both gateway and client
Gateway <b>moon</b> additionally uses an <b>RSA signature</b> to authenticate itself
against <b>carol</b>.
At the outset the gateway authenticates itself to the client by sending
an IKEv2 <b>digital signature</b> accompanied by an X.509 certificate.
<p/>
Next <b>carol</b> uses the <i>MD5</i> (<b>EAP-MD5</b>) method of the
<i>Extensible Authentication Protocol</i> to authenticate herself.
@@ -1,8 +1,10 @@
The roadwarrior <b>carol</b> sets up a connection to gateway <b>moon</b>.
<b>carol</b> uses the <i>Extensible Authentication Protocol</i>
in association with the <i>Microsoft CHAP version 2</i> protocol
(<b>EAP-MSCHAPV2</b>) to authenticate against the gateway. This protocol is used
e.g. by the Windows 7 Agile VPN client.
In addition to her IKEv2 identity <b>PH_IP_CAROL</b>, roadwarrior <b>carol</b>
uses the EAP identy <b>carol</b>. Gateway <b>moon</b> additionally uses an <b>RSA signature</b>
to authenticate itself against <b>carol</b>.
At the outset the gateway authenticates itself to the client by sending
an IKEv2 <b>digital signature</b> accompanied by an X.509 certificate.
<p/>
Next <b>carol</b> uses the <i>Microsoft CHAP version 2</i> (<b>EAP-MSCHAPV2</b>)
method of the <i>Extensible Authentication Protocol</i> to authenticate herself.
This EAP method is used e.g. by the Windows 7/8/10 Agile VPN client.
<p/>
In addition to her IKEv2 identity which defaults to her IP address,
roadwarrior <b>carol</b> uses the EAP identity <b>carol</b>.
@@ -1,13 +1,13 @@
The roadwarrior <b>carol</b> sets up a connection to gateway <b>moon</b>.
At the outset the gateway authenticates itself to the client by sending
an IKEv2 <b>RSA signature</b> accompanied by a certificate.
<b>carol</b> then uses the <i>Extensible Authentication Protocol</i>
in association with a <i>GSM Subscriber Identity Module</i>
(<b>EAP-SIM</b>) to authenticate against the gateway <b>moon</b>.
In this scenario triplets from the file <b>/etc/ipsec.d/triplets.dat</b>
are used instead of a physical SIM card on the client <b>carol</b> and
the gateway forwards all EAP messages to the RADIUS server <b>alice</b>
an IKEv2 <b>digital signature</b> accompanied by an X.509 certificate.
<p/>
Next <b>carol</b> uses the GSM <i>Subscriber Identity Module</i> (<b>EAP-SIM</b>)
method of the <i>Extensible Authentication Protocol</i> to authenticate herself.
In this scenario triplets from the file <b>/etc/ipsec.d/triplets.dat</b> are used
instead of a physical SIM card.
<p/>
The gateway forwards all EAP messages to the RADIUS server <b>alice</b>
which also uses static triplets. In addition to her IKEv2 identity
<b>[email protected]</b>, roadwarrior <b>carol</b> uses the EAP
identity <b>228060123456001</b>.
@@ -1,14 +1,15 @@
The roadwarrior <b>carol</b> sets up a connection to gateway <b>moon</b>.
The gateway <b>moon</b> does not send an AUTH payload thus signalling
The roadwarriors <b>carol</b> and <b>dave</b> set up a connection to gateway <b>moon</b>.
At the outset the gateway does not send an AUTH payload thus signalling
a mutual <b>EAP-only</b> authentication.
<b>carol</b> then uses the <i>Extensible Authentication Protocol</i>
in association with a <i>GSM Subscriber Identity Module</i>
(<b>EAP-SIM</b>) to authenticate against the gateway <b>moon</b>.
In this scenario, triplets from the file <b>/etc/ipsec.d/triplets.dat</b>
are used instead of a physical SIM card on the client <b>carol</b>.
<p/>
Next the clients use the GSM <i>Subscriber Identity Module</i> (<b>EAP-SIM</b>)
method of the <i>Extensible Authentication Protocol</i> to authenticate themselves.
In this scenario triplets from the file <b>/etc/ipsec.d/triplets.dat</b> are used
instead of a physical SIM card.
<p/>
The gateway forwards all EAP messages to the RADIUS server <b>alice</b>
which also uses a static triplets file.
<p>
which also uses static triplets.
<p/>
The roadwarrior <b>dave</b> sends wrong EAP-SIM triplets. As a consequence
the radius server <b>alice</b> returns an <b>Access-Reject</b> message
and the gateway <b>moon</b> sends back an <b>EAP_FAILURE</b>.
the RADIUS server <b>alice</b> returns an <b>Access-Reject</b> message
and the gateway <b>moon</b> sends back <b>EAP_FAILURE</b>.
@@ -1,14 +1,15 @@
The roadwarrior <b>carol</b> sets up a connection to gateway <b>moon</b>.
At the outset the gateway authenticates itself to the client by sending
an IKEv2 <b>RSA signature</b> accompanied by a certificate.
<b>carol</b> then uses the <i>Extensible Authentication Protocol</i>
in association with a <i>GSM Subscriber Identity Module</i>
(<b>EAP-SIM</b>) to authenticate against the gateway <b>moon</b>.
In this scenario, triplets from the file <b>/etc/ipsec.d/triplets.dat</b>
are used instead of a physical SIM card on the client <b>carol</b>.
The roadwarriors <b>carol</b> and <b>dave</b> set up a connection to gateway <b>moon</b>.
At the outset the gateway authenticates itself to the clients by sending
an IKEv2 <b>digital signature</b> accompanied by an X.509 certificate.
<p/>
Next the clients use the GSM <i>Subscriber Identity Module</i> (<b>EAP-SIM</b>)
method of the <i>Extensible Authentication Protocol</i> to authenticate themselves.
In this scenario triplets from the file <b>/etc/ipsec.d/triplets.dat</b> are used
instead of a physical SIM card.
<p/>
The gateway forwards all EAP messages to the RADIUS server <b>alice</b>
which also uses a static triplets file.
<p>
which also uses static triplets.
<p/>
The roadwarrior <b>dave</b> sends wrong EAP-SIM triplets. As a consequence
the radius server <b>alice</b> returns an <b>Access-Reject</b> message
and the gateway <b>moon</b> sends back an <b>EAP_FAILURE</b>.
the RADIUS server <b>alice</b> returns an <b>Access-Reject</b> message
and the gateway <b>moon</b> sends back <b>EAP_FAILURE</b>.
@@ -1,7 +1,8 @@
The roadwarrior <b>carol</b> sets up a connection to gateway <b>moon</b>.
<b>carol</b> uses the <i>Extensible Authentication Protocol</i>
in association with a GSM <i>Subscriber Identity Module</i> (<b>EAP-SIM</b>)
to authenticate against the gateway. In this scenario triplets from the file
<b>/etc/ipsec.d/triplets.dat</b> are used instead of a physical SIM card.
Gateway <b>moon</b> additionally uses an <b>RSA signature</b> to authenticate
itself against <b>carol</b>.
At the outset the gateway authenticates itself to the client by sending
an IKEv2 <b>digital signature</b> accompanied by an X.509 certificate.
<p/>
Next <b>carol</b> uses the GSM <i>Subscriber Identity Module</i> (<b>EAP-SIM</b>)
method of the <i>Extensible Authentication Protocol</i> to authenticate herself.
In this scenario triplets from the file <b>/etc/ipsec.d/triplets.dat</b> are used
instead of a physical SIM card.
@@ -1,10 +0,0 @@
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-MD5</b> (phase2 of EAP-TTLS).
<p/>
With the setting <b>charon.plugins.eap-ttls.phase2_piggyback = yes</b> the server <b>moon</b>
initiates phase2 of the EAP-TTLS protocol by piggybacking a tunneled EAP Identity request
right onto the TLS Finished message. Client <b>carol</b> presents the correct MD5 password
and succeeds whereas client <b>dave</b> chooses the wrong password and fails.
@@ -1,19 +0,0 @@
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::server requested EAP_MD5 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=Linux strongSwan, 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::server requested EAP_MD5 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 '[email protected]' with EAP_MD5 successful::YES
moon:: cat /var/log/daemon.log::authentication of '[email protected]' with EAP successful::YES
moon:: cat /var/log/daemon.log::EAP method EAP_TTLS failed for peer [email protected]::YES
moon:: ipsec status 2> /dev/null::rw-eap.*ESTABLISHED.*[email protected]::YES
moon:: ipsec status 2> /dev/null::rw-eap.*ESTABLISHED.*[email protected]::NO
carol::ipsec status 2> /dev/null::home.*ESTABLISHED::YES
dave:: ipsec status 2> /dev/null::home.*ESTABLISHED::NO
carol::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
@@ -1,20 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_CAROL
[email protected]
leftauth=eap
leftfirewall=yes
right=PH_IP_MOON
rightid="C=CH, O=Linux strongSwan, CN=moon.strongswan.org"
rightauth=any
rightsubnet=10.1.0.0/16
rightsendcert=never
auto=add
@@ -1,3 +0,0 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
[email protected] : EAP "Ar3etTnp"
@@ -1,11 +0,0 @@
# /etc/strongswan.conf - strongSwan configuration file
charon {
load = random nonce aes sha1 sha2 md5 pem pkcs1 curve25519 gmp x509 curl revocation hmac stroke kernel-netlink socket-default eap-identity eap-md5 eap-ttls updown
multiple_authentication=no
syslog {
daemon {
tls = 2
}
}
}
@@ -1,20 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_DAVE
[email protected]
leftauth=eap
leftfirewall=yes
right=PH_IP_MOON
rightid="C=CH, O=Linux strongSwan, CN=moon.strongswan.org"
rightauth=any
rightsubnet=10.1.0.0/16
rightsendcert=never
auto=add
@@ -1,3 +0,0 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
[email protected] : EAP "UgaM65Va"
@@ -1,11 +0,0 @@
# /etc/strongswan.conf - strongSwan configuration file
charon {
load = random nonce aes sha1 sha2 md5 pem pkcs1 curve25519 gmp x509 curl revocation hmac stroke kernel-netlink socket-default eap-identity eap-md5 eap-ttls updown
multiple_authentication=no
syslog {
daemon {
tls = 2
}
}
}
@@ -1,19 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn rw-eap
left=PH_IP_MOON
leftsubnet=10.1.0.0/16
leftcert=moonCert.pem
leftauth=eap-ttls
leftfirewall=yes
rightauth=eap-ttls
rightsendcert=never
right=%any
auto=add
@@ -1,6 +0,0 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA moonKey.pem
[email protected] : EAP "Ar3etTnp"
[email protected] : EAP "W7R0g3do"
@@ -1,18 +0,0 @@
# /etc/strongswan.conf - strongSwan configuration file
charon {
load = random nonce aes sha1 sha2 md5 pem pkcs1 curve25519 gmp x509 curl revocation hmac stroke kernel-netlink socket-default eap-identity eap-md5 eap-ttls updown
multiple_authentication=no
syslog {
daemon {
tls = 2
}
}
plugins {
eap-ttls {
phase2_method = md5
phase2_piggyback = yes
}
}
}
@@ -1,6 +0,0 @@
moon::ipsec stop
carol::ipsec stop
dave::ipsec stop
moon::iptables-restore < /etc/iptables.flush
carol::iptables-restore < /etc/iptables.flush
dave::iptables-restore < /etc/iptables.flush
@@ -1,11 +0,0 @@
moon::iptables-restore < /etc/iptables.rules
carol::iptables-restore < /etc/iptables.rules
dave::iptables-restore < /etc/iptables.rules
moon::ipsec start
carol::ipsec start
dave::ipsec start
moon::expect-connection rw-eap
carol::expect-connection home
carol::ipsec up home
dave::expect-connection home
dave::ipsec up home
@@ -1,21 +0,0 @@
#!/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"