for zone in $(grep 'zone ' "${rootPath}/../../regression-tests/named.conf" | cut -f2 -d\" | grep -v '^nztest.com$')
do
if [ "$zone" != "." ]; then
- $PDNSUTIL --config-dir="${workdir}" --config-name=lmdb list-zone $zone
+ $PDNSUTIL -q --config-dir="${workdir}" --config-name=lmdb list-zone $zone
fi
done
rm -r $workdir
*.w4.example.com 120 IN CNAME x.y.z.w5.example.com.
*.w5.example.com 120 IN A 1.2.3.5
www.example.com 120 IN CNAME outpost.example.com.
-WARNING: local files have been created as a result of this operation.
-Be sure to check the files owner, group and permission to make sure that
-the authoritative server can correctly use them.
$ORIGIN .
test.com 3600 IN NS ns1.test.com.
test.com 3600 IN NS ns2.test.com.
*.w4.example.com 120 IN CNAME x.y.z.w5.example.com.
*.w5.example.com 120 IN A 1.2.3.5
www.example.com 120 IN CNAME outpost.example.com.
-WARNING: local files have been created as a result of this operation.
-Be sure to check the files owner, group and permission to make sure that
-the authoritative server can correctly use them.
$ORIGIN .
test.com 3600 IN NS ns1.test.com.
test.com 3600 IN NS ns2.test.com.
start_slave ()
{
- skipreasons="$skipreasons presigned nodyndns"
+ skipreasons="$skipreasons presigned nodyndns slave"
case $presignedcontext in
bind*)
launch=lmdb
lmdb-filename=./pdns.lmdb
lmdb-random-ids=yes
+edns-subnet-processing
+views=yes
__EOF__
rm -f pdns.lmdb*
$RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb set-options-json tsig.com '{"producer":{"group":["pdns-group-x","pdns-group-y"]}}'
fi
+ for variant in foo bar
+ do
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb create-zone example.com..$variant
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb list-all-zones
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb show-zone example.com..$variant
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb add-record example.com..$variant '' TXT '"hello from the '$variant' variant"'
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb add-record example.com..$variant cname CNAME target.example.org
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb add-record example.com..$variant cname-nxd CNAME nxd.example.org
+ done
+
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb view-add-zone view1 example.com..foo
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb view-add-zone view2 example.com..bar
+
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb create-zone example.org..foo
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb add-record example.org..foo target TXT '"hello from target..foo"'
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb view-add-zone view1 example.org..foo
+
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb network-set 192.0.2.0/24 view1
+ $RUNWRAPPER_PDNSUTIL $PDNSUTIL --config-dir=. --config-name=lmdb network-set 192.0.2.0/25 view2
+
$RUNWRAPPER $PDNS --loglevel=7 --daemon=no --local-address=$address --local-port=$port --config-dir=. \
--config-name=lmdb --socket-dir=./ --no-shuffle \
--dnsupdate=no \
# Invocations which will output zone contents are passed through sort(1), as
# the order of entries for records having multiple entries is backend-specific
# and not guaranteed to be in any particular order.
-$PDNSUTIL --config-dir=. --config-name=$backend \
- create-zone bug.less \
- > /dev/null 2>&1
-$PDNSUTIL --config-dir=. --config-name=$backend \
- add-record bug.less cname CNAME host \
- 2>&1 | grep -v Ueber
-$PDNSUTIL --config-dir=. --config-name=$backend \
- add-record bug.less host A 127.0.0.1 \
- 2>&1 | grep -v Ueber
+
+pdnsutil_wrapper() {
+$PDNSUTIL --config-dir=. --config-name=$backend $* 2>&1 | egrep -v 'destructor'
+}
+
+pdnsutil_wrapper create-zone bug.less > /dev/null
+pdnsutil_wrapper add-record bug.less cname CNAME host
+pdnsutil_wrapper add-record bug.less host A 127.0.0.1
# Duplicate records should be omitted
-$PDNSUTIL --config-dir=. --config-name=$backend \
- add-record bug.less host2 A 127.0.0.2 127.0.0.2 \
- 2>&1 | LC_ALL=C sort | grep -v Ueber
+pdnsutil_wrapper add-record bug.less host2 A 127.0.0.2 127.0.0.2
# Can't add non-CNAME record to a CNAME record
-$PDNSUTIL --config-dir=. --config-name=$backend \
- add-record bug.less cname A 127.0.0.1 \
- 2>&1 | grep -v Ueber
+pdnsutil_wrapper add-record bug.less cname A 127.0.0.1
# Can't add CNAME record if other records exist
-$PDNSUTIL --config-dir=. --config-name=$backend \
- add-record bug.less host CNAME host2 \
- 2>&1 | grep -v Ueber
+pdnsutil_wrapper add-record bug.less host CNAME host2
# Adding existing record should ignore duplicates
-$PDNSUTIL --config-dir=. --config-name=$backend \
- add-record bug.less host2 A 127.0.0.2 127.0.0.3 \
- 2>&1 | LC_ALL=C sort | grep -v Ueber
+pdnsutil_wrapper add-record bug.less host2 A 127.0.0.2 127.0.0.3 | LC_ALL=C sort
# Display zone contents for final verification
-$PDNSUTIL --config-dir=. --config-name=$backend \
- list-zone bug.less \
- 2>&1 | LC_ALL=C sort | grep -v Ueber
+pdnsutil_wrapper list-zone bug.less | LC_ALL=C sort
+
+# Delete this non-standard zone, so that the result of the zone-variants
+# test do not vary if this particular test is skipped.
+pdnsutil_wrapper delete-zone bug.less > /dev/null
--- /dev/null
+#!/usr/bin/env bash
+set -o pipefail
+
+pdnsutil_wrapper() {
+$PDNSUTIL --config-dir=. --config-name=$backend $* 2>&1 | (egrep -v 'destructor' || true)
+}
+
+set -e # to make this first call exit us early for non-variant capable backends.
+pdnsutil_wrapper view-add-zone myview example.org..variant3
+set +e
+
+echo == one view
+pdnsutil_wrapper view-list
+echo == with one zone
+pdnsutil_wrapper view-list myview
+
+pdnsutil_wrapper view-add-zone myotherview example.com
+
+echo == view with one zone
+pdnsutil_wrapper view-list myotherview
+
+pdnsutil_wrapper view-add-zone myview example.org..variant2
+pdnsutil_wrapper view-add-zone myview example.net..variant5
+echo == with two zones
+pdnsutil_wrapper view-list myview
+
+pdnsutil_wrapper view-del-zone myview example.org..variant2
+echo == view with one zone
+pdnsutil_wrapper view-list myview
+
+pdnsutil_wrapper view-del-zone myotherview example.com
+echo == one view
+pdnsutil_wrapper view-list
+
+echo == check proper variant replacement
+pdnsutil_wrapper view-list myview
+pdnsutil_wrapper view-add-zone myview example.net..completelydifferent
+pdnsutil_wrapper view-list myview
--- /dev/null
+Tests for views management.
+The expected result for non-LMDB backends is failure.
--- /dev/null
+Operation failed.
--- /dev/null
+== one view
+myview
+view1
+view2
+== with one zone
+example.org..variant3
+== view with one zone
+example.com
+== with two zones
+example.net..variant5
+example.org..variant2
+== view with one zone
+example.net..variant5
+== one view
+myview
+view1
+view2
+== check proper variant replacement
+example.net..variant5
+example.net..completelydifferent
--- /dev/null
+#!/bin/sh
+cleandig example.com TXT ednssubnet 192.0.2.0/32
+cleandig example.com TXT ednssubnet 192.0.2.200/32
+
+cleandig cname.example.com TXT ednssubnet 192.0.2.0/32
+cleandig cname.example.com TXT ednssubnet 192.0.2.200/32
+
+cleandig cname-nxd.example.com TXT ednssubnet 192.0.2.0/32
+cleandig cname-nxd.example.com TXT ednssubnet 192.0.2.200/32
--- /dev/null
+Views test. Currently expects one layer of abstraction
+where we should be having two.
--- /dev/null
+1 example.com. 86400 IN SOA ns1.example.com. ahu.example.com. 2847484148 28800 7200 604800 86400
+2 . 0 IN OPT
+Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='example.com.', qtype=TXT
+1 example.com. 86400 IN SOA ns1.example.com. ahu.example.com. 2847484148 28800 7200 604800 86400
+2 . 0 IN OPT
+Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='example.com.', qtype=TXT
+1 example.com. 86400 IN SOA ns1.example.com. ahu.example.com. 2847484148 28800 7200 604800 86400
+2 . 0 IN OPT
+Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='cname.example.com.', qtype=TXT
+1 example.com. 86400 IN SOA ns1.example.com. ahu.example.com. 2847484148 28800 7200 604800 86400
+2 . 0 IN OPT
+Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='cname.example.com.', qtype=TXT
+1 example.com. 86400 IN SOA ns1.example.com. ahu.example.com. 2847484148 28800 7200 604800 86400
+2 . 0 IN OPT
+Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='cname-nxd.example.com.', qtype=TXT
+1 example.com. 86400 IN SOA ns1.example.com. ahu.example.com. 2847484148 28800 7200 604800 86400
+2 . 0 IN OPT
+Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='cname-nxd.example.com.', qtype=TXT
--- /dev/null
+0 example.com. 3600 IN TXT "hello from the bar variant"
+2 . 0 IN OPT AAgACAABIADAAAIA
+Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='example.com.', qtype=TXT
+0 example.com. 3600 IN TXT "hello from the foo variant"
+2 . 0 IN OPT AAgACAABIADAAALI
+Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='example.com.', qtype=TXT
+0 cname.example.com. 3600 IN CNAME target.example.org.
+2 . 0 IN OPT AAgACAABIADAAAIA
+Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='cname.example.com.', qtype=TXT
+0 cname.example.com. 3600 IN CNAME target.example.org.
+0 target.example.org. 3600 IN TXT "hello from target..foo"
+2 . 0 IN OPT AAgACAABIADAAALI
+Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='cname.example.com.', qtype=TXT
+0 cname-nxd.example.com. 3600 IN CNAME nxd.example.org.
+2 . 0 IN OPT AAgACAABIADAAAIA
+Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='cname-nxd.example.com.', qtype=TXT
+0 cname-nxd.example.com. 3600 IN CNAME nxd.example.org.
+1 example.org. 3600 IN SOA a.misconfigured.dns.server.invalid. hostmaster.example.org. 0 10800 3600 604800 3600
+2 . 0 IN OPT AAgACAABIADAAALI
+Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
+Reply to question for qname='cname-nxd.example.com.', qtype=TXT
--- /dev/null
+#!/usr/bin/env bash
+set -o pipefail
+
+pdnsutil_wrapper() {
+$PDNSUTIL --config-dir=. --config-name=$backend $* 2>&1 | egrep -v 'destructor'
+}
+
+set -e # to make this first call exit us early for non-variant capable backends. This relies on the existing example.com causing "already exists"
+
+pdnsutil_wrapper create-zone example.com..variant1 | egrep -v 'file|use them'
+set +e
+pdnsutil_wrapper show-zone example.com..variant1
+
+pdnsutil_wrapper create-zone ..myroot | egrep -v 'file|use them'
+pdnsutil_wrapper show-zone ..myroot
+
+pdnsutil_wrapper create-zone . | egrep -v 'file|use them'
+pdnsutil_wrapper show-zone .
+
+pdnsutil_wrapper list-all-zones | LC_ALL=C sort
+
+pdnsutil_wrapper add-record example.com..variant1 uniquename A 1.2.3.4
+pdnsutil_wrapper backend-lookup $backend uniquename.example.com..variant1
--- /dev/null
+Tests for zone variant handling.
+The expected result for non-LMDB backends is failure.
+
+The current expected_result file is -wrong-. It shows how
+other backends ignore the variant, instead of rejecting it.
+I left it like this for now so CI is green.
--- /dev/null
+None of the configured backends support views.
+Zone 'example.com..variant1' was not created.
--- /dev/null
+Creating empty zone 'example.com..variant1'
+This is a Native zone
+Variant: variant1
+Zone is not actively secured
+Metadata items: None
+No keys for zone 'example.com..variant1'.
+Creating empty zone '..myroot'
+This is a Native zone
+Variant: myroot
+Zone is not actively secured
+Metadata items: None
+No keys for zone '..myroot'.
+Creating empty zone '.'
+This is a Native zone
+Zone is not actively secured
+Metadata items: None
+No keys for zone '.'.
+.
+..myroot
+2.0.192.in-addr.arpa
+catalog.invalid
+cdnskey-cds-test.com
+cryptokeys.org
+delegated.dnssec-parent.com
+dnssec-parent.com
+example.com
+example.com..bar
+example.com..foo
+example.com..variant1
+example.org..foo
+hiddencryptokeys.org
+insecure.dnssec-parent.com
+minimal.com
+secure-delegated.dnssec-parent.com
+stest.com
+sub.test.dyndns
+test.com
+test.dyndns
+tsig.com
+wtest.com
+New rrset:
+uniquename.example.com. 3600 IN A 1.2.3.4
+uniquename.example.com. 3600 IN A 1.2.3.4