/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 #
 ipsec start
Redirecting to: [initsystem]
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec auto --add westnet-eastnet-ikev2
002 "westnet-eastnet-ikev2": added IKEv2 connection
west #
 echo "initdone"
initdone
west #
 #!/bin/sh
west #
 ipsec auto --up westnet-eastnet-ikev2
1v2 "westnet-eastnet-ikev2" #1: initiating IKEv2 connection
1v2 "westnet-eastnet-ikev2" #1: sent IKE_SA_INIT request
1v2 "westnet-eastnet-ikev2" #1: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "westnet-eastnet-ikev2" #1: established IKE SA; authenticated using RSA with SHA2_512 and preloaded certificate '@east'
004 "westnet-eastnet-ikev2" #2: established Child SA; IPsec tunnel [192.0.1.0-192.0.1.255:0-65535 0] -> [192.0.2.0-192.0.2.255:0-65535 0] {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=active}
west #
 # Tunnel should be up
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.0.2.254
up
west #
 ipsec whack --trafficstatus
006 #2: "westnet-eastnet-ikev2", type=ESP, add_time=1234567890, inBytes=84, outBytes=84, id='@east'
west #
 # Let R_U_THERE packets flow
west #
 sleep 15
west #
 # Setting up block
west #
 ip route add unreachable 192.1.2.23
west #
 ../../guestbin/ping-once.sh --error 192.1.2.23
connect: No route to host
west #
 # wait for liveness/dpd to trigger: tunnel should be down with %trap
west #
 # or %hold preventing packet leaks But shuntstatus only shows bare
west #
 # shunts, not connection shunts :(
west #
 ../../guestbin/wait-for.sh --timeout 90 --no-match '.' -- ipsec trafficstatus
west #
 conntrack -L -n
conntrack vA.B.C (conntrack-tools): 0 flow entries have been shown.
west #
 conntrack -F
conntrack vA.B.C (conntrack-tools): connection tracking table has been emptied.
west #
 ipsec whack --shuntstatus
000 Bare Shunt list:
000  
west #
 ipsec status | grep westnet-eastnet-ikev2
000 "westnet-eastnet-ikev2": 192.0.1.0/24===192.1.2.45<192.1.2.45>[@west]...192.1.2.23<192.1.2.23>[@east]===192.0.2.0/24; prospective erouted; eroute owner: #0
000 "westnet-eastnet-ikev2":     oriented; my_ip=unset; their_ip=unset; my_updown=ipsec _updown;
000 "westnet-eastnet-ikev2":   xauth us:none, xauth them:none,  my_username=[any]; their_username=[any]
000 "westnet-eastnet-ikev2":   our auth:rsasig, their auth:rsasig
000 "westnet-eastnet-ikev2":   modecfg info: us:none, them:none, modecfg policy:push, dns:unset, domains:unset, cat:unset;
000 "westnet-eastnet-ikev2":   sec_label:unset;
000 "westnet-eastnet-ikev2":   ike_life: 28800s; ipsec_life: 28800s; replay_window: 32; rekey_margin: 540s; rekey_fuzz: 100%; keyingtries: 0;
000 "westnet-eastnet-ikev2":   retransmit-interval: 9999ms; retransmit-timeout: 99s; iketcp:no; iketcp-port:4500;
000 "westnet-eastnet-ikev2":   initial-contact:no; cisco-unity:no; fake-strongswan:no; send-vendorid:no; send-no-esp-tfc:no;
000 "westnet-eastnet-ikev2":   policy: IKEv2+RSASIG+ECDSA+ENCRYPT+TUNNEL+PFS+UP+IKE_FRAG_ALLOW+ESN_NO+RSASIG_v1_5;
000 "westnet-eastnet-ikev2":   v2-auth-hash-policy: SHA2_256+SHA2_384+SHA2_512;
000 "westnet-eastnet-ikev2":   conn_prio: 24,24; interface: eth1; metric: 0; mtu: unset; sa_prio:auto; sa_tfc:none;
000 "westnet-eastnet-ikev2":   nflog-group: unset; mark: unset; vti-iface:unset; vti-routing:no; vti-shared:no; nic-offload:auto;
000 "westnet-eastnet-ikev2":   our idtype: ID_FQDN; our id=@west; their idtype: ID_FQDN; their id=@east
000 "westnet-eastnet-ikev2":   dpd: action:hold; delay:3; timeout:10; nat-t: encaps:auto; nat_keepalive:yes; ikev1_natt:both
000 "westnet-eastnet-ikev2":   newest ISAKMP SA: #0; newest IPsec SA: #0; conn serial: $1;
000 #3: "westnet-eastnet-ikev2":500 STATE_V2_PARENT_I1 (sent IKE_SA_INIT request); RETRANSMIT in XXs; idle;
000 #3: pending CHILD SA for "westnet-eastnet-ikev2"
west #
 # ping should be caught ip route unreachable
