Debian Codegraph @

debian/tests/runzones

raw symbols SCIP
1 #! /bin/sh
2 set -e
3
4 export PATH=/usr/bin:/bin:/usr/sbin:/sbin
5 cd "$AUTOPKGTEST_TMP"
6
7 doit() {
8 echo "-- $1: --"
9 shift
10 "$@"
11 echo "-- ok --"
12 }
13
14 #echo Checking unbound help text and version number:
15 # it exits nonzero with -h
16 #unbound -h || :
17 #echo "---"
18
19 doit "Checking www.debian.org with unbound-host and DNSSEC" \
20 unbound-host -D www.debian.org. -d -d 2>&1
21
22 cat >unbound.conf <<EOF
23 server:
24 verbosity: 2
25 directory: "$AUTOPKGTEST_TMP"
26 logfile: unbound.log
27 username: ""
28 chroot: ""
29 pidfile: unbound.pid
30 port: 1053
31 interface: 127.0.0.1
32 so-sndbuf: 0
33 remote-control:
34 control-enable: yes
35 control-interface: "$AUTOPKGTEST_TMP/unbound.ctl"
36 EOF
37
38 doit "Checking config file with unbound-checkconf" \
39 unbound-checkconf unbound.conf
40
41 > unbound.log
42 > unbound.pid
43
44 trap 'echo Cleaning up
45 if [ -f unbound.pid ]; then
46 kill $(cat unbound.pid); sleep 1
47 fi
48 echo -- unbound.log:
49 cat unbound.log
50 ' 0
51
52 # If apparmor is available, run with unconfined profile
53 aaexec=
54 if command -v aa-exec >/dev/null; then
55 aaexec="aa-exec -p unconfined"
56 fi
57
58 doit "Attempting to start daemon" \
59 ${aaexec} unbound -c unbound.conf
60 sleep 1
61 if [ -f unbound.pid ]; then
62 read pid < unbound.pid || :
63 echo unbound pid = $pid
64 else
65 echo "Warning: no unbound.pid file, condinuing anyway"
66 fi
67
68 doit "Checking status of running daemon" \
69 unbound-control -c unbound.conf status
70
71 doit "Checking for localhost. using dnsget" \
72 dnsget -o port:1053 -n 127.0.0.1 -v localhost.
73
74 localhost_127() {
75 ip=$(dnsget -o port:1053 -n 127.0.0.1 -q localhost.)
76 case "$ip" in
77 127.0.0.1) echo "localhost is $ip" ;;
78 *) echo "localhost. is $ip which is NOT 127.0.0.1"; return 1;;
79 esac
80 }
81 doit "Checking for localhost. to be 127.0.0.1" \
82 localhost_127
83
84 doit "Checking for www.debian.org with DNSSEC" \
85 dnsget -o port:1053 -n 127.0.0.1 -o do -v www.debian.org.
86
87 nxdomain_dnsget() {
88 dnsget -o port:1053 -n 127.0.0.1 "$@" 2>&1 || [ $? = 100 ]
89 }
90 doit "Checking for unknown-nosuchname.debian.org, should be NXDOMAIN" \
91 nxdomain_dnsget -v unknown.debian.org.
92
93 doit "Stopping the daemon" \
94 unbound-control -c unbound.conf stop
95
96 trap "" 0
97
98 exit 0