/testing/guestbin/swan-prep
west #
 ipsec start
Redirecting to: [initsystem]
west #
 /testing/pluto/bin/wait-until-pluto-started
west #
 ipsec whack --impair revival
west #
 ipsec whack --impair suppress-retransmits
west #
 ipsec auto --add west
002 added IKEv2 connection "west"
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
west #
 echo "initdone"
initdone
west #
 ipsec auto --status | grep west
000 "west": 192.1.2.45<192.1.2.45>[@west]...192.1.2.23<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
000 "west":   modecfg info: us:none, them:none, modecfg policy:push, dns:unset, domains:unset, banner:unset, cat:unset;
000 "west":   policy_label:unset;
000 "west":   ike_life: 3600s; ipsec_life: 28800s; replay_window: 32; 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: PSK+ENCRYPT+TUNNEL+PFS+IKEV2_ALLOW+IKE_FRAG_ALLOW+ESN_NO;
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":   dpd: action:hold; delay:0; timeout:0; nat-t: encaps:auto; nat_keepalive:yes; ikev1_natt:both
000 "west":   newest ISAKMP 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
1v2 "west" #1: sent IKE_AUTH request {auth=IKEv2 cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
002 "west" #2: IKEv2 mode peer ID is ID_FQDN: '@east'
003 "west" #1: authenticated using authby=secret
002 "west" #2: negotiated connection [192.1.2.45-192.1.2.45:0-65535 0] -> [192.1.2.23-192.1.2.23:0-65535 0]
004 "west" #2: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
west #
 # ../../pluto/bin/ping-once.sh ...?
west #
 taskset 0x3 ping -w 3 -n -c 2 192.1.2.23
PING 192.1.2.23 (192.1.2.23) 56(84) bytes of data.
64 bytes from 192.1.2.23: icmp_seq=1 ttl=64 time=0.XXX ms
64 bytes from 192.1.2.23: icmp_seq=2 ttl=64 time=0.XXX ms
--- 192.1.2.23 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
west #
 ipsec trafficstatus
006 #2: "west", type=ESP, add_time=1234567890, inBytes=168, outBytes=168, id='@east'
west #
 # this rekey, 1 #3, should succeed
west #
 ipsec whack --rekey-ipsec --name west
1v2 "west" #3: sent CREATE_CHILD_SA request to rekey IPsec SA
002 "west" #3: rekeyed #2 STATE_V2_REKEY_CHILD_I1 and expire it remaining life XXs
002 "west" #3: negotiated connection [192.1.2.45-192.1.2.45:0-65535 0] -> [192.1.2.23-192.1.2.23:0-65535 0]
004 "west" #3: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE-MODP2048 NATOA=none NATD=none DPD=passive}
002 "west" #2: deleting state (STATE_V2_ESTABLISHED_CHILD_SA) and sending notification
005 "west" #2: ESP traffic information: in=168B out=168B
west #
 sleep 15
west #
 # this rekey, 2 #4, should fail creating an unacknowledged message and dead lock
west #
 ipsec whack --rekey-ipsec --name west
1v2 "west" #4: sent CREATE_CHILD_SA request to rekey IPsec SA
031 "west" #4: STATE_V2_REKEY_CHILD_I1: 60 second timeout exceeded after 0 retransmits.  No response (or no acceptable response) to our IKEv2 message
002 "west" #4: liveness action - putting connection into hold
002 "west" #4: deleting state (STATE_V2_REKEY_CHILD_I1) and NOT sending notification
002 "west" #3: deleting state (STATE_V2_ESTABLISHED_CHILD_SA) and sending notification
005 "west" #3: ESP traffic information: in=0B out=0B
west #
 # this rekey, 3 #5, message will not be sent, #1.#5
west #
 ipsec whack --rekey-ipsec --name west
002 connection does not have CHILD SA
west #
 # there should be one hit
west #
 grep "next initiator blocked by outstanding" OUTPUT/west.pluto.log | sed -e 's/\(.*\ |\)//' | sort -u
west #
 ipsec status | grep STATE_
west #
 echo done
done
west #
 ipsec whack --trafficstatus
west #
 # policies and state should be multiple
west #
 ../bin/check-for-core.sh
west #
 if [ -f /sbin/ausearch ]; then ausearch -r -m avc -ts recent ; fi
west #
 