west #
 ../../guestbin/ping-once.sh --down -I 192.0.1.254 192.0.2.254
down
west #
 # Remove the null route; things should recover witout a trigger
west #
 ip route del unreachable 192.1.2.23
west #
 ../../guestbin/wait-until-alive 192.1.2.23
destination 192.1.2.23 is alive
west #
 ../../guestbin/wait-for.sh --match ':' -- ipsec trafficstatus
006 #4: "westnet-eastnet-ikev2", type=ESP, add_time=1234567890, inBytes=0, outBytes=0, id='@east'
west #
 # Tunnel should be back up now even without triggering traffic
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.0.2.254
up
west #
 ipsec trafficstatus
006 #4: "westnet-eastnet-ikev2", type=ESP, add_time=1234567890, inBytes=84, outBytes=84, id='@east'
west #
 ipsec shuntstatus
000 Bare Shunt list:
000  
west #
 grep -E "liveness action|acquire" OUTPUT/west.pluto.log
netlink_acquire got message with length 44 < 232 bytes; ignore message
"westnet-eastnet-ikev2" #1: liveness action - putting connection into hold
| xfrm acquire rtattribute type 5 ...
| xfrm acquire rtattribute type 16 ...
| kernel: acquire looking for 192.0.1.254/32:8 -ICMP-> 192.0.2.254/32:0 (1)
| add bare shunt 0xPOINTER 192.0.1.254/32:8 --1--> 192.0.2.254/32:0 => %hold 0    acquire
| comparing bare shunt 0xPOINTER 192.0.1.254/32:8 --1--> 192.0.2.254/32:0 => %hold 0    acquire
| delete bare shunt 0xPOINTER 192.0.1.254/32:8 --1--> 192.0.2.254/32:0 => %hold 0    acquire
initiate on demand by acquire from 192.0.1.254:8 to 192.0.2.254:0 proto=ICMP
west #
 grep -E "liveness: action|acquire" OUTPUT/west.pluto.log
netlink_acquire got message with length 44 < 232 bytes; ignore message
| xfrm acquire rtattribute type 5 ...
| xfrm acquire rtattribute type 16 ...
| kernel: acquire looking for 192.0.1.254/32:8 -ICMP-> 192.0.2.254/32:0 (1)
| add bare shunt 0xPOINTER 192.0.1.254/32:8 --1--> 192.0.2.254/32:0 => %hold 0    acquire
| comparing bare shunt 0xPOINTER 192.0.1.254/32:8 --1--> 192.0.2.254/32:0 => %hold 0    acquire
| delete bare shunt 0xPOINTER 192.0.1.254/32:8 --1--> 192.0.2.254/32:0 => %hold 0    acquire
initiate on demand by acquire from 192.0.1.254:8 to 192.0.2.254:0 proto=ICMP
west #
 echo done
done
west #
 
