/testing/guestbin/swan-prep --hostkeys
Creating NSS database containing host keys
west #
 ipsec start
Redirecting to: [initsystem]
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec auto --add west-east
ipsec addconn: /etc/ipsec.conf:17: warning: obsolete keyword ignored: dpdaction=hold
"west-east": added IKEv1 connection
west #
 ipsec auto --add west-eastnet
ipsec addconn: /etc/ipsec.conf:17: warning: obsolete keyword ignored: dpdaction=hold
"west-eastnet": added IKEv1 connection
west #
 ipsec auto --add westnet-east
ipsec addconn: /etc/ipsec.conf:17: warning: obsolete keyword ignored: dpdaction=hold
"westnet-east": added IKEv1 connection
west #
 # don't auto-revive, instead wait for a trigger
west #
 ipsec whack --impair revival
west #
 echo "initdone"
initdone
west #
 # we can transmit in the clear
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.1.2.23
up
west #
 # bring up the tunnel
west #
 ipsec auto --up west-east
"west-east" #1: initiating IKEv1 Main Mode connection
"west-east" #1: sent Main Mode request
"west-east" #1: sent Main Mode I2
"west-east" #1: sent Main Mode I3
"west-east" #1: Peer ID is ID_FQDN: '@east'
"west-east" #1: authenticated peer using preloaded certificate '@east' and 2nnn-bit RSA with SHA1 signature
"west-east" #1: ISAKMP SA established {auth=RSA_SIG cipher=AES_CBC_256 integ=HMAC_SHA2_256 group=MODP2048}
"west-east" #2: initiating Quick Mode IKEv1+RSASIG+ENCRYPT+TUNNEL+PFS+UP+IKE_FRAG_ALLOW+ESN_NO+ESN_YES
"west-east" #2: sent Quick Mode request
"west-east" #2: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_CBC_128-HMAC_SHA1_96 DPD=active}
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.1.2.23
up
west #
 ipsec auto --up west-eastnet
"west-eastnet" #3: initiating Quick Mode IKEv1+RSASIG+ENCRYPT+TUNNEL+PFS+UP+IKE_FRAG_ALLOW+ESN_NO+ESN_YES
"west-eastnet" #3: sent Quick Mode request
"west-eastnet" #3: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_CBC_128-HMAC_SHA1_96 DPD=active}
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.0.2.254
up
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.0.2.254
up
west #
 ipsec auto --up westnet-east
"westnet-east" #4: initiating Quick Mode IKEv1+RSASIG+ENCRYPT+TUNNEL+PFS+UP+IKE_FRAG_ALLOW+ESN_NO+ESN_YES
"westnet-east" #4: sent Quick Mode request
"westnet-east" #4: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_CBC_128-HMAC_SHA1_96 DPD=active}
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.1.2.23
up
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.1.2.23
up
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.1.2.23
up
west #
 # use the tunnel
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.1.2.23
up
west #
 # show the tunnel
west #
 ipsec whack --trafficstatus
#2: "west-east", type=ESP, add_time=1234567890, inBytes=168, outBytes=168, maxBytes=2^63B, id='@east'
#3: "west-eastnet", type=ESP, add_time=1234567890, inBytes=168, outBytes=168, maxBytes=2^63B, id='@east'
#4: "westnet-east", type=ESP, add_time=1234567890, inBytes=252, outBytes=252, maxBytes=2^63B, id='@east'
west #
 # Let R_U_THERE packets flow; connection should still be up
west #
 sleep 10
west #
 sleep 10
west #
 ipsec whack --trafficstatus
#2: "west-east", type=ESP, add_time=1234567890, inBytes=168, outBytes=168, maxBytes=2^63B, id='@east'
#3: "west-eastnet", type=ESP, add_time=1234567890, inBytes=168, outBytes=168, maxBytes=2^63B, id='@east'
#4: "westnet-east", type=ESP, add_time=1234567890, inBytes=252, outBytes=252, maxBytes=2^63B, id='@east'
west #
 # Create the block; wait for DPD to trigger
west #
 iptables -I OUTPUT -s 192.1.2.45/32 -d 0/0 -j DROP
west #
 iptables -I INPUT -s 192.1.2.23/32 -d 0/0 -j DROP
west #
 ../../guestbin/wait-for-pluto.sh --match '#1: DPD action'
"west-east" #1: DPD action - putting connection into hold
west #
 ../../guestbin/wait-for.sh --no-match ':' -- ipsec whack --trafficstatus
west #
 ../../guestbin/ipsec-kernel-state.sh
west #
 ../../guestbin/ipsec-kernel-policy.sh
src 192.1.2.45/32 dst 192.1.2.23/32
	dir out priority PRIORITY ptype main
	tmpl src 0.0.0.0 dst 0.0.0.0
		proto esp reqid 0 mode transport
src 192.1.2.45/32 dst 192.0.2.0/24
	dir out priority PRIORITY ptype main
	tmpl src 0.0.0.0 dst 0.0.0.0
		proto esp reqid 0 mode transport
src 192.0.1.0/24 dst 192.1.2.23/32
	dir out priority PRIORITY ptype main
	tmpl src 0.0.0.0 dst 0.0.0.0
		proto esp reqid 0 mode transport
