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
@@ -0,0 +1,4 @@
*.crl
*.der
*.p12
*.pem
@@ -0,0 +1,8 @@
By setting <b>left=%any</b> this scenario tests the ability of the IKEv2 daemon
to automatically determine its own IP address of an IPsec SA to be established.
This is achieved by finding a route via the correct network interface to the remote IPsec peer.
<p>
The hosts <b>moon</b> and <b>bob</b> act as initiators by setting <b>auto=route</b>
whereas the hosts <b>alice</b> and <b>sun</b> act as responders by setting <b>auto=add</b>.
Pings from <b>moon</b> to <b>alice</b> and <b>sun</b> as well as a ping from <b>bob</b>
to <b>sun</b> set up three compressed IPsec Transport Mode connections.
@@ -0,0 +1,21 @@
moon:: cat /var/log/daemon.log::creating acquire job::YES
bob:: cat /var/log/daemon.log::creating acquire job::YES
moon:: ipsec status 2> /dev/null::alice.*ESTABLISHED.*CN=moon.strongswan.org.*[email protected]::YES
moon:: ipsec status 2> /dev/null::sun.*ESTABLISHED.*CN=moon.strongswan.org.*CN=sun.strongswan.org::YES
alice::ipsec status 2> /dev/null::remote.*ESTABLISHED.*[email protected].*CN=moon.strongswan.org::YES
sun:: ipsec status 2> /dev/null::remote\[1]: ESTABLISHED.*CN=sun.strongswan.org.*CN=moon.strongswan.org::YES
sun:: ipsec status 2> /dev/null::remote\[2]: ESTABLISHED.*CN=sun.strongswan.org.*[email protected]::YES
bob:: ipsec status 2> /dev/null::sun.*ESTABLISHED.*[email protected].*CN=sun.strongswan.org::YES
moon:: ipsec status 2> /dev/null::alice.*INSTALLED, TRANSPORT::YES
moon:: ipsec status 2> /dev/null::sun.*INSTALLED, TRANSPORT::YES
alice::ipsec status 2> /dev/null::remote.*INSTALLED, TRANSPORT::YES
sun:: ipsec status 2> /dev/null::remote[{]1}.*INSTALLED, TRANSPORT::YES
sun:: ipsec status 2> /dev/null::remote[{]2}.*INSTALLED, TRANSPORT::YES
bob:: ipsec status 2> /dev/null::sun.*INSTALLED, TRANSPORT::YES
alice::tcpdump::IP moon1.strongswan.org > alice.strongswan.org: ESP::YES
alice::tcpdump::IP alice.strongswan.org > moon1.strongswan.org: ESP::YES
sun::tcpdump::IP moon.strongswan.org > sun.strongswan.org: ESP::YES
sun::tcpdump::IP sun.strongswan.org > moon.strongswan.org: ESP::YES
bob::tcpdump::IP bob.strongswan.org > sun1.strongswan.org: ESP::YES
bob::tcpdump::IP sun1.strongswan.org > bob.strongswan.org: ESP::YES
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
mobike=no
type=transport
compress=yes
dpdaction=clear
dpddelay=10
left=%any
leftcert=aliceCert.pem
conn remote
right=%any
auto=add
@@ -0,0 +1,6 @@
# /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
multiple_authentication = no
}
@@ -0,0 +1,22 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
mobike=no
type=transport
compress=yes
dpdaction=hold
dpddelay=10
left=%any
leftcert=bobCert.pem
conn sun
right=PH_IP_SUN1
rightid="C=CH, O=strongSwan Project, CN=sun.strongswan.org"
auto=route
@@ -0,0 +1,6 @@
# /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
multiple_authentication = no
}
@@ -0,0 +1,27 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
mobike=no
type=transport
compress=yes
dpdaction=hold
dpddelay=10
left=%any
leftcert=moonCert.pem
conn alice
right=PH_IP_ALICE
rightid="C=CH, O=strongSwan Project, OU=Sales, [email protected]"
auto=route
conn sun
right=PH_IP_SUN
rightid="C=CH, O=strongSwan Project, CN=sun.strongswan.org"
auto=route
@@ -0,0 +1,6 @@
# /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
multiple_authentication = no
}
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
mobike=no
type=transport
compress=yes
dpdaction=clear
dpddelay=10
left=%any
leftcert=sunCert.pem
conn remote
right=%any
auto=add
@@ -0,0 +1,6 @@
# /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
multiple_authentication = no
}
@@ -0,0 +1,6 @@
alice::ipsec stop
moon::ipsec stop
sun::ipsec stop
bob::ipsec stop
winnetou::ip route del 10.1.0.0/16 via PH_IP_MOON
winnetou::ip route del 10.2.0.0/16 via PH_IP_SUN
@@ -0,0 +1,13 @@
winnetou::ip route add 10.1.0.0/16 via PH_IP_MOON
winnetou::ip route add 10.2.0.0/16 via PH_IP_SUN
alice::ipsec start
moon::ipsec start
sun::ipsec start
bob::ipsec start
alice::expect-connection remote
sun::expect-connection remote
moon::expect-connection alice
moon::ping -n -c 3 -W 1 -i 0.2 -s 8184 -p deadbeef PH_IP_ALICE
moon::ping -n -c 3 -W 1 -i 0.2 -s 8184 -p deadbeef PH_IP_SUN
bob::expect-connection sun
bob::ping -n -c 3 -W 1 -i 0.2 -s 8184 -p deadbeef PH_IP_SUN1
@@ -0,0 +1,21 @@
#!/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 winnetou sun bob"
# Corresponding block diagram
#
DIAGRAM="a-m-w-s-b.png"
# Guest instances on which tcpdump is to be started
#
TCPDUMPHOSTS="alice sun bob"
# Guest instances on which IPsec is started
# Used for IPsec logging purposes
#
IPSECHOSTS="alice moon sun bob"
@@ -0,0 +1,3 @@
The peers <b>alice</b> and <b>bob</b> are located behind the NAT routers <b>moon</b> and <b>sun</b>,
respectively. They both connect to a central gateway <b>carol</b> using IPComp.
In order to test the IPsec tunnel both peers ping each other and gateway <b>carol</b>.
@@ -0,0 +1,22 @@
alice::ipsec status 2> /dev/null::hub.*ESTABLISHED.*[email protected].*[email protected]::YES
bob:: ipsec status 2> /dev/null::hub.*ESTABLISHED.*[email protected].*[email protected]::YES
carol::ipsec status 2> /dev/null::hub.*ESTABLISHED.*PH_IP_MOON.*[email protected]::YES
carol::ipsec status 2> /dev/null::hub.*ESTABLISHED.*PH_IP_SUN.*[email protected]::YES
alice::ipsec status 2> /dev/null::hub.*INSTALLED, TUNNEL.*IPCOMP::YES
bob:: ipsec status 2> /dev/null::hub.*INSTALLED, TUNNEL.*IPCOMP::YES
carol::ipsec status 2> /dev/null::hub.*INSTALLED, TUNNEL.*IPCOMP::YES
carol::cat /var/log/daemon.log::IKE_AUTH request.*N(IPCOMP_SUP)::YES
carol::cat /var/log/daemon.log::IKE_AUTH response.*N(IPCOMP_SUP)::YES
alice::ip xfrm state::proto comp spi::YES
bob:: ip xfrm state::proto comp spi::YES
carol::ip xfrm state::proto comp spi::YES
alice::ping -c 1 -s 8184 -p deadbeef PH_IP_CAROL::8192 bytes from PH_IP_CAROL: icmp_.eq=1::YES
alice::ping -c 1 PH_IP_CAROL::64 bytes from PH_IP_CAROL: icmp_.eq=1::YES
alice::ping -c 1 -s 8184 -p deadbeef PH_IP_BOB::8192 bytes from PH_IP_BOB: icmp_.eq=1::YES
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_.eq=1::YES
bob:: ping -c 1 -s 8184 -p deadbeef PH_IP_ALICE::8192 bytes from PH_IP_ALICE: icmp_.eq=1::YES
bob:: ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
moon::tcpdump::IP moon.strongswan.org.* > carol.strongswan.org.*: UDP::YES
moon::tcpdump::IP carol.strongswan.org.* > moon.strongswan.org.*: UDP::YES
sun::tcpdump::IP sun.strongswan.org.* > carol.strongswan.org.*: UDP::YES
sun::tcpdump::IP carol.strongswan.org.* > sun.strongswan.org.*: UDP::YES
@@ -0,0 +1,24 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
dpdaction=restart
dpddelay=60s
leftfirewall=yes
lefthostaccess=yes
conn hub
leftcert=aliceCert.pem
[email protected]
leftsubnet=10.1.0.0/16
right=PH_IP_CAROL
[email protected]
rightsubnet=PH_IP_CAROL/32,10.2.0.0/16
compress=yes
auto=add
@@ -0,0 +1,5 @@
# /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
}
@@ -0,0 +1,24 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
dpdaction=restart
dpddelay=60s
leftfirewall=yes
lefthostaccess=yes
conn hub
leftcert=bobCert.pem
[email protected]
leftsubnet=10.2.0.0/16
right=PH_IP_CAROL
[email protected]
rightsubnet=PH_IP_CAROL/32,10.1.0.0/16
compress=yes
auto=add
@@ -0,0 +1,5 @@
# /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
}
@@ -0,0 +1,23 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
dpdaction=clear
dpddelay=60s
conn hub
leftcert=carolCert.pem
[email protected]
leftfirewall=yes
lefthostaccess=yes
right=%any
leftsubnet=0.0.0.0/0
rightsubnet=0.0.0.0/0
compress=yes
auto=add
@@ -0,0 +1,24 @@
*filter
# default policy is DROP
-P INPUT DROP
-P OUTPUT DROP
-P FORWARD DROP
# allow IKE
-A INPUT -i eth0 -p udp --dport 500 -j ACCEPT
-A OUTPUT -o eth0 -p udp --sport 500 -j ACCEPT
# allow MobIKE
-A INPUT -i eth0 -p udp --dport 4500 -j ACCEPT
-A OUTPUT -o eth0 -p udp --sport 4500 -j ACCEPT
# allow ssh
-A INPUT -p tcp --dport 22 -j ACCEPT
-A OUTPUT -p tcp --sport 22 -j ACCEPT
# allow crl fetch from winnetou
-A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
-A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
COMMIT
@@ -0,0 +1,5 @@
# /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
}
@@ -0,0 +1,8 @@
bob::ipsec stop
alice::ipsec stop
carol::ipsec stop
alice::iptables-restore < /etc/iptables.flush
carol::iptables-restore < /etc/iptables.flush
bob::iptables-restore < /etc/iptables.flush
moon::iptables-restore < /etc/iptables.flush
sun::iptables-restore < /etc/iptables.flush
@@ -0,0 +1,21 @@
alice::iptables-restore < /etc/iptables.rules
carol::iptables-restore < /etc/iptables.rules
bob::iptables-restore < /etc/iptables.rules
moon::iptables-restore < /etc/iptables.rules
sun::iptables-restore < /etc/iptables.rules
moon::iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p udp -j SNAT --to-source PH_IP_MOON:1100-1200
moon::iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p tcp -j SNAT --to-source PH_IP_MOON:2000-2100
moon::iptables -A FORWARD -i eth1 -o eth0 -s 10.1.0.0/16 -j ACCEPT
moon::iptables -A FORWARD -i eth0 -o eth1 -d 10.1.0.0/16 -j ACCEPT
sun::iptables -t nat -A POSTROUTING -o eth0 -s 10.2.0.0/16 -p udp -j SNAT --to-source PH_IP_SUN:1200-1300
sun::iptables -t nat -A POSTROUTING -o eth0 -s 10.2.0.0/16 -p tcp -j SNAT --to-source PH_IP_SUN:2000-2100
sun::iptables -A FORWARD -i eth1 -o eth0 -s 10.2.0.0/16 -j ACCEPT
sun::iptables -A FORWARD -i eth0 -o eth1 -d 10.2.0.0/16 -j ACCEPT
carol::ipsec start
alice::ipsec start
bob::ipsec start
carol::expect-connection hub
alice::expect-connection hub
bob::expect-connection hub
alice::ipsec up hub
bob::ipsec up hub
@@ -0,0 +1,21 @@
#!/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 sun bob"
# Corresponding block diagram
#
DIAGRAM="a-m-c-w-s-b-med.png"
# Guest instances on which tcpdump is to be started
#
TCPDUMPHOSTS="moon sun"
# Guest instances on which IPsec is started
# Used for IPsec logging purposes
#
IPSECHOSTS="alice carol bob"
@@ -0,0 +1,5 @@
By setting <b>strictcrlpolicy=yes</b> a <b>strict CRL policy</b> is enforced on
both roadwarrior <b>carol</b> and gateway <b>moon</b>. When <b>carol</b> initiates
an IPsec connection to <b>moon</b>, both VPN endpoints find a cached CRL in
their <b>/etc/ipsec.d/crls/</b> directories which allows them to immediately verify
the certificate received from their peer.
@@ -0,0 +1,12 @@
moon:: ipsec status 2> /dev/null::rw.*ESTABLISHED.*moon.strongswan.org.*[email protected]::YES
carol::ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*moon.strongswan.org::YES
moon:: cat /var/log/daemon.log::loaded crl from::YES
moon:: cat /var/log/daemon.log::crl is valid::YES
moon:: cat /var/log/daemon.log::certificate status is good::YES
moon:: cat /var/log/daemon.log::using cached crl::YES
moon:: ipsec listcrls 2> /dev/null:: ok::YES
carol::cat /var/log/daemon.log::loaded crl from::YES
carol::cat /var/log/daemon.log::crl is valid::YES
carol::cat /var/log/daemon.log::certificate status is good::YES
carol::cat /var/log/daemon.log::using cached crl::YES
carol::ipsec listcrls 2> /dev/null:: ok::YES
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
strictcrlpolicy=yes
cachecrls=yes
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_CAROL
leftcert=carolCert.pem
[email protected]
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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
}
@@ -0,0 +1,19 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
strictcrlpolicy=yes
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn rw
left=PH_IP_MOON
leftcert=moonCert.pem
[email protected]
leftsubnet=10.1.0.0/16
right=%any
auto=add
@@ -0,0 +1,7 @@
# /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
cache_crls = yes
}
@@ -0,0 +1,4 @@
moon::ipsec stop
carol::ipsec stop
moon::rm /etc/ipsec.d/crls/*
carol::rm /etc/ipsec.d/crls/*
@@ -0,0 +1,9 @@
moon::wget -q http://crl.strongswan.org/strongswan.crl
moon::mv strongswan.crl /etc/ipsec.d/crls/5da7dd700651327ee7b66db3b5e5e060ea2e4def.crl
carol::wget -q http://crl.strongswan.org/strongswan.crl
carol::mv strongswan.crl /etc/ipsec.d/crls/5da7dd700651327ee7b66db3b5e5e060ea2e4def.crl
moon::ipsec start
carol::ipsec start
moon::expect-connection rw
carol::expect-connection home
carol::ipsec up home
@@ -0,0 +1,21 @@
#!/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="moon carol winnetou"
# Corresponding block diagram
#
DIAGRAM="m-c-w.png"
# Guest instances on which tcpdump is to be started
#
TCPDUMPHOSTS=""
# Guest instances on which IPsec is started
# Used for IPsec logging purposes
#
IPSECHOSTS="moon carol"
@@ -0,0 +1,11 @@
The roadwarriors <b>carol</b> and <b>dave</b> set up a connection each to gateway <b>moon</b>
and request a <b>virtual IP</b> via the IKEv2 configuration payload by using the <b>leftsourceip=%config</b>
parameter. The <b>dhcp</b> plugin on gateway <b>moon</b> then requests an IP address and DNS/WINS server
information from DHCP server <b>venus</b> using the DHCP protocol. The IP addresses are assigned statically
by <b>venus</b> based on the IKEv2 peer identities <b>[email protected]</b> and <b>[email protected]</b>,
respectively, included by the dhcp plugin as a <b>dhcp-client-identity</b> option in the DHCP request.
<p/>
With the static assignment of 10.1.0.30 and 10.1.0.40, respectively, <b>carol</b> and <b>dave</b>
become full members of the subnet 10.1.0.0/16 hidden behind gateway <b>moon</b>. And this thanks to
the <b>farp</b> plugin through which <b>moon</b> acts as a proxy for ARP requests e.g. from <b>alice</b>
who wants to ping <b>carol</b> and <b>dave</b>.
@@ -0,0 +1,26 @@
carol::ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*moon.strongswan.org::YES
carol::ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
alice::ping -c 1 10.1.0.30::64 bytes from 10.1.0.30: icmp_.eq=1::YES
carol::ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
dave:: ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*moon.strongswan.org::YES
dave:: ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
alice::ping -c 1 10.1.0.40::64 bytes from 10.1.0.40: icmp_.eq=1::YES
dave:: ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
moon:: ipsec status 2> /dev/null::rw\[1]: ESTABLISHED.*moon.strongswan.org.*[email protected]::YES
moon:: ipsec status 2> /dev/null::rw\[2]: ESTABLISHED.*moon.strongswan.org.*[email protected]::YES
moon:: ipsec status 2> /dev/null::rw[{]1}.*10.1.0.0/16 === 10.1.0.30/32::YES
moon:: ipsec status 2> /dev/null::rw[{]2}.*10.1.0.0/16 === 10.1.0.40/32::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
alice::tcpdump::ARP, Reply carol2.strongswan.org is-at 52:54:00:43:e3:35::YES
alice::tcpdump::IP alice.strongswan.org > carol2.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP carol2.strongswan.org > alice.strongswan.org: ICMP echo reply::YES
alice::tcpdump::IP carol2.strongswan.org > alice.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP alice.strongswan.org > carol2.strongswan.org: ICMP echo reply::YES
alice::tcpdump::ARP, Reply dave2.strongswan.org is-at 52:54:00:43:e3:35::YES
alice::tcpdump::IP alice.strongswan.org > dave2.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP dave2.strongswan.org > alice.strongswan.org: ICMP echo reply::YES
alice::tcpdump::IP dave2.strongswan.org > alice.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP alice.strongswan.org > dave2.strongswan.org: ICMP echo reply::YES
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_CAROL
leftsourceip=%config
leftcert=carolCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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 resolve
}
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_DAVE
leftsourceip=%config
leftcert=daveCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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 resolve
}
@@ -0,0 +1,20 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
left=PH_IP_MOON
leftsubnet=10.1.0.0/16
leftcert=moonCert.pem
[email protected]
leftfirewall=yes
conn rw
right=%any
rightsourceip=%dhcp
auto=add
@@ -0,0 +1,39 @@
*filter
# default policy is DROP
-P INPUT DROP
-P OUTPUT DROP
-P FORWARD DROP
# allow bootpc and bootps
-A OUTPUT -p udp --sport bootpc --dport bootps -j ACCEPT
-A INPUT -p udp --sport bootps --dport bootps -j ACCEPT
# allow broadcasts from eth1
-A INPUT -i eth1 -d 10.1.255.255 -j ACCEPT
# allow esp
-A INPUT -i eth0 -p 50 -j ACCEPT
-A OUTPUT -o eth0 -p 50 -j ACCEPT
# allow IKE
-A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
-A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
# allow MobIKE
-A INPUT -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT
-A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT
# allow ssh
-A INPUT -p tcp --dport 22 -j ACCEPT
-A OUTPUT -p tcp --sport 22 -j ACCEPT
# allow crl fetch from winnetou
-A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
-A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# log dropped packets
-A INPUT -j LOG --log-prefix " IN: "
-A OUTPUT -j LOG --log-prefix " OUT: "
COMMIT
@@ -0,0 +1,12 @@
# /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 attr farp dhcp
plugins {
dhcp {
server = 10.1.255.255
identity_lease = yes
}
}
}
@@ -0,0 +1,24 @@
# dhcpd configuration file
ddns-update-style none;
subnet 10.1.0.0 netmask 255.255.0.0 {
option domain-name "strongswan.org";
option domain-name-servers PH_IP_VENUS;
option netbios-name-servers PH_IP_ALICE;
option routers PH_IP_MOON1;
option broadcast-address 10.1.255.255;
next-server PH_IP_VENUS;
range 10.1.0.50 10.1.0.60;
}
host carol {
option dhcp-client-identifier "carol@strongswan.org";
fixed-address 10.1.0.30;
}
host dave {
option dhcp-client-identifier "dave@strongswan.org";
fixed-address 10.1.0.40;
}
@@ -0,0 +1,9 @@
interface=eth0
dhcp-range=10.1.0.50,10.1.0.60,255.255.0.0,10.1.255.255
dhcp-host=id:[email protected],10.1.0.30
dhcp-host=id:[email protected],10.1.0.40
dhcp-option=option:router,PH_IP_MOON1
dhcp-option=option:dns-server,PH_IP_VENUS
dhcp-option=option:netbios-ns,PH_IP_ALICE
dhcp-option=option:domain-name,strongswan.org
log-dhcp
@@ -0,0 +1,9 @@
moon::ipsec stop
carol::ipsec stop
dave::ipsec stop
venus::service isc-dhcp-server stop 2> /dev/null
moon::iptables-restore < /etc/iptables.flush
carol::iptables-restore < /etc/iptables.flush
dave::iptables-restore < /etc/iptables.flush
alice::arp -d 10.1.0.30
alice::arp -d 10.1.0.40
@@ -0,0 +1,13 @@
moon::iptables-restore < /etc/iptables.rules
carol::iptables-restore < /etc/iptables.rules
dave::iptables-restore < /etc/iptables.rules
venus::cat /etc/dhcp/dhcpd.conf
venus::service isc-dhcp-server start 2> /dev/null
moon::ipsec start
carol::ipsec start
dave::ipsec start
moon::expect-connection rw
carol::expect-connection home
carol::ipsec up home
dave::expect-connection home
dave::ipsec up home
@@ -0,0 +1,21 @@
#!/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 venus moon carol winnetou dave"
# Corresponding block diagram
#
DIAGRAM="a-v-m-c-w-d.png"
# Guest instances on which tcpdump is to be started
#
TCPDUMPHOSTS="moon alice"
# Guest instances on which IPsec is started
# Used for IPsec logging purposes
#
IPSECHOSTS="moon carol dave"
@@ -0,0 +1,12 @@
The roadwarriors <b>carol</b> and <b>dave</b> set up a connection each to gateway <b>moon</b>
and request a <b>virtual IP</b> via the IKEv2 configuration payload by using the <b>leftsourceip=%config</b>
parameter. The <b>dhcp</b> plugin on gateway <b>moon</b> then requests an IP address and DNS/WINS server
information from DHCP server <b>venus</b> using the DHCP protocol. The IP addresses are assigned statically
by <b>venus</b> based on the user-defined MAC address derived by the <b>dhcp</b> plugin from a hash over
the client identity. This deterministic MAC generation is activated with the strongswan.conf setting
<b>charon.plugins.dhcp.identity_lease = yes</b>.
<p/>
With the static assignment of 10.1.0.30 and 10.1.0.40, respectively, <b>carol</b> and <b>dave</b>
become full members of the subnet 10.1.0.0/16 hidden behind gateway <b>moon</b>. And this thanks to
the <b>farp</b> plugin through which <b>moon</b> acts as a proxy for ARP requests e.g. from <b>alice</b>
who wants to ping <b>carol</b> and <b>dave</b>.
@@ -0,0 +1,26 @@
carol::ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*moon.strongswan.org::YES
carol::ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
alice::ping -c 1 10.1.0.30::64 bytes from 10.1.0.30: icmp_.eq=1::YES
carol::ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
dave:: ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*moon.strongswan.org::YES
dave:: ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
alice::ping -c 1 10.1.0.40::64 bytes from 10.1.0.40: icmp_.eq=1::YES
dave:: ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
moon:: ipsec status 2> /dev/null::rw\[1]: ESTABLISHED.*moon.strongswan.org.*[email protected]::YES
moon:: ipsec status 2> /dev/null::rw\[2]: ESTABLISHED.*moon.strongswan.org.*[email protected]::YES
moon:: ipsec status 2> /dev/null::rw[{]1}.*10.1.0.0/16 === 10.1.0.30/32::YES
moon:: ipsec status 2> /dev/null::rw[{]2}.*10.1.0.0/16 === 10.1.0.40/32::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
alice::tcpdump::ARP, Reply carol2.strongswan.org is-at 52:54:00:43:e3:35::YES
alice::tcpdump::IP alice.strongswan.org > carol2.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP carol2.strongswan.org > alice.strongswan.org: ICMP echo reply::YES
alice::tcpdump::IP carol2.strongswan.org > alice.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP alice.strongswan.org > carol2.strongswan.org: ICMP echo reply::YES
alice::tcpdump::ARP, Reply dave2.strongswan.org is-at 52:54:00:43:e3:35::YES
alice::tcpdump::IP alice.strongswan.org > dave2.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP dave2.strongswan.org > alice.strongswan.org: ICMP echo reply::YES
alice::tcpdump::IP dave2.strongswan.org > alice.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP alice.strongswan.org > dave2.strongswan.org: ICMP echo reply::YES
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_CAROL
leftsourceip=%config
leftcert=carolCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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 resolve
}
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_DAVE
leftsourceip=%config
leftcert=daveCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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 resolve
}
@@ -0,0 +1,20 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
left=PH_IP_MOON
leftsubnet=10.1.0.0/16
leftcert=moonCert.pem
[email protected]
leftfirewall=yes
conn rw
right=%any
rightsourceip=%dhcp
auto=add
@@ -0,0 +1,39 @@
*filter
# default policy is DROP
-P INPUT DROP
-P OUTPUT DROP
-P FORWARD DROP
# allow bootpc and bootps
-A OUTPUT -p udp --sport bootpc --dport bootps -j ACCEPT
-A INPUT -p udp --sport bootps --dport bootps -j ACCEPT
# allow broadcasts from eth1
-A INPUT -i eth1 -d 10.1.255.255 -j ACCEPT
# allow esp
-A INPUT -i eth0 -p 50 -j ACCEPT
-A OUTPUT -o eth0 -p 50 -j ACCEPT
# allow IKE
-A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
-A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
# allow MobIKE
-A INPUT -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT
-A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT
# allow ssh
-A INPUT -p tcp --dport 22 -j ACCEPT
-A OUTPUT -p tcp --sport 22 -j ACCEPT
# allow crl fetch from winnetou
-A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
-A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# log dropped packets
-A INPUT -j LOG --log-prefix " IN: "
-A OUTPUT -j LOG --log-prefix " OUT: "
COMMIT
@@ -0,0 +1,12 @@
# /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 attr farp dhcp
plugins {
dhcp {
server = 10.1.255.255
identity_lease = yes
}
}
}
@@ -0,0 +1,24 @@
# dhcpd configuration file
ddns-update-style none;
subnet 10.1.0.0 netmask 255.255.0.0 {
option domain-name "strongswan.org";
option domain-name-servers PH_IP_VENUS;
option netbios-name-servers PH_IP_ALICE;
option routers PH_IP_MOON1;
option broadcast-address 10.1.255.255;
next-server PH_IP_VENUS;
range 10.1.0.50 10.1.0.60;
}
host carol {
hardware ethernet 7a:a7:51:cc:22:4a;
fixed-address 10.1.0.30;
}
host dave {
hardware ethernet 7a:a7:93:70:2b:21;
fixed-address 10.1.0.40;
}
@@ -0,0 +1,9 @@
interface=eth0
dhcp-range=10.1.0.50,10.1.0.60,255.255.0.0,10.1.255.255
dhcp-host=7a:a7:51:cc:22:4a,10.1.0.30
dhcp-host=7a:a7:93:70:2b:21,10.1.0.40
dhcp-option=option:router,PH_IP_MOON1
dhcp-option=option:dns-server,PH_IP_VENUS
dhcp-option=option:netbios-ns,PH_IP_ALICE
dhcp-option=option:domain-name,strongswan.org
log-dhcp
@@ -0,0 +1,9 @@
moon::ipsec stop
carol::ipsec stop
dave::ipsec stop
venus::service isc-dhcp-server stop 2> /dev/null
moon::iptables-restore < /etc/iptables.flush
carol::iptables-restore < /etc/iptables.flush
dave::iptables-restore < /etc/iptables.flush
alice::arp -d 10.1.0.30
alice::arp -d 10.1.0.40
@@ -0,0 +1,13 @@
moon::iptables-restore < /etc/iptables.rules
carol::iptables-restore < /etc/iptables.rules
dave::iptables-restore < /etc/iptables.rules
venus::cat /etc/dhcp/dhcpd.conf
venus::service isc-dhcp-server start 2> /dev/null
moon::ipsec start
carol::ipsec start
dave::ipsec start
moon::expect-connection rw
carol::expect-connection home
carol::ipsec up home
dave::expect-connection home
dave::ipsec up home
@@ -0,0 +1,21 @@
#!/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 venus moon carol winnetou dave"
# Corresponding block diagram
#
DIAGRAM="a-v-m-c-w-d.png"
# Guest instances on which tcpdump is to be started
#
TCPDUMPHOSTS="moon alice"
# Guest instances on which IPsec is started
# Used for IPsec logging purposes
#
IPSECHOSTS="moon carol dave"
@@ -0,0 +1,7 @@
The roadwarrior <b>carol</b> sets up an IPsec tunnel connection to the gateway
<b>moon</b>. Both end points activate <b>Dead Peer Detection</b> (DPD) with a
polling interval of 10 s. When the network connectivity between <b>carol</b>
and <b>moon</b> is forcefully disrupted for a duration of 100 s, <b>moon</b>
clears the connection after 4 unsuccessful retransmits whereas <b>carol</b>
also takes down the connection but installs a route which triggers when
<b>carol</b> sends a ping to client <b>alice</b> behind gateway <b>moon</b>.
@@ -0,0 +1,14 @@
carol::ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
moon:: ipsec status 2> /dev/null::rw.*INSTALLED, TUNNEL::YES
moon:: iptables -A INPUT -i eth0 -s PH_IP_CAROL -j DROP::no output expected::NO
carol::iptables -A INPUT -i eth0 -s PH_IP_MOON -j DROP::no output expected::NO
carol::sleep 13::no output expected::NO
carol::cat /var/log/daemon.log::sending DPD request::YES
carol::cat /var/log/daemon.log::retransmit.*of request::YES
carol::cat /var/log/daemon.log::giving up after.*retransmits::YES
carol::iptables -D INPUT -i eth0 -s PH_IP_MOON -j DROP::no output expected::NO
moon:: iptables -D INPUT -i eth0 -s PH_IP_CAROL -j DROP::no output expected::NO
carol::ping -c 1 -W 1 PH_IP_ALICE::trigger route::NO
carol::sleep 1::no output expected::NO
carol::ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
moon:: ipsec status 2> /dev/null::rw.*INSTALLED, TUNNEL::YES
@@ -0,0 +1,22 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
dpdaction=hold
dpddelay=10
conn home
left=PH_IP_CAROL
leftcert=carolCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_MOON
[email protected]
rightsubnet=10.1.0.0/16
auto=add
@@ -0,0 +1,5 @@
# /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
}
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
dpdaction=clear
dpddelay=10
conn rw
left=PH_IP_MOON
leftcert=moonCert.pem
[email protected]
leftsubnet=10.1.0.0/16
right=%any
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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
}
@@ -0,0 +1,2 @@
moon::ipsec stop
carol::ipsec stop
@@ -0,0 +1,5 @@
moon::ipsec start
carol::ipsec start
moon::expect-connection rw
carol::expect-connection home
carol::ipsec up home
@@ -0,0 +1,21 @@
#!/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"
# Corresponding block diagram
#
DIAGRAM="a-m-c-w.png"
# Guest instances on which tcpdump is to be started
#
TCPDUMPHOSTS=""
# Guest instances on which IPsec is started
# Used for IPsec logging purposes
#
IPSECHOSTS="moon carol"
@@ -0,0 +1,6 @@
The roadwarriors <b>carol</b> and <b>dave</b> set up a connection each to gateway <b>moon</b>
and request a <b>virtual IP</b> via the IKEv2 configuration payload by using the <b>leftsourceip=%config</b>
parameter. The virtual addresses assigned to the clients by gateway <b>moon</b> belong to the
subnet 10.1.0.0/16 hidden behind the gateway so that <b>carol</b> and <b>dave</b> become full members of
this network. And this thanks to the <b>farp</b> plugin through which <b>moon</b> acts as a proxy
for ARP requests e.g. from <b>alice</b> who wants to ping <b>carol</b> and <b>dave</b>.
@@ -0,0 +1,26 @@
carol::ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*moon.strongswan.org::YES
carol::ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
alice::ping -c 1 10.1.0.30::64 bytes from 10.1.0.30: icmp_.eq=1::YES
carol::ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
dave:: ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*moon.strongswan.org::YES
dave:: ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
alice::ping -c 1 10.1.0.40::64 bytes from 10.1.0.40: icmp_.eq=1::YES
dave:: ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
moon:: ipsec status 2> /dev/null::rw-carol.*ESTABLISHED.*moon.strongswan.org.*[email protected]::YES
moon:: ipsec status 2> /dev/null::rw-dave.*ESTABLISHED.*moon.strongswan.org.*[email protected]::YES
moon:: ipsec status 2> /dev/null::rw-carol.*INSTALLED, TUNNEL::YES
moon:: ipsec status 2> /dev/null::rw-dave.*INSTALLED, TUNNEL::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
alice::tcpdump::ARP, Reply carol2.strongswan.org is-at 52:54:00:43:e3:35::YES
alice::tcpdump::IP alice.strongswan.org > carol2.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP carol2.strongswan.org > alice.strongswan.org: ICMP echo reply::YES
alice::tcpdump::IP carol2.strongswan.org > alice.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP alice.strongswan.org > carol2.strongswan.org: ICMP echo reply::YES
alice::tcpdump::ARP, Reply dave2.strongswan.org is-at 52:54:00:43:e3:35::YES
alice::tcpdump::IP alice.strongswan.org > dave2.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP dave2.strongswan.org > alice.strongswan.org: ICMP echo reply::YES
alice::tcpdump::IP dave2.strongswan.org > alice.strongswan.org: ICMP echo request::YES
alice::tcpdump::IP alice.strongswan.org > dave2.strongswan.org: ICMP echo reply::YES
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_CAROL
leftsourceip=%config
leftcert=carolCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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 resolve
}
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_DAVE
leftsourceip=%config
leftcert=daveCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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 resolve
}
@@ -0,0 +1,27 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
left=PH_IP_MOON
leftsubnet=10.1.0.0/16
leftcert=moonCert.pem
[email protected]
leftfirewall=yes
conn rw-carol
right=%any
[email protected]
rightsourceip=10.1.0.30
auto=add
conn rw-dave
right=%any
[email protected]
rightsourceip=10.1.0.40
auto=add
@@ -0,0 +1,7 @@
# /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 attr farp
dns1 = PH_IP_WINNETOU
dns2 = PH_IP_VENUS
}
@@ -0,0 +1,6 @@
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
@@ -0,0 +1,13 @@
moon::iptables-restore < /etc/iptables.rules
carol::iptables-restore < /etc/iptables.rules
dave::iptables-restore < /etc/iptables.rules
alice::arp -d 10.1.0.30
alice::arp -d 10.1.0.40
moon::ipsec start
carol::ipsec start
dave::ipsec start
moon::expect-connection rw-carol
carol::expect-connection home
carol::ipsec up home
dave::expect-connection home
dave::ipsec up home
@@ -0,0 +1,21 @@
#!/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 alice"
# Guest instances on which IPsec is started
# Used for IPsec logging purposes
#
IPSECHOSTS="moon carol dave"
@@ -0,0 +1,6 @@
The roadwarrior <b>alice</b> sitting behind the NAT router <b>moon</b> sets up a tunnel to
gateway <b>sun</b>. Since the firewall on <b>sun</b> blocks the ESP protocol, enforced UDP
encapsulation (<b>forceencaps=yes</b>) is used by <b>alice</b> to punch through this hurdle.
<b>leftfirewall=yes</b> automatically inserts iptables-based firewall rules that let pass
the tunneled traffic. In order to test the tunnel, host <b>alice</b> pings the
client <b>bob</b> behind the gateway <b>sun</b>.
@@ -0,0 +1,8 @@
alice::ipsec status 2> /dev/null::nat-t.*ESTABLISHED.*[email protected].*sun.strongswan.org::YES
sun:: ipsec status 2> /dev/null::nat.t.*ESTABLISHED.*sun.strongswan.org.*[email protected]::YES
alice::ipsec status 2> /dev/null::nat-t.*INSTALLED, TUNNEL::YES
sun:: ipsec status 2> /dev/null::nat-t.*INSTALLED, TUNNEL::YES
alice::cat /var/log/daemon.log::faking NAT situation to enforce UDP encapsulation::YES
alice:: ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_.eq=1::YES
moon::tcpdump::IP alice.strongswan.org.* > sun.strongswan.org.\(4500\|ipsec-nat-t\): UDP::YES
moon::tcpdump::IP sun.strongswan.org.\(4500\|ipsec-nat-t\) > alice.strongswan.org.*: UDP::YES
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn nat-t
left=%defaultroute
leftcert=aliceCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_SUN
[email protected]
rightsubnet=10.2.0.0/16
forceencaps=yes
auto=add
@@ -0,0 +1,5 @@
# /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
}
@@ -0,0 +1,20 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
left=PH_IP_SUN
leftcert=sunCert.pem
[email protected]
leftfirewall=yes
conn nat-t
leftsubnet=10.2.0.0/16
right=%any
rightsubnet=10.1.0.10/32
auto=add
@@ -0,0 +1,24 @@
*filter
# default policy is DROP
-P INPUT DROP
-P OUTPUT DROP
-P FORWARD DROP
# allow IKE
-A INPUT -i eth0 -p udp --dport 500 -j ACCEPT
-A OUTPUT -o eth0 -p udp --sport 500 -j ACCEPT
# allow MobIKE
-A INPUT -i eth0 -p udp --dport 4500 -j ACCEPT
-A OUTPUT -o eth0 -p udp --sport 4500 -j ACCEPT
# allow ssh
-A INPUT -p tcp --dport 22 -j ACCEPT
-A OUTPUT -p tcp --sport 22 -j ACCEPT
# allow crl fetch from winnetou
-A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
-A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
COMMIT
@@ -0,0 +1,5 @@
# /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
}
@@ -0,0 +1,6 @@
alice::ipsec stop
sun::ipsec stop
alice::iptables-restore < /etc/iptables.flush
sun::iptables-restore < /etc/iptables.flush
sun::ip route del 10.1.0.0/16 via PH_IP_MOON
winnetou::ip route del 10.1.0.0/16 via PH_IP_MOON
@@ -0,0 +1,9 @@
alice::iptables-restore < /etc/iptables.rules
sun::iptables-restore < /etc/iptables.rules
sun::ip route add 10.1.0.0/16 via PH_IP_MOON
winnetou::ip route add 10.1.0.0/16 via PH_IP_MOON
alice::ipsec start
sun::ipsec start
sun::expect-connection nat-t
alice::expect-connection nat-t
alice::ipsec up nat-t
@@ -0,0 +1,21 @@
#!/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 winnetou sun bob"
# Corresponding block diagram
#
DIAGRAM="a-m-w-s-b.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="alice sun"
@@ -0,0 +1,8 @@
The roadwarriors <b>carol</b> and <b>dave</b> set up a connection each to
gateway <b>moon</b> and request a <b>virtual IP</b>. <b>moon</b> negotiates
broadcast and multicast traffic selectors with the clients, and uses
<i>%unique</i> marks to avoid any policy conflicts. The enabled <i>forecast</i>
plugin on <b>moon</b> installs the required Netfilter rules to make use of these
policies, and additionally starts forwarding broadcast and multicast packets
between the clients.<br/>
To test forwarding, the hosts send multicast and broadcast ping messages.
@@ -0,0 +1,20 @@
carol::ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*moon.strongswan.org::YES
carol::ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
dave:: ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*moon.strongswan.org::YES
dave:: ipsec status 2> /dev/null::home.*INSTALLED, TUNNEL::YES
moon:: ipsec status 2> /dev/null::rw.*ESTABLISHED.*moon.strongswan.org.*[email protected]::YES
moon:: ipsec status 2> /dev/null::rw.*ESTABLISHED.*moon.strongswan.org.*[email protected]::YES
moon:: ipsec status 2> /dev/null::rw.*INSTALLED, TUNNEL, reqid 1::YES
moon:: ipsec status 2> /dev/null::rw.*INSTALLED, TUNNEL, reqid 2::YES
alice::ping -W 1 -c 1 239.0.0.1 2>&1> /dev/null
carol::ping -W 1 -c 1 239.0.0.2 2>&1> /dev/null
dave::ping -W 1 -c 1 239.0.0.3 2>&1> /dev/null
carol::ping -W 1 -c 1 -b 10.1.255.255 2>&1> /dev/null
dave::ping -W 1 -c 1 -b 10.1.255.255 2>&1> /dev/null
moon::iptables -t mangle -L -n -v
carol::tcpdump::IP alice.strongswan.org > 239.0.0.1: ICMP echo request::YES
dave::tcpdump::IP alice.strongswan.org > 239.0.0.1: ICMP echo request::YES
carol::tcpdump::IP 10.1.0.130 > 239.0.0.3: ICMP echo request::YES
dave::tcpdump::IP 10.1.0.129 > 239.0.0.2: ICMP echo request::YES
carol::tcpdump::IP 10.1.0.130 > 10.1.255.255: ICMP echo request::YES
dave::tcpdump::IP 10.1.0.129 > 10.1.255.255: ICMP echo request::YES
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_CAROL
leftsourceip=%config
leftsubnet=0.0.0.0/0
leftcert=carolCert.pem
[email protected]
right=PH_IP_MOON
rightsubnet=0.0.0.0/0
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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 resolve
}
@@ -0,0 +1,21 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn home
left=PH_IP_DAVE
leftsourceip=%config
leftsubnet=0.0.0.0/0
leftcert=daveCert.pem
[email protected]
right=PH_IP_MOON
rightsubnet=0.0.0.0/0
[email protected]
auto=add
@@ -0,0 +1,5 @@
# /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 resolve
}
@@ -0,0 +1,22 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn rw
left=PH_IP_MOON
leftcert=moonCert.pem
[email protected]
leftsubnet=10.1.0.0/16,224.0.0.0/4
right=%any
rightid=*@strongswan.org
rightsourceip=10.1.0.128/26
rightsubnet=%dynamic,224.0.0.0/4,10.1.255.255
mark=%unique
auto=add

Some files were not shown because too many files have changed in this diff Show More