/testing/guestbin/swan-prep --nokey
Creating empty NSS database
west #
 ipsec start
Redirecting to: [initsystem]
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec whack --impair suppress_retransmits
west #
 # note order
west #
 ipsec add a
"a": added IKEv2 connection
west #
 ipsec add b
"b": added IKEv2 connection
west #
 # Initiate "a" with all packets blocked.
west #
 #
west #
 # This will create the negotiating IKE SA #1, and then hang.
west #
 ipsec whack --impair block_outbound:yes
IMPAIR: recording all outbound messages
IMPAIR: block all outbound messages: no -> yes
west #
 ipsec up a --asynchronous
"a" #1: initiating IKEv2 connection to 192.1.2.23 using UDP
west #
 ../../guestbin/wait-for-pluto.sh --match '"a" #1: IMPAIR: blocking outbound message 1'
"a" #1: IMPAIR: blocking outbound message 1
west #
 ../../guestbin/wait-for-pluto.sh --match '"a" #1: sent IKE_SA_INIT request'
"a" #1: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
west #
 # With connection "a"'s IKE SA #1 stuck, unblock so that the peer's
west #
 # IKE SA #2, which will cross "a", can establish
west #
 ipsec whack --impair block_outbound:no
IMPAIR: block all outbound messages: yes -> no
west #
 # confirm that the peer's IKE SA established "a", and then the peer's
west #
 # Child SA needed to switch to "b" before establishing.
west #
 ../../guestbin/wait-for-pluto.sh --match '"a" #2: responder established IKE SA'
"a" #2: responder established IKE SA; authenticated peer using authby=secret and FQDN '@east'
west #
 ../../guestbin/wait-for-pluto.sh --match '"a" #3: switched to "b"'
"a" #3: switched to "b"
west #
 ../../guestbin/wait-for-pluto.sh --match '"b" #3: responder established Child SA using #2'
"b" #3: responder established Child SA using #2; IPsec tunnel [192.0.3.254/32===192.0.20.0/24] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 # this is where pluto realises that the stream crossed
west #
 ../../guestbin/wait-for-pluto.sh --match '#1: dropping negotiation'
"a" #1: dropping negotiation as superseded by established IKE SA #2
west #
 ../../guestbin/wait-for-pluto.sh --match '"a" #4: initiator established Child SA using #2'
"a" #4: initiator established Child SA using #2; IPsec tunnel [192.0.3.253/32===192.0.2.0/24] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE-DH19 DPD=passive}
west #
 ../../guestbin/ping-once.sh --up -I 192.0.3.253 192.0.2.254
up
west #
 ../../guestbin/ping-once.sh --up -I 192.0.3.254 192.0.20.254
up
west #
 # non-zero counts confirm encrypted traffic flowing
west #
 ipsec trafficstatus
#4: "a", type=ESP, add_time=1234567890, inBytes=84, outBytes=84, maxBytes=2^63B, id='@east'
#3: "b", type=ESP, add_time=1234567890, inBytes=84, outBytes=84, maxBytes=2^63B, id='@east'
west #
 # do things line up?
west #
 ipsec _kernel state
src 192.1.2.45 dst 192.1.2.23
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec esn
	aead rfc4106(gcm(aes)) 0xENCAUTHKEY 128
	lastused YYYY-MM-DD HH:MM:SS
	anti-replay esn context:
	 seq-hi 0x0, seq 0xXX, oseq-hi 0x0, oseq 0xXX
	 replay_window 0, bitmap-length 0
src 192.1.2.23 dst 192.1.2.45
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec esn
	aead rfc4106(gcm(aes)) 0xENCAUTHKEY 128
	lastused YYYY-MM-DD HH:MM:SS
	anti-replay esn context:
	 seq-hi 0x0, seq 0xXX, oseq-hi 0x0, oseq 0xXX
	 replay_window 128, bitmap-length 4
	 00000000 00000000 00000000 XXXXXXXX 
src 192.1.2.45 dst 192.1.2.23
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec esn
	aead rfc4106(gcm(aes)) 0xENCAUTHKEY 128
	lastused YYYY-MM-DD HH:MM:SS
	anti-replay esn context:
	 seq-hi 0x0, seq 0xXX, oseq-hi 0x0, oseq 0xXX
	 replay_window 0, bitmap-length 0
src 192.1.2.23 dst 192.1.2.45
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec esn
	aead rfc4106(gcm(aes)) 0xENCAUTHKEY 128
	lastused YYYY-MM-DD HH:MM:SS
	anti-replay esn context:
	 seq-hi 0x0, seq 0xXX, oseq-hi 0x0, oseq 0xXX
	 replay_window 128, bitmap-length 4
	 00000000 00000000 00000000 XXXXXXXX 
west #
 ipsec _kernel policy
src 192.0.2.0/24 dst 192.0.3.253/32
	dir fwd priority PRIORITY ptype main
	tmpl src 192.1.2.23 dst 192.1.2.45
		proto esp reqid REQID mode tunnel
src 192.0.2.0/24 dst 192.0.3.253/32
	dir in priority PRIORITY ptype main
	tmpl src 192.1.2.23 dst 192.1.2.45
		proto esp reqid REQID mode tunnel
src 192.0.3.253/32 dst 192.0.2.0/24
	dir out priority PRIORITY ptype main
	tmpl src 192.1.2.45 dst 192.1.2.23
		proto esp reqid REQID mode tunnel
src 192.0.3.254/32 dst 192.0.20.0/24
	dir out priority PRIORITY ptype main
	tmpl src 192.1.2.45 dst 192.1.2.23
		proto esp reqid REQID mode tunnel
src 192.0.20.0/24 dst 192.0.3.254/32
	dir fwd priority PRIORITY ptype main
	tmpl src 192.1.2.23 dst 192.1.2.45
		proto esp reqid REQID mode tunnel
src 192.0.20.0/24 dst 192.0.3.254/32
	dir in priority PRIORITY ptype main
	tmpl src 192.1.2.23 dst 192.1.2.45
		proto esp reqid REQID mode tunnel
west #