west #
 # remove the block
west #
 iptables -D INPUT -s 192.1.2.23/32 -d 0/0 -j DROP
west #
 iptables -D OUTPUT -s 192.1.2.45/32 -d 0/0 -j DROP
west #
 # wait for west-east
west #
 ../../guestbin/ping-once.sh --down -I 192.1.2.45 192.1.2.23
down
west #
 ../../guestbin/wait-for.sh --match '"west-east"' -- ipsec whack --trafficstatus
#6: "west-east", type=ESP, add_time=1234567890, inBytes=0, outBytes=0, maxBytes=2^63B, id='@east'
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.1.2.23
up
west #
 # wait for west-eastnet
west #
 ../../guestbin/ping-once.sh --down -I 192.1.2.45 192.0.2.254
down
west #
 ../../guestbin/wait-for.sh --match '"west-eastnet"' -- ipsec whack --trafficstatus
#7: "west-eastnet", type=ESP, add_time=1234567890, inBytes=0, outBytes=0, maxBytes=2^63B, id='@east'
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.0.2.254
up
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.0.2.254
up
west #
 # wait for westnet-east
west #
 ../../guestbin/ping-once.sh --down -I 192.0.1.254 192.1.2.23
down
west #
 ../../guestbin/wait-for.sh --match '"westnet-east"' -- ipsec whack --trafficstatus
#8: "westnet-east", type=ESP, add_time=1234567890, inBytes=0, outBytes=0, maxBytes=2^63B, id='@east'
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.1.2.23
up
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.1.2.23
up
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.1.2.23
up
west #
 # Tunnels should be back up now
west #
 ipsec whack --trafficstatus
#6: "west-east", type=ESP, add_time=1234567890, inBytes=84, outBytes=84, maxBytes=2^63B, id='@east'
#7: "west-eastnet", type=ESP, add_time=1234567890, inBytes=168, outBytes=168, maxBytes=2^63B, id='@east'
#8: "westnet-east", type=ESP, add_time=1234567890, inBytes=252, outBytes=252, maxBytes=2^63B, id='@east'
west #
 echo done
done
west #
 # final check
west #
 ipsec whack --trafficstatus
#6: "west-east", type=ESP, add_time=1234567890, inBytes=84, outBytes=84, maxBytes=2^63B, id='@east'
#7: "west-eastnet", type=ESP, add_time=1234567890, inBytes=168, outBytes=168, maxBytes=2^63B, id='@east'
#8: "westnet-east", type=ESP, add_time=1234567890, inBytes=252, outBytes=252, maxBytes=2^63B, id='@east'
west #
 ../../guestbin/ipsec-kernel-state.sh
src 192.1.2.45 dst 192.1.2.23
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec
	auth-trunc hmac(sha1) 0xHASHKEY 96
	enc cbc(aes) 0xENCKEY
	lastused YYYY-MM-DD HH:MM:SS
src 192.1.2.23 dst 192.1.2.45
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec
	auth-trunc hmac(sha1) 0xHASHKEY 96
	enc cbc(aes) 0xENCKEY
	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.0.1.254 dst 192.1.2.23
	proto esp spi 0x00000000 reqid 0 mode transport
	replay-window 0 
	sel src 192.0.1.254/32 dst 192.1.2.23/32 proto icmp type 8 code 0 dev eth1 
src 192.1.2.45 dst 192.1.2.23
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec
	auth-trunc hmac(sha1) 0xHASHKEY 96
	enc cbc(aes) 0xENCKEY
	lastused YYYY-MM-DD HH:MM:SS
src 192.1.2.23 dst 192.1.2.45
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec
	auth-trunc hmac(sha1) 0xHASHKEY 96
	enc cbc(aes) 0xENCKEY
	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.0.2.254
	proto esp spi 0x00000000 reqid 0 mode transport
	replay-window 0 
	sel src 192.1.2.45/32 dst 192.0.2.254/32 proto icmp type 8 code 0 dev eth1 
src 192.1.2.45 dst 192.1.2.23
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec
	auth-trunc hmac(sha1) 0xHASHKEY 96
	enc cbc(aes) 0xENCKEY
	lastused YYYY-MM-DD HH:MM:SS
src 192.1.2.23 dst 192.1.2.45
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec
	auth-trunc hmac(sha1) 0xHASHKEY 96
	enc cbc(aes) 0xENCKEY
	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 0x00000000 reqid 0 mode transport
	replay-window 0 
	sel src 192.1.2.45/32 dst 192.1.2.23/32 proto icmp type 8 code 0 dev eth1 
west #
 ../../guestbin/ipsec-kernel-policy.sh
src 192.1.2.23/32 dst 192.1.2.45/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.1.2.23/32 dst 192.1.2.45/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.1.2.45/32 dst 192.1.2.23/32
	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.2.0/24 dst 192.1.2.45/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.1.2.45/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.1.2.45/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.1.0/24 dst 192.1.2.23/32
	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.1.2.23/32 dst 192.0.1.0/24
	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.1.2.23/32 dst 192.0.1.0/24
	dir in priority PRIORITY ptype main
	tmpl src 192.1.2.23 dst 192.1.2.45
		proto esp reqid REQID mode tunnel
west #
 
