File: smoke-bind

package info (click to toggle)
pdns 4.7.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,636 kB
  • sloc: cpp: 93,475; sh: 5,408; makefile: 2,232; sql: 860; ruby: 598; yacc: 228; lex: 130; ansic: 93; perl: 48; python: 4
file content (36 lines) | stat: -rwxr-xr-x 827 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
#!/bin/bash
exec 2>&1
set -ex

ZONE=bind.example.org

cat <<EOF >/etc/powerdns/named.conf
zone "$ZONE" { type master; file "/etc/powerdns/$ZONE.zone"; };
EOF

cat <<EOF >/etc/powerdns/$ZONE.zone
$ZONE.           172800  IN      SOA     ns1.example.org. dns.example.org. 1 10800 3600 604800 3600
$ZONE.           172800  IN      NS      ns1.example.org.
smoke.$ZONE.     172800  IN      A       127.0.0.222
EOF

service pdns restart
journalctl _SYSTEMD_UNIT=pdns.service -n 10 --no-pager || true

TMPFILE=$(mktemp)
cleanup() {
  rm -f "$TMPFILE"
  journalctl _SYSTEMD_UNIT=pdns.service -n 100 --no-pager || true
  service pdns stop
}
trap cleanup EXIT

dig @127.0.0.1 smoke.$ZONE 2>&1 | tee "$TMPFILE"

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