/testing/guestbin/swan-prep
west #
 # confirm that the network is alive
west #
 ../../guestbin/wait-until-alive -I 192.0.1.254 192.0.2.254
destination -I 192.0.1.254 192.0.2.254 is alive
west #
 # ensure that clear text does not get through
west #
 iptables -A INPUT -i eth1 -s 192.0.2.0/24 -j DROP
west #
 iptables -I INPUT -m policy --dir in --pol ipsec -j ACCEPT
west #
 # confirm clear text does not get through
west #
 ../../guestbin/ping-once.sh --down -I 192.0.1.254 192.0.2.254
down
west #
 ipsec start
Redirecting to: [initsystem]
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec auto --add westnet-eastnet-ipv4-psk-ikev2
002 "westnet-eastnet-ipv4-psk-ikev2": added IKEv1 connection
west #
 ipsec whack --impair suppress-retransmits
west #
 echo "initdone"
initdone
west #
 ipsec auto --up westnet-eastnet-ipv4-psk-ikev2
002 "westnet-eastnet-ipv4-psk-ikev2" #1: initiating IKEv1 Main Mode connection
1v1 "westnet-eastnet-ipv4-psk-ikev2" #1: sent Main Mode request
1v1 "westnet-eastnet-ipv4-psk-ikev2" #1: sent Main Mode I2
1v1 "westnet-eastnet-ipv4-psk-ikev2" #1: sent Main Mode I3
002 "westnet-eastnet-ipv4-psk-ikev2" #1: Peer ID is ID_FQDN: '@east'
004 "westnet-eastnet-ipv4-psk-ikev2" #1: IKE SA established {auth=PRESHARED_KEY cipher=AES_CBC_256 integ=HMAC_SHA2_256 group=MODP2048}
002 "westnet-eastnet-ipv4-psk-ikev2" #2: initiating Quick Mode IKEv1+PSK+ENCRYPT+TUNNEL+PFS+UP+IKE_FRAG_ALLOW+ESN_NO+ESN_YES
1v1 "westnet-eastnet-ipv4-psk-ikev2" #2: sent Quick Mode request
004 "westnet-eastnet-ipv4-psk-ikev2" #2: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_CBC_128-HMAC_SHA1_96 DPD=passive}
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.0.2.254
up
west #
 # wait for an IKE rekey which happens at the 1m mark
west #
 sleep 45
west #
 ../../guestbin/wait-for.sh --match '#3: initiating IKEv1 Main Mode connection to replace #1' -- cat /tmp/pluto.log
"westnet-eastnet-ipv4-psk-ikev2" #3: initiating IKEv1 Main Mode connection to replace #1
west #
 ../../guestbin/wait-for.sh --match '#3.*IKE SA established' -- ipsec whack --showstates
000 #3: "westnet-eastnet-ipv4-psk-ikev2":500 STATE_MAIN_I4 (IKE SA established); REPLACE in XXs; newest; lastdpd=-1s(seq in:0 out:0); idle;
west #
 # because both ends are fighting over who is establishing the ISAKMP
west #
 # SA, showstates is always changing.
west #
 # ready for shutdown test in final.sh
west #
 echo done
done
west #
 # specifically test shutting down after rekey doesn't crash
west #
 ipsec stop
Redirecting to: [initsystem]
west #
 
