/testing/guestbin/swan-prep --hostkeys
Creating NSS database containing host keys
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
"westnet-eastnet-ikev2": added IKEv2 connection
west #
 ipsec whack --impair suppress_retransmits
west #
 echo "initdone"
initdone
west #
 nft list ruleset
west #
 ipsec auto --up westnet-eastnet-ikev2
"westnet-eastnet-ikev2" #1: initiating IKEv2 connection to 192.1.2.23 using UDP
"westnet-eastnet-ikev2" #1: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
"westnet-eastnet-ikev2" #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
"westnet-eastnet-ikev2" #1: sent IKE_AUTH request to 192.1.2.23:UDP/500
"westnet-eastnet-ikev2" #1: initiator established IKE SA; authenticated peer using preloaded certificate '@east' and 2nnn-bit RSASSA-PSS with SHA2_512 digital signature
"westnet-eastnet-ikev2" #2: initiator established Child SA using #1; IPsec tunnel [192.0.1.0/24===192.0.2.0/24] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 nft list ruleset
table inet ipsec-log {
	chain input {
		type filter hook input priority filter; policy accept;
		ipsec in reqid REQID ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 counter packets 0 bytes 0 log group 50
	}
	chain output {
		type filter hook output priority filter; policy accept;
		ipsec out reqid REQID ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 counter packets 0 bytes 0 log group 50
	}
}
west #
 # suppress job monitoring; specify packet count
west #
 rm -f /tmp/nflog-50.pcap /tmp/tcpdump.log
west #
 set +m
west #
 tcpdump -c 4 -s 0 -w /tmp/nflog-50.pcap -i nflog:50 > /tmp/tcpdump.log 2>&1 & sleep 1
[x] PID
west #
 ../../guestbin/wait-for.sh --match 'listening on' -- cat /tmp/tcpdump.log
tcpdump: listening on INTERFACE DETAILS
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.0.2.254
up
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.0.2.254
up
west #
 ipsec auto --down westnet-eastnet-ikev2
"westnet-eastnet-ikev2": terminating SAs using this connection
"westnet-eastnet-ikev2" #1: sent INFORMATIONAL request to delete IKE SA
"westnet-eastnet-ikev2" #2: ESP traffic information: in=168B out=168B
"westnet-eastnet-ikev2" #1: deleting IKE SA (established IKE SA)
west #
 # wait for count to reach tcpdump then dump it
west #
 wait
west #
 cp  /tmp/nflog-50.pcap OUTPUT/nflog-50.pcap
west #
 tcpdump -n -r OUTPUT/nflog-50.pcap 2>/dev/null
IP 192.0.1.254 > 192.0.2.254: ICMP echo request, id XXXX, seq 1, length 64
IP 192.0.2.254 > 192.0.1.254: ICMP echo reply, id XXXX, seq 1, length 64
IP 192.0.1.254 > 192.0.2.254: ICMP echo request, id XXXX, seq 1, length 64
IP 192.0.2.254 > 192.0.1.254: ICMP echo reply, id XXXX, seq 1, length 64
west #
 # expect no nftables rulese
west #
 nft list ruleset
west #
 echo done
done
west #
 ../../guestbin/ipsec-kernel-state.sh
west #
 ../../guestbin/ipsec-kernel-policy.sh
west #
 nft list ruleset
west #
 ipsec stop
Redirecting to: [initsystem]
west #
 # show no nflog left behind
west #
 nft list ruleset
west #
 
