mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-09 00:00:53 -04:00
testing: Added route-based/rw-shared-vti scenario
This commit is contained in:
parent
95deada184
commit
a35416af1c
12
testing/tests/route-based/rw-shared-vti/description.txt
Normal file
12
testing/tests/route-based/rw-shared-vti/description.txt
Normal file
@ -0,0 +1,12 @@
|
||||
The roadwarriors <b>carol</b> and <b>dave</b> set up a connection each to
|
||||
gateway <b>moon</b>. Both <b>carol</b> and <b>dave</b> request a <b>virtual
|
||||
IP</b> via the IKEv2 configuration payload.
|
||||
<p/>
|
||||
The gateway <b>moon</b> uses <b>route-based forwarding</b> with <b>VTI
|
||||
tunnels</b>, with firewall rules to allow traffic to pass. The IKE daemon is
|
||||
configured to not install routes with <em>charon.install_routes=0</em>, and a
|
||||
static route is installed for the virtual IP subnet on the VTI device.
|
||||
<p/>
|
||||
Both <b>carol</b> and <b>dave</b> ping the client <b>alice</b> behind the
|
||||
gateway <b>moon</b>. The source IP addresses of the two pings will be the
|
||||
virtual IPs <b>carol1</b> and <b>dave1</b>, respectively.
|
10
testing/tests/route-based/rw-shared-vti/evaltest.dat
Normal file
10
testing/tests/route-based/rw-shared-vti/evaltest.dat
Normal file
@ -0,0 +1,10 @@
|
||||
carol::swanctl --list-sas --raw 2> /dev/null::home.*version=2 state=ESTABLISHED local-host=PH_IP_CAROL local-port=4500 local-id=carol@strongswan.org remote-host=PH_IP_MOON remote-port=4500 remote-id=moon.strongswan.org initiator=yes.*child-sas.*home.*state=INSTALLED mode=TUNNEL.*ESP.*local-ts=\[10.3.0.1/32] remote-ts=\[10.1.0.0/16]::YES
|
||||
dave:: swanctl --list-sas --raw 2> /dev/null::home.*version=2 state=ESTABLISHED local-host=PH_IP_DAVE local-port=4500 local-id=dave@strongswan.org remote-host=PH_IP_MOON remote-port=4500 remote-id=moon.strongswan.org initiator=yes.*child-sas.*home.*state=INSTALLED mode=TUNNEL.*ESP.*local-ts=\[10.3.0.2/32] remote-ts=\[10.1.0.0/16]::YES
|
||||
moon:: swanctl --list-sas --ike-id 1 --raw 2> /dev/null::rw.*version=2 state=ESTABLISHED local-host=PH_IP_MOON local-port=4500 local-id=moon.strongswan.org remote-host=PH_IP_CAROL remote-port=4500 remote-id=carol@strongswan.org.*child-sas.*net.*reqid=1 state=INSTALLED mode=TUNNEL.*ESP.*local-ts=\[10.1.0.0/16] remote-ts=\[10.3.0.1/32]::YES
|
||||
moon:: swanctl --list-sas --ike-id 2 --raw 2> /dev/null::rw.*version=2 state=ESTABLISHED local-host=PH_IP_MOON local-port=4500 local-id=moon.strongswan.org remote-host=PH_IP_DAVE remote-port=4500 remote-id=dave@strongswan.org.*child-sas.*net.*reqid=2 state=INSTALLED mode=TUNNEL.*ESP.*local-ts=\[10.1.0.0/16] remote-ts=\[10.3.0.2/32]::YES
|
||||
carol::ping -c 1 PH_IP_ALICE::64 bytes from PH_IP_ALICE: icmp_.eq=1::YES
|
||||
dave::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: ESP::YES
|
||||
moon::tcpdump::IP carol.strongswan.org > moon.strongswan.org: ESP::YES
|
||||
moon::tcpdump::IP moon.strongswan.org > dave.strongswan.org: ESP::YES
|
||||
moon::tcpdump::IP dave.strongswan.org > moon.strongswan.org: ESP::YES
|
9
testing/tests/route-based/rw-shared-vti/hosts/carol/etc/strongswan.conf
Executable file
9
testing/tests/route-based/rw-shared-vti/hosts/carol/etc/strongswan.conf
Executable file
@ -0,0 +1,9 @@
|
||||
# /etc/strongswan.conf - strongSwan configuration file
|
||||
|
||||
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
|
||||
}
|
28
testing/tests/route-based/rw-shared-vti/hosts/carol/etc/swanctl/swanctl.conf
Executable file
28
testing/tests/route-based/rw-shared-vti/hosts/carol/etc/swanctl/swanctl.conf
Executable file
@ -0,0 +1,28 @@
|
||||
connections {
|
||||
|
||||
home {
|
||||
local_addrs = PH_IP_CAROL
|
||||
remote_addrs = PH_IP_MOON
|
||||
vips = 0.0.0.0
|
||||
|
||||
local {
|
||||
auth = pubkey
|
||||
certs = carolCert.pem
|
||||
id = carol@strongswan.org
|
||||
}
|
||||
remote {
|
||||
auth = pubkey
|
||||
id = moon.strongswan.org
|
||||
}
|
||||
children {
|
||||
home {
|
||||
remote_ts = 10.1.0.0/16
|
||||
|
||||
updown = /usr/local/libexec/ipsec/_updown iptables
|
||||
esp_proposals = aes128gcm128-x25519
|
||||
}
|
||||
}
|
||||
version = 2
|
||||
proposals = aes128-sha256-x25519
|
||||
}
|
||||
}
|
9
testing/tests/route-based/rw-shared-vti/hosts/dave/etc/strongswan.conf
Executable file
9
testing/tests/route-based/rw-shared-vti/hosts/dave/etc/strongswan.conf
Executable file
@ -0,0 +1,9 @@
|
||||
# /etc/strongswan.conf - strongSwan configuration file
|
||||
|
||||
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
|
||||
}
|
28
testing/tests/route-based/rw-shared-vti/hosts/dave/etc/swanctl/swanctl.conf
Executable file
28
testing/tests/route-based/rw-shared-vti/hosts/dave/etc/swanctl/swanctl.conf
Executable file
@ -0,0 +1,28 @@
|
||||
connections {
|
||||
|
||||
home {
|
||||
local_addrs = PH_IP_DAVE
|
||||
remote_addrs = PH_IP_MOON
|
||||
vips = 0.0.0.0
|
||||
|
||||
local {
|
||||
auth = pubkey
|
||||
certs = daveCert.pem
|
||||
id = dave@strongswan.org
|
||||
}
|
||||
remote {
|
||||
auth = pubkey
|
||||
id = moon.strongswan.org
|
||||
}
|
||||
children {
|
||||
home {
|
||||
remote_ts = 10.1.0.0/16
|
||||
|
||||
updown = /usr/local/libexec/ipsec/_updown iptables
|
||||
esp_proposals = aes128gcm128-x25519
|
||||
}
|
||||
}
|
||||
version = 2
|
||||
proposals = aes128-sha256-x25519
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
# /etc/strongswan.conf - strongSwan configuration file
|
||||
|
||||
swanctl {
|
||||
load = pem pkcs1 x509 revocation constraints pubkey openssl random
|
||||
}
|
||||
|
||||
charon-systemd {
|
||||
load = random nonce aes sha1 sha2 pem pkcs1 curve25519 gmp x509 curl revocation hmac vici kernel-netlink socket-default updown
|
||||
}
|
||||
|
||||
charon {
|
||||
install_routes = 0
|
||||
}
|
33
testing/tests/route-based/rw-shared-vti/hosts/moon/etc/swanctl/swanctl.conf
Executable file
33
testing/tests/route-based/rw-shared-vti/hosts/moon/etc/swanctl/swanctl.conf
Executable file
@ -0,0 +1,33 @@
|
||||
connections {
|
||||
|
||||
rw {
|
||||
local_addrs = PH_IP_MOON
|
||||
pools = rw_pool
|
||||
|
||||
local {
|
||||
auth = pubkey
|
||||
certs = moonCert.pem
|
||||
id = moon.strongswan.org
|
||||
}
|
||||
remote {
|
||||
auth = pubkey
|
||||
}
|
||||
children {
|
||||
net {
|
||||
local_ts = 10.1.0.0/16
|
||||
mark_in = 42
|
||||
mark_out = 42
|
||||
|
||||
esp_proposals = aes128gcm128-x25519
|
||||
}
|
||||
}
|
||||
version = 2
|
||||
proposals = aes128-sha256-x25519
|
||||
}
|
||||
}
|
||||
|
||||
pools {
|
||||
rw_pool {
|
||||
addrs = 10.3.0.0/28
|
||||
}
|
||||
}
|
9
testing/tests/route-based/rw-shared-vti/posttest.dat
Normal file
9
testing/tests/route-based/rw-shared-vti/posttest.dat
Normal file
@ -0,0 +1,9 @@
|
||||
carol::swanctl --terminate --ike home
|
||||
dave::swanctl --terminate --ike home
|
||||
moon::systemctl stop strongswan-swanctl
|
||||
carol::systemctl stop strongswan-swanctl
|
||||
dave::systemctl stop strongswan-swanctl
|
||||
moon::iptables-restore < /etc/iptables.flush
|
||||
carol::iptables-restore < /etc/iptables.flush
|
||||
dave::iptables-restore < /etc/iptables.flush
|
||||
moon::ip tunnel del vti0
|
17
testing/tests/route-based/rw-shared-vti/pretest.dat
Normal file
17
testing/tests/route-based/rw-shared-vti/pretest.dat
Normal file
@ -0,0 +1,17 @@
|
||||
moon::iptables-restore < /etc/iptables.rules
|
||||
carol::iptables-restore < /etc/iptables.rules
|
||||
dave::iptables-restore < /etc/iptables.rules
|
||||
moon::ip tunnel add vti0 local PH_IP_MOON remote 0.0.0.0 mode vti key 42
|
||||
moon::sysctl -w net.ipv4.conf.vti0.disable_policy=1
|
||||
moon::ip link set vti0 up
|
||||
moon::ip route add 10.3.0.0/28 dev vti0
|
||||
moon::iptables -A FORWARD -i vti0 -j ACCEPT
|
||||
moon::iptables -A FORWARD -o vti0 -j ACCEPT
|
||||
moon::systemctl start strongswan-swanctl
|
||||
carol::systemctl start strongswan-swanctl
|
||||
dave::systemctl start strongswan-swanctl
|
||||
moon::expect-connection rw
|
||||
carol::expect-connection home
|
||||
carol::swanctl --initiate --child home
|
||||
dave::expect-connection home
|
||||
dave::swanctl --initiate --child home
|
25
testing/tests/route-based/rw-shared-vti/test.conf
Normal file
25
testing/tests/route-based/rw-shared-vti/test.conf
Normal file
@ -0,0 +1,25 @@
|
||||
#!/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"
|
||||
|
||||
# charon controlled by swanctl
|
||||
#
|
||||
SWANCTL=1
|
Loading…
x
Reference in New Issue
Block a user