testing: Reorganizing IKEv1 and IKEv2 examples

For documentation purposes the new folders ikev1-algs, ikev2-algs,
ikev1-multi-ca and ikev2-multi-ca have been created. Most of the
test cases have now been converted to the vici interface. The
remaining legacy stroke scenarios yet to be converted have been put
into the ikev2-stroke-bye folder.

For documentation purposes some legacy stroke scenarios will be kept
in the ikev1-stroke, ikev2-stroke and ipv6-stroke folders.
This commit is contained in:
Andreas Steffen
2021-05-21 09:42:50 +02:00
parent db93938297
commit 7c5a2974b9
4054 changed files with 16375 additions and 15209 deletions
+6 -7
View File
@@ -1,13 +1,12 @@
The peers <b>carol</b> and <b>moon</b> both have dynamic IP addresses, so that the remote end
is defined symbolically by <b>right=&lt;hostname&gt;</b>. The ipsec starter resolves the
fully-qualified hostname into the current IP address via a DNS lookup (simulated by an
/etc/hosts entry). Since the peer IP addresses are expected to change over time, the option
<b>rightallowany=yes</b> will allow an IKE main mode rekeying to arrive from an arbitrary
IP address under the condition that the peer identity remains unchanged. When this happens
The peers <b>carol</b> and <b>moon</b> both have dynamic IP addresses, so that the
<b>remote_addrs</b> field contains a <b>Fully Qualified Domain Name</b> (FQDN) which
is evaluated just before use via a DNS lookup (simulated by an /etc/hosts entry).
This will allow an IKE main mode rekeying to arrive from an arbitrary IP address
under the condition that the peer identity remains unchanged. When this happens
the old tunnel is replaced by an IPsec connection to the new origin.
<p>
In this scenario <b>moon</b> first initiates a tunnel to <b>carol</b>. After some time
the responder <b>carol</b> suddenly changes her IP address and restarts the connection to
<b>moon</b> without deleting the old tunnel first (simulated by iptables blocking IKE packets
to and from <b>carol</b> and starting the connection from host <b>dave</b> using
<b>carol</b>'s identity).
<b>carol</b>'s identity).
+2 -4
View File
@@ -1,7 +1,5 @@
carol::ipsec status 2> /dev/null::moon.*ESTABLISHED.*carol.strongswan.org.*moon.strongswan.org::YES
dave:: ipsec status 2> /dev/null::moon.*ESTABLISHED.*carol.strongswan.org.*moon.strongswan.org::YES
carol::ipsec status 2> /dev/null::moon.*INSTALLED, TUNNEL::YES
dave:: ipsec status 2> /dev/null::moon.*INSTALLED, TUNNEL::YES
carol::swanctl --list-sas --raw 2> /dev/null::moon.*version=1 state=ESTABLISHED local-host=192.168.0.100 local-port=500 [email protected] remote-host=192.168.0.1 remote-port=500 remote-id=moon.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.*local-vips=\[10.3.0.1] child-sas.*moon.*state=INSTALLED mode=TUNNEL.*ESP.*encr-alg=AES_GCM_16 encr-keysize=128.*local-ts=\[10.3.0.1/32] remote-ts=\[10.1.0.0/16]::YES
dave:: swanctl --list-sas --raw 2> /dev/null::moon.*version=1 state=ESTABLISHED local-host=192.168.0.200 local-port=500 local-id=carol@strongswan.org remote-host=192.168.0.1 remote-port=500 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.*local-vips=\[10.3.0.1] child-sas.*moon.*state=INSTALLED mode=TUNNEL.*ESP.*encr-alg=AES_GCM_16 encr-keysize=128.*local-ts=\[10.3.0.1/32] remote-ts=\[10.1.0.0/16]::YES
moon:: cat /var/log/auth.log::IKE_SA carol\[1] established.*PH_IP_CAROL::YES
moon:: cat /var/log/daemon.log::deleting duplicate IKE_SA for.*[email protected].*due to uniqueness policy::YES
moon:: cat /var/log/auth.log::IKE_SA carol\[2] established.*PH_IP_DAVE::YES
@@ -1,21 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev1
conn moon
left=%any
leftsourceip=%config
leftcert=carolCert.pem
[email protected]
leftfirewall=yes
right=%moon.strongswan.org
rightsubnet=10.1.0.0/16
[email protected]
auto=add
+6 -2
View File
@@ -1,5 +1,9 @@
# /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 updown
swanctl {
load = pem pkcs1 x509 revocation constraints pubkey openssl random
}
charon-systemd {
load = random nonce aes sha1 sha2 hmac pem pkcs1 x509 revocation curve25519 gmp curl kernel-netlink socket-default updown vici
}
@@ -0,0 +1,27 @@
connections {
moon {
remote_addrs = moon.strongswan.org
vips = 0.0.0.0
local {
auth = pubkey
certs = carolCert.pem
id = [email protected]
}
remote {
auth = pubkey
id = moon.strongswan.org
}
children {
moon {
remote_ts = 10.1.0.0/16
updown = /usr/local/libexec/ipsec/_updown iptables
esp_proposals = aes128gcm128-x25519
}
}
version = 1
proposals = aes128-sha256-x25519
}
}
@@ -1,21 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev1
conn moon
left=%any
leftsourceip=%config
leftcert=carolCert.pem
[email protected]
leftfirewall=yes
right=%moon.strongswan.org
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -1,3 +0,0 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA carolKey.pem "nH5ZQEWtku0RJEZ6"
+6 -2
View File
@@ -1,5 +1,9 @@
# /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 updown
swanctl {
load = pem pkcs1 x509 revocation constraints pubkey openssl random
}
charon-systemd {
load = random nonce aes sha1 sha2 hmac pem pkcs1 x509 revocation curve25519 gmp curl kernel-netlink socket-default updown vici
}
@@ -0,0 +1,27 @@
connections {
moon {
remote_addrs = moon.strongswan.org
vips = 0.0.0.0
local {
auth = pubkey
certs = carolCert.pem
id = [email protected]
}
remote {
auth = pubkey
id = moon.strongswan.org
}
children {
moon {
remote_ts = 10.1.0.0/16
updown = /usr/local/libexec/ipsec/_updown iptables
esp_proposals = aes128gcm128-x25519
}
}
version = 1
proposals = aes128-sha256-x25519
}
}
@@ -1,21 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev1
conn carol
left=%any
leftsubnet=10.1.0.0/16
leftcert=moonCert.pem
[email protected]
leftfirewall=yes
right=%carol.strongswan.org
[email protected]
rightsourceip=PH_IP_CAROL1
auto=add
+6 -2
View File
@@ -1,5 +1,9 @@
# /etc/strongswan.conf - strongSwan configuration file
charon {
load = random nonce aes sha1 sha2 pem pkcs1 curve25519 gmp x509 curl revocation hmac stroke kernel-netlink socket-default updown
swanctl {
load = pem pkcs1 x509 revocation constraints pubkey openssl random
}
charon-systemd {
load = random nonce aes sha1 sha2 hmac pem pkcs1 x509 revocation curve25519 gmp curl kernel-netlink socket-default updown vici
}
@@ -0,0 +1,33 @@
connections {
carol {
remote_addrs = carol.strongswan.org
pools = carol_vip
local {
auth = pubkey
certs = moonCert.pem
id = moon.strongswan.org
}
remote {
auth = pubkey
}
children {
carol {
local_ts = 10.1.0.0/16
updown = /usr/local/libexec/ipsec/_updown iptables
esp_proposals = aes128gcm128-x25519
}
}
version = 1
proposals = aes128-sha256-x25519
unique = replace
}
}
pools {
carol_vip {
addrs = 10.3.0.1
}
}
+4 -5
View File
@@ -1,6 +1,5 @@
dave::ipsec stop
carol::ipsec stop
moon::ipsec stop
carol::systemctl stop strongswan
dave::systemctl stop strongswan
moon::systemctl stop strongswan
carol::iptables-restore < /etc/iptables.flush
dave::rm /etc/ipsec.d/certs/*
dave::rm /etc/ipsec.d/private/*
dave::cd /etc/swanctl; rm rsa/carolKey.pem x509/carolCert.pem
+7 -7
View File
@@ -1,13 +1,13 @@
carol::iptables-restore < /etc/iptables.rules
carol::ipsec start
dave::ipsec start
moon::ipsec start
moon::systemctl start strongswan
carol::systemctl start strongswan
dave::systemctl start strongswan
carol::expect-connection moon
moon::expect-connection carol
moon::ipsec up carol
moon::sleep 0.5
moon::swanctl --initiate --child carol 2> /dev/null
moon::sleep 1
carol::iptables -D INPUT -i eth0 -p udp --dport 500 --sport 500 -j ACCEPT
carol::iptables -D OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
moon::sed -i 's/192.168.0.100/192.168.0.200/g' /etc/hosts
dave::expect-connection moon
dave::ipsec up moon
moon::sleep 0.5
dave::swanctl --initiate --child moon 2> /dev/null
+5 -1
View File
@@ -13,9 +13,13 @@ DIAGRAM="a-m-c-w-d.png"
# Guest instances on which tcpdump is to be started
#
TCPDUMPHOSTS="moon alice"
TCPDUMPHOSTS="alice"
# Guest instances on which IPsec is started
# Used for IPsec logging purposes
#
IPSECHOSTS="moon carol dave"
# charon controlled by swanctl
#
SWANCTL=1