testing: Migrated redirect-active scenario to vici

This commit is contained in:
Andreas Steffen
2021-03-30 22:12:00 +02:00
parent 511b860916
commit 2cbf7da51a
21 changed files with 152 additions and 121 deletions
@@ -1,8 +0,0 @@
The roadwarriors <b>carol</b> and <b>dave</b> set up a connection each
to gateway <b>alice</b>, which identifies itself as <b>mars</b>.
Host <b>venus</b> in the subnet behind this gateway uses gateway <b>moon</b> as
default gateway, so it is not fully reachable by the two roadwarriors.
Then both SAs are actively redirected with the <em>swanctl --redirect</em>
command to gateway <b>moon</b> (also identified as <b>mars</b>) using the
mechanism described in <b>RFC 5685</b> enabling the roadwarriors to
ping <b>venus</b>.
@@ -1,28 +0,0 @@
alice::ipsec status 2> /dev/null::rw\[1].*ESTABLISHED.*mars.strongswan.org.*[email protected]::YES
alice::ipsec status 2> /dev/null::rw\[2].*ESTABLISHED.*mars.strongswan.org.*[email protected]::YES
carol::ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*mars.strongswan.org::YES
dave:: ipsec status 2> /dev/null::home.*ESTABLISHED.*[email protected].*mars.strongswan.org::YES
carol::ping -c 1 -W 1 PH_IP_VENUS::64 bytes from PH_IP_VENUS: icmp_.eq=1::NO
dave:: ping -c 1 -W 1 PH_IP_VENUS::64 bytes from PH_IP_VENUS: icmp_.eq=1::NO
alice::swanctl --redirect --peer-ip PH_IP_CAROL --gateway 192.168.0.1::redirect completed successfully::YES
alice::swanctl --redirect --peer-id [email protected] --gateway moon.strongswan.org::redirect completed successfully::YES
carol::sleep 1::No output expected::NO
carol::cat /var/log/daemon.log::redirected to 192.168.0.1::YES
dave::cat /var/log/daemon.log::redirected to moon.strongswan.org::YES
moon::cat /var/log/daemon.log::client got redirected from 192.168.0.5::YES
moon::ipsec status 2> /dev/null::rw\[1].*ESTABLISHED.*mars.strongswan.org.*[email protected]::YES
moon::ipsec status 2> /dev/null::rw\[2].*ESTABLISHED.*mars.strongswan.org.*[email protected]::YES
carol::ping -c 1 PH_IP_VENUS::64 bytes from PH_IP_VENUS: icmp_.eq=1::YES
dave:: ping -c 1 PH_IP_VENUS::64 bytes from PH_IP_VENUS: icmp_.eq=1::YES
carol::tcpdump::IP carol.strongswan.org > mars.strongswan.org: ESP::YES
carol::tcpdump::IP mars.strongswan.org > carol.strongswan.org: ESP::NO
carol::tcpdump::IP carol.strongswan.org > moon.strongswan.org: ESP::YES
carol::tcpdump::IP moon.strongswan.org > carol.strongswan.org: ESP::YES
dave::tcpdump::IP dave.strongswan.org > mars.strongswan.org: ESP::YES
dave::tcpdump::IP mars.strongswan.org > dave.strongswan.org: ESP::NO
dave::tcpdump::IP dave.strongswan.org > moon.strongswan.org: ESP::YES
dave::tcpdump::IP moon.strongswan.org > dave.strongswan.org: ESP::YES
venus::tcpdump::IP carol.strongswan.org > venus.strongswan.org: ICMP echo request::YES
venus::tcpdump::IP venus.strongswan.org > carol.strongswan.org: ICMP echo reply::YES
venus::tcpdump::IP dave.strongswan.org > venus.strongswan.org: ICMP echo request::YES
venus::tcpdump::IP venus.strongswan.org > dave.strongswan.org: ICMP echo reply::YES
@@ -1,19 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
conn rw
left=192.168.0.5
leftcert=marsCert.pem
leftid=mars.strongswan.org
leftsubnet=10.1.0.0/16
leftfirewall=yes
right=%any
keyexchange=ikev2
auto=add
@@ -1,3 +0,0 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA marsKey.pem
@@ -1,34 +0,0 @@
*filter
# default policy is DROP
-P INPUT DROP
-P OUTPUT DROP
-P FORWARD DROP
# forward ESP-tunneled traffic
-A FORWARD -i eth1 -m policy --dir in --pol ipsec --proto esp -s PH_IP_CAROL -j ACCEPT
-A FORWARD -i eth1 -m policy --dir in --pol ipsec --proto esp -s PH_IP_DAVE -j ACCEPT
-A FORWARD -o eth1 -m policy --dir out --pol ipsec --proto esp -j ACCEPT
# allow esp
-A INPUT -p 50 -j ACCEPT
-A OUTPUT -p 50 -d PH_IP_CAROL -j ACCEPT
-A OUTPUT -p 50 -d PH_IP_DAVE -j ACCEPT
# allow IKE
-A INPUT -i eth1 -p udp --sport 500 --dport 500 -j ACCEPT
-A OUTPUT -o eth1 -p udp --dport 500 --sport 500 -j ACCEPT
# allow MobIKE
-A INPUT -i eth1 -p udp --sport 4500 --dport 4500 -j ACCEPT
-A OUTPUT -o eth1 -p udp --dport 4500 --sport 4500 -j ACCEPT
# allow crl fetch from winnetou
-A INPUT -i eth1 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
-A OUTPUT -o eth1 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# allow ssh
-A INPUT -p tcp --dport 22 -j ACCEPT
-A OUTPUT -p tcp --sport 22 -j ACCEPT
COMMIT
@@ -1,6 +0,0 @@
# /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 vici
}
@@ -1,17 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
conn home
leftcert=carolCert.pem
[email protected]
leftfirewall=yes
right=192.168.0.5
rightid=mars.strongswan.org
rightsubnet=10.1.0.0/16
keyexchange=ikev2
auto=add
@@ -1,10 +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 updown
syslog {
daemon {
knl = 2
}
}
}
@@ -1,19 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
conn home
leftcert=daveCert.pem
[email protected]
leftfirewall=yes
right=192.168.0.5
rightid=mars.strongswan.org
rightsubnet=10.1.0.0/16
keyexchange=ikev2
auto=add
@@ -1,6 +0,0 @@
# /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
}
@@ -1,18 +0,0 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
conn rw
leftcert=marsCert.pem
leftid=mars.strongswan.org
leftsubnet=10.1.0.0/16
leftfirewall=yes
right=%any
keyexchange=ikev2
auto=add
@@ -1,3 +0,0 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA marsKey.pem
@@ -1,6 +0,0 @@
# /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
}
@@ -1,10 +0,0 @@
carol::ipsec stop
dave::ipsec stop
moon::ipsec stop
alice::ipsec stop
moon::iptables-restore < /etc/iptables.flush
alice::iptables-restore < /etc/iptables.flush
carol::iptables-restore < /etc/iptables.flush
dave::iptables-restore < /etc/iptables.flush
alice::ip addr del 192.168.0.5/24 dev eth1
alice::ifdown eth1
@@ -1,16 +0,0 @@
alice::ifup eth1
alice::ip addr add 192.168.0.5/24 dev eth1
moon::iptables-restore < /etc/iptables.rules
alice::iptables-restore < /etc/iptables.rules
carol::iptables-restore < /etc/iptables.rules
dave::iptables-restore < /etc/iptables.rules
moon::ipsec start
alice::ipsec start
carol::ipsec start
dave::ipsec start
moon::expect-connection rw
alice::expect-connection rw
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 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="venus carol dave"
# Guest instances on which IPsec is started
# Used for IPsec logging purposes
#
IPSECHOSTS="alice moon carol dave"