]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test whether mirror zones can be added and removed dynamically
authorMichał Kępień <michal@isc.org>
Tue, 9 Oct 2018 08:54:51 +0000 (10:54 +0200)
committerOndřej Surý <ondrej@sury.org>
Wed, 24 Oct 2018 18:32:56 +0000 (20:32 +0200)
Extend the "mirror" zone system test to make sure mirror zones can be
added and removed dynamically using rndc.

bin/tests/system/mirror/clean.sh
bin/tests/system/mirror/ns2/named.conf.in
bin/tests/system/mirror/ns2/sign.sh
bin/tests/system/mirror/ns3/named.conf.in
bin/tests/system/mirror/tests.sh

index fc189a86044ff83d369757342c668baa0cdfb88a..99ee2ae020cffddb7ec48770b84f40599c2e6234 100644 (file)
@@ -11,6 +11,7 @@ rm -f */*.conf
 rm -f */*.db
 rm -f */*.jnl
 rm -f */*.mirror
+rm -f */*.nzd*
 rm -f */*.prev
 rm -f */*.signed
 rm -f */K*
index ebcce5729aabb2b0e6d5864561d131c04c186ce9..2979ea9980540c2cea276a0f85f5914a24bd504e 100644 (file)
@@ -45,6 +45,11 @@ zone "initially-unavailable" {
        allow-transfer { 10.53.0.254; };
 };
 
+zone "verify-addzone" {
+       type master;
+       file "verify-addzone.db.original.signed";
+};
+
 zone "verify-axfr" {
        type master;
        file "verify-axfr.db.signed";
index e8239b14e034bfc2fe7a8642e288d7a9a3f347a4..57df68db1b405599da1f2005bde48fe9167f5fa1 100644 (file)
@@ -36,7 +36,7 @@ ORIGINAL_SERIAL=`awk '$2 == "SOA" {print $5}' verify.db.in`
 UPDATED_SERIAL_BAD=`expr ${ORIGINAL_SERIAL} + 1`
 UPDATED_SERIAL_GOOD=`expr ${ORIGINAL_SERIAL} + 2`
 
-for variant in axfr ixfr load reconfig untrusted; do
+for variant in addzone axfr ixfr load reconfig untrusted; do
        zone=verify-$variant
        infile=verify.db.in
        zonefile=verify-$variant.db
index 4b14e8d9a7141cf1c1d073f57786029c8942f466..edf6a21702933a186f22859b144bc7b977d8ff23 100644 (file)
@@ -29,6 +29,7 @@ options {
        recursion yes;
        allow-query-cache { 10.53.0.1; };
        trust-anchor-telemetry yes;
+       allow-new-zones yes;
 };
 
 zone "." {
index 1768847d6a8ce22c4d1110af5a5b462e90835fe4..8411857d0d569ba5f2ebb1dd93aa254e1a7c3526 100644 (file)
@@ -427,6 +427,39 @@ nextpart ns3/named.run | grep "No correct RSASHA256 signature for verify-reconfi
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "checking that a mirror zone can be added using rndc ($n)"
+ret=0
+# Sanity check: the zone should not exist in the root zone.
+$DIG $DIGOPTS @10.53.0.3 +norec verify-addzone SOA > dig.out.ns3.test$n.1 2>&1 || ret=1
+grep "NXDOMAIN" dig.out.ns3.test$n.1 > /dev/null || ret=1
+grep "flags:.* aa" dig.out.ns3.test$n.1 > /dev/null && ret=1
+grep "flags:.* ad" dig.out.ns3.test$n.1 > /dev/null || ret=1
+# Mirror a zone which does not exist in the root zone.
+nextpart ns3/named.run > /dev/null
+$RNDCCMD 10.53.0.3 addzone verify-addzone '{ type mirror; masters { 10.53.0.2; }; };' > rndc.out.ns3.test$n 2>&1 || ret=1
+wait_for_transfer verify-addzone
+# Check whether the mirror zone was added and whether it behaves as expected.
+$DIG $DIGOPTS @10.53.0.3 +norec verify-addzone SOA > dig.out.ns3.test$n.2 2>&1 || ret=1
+grep "NOERROR" dig.out.ns3.test$n.2 > /dev/null || ret=1
+grep "flags:.* aa" dig.out.ns3.test$n.2 > /dev/null && ret=1
+grep "flags:.* ad" dig.out.ns3.test$n.2 > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
+n=`expr $n + 1`
+echo_i "checking that a mirror zone can be deleted using rndc ($n)"
+ret=0
+# Remove the mirror zone added in the previous test.
+$RNDCCMD 10.53.0.3 delzone verify-addzone > rndc.out.ns3.test$n 2>&1 || ret=1
+# Check whether the mirror zone was removed.
+$DIG $DIGOPTS @10.53.0.3 +norec verify-addzone SOA > dig.out.ns3.test$n 2>&1 || ret=1
+grep "NXDOMAIN" dig.out.ns3.test$n > /dev/null || ret=1
+grep "flags:.* aa" dig.out.ns3.test$n > /dev/null && ret=1
+grep "flags:.* ad" dig.out.ns3.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "ensuring trust anchor telemetry queries are sent upstream for a mirror zone ($n)"
 ret=0