/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 #
 /testing/pluto/bin/wait-until-pluto-started
road #
 ipsec auto --add westnet-eastnet-ipv4-psk-ikev2
002 added IKEv2 connection "westnet-eastnet-ipv4-psk-ikev2"
road #
 ipsec whack --impair suppress-retransmits
road #
 echo "initdone"
initdone
road #
 ipsec auto --up westnet-eastnet-ipv4-psk-ikev2
1v2 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: initiating IKEv2 connection
1v2 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: sent IKE_SA_INIT request
1v2 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: sent IKE_AUTH request {auth=IKEv2 cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: IKEv2 mode peer ID is ID_FQDN: '@east'
003 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: authenticated using authby=secret
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: received INTERNAL_IP4_ADDRESS 100.64.0.1
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: received INTERNAL_IP4_DNS 1.2.3.4
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: received INTERNAL_IP4_DNS 8.8.8.8
005 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: Received INTERNAL_DNS_DOMAIN: test.tld
002 "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 8.8.8.8
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: ok
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: ok removed 0 rrsets, 0 messages and 0 key entries
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: up-client output: ok
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: negotiated connection [100.64.0.1-100.64.0.1:0-65535 0] -> [0.0.0.0-255.255.255.255:0-65535 0]
004 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: IPsec SA established tunnel mode {ESPinUDP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=192.1.2.23:4500 DPD=passive}
road #
 ipsec whack --trafficstatus
006 #2: "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23, type=ESP, add_time=1234567890, inBytes=0, outBytes=0, 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
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23: terminating SAs using this connection
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: deleting state (STATE_V2_ESTABLISHED_CHILD_SA) and sending notification
005 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: ESP traffic information: in=0B out=0B
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: flushing local nameserver of test.tld
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: ok
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: ok removed 0 rrsets, 0 messages and 0 key entries
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #2: down-client output: ok
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23 #1: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and sending notification
002 "westnet-eastnet-ipv4-psk-ikev2"[1] 192.1.2.23: deleting connection instance with peer 192.1.2.23
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 #
 /testing/pluto/bin/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
003 pluto is running with seccomp=enabled! pluto is expected to die!
003 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 
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 #
 ../bin/check-for-core.sh
road #
 if [ -f /sbin/ausearch ]; then ausearch -r -m avc -ts recent ; fi
road #
 
