/testing/guestbin/swan-prep
road #
 # just start it so we try some resolv.conf rewriting
road #
 cp road-unbound.conf /etc/unbound/unbound.conf
road #
 unbound-control-setup > /dev/null 2>&1
road #
 unbound
road #
 ipsec start
Redirecting to: [initsystem]
road #
 ../../guestbin/wait-until-pluto-started
road #
 ipsec auto --add westnet-eastnet-ipv4-psk-ikev2
"westnet-eastnet-ipv4-psk-ikev2": added IKEv2 connection
road #
 ipsec whack --impair suppress_retransmits
road #
 echo "initdone"
initdone
road #
 ipsec auto --up westnet-eastnet-ipv4-psk-ikev2
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: initiating IKEv2 connection to 192.1.2.23 using UDP
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: processed IKE_SA_INIT response from 192.1.2.23:UDP/4500 {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=DH19}, initiating IKE_AUTH
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: sent IKE_AUTH request to 192.1.2.23:UDP/4500 with shared-key-mac and FQDN '@road'; Child SA #2 {ESPinUDP <0xESPESP}
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: initiator established IKE SA; authenticated peer using authby=secret and FQDN '@east'
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: received INTERNAL_IP4_ADDRESS 100.64.0.1
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: received INTERNAL_IP4_DNS server address 1.2.3.4
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: received INTERNAL_IP4_DNS server address 8.8.8.8
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: received INTERNAL_DNS_DOMAIN 'test.tld'
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: updating local nameserver for test.tld with 1.2.3.4 1.2.3.4 8.8.8.8
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: ok
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: ok removed 0 rrsets, 0 messages and 0 key entries
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: ok
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: updating local nameserver for test.tld with 1.2.3.4 1.2.3.4 8.8.8.8
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: ok
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: ok removed 0 rrsets, 0 messages and 0 key entries
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: ok
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: initiator established Child SA using #1; IPsec tunnel [100.64.0.1/32===0.0.0.0/0] {ESPinUDP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATD=192.1.2.23:4500 DPD=passive}
road #
 ipsec whack --trafficstatus
#2: "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23, type=ESP, add_time=1234567890, inBytes=0, outBytes=56, maxBytes=2^63B, id='@east', lease=100.64.0.1/32
road #
 sleep 5
road #
 # confirm we updated unbound - should not be empty once DNS CP is
road #
 # added
road #
 unbound-control list_forwards
test.tld. IN forward 8.8.8.8 1.2.3.4
road #
 ipsec auto --down westnet-eastnet-ipv4-psk-ikev2
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23: initiating delete of connection's IKE SA #1 (and Child SA #2)
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: sent INFORMATIONAL request to delete IKE SA
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: flushing local nameserver of test.tld
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: ok
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: ok removed 0 rrsets, 0 messages and 0 key entries
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: ok
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: flushing local nameserver of test.tld
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: ok
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: ok removed 0 rrsets, 0 messages and 0 key entries
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: ok
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: ESP traffic information: in=0B out=56B
"westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: deleting IKE SA (established IKE SA)
road #
 # try some things to trigger new syscalls
road #
 ipsec status > /dev/null
road #
 ipsec whack --listen > /dev/null
road #
 ipsec whack --globalstatus > /dev/null
road #
 ipsec whack --shuntstatus > /dev/null
road #
 ipsec secrets > /dev/null
road #
 ipsec auto --delete westnet-eastnet-ipv4-psk-ikev2
road #
 ipsec stop
Redirecting to: [initsystem]
road #
 # ensure seccomp did not kill pluto - should not show any hits
road #
 ausearch -ts recent -i -m SECCOMP
<no matches>
road #
 # Test seccomp actually works - that it records pluto crashing ....
road #
 ipsec start
Redirecting to: [initsystem]
road #
 ../../guestbin/wait-until-pluto-started
road #
 # Since whack hangs - it does not know that pluto died - run it in the
road #
 # background.  Give it a few seconds to do its job.
road #
 ipsec whack --seccomp-crashtest & sleep 2
[x] PID
pluto is running with seccomp=enabled! pluto is expected to die!
Performing seccomp security test using getsid() syscall
road #
 # should show 1 entry of pluto crashing now
road #
 ausearch -ts recent -i -m SECCOMP | sed -e "s/ ip=[^ ]* / ip=XXX /" -e "s/ pid=[^ ]* / pid=XXX /" -e "s/msg=audit(.*) /msg=audit(XXX) /"
----
type=SECCOMP msg=audit(XXX) : auid=unset uid=root gid=root ses=unset subj=system_u:system_r:unconfined_service_t:s0 pid=XXX comm=pluto exe=PATH/libexec/ipsec/pluto sig=SIGSYS arch=x86_64 syscall=getsid compat=0 ip=XXX code=kill-thread 
road #
 echo done
done
road #
 # seccomp test for east should be empty
road #
 hostname | grep east > /dev/null && ausearch -ts recent -i -m SECCOMP
road #
 if [ -f /sbin/ausearch ]; then ausearch -r -m avc -ts recent ; fi
