/testing/guestbin/swan-prep
west #
 ip addr add 192.0.100.254/24 dev eth0:1
west #
 ip route add 192.0.200.0/24 via 192.1.2.23  dev eth1
west #
 # ensure that clear text does not get through
west #
 iptables -A INPUT -i eth1 -s 192.0.2.0/24 -j DROP
west #
 iptables -A INPUT -i eth1 -s 192.0.200.0/24 -j DROP
west #
 iptables -I INPUT -m policy --dir in --pol ipsec -j ACCEPT
west #
 ipsec start
Redirecting to: [initsystem]
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec whack --impair suppress-retransmits
west #
 ipsec auto --add westnet-eastnet-ikev2a
002 "westnet-eastnet-ikev2a": added IKEv2 connection
west #
 ipsec auto --add westnet-eastnet-ikev2b
002 "westnet-eastnet-ikev2b": added IKEv2 connection
west #
 ipsec auto --add westnet-eastnet-ikev2c
002 "westnet-eastnet-ikev2c": added IKEv2 connection
west #
 echo "initdone"
initdone
west #
 ipsec auto --up westnet-eastnet-ikev2a
1v2 "westnet-eastnet-ikev2a" #1: initiating IKEv2 connection
1v2 "westnet-eastnet-ikev2a" #1: sent IKE_SA_INIT request to 192.1.2.23:500
1v2 "westnet-eastnet-ikev2a" #1: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "westnet-eastnet-ikev2a" #1: initiator established IKE SA; authenticated peer using authby=secret and ID_FQDN '@east'
004 "westnet-eastnet-ikev2a" #2: initiator established Child SA using #1; IPsec tunnel [192.0.1.0-192.0.1.255:0-65535 0] -> [192.0.2.0-192.0.2.255:0-65535 0] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 ping -n -q -w 1 -c 4 -I 192.0.1.254 192.0.2.254
PING 192.0.2.254 (192.0.2.254) from 192.0.1.254 : 56(84) bytes of data.
--- 192.0.2.254 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
west #
 # These two conns are mismatched and should fail
west #
 # The whack should release the socket on receiving NO_PROPOSAL_CHOSEN
west #
 ipsec auto --up westnet-eastnet-ikev2b
002 "westnet-eastnet-ikev2b" #3: initiating Child SA using IKE SA #1
1v2 "westnet-eastnet-ikev2b" #3: sent CREATE_CHILD_SA request for new IPsec SA
003 "westnet-eastnet-ikev2b" #3: CREATE_CHILD_SA failed with error notification TS_UNACCEPTABLE
200 "westnet-eastnet-ikev2b" #3: state transition 'initiate create Child SA (CREATE_CHILD_SA)' failed
west #
 ipsec auto --up westnet-eastnet-ikev2c
002 "westnet-eastnet-ikev2c" #4: initiating Child SA using IKE SA #1
1v2 "westnet-eastnet-ikev2c" #4: sent CREATE_CHILD_SA request for new IPsec SA
003 "westnet-eastnet-ikev2c" #4: CREATE_CHILD_SA failed with error notification TS_UNACCEPTABLE
200 "westnet-eastnet-ikev2c" #4: state transition 'initiate create Child SA (CREATE_CHILD_SA)' failed
west #
 #
west #
 # should see westnet-eastnet-ikev2b expiring
west #
 # should see westnet-eastnet-ikev2c replacing
west #
 ipsec auto --delete westnet-eastnet-ikev2a
002 "westnet-eastnet-ikev2a": terminating SAs using this connection
002 "westnet-eastnet-ikev2a" #1: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and sending notification
005 "westnet-eastnet-ikev2a" #2: ESP traffic information: in=84B out=84B
west #
 ipsec status | grep westnet-eastnet
