/testing/guestbin/swan-prep --hostkeys
Creating NSS database containing host keys
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 #
 # ensure that clear text does not get through
west #
 ../../guestbin/nftable-westneteastnet-ipsec-only.nft
west #
 # confirm clear text does not get through
west #
 ../../guestbin/ping-once.sh --down -I 192.0.1.254 192.0.2.254
down
west #
 ipsec start
Redirecting to: [initsystem]
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec auto --add westnet-eastnet-nflog
"westnet-eastnet-nflog": added IKEv1 connection
west #
 ipsec auto --add west-east-nflog
"west-east-nflog": added IKEv1 connection
west #
 echo "initdone"
initdone
west #
 nft list ruleset
table ip filter {
	chain input {
		type filter hook input priority filter; policy accept;
		meta ipsec exists ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 accept
		ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 drop
	}
	chain output {
		type filter hook output priority filter; policy accept;
		rt ipsec exists ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 accept
		ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 drop
	}
}
west #
 ipsec auto --up westnet-eastnet-nflog
"westnet-eastnet-nflog" #1: initiating IKEv1 Main Mode connection
"westnet-eastnet-nflog" #1: sent Main Mode request
"westnet-eastnet-nflog" #1: sent Main Mode I2
"westnet-eastnet-nflog" #1: sent Main Mode I3
"westnet-eastnet-nflog" #1: Peer ID is FQDN: '@east'
"westnet-eastnet-nflog" #1: authenticated peer using preloaded certificate '@east' and 2nnn-bit RSA with SHA1 signature
"westnet-eastnet-nflog" #1: ISAKMP SA established {auth=RSA_SIG cipher=AES_CBC_256 integ=HMAC_SHA2_256 group=MODP2048}
"westnet-eastnet-nflog" #2: initiating Quick Mode IKEv1+RSASIG+ENCRYPT+TUNNEL+PFS+UP+IKE_FRAG_ALLOW+ESN_NO+ESN_YES {using isakmp#1 msgid:MSGID proposal=AES_CBC-HMAC_SHA1_96, AES_CBC-HMAC_SHA2_512_256, AES_CBC-HMAC_SHA2_256_128, AES_GCM_16_128-NONE, AES_GCM_16_256-NONE, 3DES_CBC-HMAC_SHA1_96, 3DES_CBC-HMAC_SHA2_512_256, 3DES_CBC-HMAC_SHA2_256_128 pfsgroup=MODP2048 192.0.1.0/24===192.0.2.0/24}
"westnet-eastnet-nflog" #2: sent Quick Mode request
"westnet-eastnet-nflog" #2: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_CBC_128-HMAC_SHA1_96 DPD=passive}
west #
 nft list ruleset
table ip filter {
	chain input {
		type filter hook input priority filter; policy accept;
		meta ipsec exists ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 accept
		ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 drop
	}
	chain output {
		type filter hook output priority filter; policy accept;
		rt ipsec exists ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 accept
		ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 drop
	}
}
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 13
	}
	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 13
	}
}
west #
 ipsec auto --up west-east-nflog
"west-east-nflog" #3: initiating Quick Mode IKEv1+RSASIG+ENCRYPT+TUNNEL+PFS+UP+IKE_FRAG_ALLOW+ESN_NO+ESN_YES {using isakmp#1 msgid:MSGID proposal=AES_CBC-HMAC_SHA1_96, AES_CBC-HMAC_SHA2_512_256, AES_CBC-HMAC_SHA2_256_128, AES_GCM_16_128-NONE, AES_GCM_16_256-NONE, 3DES_CBC-HMAC_SHA1_96, 3DES_CBC-HMAC_SHA2_512_256, 3DES_CBC-HMAC_SHA2_256_128 pfsgroup=MODP2048}
"west-east-nflog" #3: sent Quick Mode request
"west-east-nflog" #3: IPsec SA established tunnel mode {ESP=>0xESPESP <0xESPESP xfrm=AES_CBC_128-HMAC_SHA1_96 DPD=passive}
west #
 nft list ruleset
