/testing/guestbin/swan-prep --hostkeys Creating NSS database containing host keys west # echo 3 > /proc/sys/net/core/xfrm_acq_expires west # # install selinux; generated in OUTPUT by east west # semodule -i OUTPUT/ipsecspd-full-perm.pp west # # start pluto west # ipsec start Redirecting to: [initsystem] west # ../../guestbin/wait-until-pluto-started west # ipsec auto --add labeled "labeled": added IKEv2 connection west # echo "initdone" initdone west # # Establish a childless IKE SA which will install the policy ready for west # # an acquire. west # ipsec auto --up labeled "labeled"[1] 192.1.2.23 #1: initiating IKEv2 connection to 192.1.2.23 using UDP "labeled"[1] 192.1.2.23 #1: sent IKE_SA_INIT request to 192.1.2.23:UDP/500 "labeled"[1] 192.1.2.23 #1: processed IKE_SA_INIT response from 192.1.2.23:UDP/500 {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=DH19}, initiating IKE_AUTH "labeled"[1] 192.1.2.23 #1: omitting CHILD SA payloads "labeled"[1] 192.1.2.23 #1: sent IKE_AUTH request to 192.1.2.23:UDP/500 "labeled"[1] 192.1.2.23 #1: initiator established IKE SA; authenticated peer using preloaded certificate '@east' and 2nnn-bit RSASSA-PSS with SHA2_512 digital signature west # ../../guestbin/ipsec-kernel-state.sh west # ../../guestbin/ipsec-kernel-policy.sh src 192.1.2.23/32 dst 192.1.2.45/32 security context system_u:object_r:ipsec_spd_t:s0 dir in priority PRIORITY ptype main tmpl src 0.0.0.0 dst 0.0.0.0 proto esp reqid REQID mode transport src 192.1.2.45/32 dst 192.1.2.23/32 security context system_u:object_r:ipsec_spd_t:s0 dir out priority PRIORITY ptype main tmpl src 0.0.0.0 dst 0.0.0.0 proto esp reqid REQID mode transport west # # Initiate a rekey of the IKE SA but drop the initial CREATE_CHILD_SA west # # request. This will cause the exchange to become stuck; the west # # retransmit, scheduled for 10s, will unstick it. west # ipsec whack --impair drop_outbound:1 IMPAIR: recording all outbound messages IMPAIR: will drop outbound message 1 west # ipsec whack --rekey-ike --asynchronous --name labeled west # ../../guestbin/wait-for.sh --match REKEY_IKE_I1 -- ipsec whack --showstates #2: "labeled"[1] 192.1.2.23:500 REKEY_IKE_I1 (sent CREATE_CHILD_SA request to rekey IKE SA); idle; west # # Trigger traffic using the predefined ping_t context. Because the west # # rekey SA is stuck it will start on the old #1 IKE SA's queue and west # # then migrated to the new SA queue when things resume. west # ../../guestbin/ping-once.sh --runcon "system_u:system_r:ping_t:s0:c1.c256" --forget -I 192.1.2.45 192.1.2.23 fired and forgotten west # ../../guestbin/wait-for.sh --match 192.1.2.23 -- ipsec trafficstatus #4: "labeled"[1][1] 192.1.2.23, type=ESP, add_time=1234567890, inBytes=0, outBytes=0, maxBytes=2^63B, id='@east' west # ../../guestbin/ping-once.sh --runcon "system_u:system_r:ping_t:s0:c1.c256" --up -I 192.1.2.45 192.1.2.23 up west # # there should be 1 tunnel in each direction west # ipsec trafficstatus #4: "labeled"[1][1] 192.1.2.23, type=ESP, add_time=1234567890, inBytes=64, outBytes=64, maxBytes=2^63B, id='@east' west # # there should be no bare shunts west # ipsec shuntstatus Bare Shunt list: west # # let larval state expire west # ../../guestbin/wait-for.sh --no-match ' spi 0x00000000 ' -- ../../guestbin/ipsec-kernel-state.sh west # echo done done west # # There should be FOUR IPsec SA states (two sets), all with same west # # reqid. And there should be one set of tunnel policies using the west # # configured ipsec_spd_t label, and no outgoing %trap policy west # ../../guestbin/ipsec-kernel-state.sh src 192.1.2.45 dst 192.1.2.23 proto esp spi 0xSPISPI reqid REQID mode transport replay-window 0 flag 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 sel src 192.1.2.45/32 dst 192.1.2.23/32 security context system_u:system_r:ping_t:s0:c1.c256 src 192.1.2.23 dst 192.1.2.45 proto esp spi 0xSPISPI reqid REQID mode transport replay-window 0 flag 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 sel src 192.1.2.23/32 dst 192.1.2.45/32 security context system_u:system_r:ping_t:s0:c1.c256 west # ../../guestbin/ipsec-kernel-policy.sh src 192.1.2.23/32 dst 192.1.2.45/32 security context system_u:object_r:ipsec_spd_t:s0 dir in priority PRIORITY ptype main tmpl src 0.0.0.0 dst 0.0.0.0 proto esp reqid REQID mode transport src 192.1.2.45/32 dst 192.1.2.23/32 security context system_u:object_r:ipsec_spd_t:s0 dir out priority PRIORITY ptype main tmpl src 0.0.0.0 dst 0.0.0.0 proto esp reqid REQID mode transport west # # The IKE SA should be associated with the template connection west # ipsec showstates #1: "labeled"[1] 192.1.2.23:500 ESTABLISHED_IKE_SA (established IKE SA); RETRANSMIT in XXs; REPLACE in XXs; idle; #2: "labeled"[1] 192.1.2.23:500 REKEY_IKE_I1 (sent CREATE_CHILD_SA request to rekey IKE SA); idle; #3: "labeled"[1] 192.1.2.23:500 ESTABLISHED_IKE_SA (established IKE SA); REKEY in XXs; REPLACE in XXs; newest; idle; #4: "labeled"[1][1] 192.1.2.23:500 ESTABLISHED_CHILD_SA (established Child SA); REKEY in XXs; REPLACE in XXs; newest; eroute owner; IKE SA #3; idle; #4: "labeled"[1][1] 192.1.2.23 esp.ESPSPIi@192.1.2.23 esp.ESPSPIi@192.1.2.45 Traffic: ESPin=64B ESPout=64B ESPmax=2^63B west #