Skip to content

Commit b574719

Browse files
committed
testing: Added botan/net2net-pkcs12 scenario
1 parent 440e6a0 commit b574719

File tree

11 files changed

+137
-0
lines changed

11 files changed

+137
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
A connection between the subnets behind the gateways <b>moon</b> and <b>sun</b> is set up.
2+
The authentication is based on <b>X.509 certificates</b> and an RSA private key stored in
3+
<b>PKCS12</b> format.
4+
<p/>
5+
Upon the successful establishment of the IPsec tunnels, <b>leftfirewall=yes</b>
6+
automatically inserts iptables-based firewall rules that let pass the tunneled traffic.
7+
In order to test both tunnel and firewall, client <b>alice</b> behind gateway <b>moon</b>
8+
pings client <b>bob</b> located behind gateway <b>sun</b>.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_.eq=1::YES
2+
moon::swanctl --list-sas --raw 2> /dev/null::gw-gw.*version=2 state=ESTABLISHED local-host=192.168.0.1 local-port=500 local-id=moon.strongswan.org remote-host=192.168.0.2 remote-port=500 remote-id=sun.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=MODP_3072.*child-sas.*net-net.*state=INSTALLED mode=TUNNEL.*ESP.*encr-alg=AES_GCM_16 encr-keysize=128.*local-ts=\[10.1.0.0/16] remote-ts=\[10.2.0.0/16]::YES
3+
sun:: swanctl --list-sas --raw 2> /dev/null::gw-gw.*version=2 state=ESTABLISHED local-host=192.168.0.2 local-port=500 local-id=sun.strongswan.org 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=MODP_3072.*child-sas.*net-net.*state=INSTALLED mode=TUNNEL.*ESP.*encr-alg=AES_GCM_16 encr-keysize=128.*local-ts=\[10.2.0.0/16] remote-ts=\[10.1.0.0/16]::YES
4+
sun::tcpdump::IP moon.strongswan.org > sun.strongswan.org: ESP::YES
5+
sun::tcpdump::IP sun.strongswan.org > moon.strongswan.org: ESP::YES
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# /etc/strongswan.conf - strongSwan configuration file
2+
3+
charon {
4+
load = pem nonce revocation botan x509 curl vici kernel-netlink socket-default updown
5+
multiple_authentication = no
6+
}
Binary file not shown.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
connections {
2+
3+
gw-gw {
4+
local_addrs = 192.168.0.1
5+
remote_addrs = 192.168.0.2
6+
7+
local {
8+
auth = pubkey
9+
id = moon.strongswan.org
10+
}
11+
remote {
12+
auth = pubkey
13+
id = sun.strongswan.org
14+
}
15+
children {
16+
net-net {
17+
local_ts = 10.1.0.0/16
18+
remote_ts = 10.2.0.0/16
19+
20+
updown = /usr/local/libexec/ipsec/_updown iptables
21+
esp_proposals = aes128gcm128-modp3072
22+
}
23+
}
24+
version = 2
25+
mobike = no
26+
proposals = aes128-sha256-modp3072
27+
}
28+
}
29+
30+
secrets {
31+
32+
pkcs12-moon {
33+
file = moonCert.p12
34+
secret = "kUqd8O7mzbjXNJKQ"
35+
}
36+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# /etc/strongswan.conf - strongSwan configuration file
2+
3+
charon {
4+
load = pem nonce revocation botan x509 curl vici kernel-netlink socket-default updown
5+
multiple_authentication = no
6+
}
Binary file not shown.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
connections {
2+
3+
gw-gw {
4+
local_addrs = 192.168.0.2
5+
remote_addrs = 192.168.0.1
6+
7+
local {
8+
auth = pubkey
9+
id = sun.strongswan.org
10+
}
11+
remote {
12+
auth = pubkey
13+
id = moon.strongswan.org
14+
}
15+
children {
16+
net-net {
17+
local_ts = 10.2.0.0/16
18+
remote_ts = 10.1.0.0/16
19+
20+
updown = /usr/local/libexec/ipsec/_updown iptables
21+
esp_proposals = aes128gcm128-modp3072
22+
}
23+
}
24+
version = 2
25+
mobike = no
26+
proposals = aes128-sha256-modp3072
27+
}
28+
}
29+
30+
secrets {
31+
32+
pkcs12-sun {
33+
file = sunCert.p12
34+
secret = "IxjQVCF3JGI+MoPi"
35+
}
36+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
moon::systemctl stop strongswan-swanctl
2+
sun::systemctl stop strongswan-swanctl
3+
moon::iptables-restore < /etc/iptables.flush
4+
sun::iptables-restore < /etc/iptables.flush
5+
moon::rm /etc/swanctl/pkcs12/moonCert.p12
6+
sun::rm /etc/swanctl/pkcs12/sunCert.p12
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
moon::cd /etc/swanctl; rm rsa/moonKey.pem x509/moonCert.pem x509ca/strongswanCert.pem
2+
sun::cd /etc/swanctl; rm rsa/sunKey.pem x509/sunCert.pem x509ca/strongswanCert.pem
3+
moon::iptables-restore < /etc/iptables.rules
4+
sun::iptables-restore < /etc/iptables.rules
5+
moon::systemctl start strongswan-swanctl
6+
sun::systemctl start strongswan-swanctl
7+
moon::expect-connection gw-gw
8+
sun::expect-connection gw-gw
9+
moon::swanctl --initiate --child net-net 2> /dev/null

0 commit comments

Comments
 (0)