Debian Codegraph @

debian/tests/opportunistic

raw
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 grep -F "$badstring" "${AUTOPKGTEST_ARTIFACTS}/before.html"
15
16 echo "0.0.0.0/0" > /etc/ipsec.d/policies/private-or-clear
17
18 systemctl --no-pager status ipsec || true
19
20 cp /usr/share/doc/libreswan/examples/oe-dnssec-client.conf /etc/ipsec.d/
21
22 if ! systemctl restart ipsec ; then
23 printf "systemctl restart failed with %d\n" "$?"
24 systemctl status ipsec || true
25 journalctl -xe
26 fi
27
28 systemctl --no-pager status ipsec
29
30 # TODO: better details?
31 ipsec whack --trafficstatus
32
33 ping -c 5 oe.libreswan.org 2>&1
34
35 systemctl --no-pager status ipsec
36
37 # now fetch some stuff from oe.libreswan.org, make sure it's good!
38 wget -q --tries=2 --timeout=5 -O "${AUTOPKGTEST_ARTIFACTS}/after.html" http://oe.libreswan.org/
39
40 if grep -F "$badstring" "${AUTOPKGTEST_ARTIFACTS}/after.html"; then
41 printf "we got 'oh nooooooos' from http://oe.libreswan.org after bringing up opportunistic ipsec\n"
42 exit 1
43 fi
44
45 # TODO: better details?
46 ipsec whack --trafficstatus