table ip filter {
	chain input {
		type filter hook input priority filter; policy accept;
		meta ipsec exists ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 accept
		ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 drop
	}
	chain output {
		type filter hook output priority filter; policy accept;
		rt ipsec exists ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 accept
		ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 drop
	}
}
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 13
		ipsec in reqid REQID ip saddr 192.1.2.23 ip daddr 192.1.2.45 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 13
		ipsec out reqid REQID ip saddr 192.1.2.45 ip daddr 192.1.2.23 counter packets 0 bytes 0 log group 50
	}
}
west #
 # suppress job monitoring; specify packet count
west #
 ../../guestbin/tcpdump.sh --start -c 4 -i nflog:50
tcpdump started
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.1.2.23
up
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.0.2.254
up
west #
 ../../guestbin/ping-once.sh --up -I 192.1.2.45 192.1.2.23
up
west #
 ../../guestbin/ping-once.sh --up -I 192.0.1.254 192.0.2.254
up
west #
 ipsec auto --down westnet-eastnet-nflog
"westnet-eastnet-nflog": initiating delete of connection's IPsec SA #2 using ISAKMP SA #1
"westnet-eastnet-nflog": note: connection's ISAKMP SA #1 will remain up: in-use by "west-east-nflog" #3
"westnet-eastnet-nflog" #2: deleting IPsec SA (QUICK_I2) and sending notification using ISAKMP SA #1
"westnet-eastnet-nflog" #2: ESP traffic information: in=168B out=168B
west #
 nft list ruleset
table ip filter {
	chain input {
		type filter hook input priority filter; policy accept;
		meta ipsec exists ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 accept
		ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 drop
	}
	chain output {
		type filter hook output priority filter; policy accept;
		rt ipsec exists ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 accept
		ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 drop
	}
}
table inet ipsec-log {
	chain input {
		type filter hook input priority filter; policy accept;
		ipsec in reqid REQID ip saddr 192.1.2.23 ip daddr 192.1.2.45 counter packets 2 bytes 168 log group 50
	}
	chain output {
		type filter hook output priority filter; policy accept;
		ipsec out reqid REQID ip saddr 192.1.2.45 ip daddr 192.1.2.23 counter packets 2 bytes 168 log group 50
	}
}
west #
 ipsec auto --down west-east-nflog
"west-east-nflog": initiating delete of connection's IPsec SA #3 and ISAKMP SA #1
"west-east-nflog" #3: deleting IPsec SA (QUICK_I2) and sending notification using ISAKMP SA "westnet-eastnet-nflog" #1
"west-east-nflog" #3: ESP traffic information: in=168B out=168B
"westnet-eastnet-nflog" #1: deleting ISAKMP SA (MAIN_I4) and sending notification
west #
 nft list ruleset
table ip filter {
	chain input {
		type filter hook input priority filter; policy accept;
		meta ipsec exists ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 accept
		ip saddr 192.0.2.0/24 ip daddr 192.0.1.0/24 drop
	}
	chain output {
		type filter hook output priority filter; policy accept;
		rt ipsec exists ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 accept
		ip saddr 192.0.1.0/24 ip daddr 192.0.2.0/24 drop
	}
}
table inet ipsec-log {
	chain input {
		type filter hook input priority filter; policy accept;
		ipsec in reqid REQID ip saddr 192.1.2.23 ip daddr 192.1.2.45 counter packets 2 bytes 168 log group 50
	}
	chain output {
		type filter hook output priority filter; policy accept;
		ipsec out reqid REQID ip saddr 192.1.2.45 ip daddr 192.1.2.23 counter packets 2 bytes 168 log group 50
	}
}
west #
 # wait for count to reach tcpdump then dump it
west #
 ../../guestbin/tcpdump.sh --wait -i nflog:50 --
reading from file OUTPUT/west.nflog-03-conns.nflog.50.tcpdump.pcap, link-type NFLOG (Linux netfilter log messages)
IP 192.1.2.45 > 192.1.2.23: ICMP echo request, id XXXX, seq 1, length 64
IP 192.1.2.23 > 192.1.2.45: ICMP echo reply, id XXXX, seq 1, length 64
IP 192.1.2.45 > 192.1.2.23: ICMP echo request, id XXXX, seq 1, length 64
IP 192.1.2.23 > 192.1.2.45: ICMP echo reply, id XXXX, seq 1, length 64
west #
 echo done
done
west #
 ipsec _kernel state
west #
 ipsec _kernel policy
west #
 ipsec stop
Redirecting to: [initsystem]
west #
 # show no nflog left behind
west #
 iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
west #