000 "westnet-eastnet-ikev2b": 192.0.1.0/24===192.1.2.45[@west]...192.1.2.23[@east]===192.0.200.0/24; unrouted; eroute owner: #0
000 "westnet-eastnet-ikev2b":     oriented; my_ip=unset; their_ip=unset; my_updown=ipsec _updown;
000 "westnet-eastnet-ikev2b":   xauth us:none, xauth them:none,  my_username=[any]; their_username=[any]
000 "westnet-eastnet-ikev2b":   our auth:secret, their auth:secret, our autheap:none, their autheap:none;
000 "westnet-eastnet-ikev2b":   modecfg info: us:none, them:none, modecfg policy:push, dns:unset, domains:unset, cat:unset;
000 "westnet-eastnet-ikev2b":   sec_label:unset;
000 "westnet-eastnet-ikev2b":   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 "westnet-eastnet-ikev2b":   retransmit-interval: 9999ms; retransmit-timeout: 99s; iketcp:no; iketcp-port:4500;
000 "westnet-eastnet-ikev2b":   initial-contact:no; cisco-unity:no; fake-strongswan:no; send-vendorid:no; send-no-esp-tfc:no;
000 "westnet-eastnet-ikev2b":   policy: IKEv2+PSK+ENCRYPT+TUNNEL+DONT_REKEY+UP+IKE_FRAG_ALLOW+ESN_NO+ESN_YES;
000 "westnet-eastnet-ikev2b":   v2-auth-hash-policy: none;
000 "westnet-eastnet-ikev2b":   conn_prio: 24,24; interface: eth1; metric: 0; mtu: unset; sa_prio:auto; sa_tfc:none;
000 "westnet-eastnet-ikev2b":   nflog-group: unset; mark: unset; vti-iface:unset; vti-routing:no; vti-shared:no; nic-offload:auto;
000 "westnet-eastnet-ikev2b":   our idtype: ID_FQDN; our id=@west; their idtype: ID_FQDN; their id=@east
000 "westnet-eastnet-ikev2b":   liveness: passive; dpdaction:hold; dpddelay:0s; retransmit-timeout:60s
000 "westnet-eastnet-ikev2b":   nat-traversal: encaps:auto; keepalive:20s
000 "westnet-eastnet-ikev2b":   newest IKE SA: #0; newest IPsec SA: #0; conn serial: $2;
000 "westnet-eastnet-ikev2c": 192.0.1.0/24===192.1.2.45[@west]...192.1.2.23[@east]===192.0.201.0/24; unrouted; eroute owner: #0
000 "westnet-eastnet-ikev2c":     oriented; my_ip=unset; their_ip=unset; my_updown=ipsec _updown;
000 "westnet-eastnet-ikev2c":   xauth us:none, xauth them:none,  my_username=[any]; their_username=[any]
000 "westnet-eastnet-ikev2c":   our auth:secret, their auth:secret, our autheap:none, their autheap:none;
000 "westnet-eastnet-ikev2c":   modecfg info: us:none, them:none, modecfg policy:push, dns:unset, domains:unset, cat:unset;
000 "westnet-eastnet-ikev2c":   sec_label:unset;
000 "westnet-eastnet-ikev2c":   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 "westnet-eastnet-ikev2c":   retransmit-interval: 9999ms; retransmit-timeout: 99s; iketcp:no; iketcp-port:4500;
000 "westnet-eastnet-ikev2c":   initial-contact:no; cisco-unity:no; fake-strongswan:no; send-vendorid:no; send-no-esp-tfc:no;
000 "westnet-eastnet-ikev2c":   policy: IKEv2+PSK+ENCRYPT+TUNNEL+UP+IKE_FRAG_ALLOW+ESN_NO+ESN_YES;
000 "westnet-eastnet-ikev2c":   v2-auth-hash-policy: none;
000 "westnet-eastnet-ikev2c":   conn_prio: 24,24; interface: eth1; metric: 0; mtu: unset; sa_prio:auto; sa_tfc:none;
000 "westnet-eastnet-ikev2c":   nflog-group: unset; mark: unset; vti-iface:unset; vti-routing:no; vti-shared:no; nic-offload:auto;
000 "westnet-eastnet-ikev2c":   our idtype: ID_FQDN; our id=@west; their idtype: ID_FQDN; their id=@east
000 "westnet-eastnet-ikev2c":   liveness: passive; dpdaction:hold; dpddelay:0s; retransmit-timeout:60s
000 "westnet-eastnet-ikev2c":   nat-traversal: encaps:auto; keepalive:20s
000 "westnet-eastnet-ikev2c":   newest IKE SA: #0; newest IPsec SA: #0; conn serial: $3;
west #
 echo done
done
west #
 
