File: smoke-bind

package info (click to toggle)
pdns 5.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,824 kB
  • sloc: cpp: 101,247; sh: 5,616; makefile: 2,318; sql: 860; ansic: 675; python: 635; yacc: 245; perl: 161; lex: 131
file content (42 lines) | stat: -rwxr-xr-x 967 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
exec 2>&1
set -ex

CONFDIR="$PWD"

cat <<EOF >"$CONFDIR/named.conf"
zone "bind.example.org" { type master; file "$CONFDIR/bind.example.org.zone"; };
EOF

cat <<EOF >"$CONFDIR/bind.example.org.zone"
bind.example.org.           172800  IN      SOA     ns1.example.org. dns.example.org. 1 10800 3600 604800 3600
bind.example.org.           172800  IN      NS      ns1.example.org.
smoke.bind.example.org.     172800  IN      A       127.0.0.123
EOF

TMPFILE=$(mktemp)
cleanup() {
  rm -f "$TMPFILE"
  rm -f named.conf bind.example.org.zone
  kill $(cat pdns.pid) || true
  rm -f pdns.conf pdns.pid pdns.controlsocket
}
trap cleanup EXIT

cat <<EOF >pdns.conf
module-dir=../../modules/bindbackend/.libs/
launch=bind
bind-config=./named.conf
EOF

./launch-pdns

../../pdns/sdig 127.0.0.1 5301 smoke.bind.example.org A 2>&1 | tee "$TMPFILE"

if grep -c '127\.0\.0\.123' "$TMPFILE"; then
    echo success
else
    echo smoke could not be resolved
    exit 1
fi