/testing/guestbin/swan-prep
road #
 cp policies/* /etc/ipsec.d/policies/
road #
 echo "192.1.2.0/24"  >> /etc/ipsec.d/policies/private-or-clear
road #
 ipsec start
Redirecting to: [initsystem]
road #
 /testing/pluto/bin/wait-until-pluto-started
road #
 # give OE policies time to load
road #
 sleep 5
road #
 echo "initdone"
initdone
road #
 ping -n -c 1 -I 192.1.3.209 192.1.2.23
PING 192.1.2.23 (192.1.2.23) from 192.1.3.209 : 56(84) bytes of data.
--- 192.1.2.23 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time XXXX
road #
 # wait on OE retransmits and rekeying
road #
 sleep 5
road #
 # should show established tunnel and no bare shunts
road #
 ipsec whack --trafficstatus
006 #2: "private-or-clear#192.1.2.0/24"[1] ...192.1.2.23, type=ESP, add_time=1234567890, inBytes=0, outBytes=0, id='ID_NULL'
road #
 ipsec whack --shuntstatus
000 Bare Shunt list:
000  
road #
 # ping should succeed through tunnel
road #
 ping -n -c 2 -I 192.1.3.209 192.1.2.23
PING 192.1.2.23 (192.1.2.23) from 192.1.3.209 : 56(84) bytes of data.
64 bytes from 192.1.2.23: icmp_seq=1 ttl=64 time=0.XXX ms
64 bytes from 192.1.2.23: icmp_seq=2 ttl=64 time=0.XXX ms
--- 192.1.2.23 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
road #
 ipsec whack --trafficstatus
006 #2: "private-or-clear#192.1.2.0/24"[1] ...192.1.2.23, type=ESP, add_time=1234567890, inBytes=168, outBytes=168, id='ID_NULL'
road #
 # prevent delete notify
road #
 ipsec whack --impair send-no-delete
road #
 ipsec restart
Redirecting to: [initsystem]
road #
 /testing/pluto/bin/wait-until-pluto-started
road #
 # give OE policies time to load
road #
 sleep 5
road #
 ping -n -c 1 -I 192.1.3.209 192.1.2.23
PING 192.1.2.23 (192.1.2.23) from 192.1.3.209 : 56(84) bytes of data.
--- 192.1.2.23 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time XXXX
road #
 ipsec whack --trafficstatus
006 #2: "private-or-clear#192.1.2.0/24"[1] ...192.1.2.23, type=ESP, add_time=1234567890, inBytes=0, outBytes=0, id='ID_NULL'
road #
 # test the new tunnel works properly
road #
 ping -n -c 3 -I 192.1.3.209 192.1.2.23
PING 192.1.2.23 (192.1.2.23) from 192.1.3.209 : 56(84) bytes of data.
64 bytes from 192.1.2.23: icmp_seq=1 ttl=64 time=0.XXX ms
64 bytes from 192.1.2.23: icmp_seq=2 ttl=64 time=0.XXX ms
64 bytes from 192.1.2.23: icmp_seq=3 ttl=64 time=0.XXX ms
--- 192.1.2.23 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
road #
 # Now immitate a second indepdent client to east to show this 2nd client doesn't kill 1st client
road #
 killall -9 pluto
road #
 ip addr del 192.1.3.209/24 dev eth0
road #
 ip addr add 192.1.3.210/24 dev eth0
road #
 ip route add 0.0.0.0/0 via 192.1.3.254
road #
 ipsec restart
Redirecting to: [initsystem]
road #
 # wait on OE to load
road #
 sleep 5
road #
 ping -n -c 2 -I 192.1.3.210 192.1.2.23
PING 192.1.2.23 (192.1.2.23) from 192.1.3.210 : 56(84) bytes of data.
64 bytes from 192.1.2.23: icmp_seq=2 ttl=64 time=0.XXX ms
--- 192.1.2.23 ping statistics ---
2 packets transmitted, 1 received, 50% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
road #
 sleep 1
road #
 ipsec whack --trafficstatus
006 #2: "private-or-clear#192.1.2.0/24"[1] ...192.1.2.23, type=ESP, add_time=1234567890, inBytes=84, outBytes=84, id='ID_NULL'
road #
 echo done
done
road #
 # road should have one tunnel, east should have two (from both IPs road used)
road #
 ipsec whack --trafficstatus
006 #2: "private-or-clear#192.1.2.0/24"[1] ...192.1.2.23, type=ESP, add_time=1234567890, inBytes=84, outBytes=84, id='ID_NULL'
road #
 # check for a counting bug where total SA's is wrong on east
road #
 ipsec status | grep 'authenticated'
000 IKE SAs: total(1), half-open(0), open(0), authenticated(0), anonymous(1)
000 IPsec SAs: total(1), authenticated(0), anonymous(1)
road #
 # verify no packets were dropped due to missing SPD policies
road #
 grep -v -P "\t0$" /proc/net/xfrm_stat
XfrmOutNoStates         	3
road #
 ../bin/check-for-core.sh
road #
 if [ -f /sbin/ausearch ]; then ausearch -r -m avc -ts recent ; fi

