| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -e |
| 4 |
# fetch some stuff from oe.libreswan.org, make sure it's bad: |
| 5 |
|
| 6 |
badstring='<HTML><BODY><HEAD><TITLE>OH noooooos!!</TITLE>' |
| 7 |
|
| 8 |
ping -c 5 oe.libreswan.org 2>&1 |
| 9 |
|
| 10 |
dig +short -x `dig +short oe.libreswan.org` ipseckey +trusted-key=/usr/share/dns/root.key +sigchase |
| 11 |
|
| 12 |
wget -q --tries=2 --timeout=5 -O "${AUTOPKGTEST_ARTIFACTS}/before.html" http://oe.libreswan.org/ |
| 13 |
|
| 14 |
echo "0.0.0.0/0" > /etc/ipsec.d/policies/private-or-clear |
| 15 |
|
| 16 |
grep -F "$badstring" "${AUTOPKGTEST_ARTIFACTS}/before.html" |
| 17 |
|
| 18 |
systemctl status ipsec |
| 19 |
|
| 20 |
cp /usr/share/doc/libreswan/examples/oe-dnssec-client.conf /etc/ipsec.d/ |
| 21 |
|
| 22 |
systemctl restart ipsec |
| 23 |
|
| 24 |
systemctl status ipsec |
| 25 |
|
| 26 |
# TODO: better details? |
| 27 |
ipsec whack --trafficstatus |
| 28 |
|
| 29 |
ping -c 5 oe.libreswan.org 2>&1 |
| 30 |
|
| 31 |
systemctl status ipsec |
| 32 |
|
| 33 |
# now fetch some stuff from oe.libreswan.org, make sure it's good! |
| 34 |
wget -q --tries=2 --timeout=5 -O "${AUTOPKGTEST_ARTIFACTS}/after.html" http://oe.libreswan.org/ |
| 35 |
|
| 36 |
if grep -F "$badstring" "${AUTOPKGTEST_ARTIFACTS}/after.html"; then |
| 37 |
printf "we got 'oh nooooooos' from http://oe.libreswan.org after bringing up opportunistic ipsec\n" |
| 38 |
exit 1 |
| 39 |
fi |
| 40 |
|
| 41 |
# TODO: better details? |
| 42 |
ipsec whack --trafficstatus |