| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | set -e |
| 3 | |
| 4 | export PATH=/usr/bin:/bin:/usr/sbin:/sbinscip-shell filesystem . . `/usr/bin:/bin:/usr/sbin:/sbin`. |
| 5 | cd "$AUTOPKGTEST_TMP" |
| 6 | |
| 7 | doitscip-shell shell unbound 1.25.1-1 doit().() { |
| 8 | echoscip-shell system . . echo. "-- $1: --" |
| 9 | shift |
| 10 | "$@" |
| 11 | echoscip-shell system . . 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 | doitscip-shell shell unbound 1.25.1-1 doit(). "Checking www.debian.org with unbound-host and DNSSEC" \ |
| 20 | unbound-host -D www.debian.org. -d -d 2>&1 |
| 21 | |
| 22 | catscip-shell system . . 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 | doitscip-shell shell unbound 1.25.1-1 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/nullscip-shell filesystem . . `/dev/null`.; then |
| 55 | aaexec="aa-exec -p unconfined" |
| 56 | fi |
| 57 | |
| 58 | doitscip-shell shell unbound 1.25.1-1 doit(). "Attempting to start daemon" \ |
| 59 | ${aaexec} unbound -c unbound.conf |
| 60 | sleepscip-shell system . . sleep. 1 |
| 61 | if [scip-shell system . . `[`. -f unbound.pid ]; then |
| 62 | read pid < unbound.pid || : |
| 63 | echoscip-shell system . . echo. unbound pid = $pid |
| 64 | else |
| 65 | echoscip-shell system . . echo. "Warning: no unbound.pid file, condinuing anyway" |
| 66 | fi |
| 67 | |
| 68 | doitscip-shell shell unbound 1.25.1-1 doit(). "Checking status of running daemon" \ |
| 69 | unbound-control -c unbound.conf status |
| 70 | |
| 71 | doitscip-shell shell unbound 1.25.1-1 doit(). "Checking for localhost. using dnsget" \ |
| 72 | dnsget -o port:1053 -n 127.0.0.1 -v localhost. |
| 73 | |
| 74 | localhost_127scip-shell shell unbound 1.25.1-1 localhost_127().() { |
| 75 | ip=$(dnsget -o port:1053 -n 127.0.0.1 -q localhost.) |
| 76 | case "$ip" in |
| 77 | 127.0.0.1) echoscip-shell system . . echo. "localhost is $ip" ;; |
| 78 | *) echoscip-shell system . . echo. "localhost. is $ip which is NOT 127.0.0.1"; return 1;; |
| 79 | esac |
| 80 | } |
| 81 | doitscip-shell shell unbound 1.25.1-1 doit(). "Checking for localhost. to be 127.0.0.1" \ |
| 82 | localhost_127 |
| 83 | |
| 84 | doitscip-shell shell unbound 1.25.1-1 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_dnsgetscip-shell shell unbound 1.25.1-1 nxdomain_dnsget().() { |
| 88 | dnsget -o port:1053 -n 127.0.0.1 "$@" 2>&1 || [scip-shell system . . `[`. $? = 100 ] |
| 89 | } |
| 90 | doitscip-shell shell unbound 1.25.1-1 doit(). "Checking for unknown-nosuchname.debian.org, should be NXDOMAIN" \ |
| 91 | nxdomain_dnsget -v unknown.debian.org. |
| 92 | |
| 93 | doitscip-shell shell unbound 1.25.1-1 doit(). "Stopping the daemon" \ |
| 94 | unbound-control -c unbound.conf stop |
| 95 | |
| 96 | trap "" 0 |
| 97 | |
| 98 | exit 0 |