testing: Migrated openssl-ikev2/net2net-pkcs12 scenario to swanctl
This commit is contained in:
parent
836e870912
commit
440e6a03c1
|
@ -2,7 +2,7 @@ A connection between the subnets behind the gateways <b>moon</b> and <b>sun</b>
|
||||||
The authentication is based on <b>X.509 certificates</b> and an RSA private key stored in
|
The authentication is based on <b>X.509 certificates</b> and an RSA private key stored in
|
||||||
<b>PKCS12</b> format.
|
<b>PKCS12</b> format.
|
||||||
<p/>
|
<p/>
|
||||||
Upon the successful establishment of the IPsec tunnel, <b>leftfirewall=yes</b> automatically
|
Upon the successful establishment of the IPsec tunnels, <b>leftfirewall=yes</b>
|
||||||
inserts iptables-based firewall rules that let pass the tunneled traffic.
|
automatically inserts iptables-based firewall rules that let pass the tunneled traffic.
|
||||||
In order to test both tunnel and firewall, client <b>alice</b> behind gateway <b>moon</b>
|
In order to test both tunnel and firewall, client <b>alice</b> behind gateway <b>moon</b>
|
||||||
pings client <b>bob</b> located behind gateway <b>sun</b>.
|
pings client <b>bob</b> located behind gateway <b>sun</b>.
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
moon::ipsec status 2> /dev/null::net-net.*ESTABLISHED.*moon.strongswan.org.*sun.strongswan.org::YES
|
|
||||||
sun:: ipsec status 2> /dev/null::net-net.*ESTABLISHED.*sun.strongswan.org.*moon.strongswan.org::YES
|
|
||||||
moon::ipsec status 2> /dev/null::net-net.*INSTALLED, TUNNEL::YES
|
|
||||||
sun:: ipsec status 2> /dev/null::net-net.*INSTALLED, TUNNEL::YES
|
|
||||||
alice::ping -c 1 PH_IP_BOB::64 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
|
||||||
|
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
|
||||||
|
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
|
||||||
sun::tcpdump::IP moon.strongswan.org > sun.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
|
sun::tcpdump::IP sun.strongswan.org > moon.strongswan.org: ESP::YES
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
# /etc/ipsec.conf - strongSwan IPsec configuration file
|
|
||||||
|
|
||||||
config setup
|
|
||||||
|
|
||||||
conn %default
|
|
||||||
ikelifetime=60m
|
|
||||||
keylife=20m
|
|
||||||
rekeymargin=3m
|
|
||||||
keyingtries=1
|
|
||||||
keyexchange=ikev2
|
|
||||||
ike=aes128-sha256-modp3072!
|
|
||||||
esp=aes128gcm16!
|
|
||||||
mobike=no
|
|
||||||
|
|
||||||
conn net-net
|
|
||||||
left=PH_IP_MOON
|
|
||||||
leftid=@moon.strongswan.org
|
|
||||||
leftsubnet=10.1.0.0/16
|
|
||||||
leftfirewall=yes
|
|
||||||
right=PH_IP_SUN
|
|
||||||
rightid=@sun.strongswan.org
|
|
||||||
rightsubnet=10.2.0.0/16
|
|
||||||
auto=add
|
|
|
@ -1,3 +0,0 @@
|
||||||
# /etc/ipsec.secrets - strongSwan IPsec secrets file
|
|
||||||
|
|
||||||
: P12 moonCert.p12 "kUqd8O7mzbjXNJKQ"
|
|
|
@ -1,6 +1,6 @@
|
||||||
# /etc/strongswan.conf - strongSwan configuration file
|
# /etc/strongswan.conf - strongSwan configuration file
|
||||||
|
|
||||||
charon {
|
charon {
|
||||||
load = pem nonce revocation openssl curl stroke kernel-netlink socket-default updown
|
load = pem nonce revocation openssl curl vici kernel-netlink socket-default updown
|
||||||
multiple_authentication = no
|
multiple_authentication = no
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
connections {
|
||||||
|
|
||||||
|
gw-gw {
|
||||||
|
local_addrs = 192.168.0.1
|
||||||
|
remote_addrs = 192.168.0.2
|
||||||
|
|
||||||
|
local {
|
||||||
|
auth = pubkey
|
||||||
|
id = moon.strongswan.org
|
||||||
|
}
|
||||||
|
remote {
|
||||||
|
auth = pubkey
|
||||||
|
id = sun.strongswan.org
|
||||||
|
}
|
||||||
|
children {
|
||||||
|
net-net {
|
||||||
|
local_ts = 10.1.0.0/16
|
||||||
|
remote_ts = 10.2.0.0/16
|
||||||
|
|
||||||
|
updown = /usr/local/libexec/ipsec/_updown iptables
|
||||||
|
esp_proposals = aes128gcm128-modp3072
|
||||||
|
}
|
||||||
|
}
|
||||||
|
version = 2
|
||||||
|
mobike = no
|
||||||
|
proposals = aes128-sha256-modp3072
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
secrets {
|
||||||
|
|
||||||
|
pkcs12-moon {
|
||||||
|
file = moonCert.p12
|
||||||
|
secret = "kUqd8O7mzbjXNJKQ"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,23 +0,0 @@
|
||||||
# /etc/ipsec.conf - strongSwan IPsec configuration file
|
|
||||||
|
|
||||||
config setup
|
|
||||||
|
|
||||||
conn %default
|
|
||||||
ikelifetime=60m
|
|
||||||
keylife=20m
|
|
||||||
rekeymargin=3m
|
|
||||||
keyingtries=1
|
|
||||||
keyexchange=ikev2
|
|
||||||
ike=aes128-sha256-modp3072!
|
|
||||||
esp=aes128gcm16!
|
|
||||||
mobike=no
|
|
||||||
|
|
||||||
conn net-net
|
|
||||||
left=PH_IP_SUN
|
|
||||||
leftid=@sun.strongswan.org
|
|
||||||
leftsubnet=10.2.0.0/16
|
|
||||||
leftfirewall=yes
|
|
||||||
right=PH_IP_MOON
|
|
||||||
rightid=@moon.strongswan.org
|
|
||||||
rightsubnet=10.1.0.0/16
|
|
||||||
auto=add
|
|
|
@ -1,8 +0,0 @@
|
||||||
# /etc/ipsec.secrets - strongSwan IPsec secrets file
|
|
||||||
|
|
||||||
: P12 sunCert.p12 "IxjQVCF3JGI+MoPi"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# /etc/strongswan.conf - strongSwan configuration file
|
# /etc/strongswan.conf - strongSwan configuration file
|
||||||
|
|
||||||
charon {
|
charon {
|
||||||
load = pem nonce revocation openssl curl stroke kernel-netlink socket-default updown
|
load = pem nonce revocation openssl curl vici kernel-netlink socket-default updown
|
||||||
multiple_authentication = no
|
multiple_authentication = no
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
connections {
|
||||||
|
|
||||||
|
gw-gw {
|
||||||
|
local_addrs = 192.168.0.2
|
||||||
|
remote_addrs = 192.168.0.1
|
||||||
|
|
||||||
|
local {
|
||||||
|
auth = pubkey
|
||||||
|
id = sun.strongswan.org
|
||||||
|
}
|
||||||
|
remote {
|
||||||
|
auth = pubkey
|
||||||
|
id = moon.strongswan.org
|
||||||
|
}
|
||||||
|
children {
|
||||||
|
net-net {
|
||||||
|
local_ts = 10.2.0.0/16
|
||||||
|
remote_ts = 10.1.0.0/16
|
||||||
|
|
||||||
|
updown = /usr/local/libexec/ipsec/_updown iptables
|
||||||
|
esp_proposals = aes128gcm128-modp3072
|
||||||
|
}
|
||||||
|
}
|
||||||
|
version = 2
|
||||||
|
mobike = no
|
||||||
|
proposals = aes128-sha256-modp3072
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
secrets {
|
||||||
|
|
||||||
|
pkcs12-sun {
|
||||||
|
file = sunCert.p12
|
||||||
|
secret = "IxjQVCF3JGI+MoPi"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
moon::ipsec stop
|
moon::systemctl stop strongswan-swanctl
|
||||||
sun::ipsec stop
|
sun::systemctl stop strongswan-swanctl
|
||||||
moon::iptables-restore < /etc/iptables.flush
|
moon::iptables-restore < /etc/iptables.flush
|
||||||
sun::iptables-restore < /etc/iptables.flush
|
sun::iptables-restore < /etc/iptables.flush
|
||||||
moon::rm /etc/ipsec.d/private/moonCert.p12
|
moon::rm /etc/swanctl/pkcs12/moonCert.p12
|
||||||
sun::rm /etc/ipsec.d/private/sunCert.p12
|
sun::rm /etc/swanctl/pkcs12/sunCert.p12
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
moon::rm /etc/ipsec.d/private/moonKey.pem
|
moon::cd /etc/swanctl; rm rsa/moonKey.pem x509/moonCert.pem x509ca/strongswanCert.pem
|
||||||
moon::rm /etc/ipsec.d/cacerts/strongswanCert.pem
|
sun::cd /etc/swanctl; rm rsa/sunKey.pem x509/sunCert.pem x509ca/strongswanCert.pem
|
||||||
sun::rm /etc/ipsec.d/private/sunKey.pem
|
|
||||||
sun::rm /etc/ipsec.d/cacerts/strongswanCert.pem
|
|
||||||
moon::iptables-restore < /etc/iptables.rules
|
moon::iptables-restore < /etc/iptables.rules
|
||||||
sun::iptables-restore < /etc/iptables.rules
|
sun::iptables-restore < /etc/iptables.rules
|
||||||
moon::ipsec start
|
moon::systemctl start strongswan-swanctl
|
||||||
sun::ipsec start
|
sun::systemctl start strongswan-swanctl
|
||||||
moon::expect-connection net-net
|
moon::expect-connection gw-gw
|
||||||
sun::expect-connection net-net
|
sun::expect-connection gw-gw
|
||||||
moon::ipsec up net-net
|
moon::swanctl --initiate --child net-net 2> /dev/null
|
||||||
|
|
|
@ -19,3 +19,7 @@ TCPDUMPHOSTS="sun"
|
||||||
# Used for IPsec logging purposes
|
# Used for IPsec logging purposes
|
||||||
#
|
#
|
||||||
IPSECHOSTS="moon sun"
|
IPSECHOSTS="moon sun"
|
||||||
|
|
||||||
|
# charon controlled by swanctl
|
||||||
|
#
|
||||||
|
SWANCTL=1
|
||||||
|
|
Loading…
Reference in New Issue