/testing/guestbin/swan-prep
west #
 ipsec start
Redirecting to: [initsystem]
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec whack --impair revival
west #
 ipsec whack --impair suppress-retransmits
west #
 ipsec auto --add west
002 "west": added IKEv2 connection
west #
 # iptables -A INPUT -s 192.1.2.23 -j LOG --log-prefix "east all"
west #
 # iptables -A INPUT -m u32 --u32 '0x6&0xFF=0x11' -j LOG --log-prefix  "udp log"
west #
 # iptables -A INPUT -m u32 --u32 '0x6 & 0xFF = 0x11 && 0x30 & 0xFFFFFFFF = 0x0:0x8' -j LOG --log-prefix  "ike"
west #
 # Drop the second IPsec rekey message, which is IKE Message ID: 4
west #
 # Message ID : 0 = IKE_INIT, 1 = IKE_AUTH, 2 = REKEY (First one let it go)
west #
 # 3 : DELETE, 4 = REKEY (DROP)
west #
 # iptables -A INPUT -m u32 --u32 '0x6 & 0xFF = 0x11 && 0x30 & 0xFFFFFFFF = 0x4' -j LOG --log-prefix  "ike"
west #
 iptables -A INPUT -m u32 --u32 '0x6 & 0xFF = 0x11 && 0x30 & 0xFFFFFFFF = 0x4' -j DROP
west #
 sleep 4 # XXX: why?
west #
 echo "initdone"
initdone
west #
 ipsec auto --status | grep west
000 "west": 192.1.2.45[@west]...192.1.2.23[@east]; unrouted; eroute owner: #0
000 "west":     oriented; my_ip=unset; their_ip=unset; my_updown=ipsec _updown;
000 "west":   xauth us:none, xauth them:none,  my_username=[any]; their_username=[any]
000 "west":   our auth:secret, their auth:secret, our autheap:none, their autheap:none;
000 "west":   modecfg info: us:none, them:none, modecfg policy:push, dns:unset, domains:unset, cat:unset;
000 "west":   sec_label:unset;
000 "west":   ike_life: 28800s; ipsec_life: 28800s; ipsec_max_bytes: 2^63B; ipsec_max_packets: 2^63; replay_window: 128; rekey_margin: 540s; rekey_fuzz: 100%; keyingtries: 0;
000 "west":   retransmit-interval: 9999ms; retransmit-timeout: 99s; iketcp:no; iketcp-port:4500;
000 "west":   initial-contact:no; cisco-unity:no; fake-strongswan:no; send-vendorid:no; send-no-esp-tfc:no;
000 "west":   policy: IKEv2+PSK+ENCRYPT+TUNNEL+PFS+IKE_FRAG_ALLOW+ESN_NO+ESN_YES;
000 "west":   v2-auth-hash-policy: none;
000 "west":   conn_prio: 32,32; interface: eth1; metric: 0; mtu: unset; sa_prio:auto; sa_tfc:none;
000 "west":   nflog-group: unset; mark: unset; vti-iface:unset; vti-routing:no; vti-shared:no; nic-offload:auto;
000 "west":   our idtype: ID_FQDN; our id=@west; their idtype: ID_FQDN; their id=@east
000 "west":   liveness: passive; dpdaction:hold; dpddelay:0s; retransmit-timeout:15s
000 "west":   nat-traversal: encaps:auto; keepalive:20s
000 "west":   newest IKE SA: #0; newest IPsec SA: #0; conn serial: $1;
west #
 ipsec auto --up west
1v2 "west" #1: initiating IKEv2 connection
1v2 "west" #1: sent IKE_SA_INIT request to 192.1.2.23:500
1v2 "west" #1: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "west" #1: initiator established IKE SA; authenticated peer using authby=secret and ID_FQDN '@east'
004 "west" #2: initiator established Child SA using #1; IPsec tunnel [192.1.2.45-192.1.2.45:0-65535 0] -> [192.1.2.23-192.1.2.23:0-65535 0] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 ../../guestbin/ping-once.sh --up 192.1.2.23
up
west #
 ipsec trafficstatus
006 #2: "west", type=ESP, add_time=1234567890, inBytes=84, outBytes=84, maxBytes=2^63B, id='@east'
west #
 # this rekey, #2->#3, should succeed
west #
 ipsec whack --rekey-ipsec --name west
002 "west" #3: initiating rekey to replace Child SA #2
1v2 "west" #3: sent CREATE_CHILD_SA request to rekey IPsec SA
004 "west" #3: initiator rekeyed Child SA #2 using #1; IPsec tunnel [192.1.2.45-192.1.2.45:0-65535 0] -> [192.1.2.23-192.1.2.23:0-65535 0] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE-MODP2048 DPD=passive}
002 "west" #2: deleting established Child SA using IKE SA #1
005 "west" #2: ESP traffic information: in=84B out=84B
west #
 # this rekey, #3->#4, which is running in the background should fail.
west #
 # The message is blocked by firewall rules added in 02-west-init.sh
west #
 ipsec whack --rekey-ipsec --name west --async
west #
 # this rekey, #?->#5, will block (waiting on the asynchronous rekey
west #
 # #3->#4) and then die.
west #
 ipsec whack --rekey-ipsec --name west
002 "west" #5: initiating rekey to replace Child SA #3
005 "west" #3: ESP traffic information: in=0B out=0B
west #
 # above whack commands leave much to be desired when it comes to
west #
 # logging; get around it by grepping for the expected outcome.
west #
 #
west #
 # Note: need to strip of "MONTH(1) DATE(2) TIME(3): "; look for real
west #
 # log lines that just match states we're interested in.
west #
 cat /tmp/pluto.log | sed -n -e 's/^[^|#]*: \([^#|].* #[1-5]:\)/\1/p'
"west" #1: initiating IKEv2 connection
"west" #1: sent IKE_SA_INIT request to 192.1.2.23:500
"west" #1: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
"west" #1: initiator established IKE SA; authenticated peer using authby=secret and ID_FQDN '@east'
"west" #2: initiator established Child SA using #1; IPsec tunnel [192.1.2.45-192.1.2.45:0-65535 0] -> [192.1.2.23-192.1.2.23:0-65535 0] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
"west" #3: initiating rekey to replace Child SA #2
"west" #3: sent CREATE_CHILD_SA request to rekey IPsec SA
"west" #3: initiator rekeyed Child SA #2 using #1; IPsec tunnel [192.1.2.45-192.1.2.45:0-65535 0] -> [192.1.2.23-192.1.2.23:0-65535 0] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE-MODP2048 DPD=passive}
"west" #2: deleting established Child SA using IKE SA #1
"west" #2: ESP traffic information: in=84B out=84B
"west" #4: initiating rekey to replace Child SA #3
"west" #4: sent CREATE_CHILD_SA request to rekey IPsec SA
"west" #5: initiating rekey to replace Child SA #3
"west" #1: STATE_V2_ESTABLISHED_IKE_SA: 15 second timeout exceeded after 0 retransmits.  No response (or no acceptable response) to our IKEv2 message
"west" #1: liveness action - putting connection into hold
"west" #3: ESP traffic information: in=0B out=0B
"west" #1: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and NOT sending notification
"west" #1: IMPAIR: skipping revival of connection that is supposed to remain up
west #
 ipsec whack --trafficstatus
west #
 # policies and state should be multiple
west #
 
