]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add xfer system test case
authorMatthijs Mekking <matthijs@isc.org>
Wed, 26 Oct 2022 14:55:05 +0000 (16:55 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Thu, 27 Oct 2022 10:18:12 +0000 (12:18 +0200)
Add a test case that if the first primary fails, the fallback of a
second primary on plain DNS works. This is mainly to test that the port
configuration inheritance works correctly.

(cherry picked from commit 622a499027b163b12d0ef8a7cefad1967fedb529)

bin/tests/system/xfer/clean.sh
bin/tests/system/xfer/dig3.good [new file with mode: 0644]
bin/tests/system/xfer/ns1/dot-fallback.db.in [new file with mode: 0644]
bin/tests/system/xfer/ns1/named.conf.in
bin/tests/system/xfer/ns2/named.conf.in
bin/tests/system/xfer/setup.sh
bin/tests/system/xfer/tests.sh

index 285155300925943e614f7ab07cfe6b3e3b0b48b3..bf5016e8f91315a788b4cbd590881c7bbcad3fcf 100644 (file)
@@ -24,10 +24,11 @@ rm -f axfr.out
 rm -f dig.out.*
 rm -f ns*/managed-keys.bind*
 rm -f ns*/named.lock
+rm -f ns1/dot-fallback.db
 rm -f ns1/edns-expire.db
 rm -f ns1/ixfr-too-big.db ns1/ixfr-too-big.db.jnl
 rm -f ns1/sec.db ns2/sec.db
-rm -f ns2/example.db ns2/tsigzone.db ns2/example.db.jnl
+rm -f ns2/example.db ns2/tsigzone.db ns2/example.db.jnl ns2/dot-fallback.db
 rm -f ns2/mapped.db
 rm -f ns3/example.bk ns3/xfer-stats.bk ns3/tsigzone.bk ns3/example.bk.jnl
 rm -f ns3/mapped.bk
diff --git a/bin/tests/system/xfer/dig3.good b/bin/tests/system/xfer/dig3.good
new file mode 100644 (file)
index 0000000..d58c421
--- /dev/null
@@ -0,0 +1,6 @@
+dot-fallback.          5       IN      SOA     ns1.dot-fallback. hostmaster.dot-fallback. 1 3600 3600 3600 3600
+dot-fallback.          5       IN      NS      ns1.dot-fallback.
+a01.dot-fallback.      5       IN      A       1.1.1.1
+a02.dot-fallback.      5       IN      A       255.255.255.255
+ns1.dot-fallback.      5       IN      A       10.53.0.1
+dot-fallback.          5       IN      SOA     ns1.dot-fallback. hostmaster.dot-fallback. 1 3600 3600 3600 3600
diff --git a/bin/tests/system/xfer/ns1/dot-fallback.db.in b/bin/tests/system/xfer/ns1/dot-fallback.db.in
new file mode 100644 (file)
index 0000000..997f5ba
--- /dev/null
@@ -0,0 +1,19 @@
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+;
+; SPDX-License-Identifier: MPL-2.0
+;
+; This Source Code Form is subject to the terms of the Mozilla Public
+; License, v. 2.0.  If a copy of the MPL was not distributed with this
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
+;
+; See the COPYRIGHT file distributed with this work for additional
+; information regarding copyright ownership.
+
+$TTL 5
+
+@                      IN SOA  ns1 hostmaster 1 3600 3600 3600 3600
+@                      NS      ns1
+ns1                    A       10.53.0.1
+a01                    A       1.1.1.1
+a02                    A       255.255.255.255
+
index 3ff6cdf0c4d4deb49fdce6c1c653fbd6192f6850..1cd72719f82db4b281b9d2316514da27cbd3b776 100644 (file)
@@ -59,3 +59,8 @@ zone "xfer-stats" {
        type primary;
        file "xfer-stats.db";
 };
+
+zone "dot-fallback" {
+       type primary;
+       file "dot-fallback.db";
+};
index 642b4bc15f2154ef61d3be9fffb74f71bb487643..e6fb0c69b7c4c0ae39da7d361f2a9edf97cee582 100644 (file)
@@ -72,3 +72,12 @@ zone "mapped" {
        masterfile-format text;
        primaries { 10.53.0.100; };
 };
+
+zone "dot-fallback" {
+       type secondary;
+       file "dot-fallback.db";
+       primaries {
+               10.53.0.1 tls ephemeral;
+               10.53.0.1;
+       };
+};
index d823f2d8b01233898aed30df24c7d3c819142268..092d798799a8cbf06b09e4127ad95e59ae030949 100644 (file)
@@ -32,6 +32,8 @@ copy_setports ns8/named.conf.in ns8/named.conf
 
 copy_setports ns4/named.conf.base ns4/named.conf
 
+cp ns1/dot-fallback.db.in ns1/dot-fallback.db
+
 cp ns2/sec.db.in ns2/sec.db
 touch -t 200101010000 ns2/sec.db
 
index 9c6fcba9747d9e604b4bcf8c75d7c693124a6ec7..2aaf4c015d9bebc7f7763c11cf5b955029928d9b 100755 (executable)
@@ -35,13 +35,24 @@ tmp=0
 # Spin to allow the zone to transfer.
 #
 wait_for_xfer () {
-       $DIG $DIGOPTS example. @10.53.0.3 axfr > dig.out.ns3.test$n || return 1
-       grep "^;" dig.out.ns3.test$n > /dev/null && return 1
+       ZONE=$1
+       SERVER=$2
+       $DIG $DIGOPTS $ZONE @$SERVER axfr > dig.out.test$n || return 1
+       grep "^;" dig.out.test$n > /dev/null && return 1
        return 0
 }
-retry_quiet 25 wait_for_xfer || tmp=1
-grep "^;" dig.out.ns3.test$n | cat_i
-digcomp dig1.good dig.out.ns3.test$n || tmp=1
+retry_quiet 25 wait_for_xfer example. 10.53.0.3 || tmp=1
+grep "^;" dig.out.test$n | cat_i
+digcomp dig1.good dig.out.test$n || tmp=1
+if test $tmp != 0 ; then echo_i "failed"; fi
+status=$((status+tmp))
+
+n=$((n+1))
+echo_i "testing zone transfer functionality (fallback to DNS after DoT failed) ($n)"
+tmp=0
+retry_quiet 25 wait_for_xfer dot-fallback. 10.53.0.2 || tmp=1
+grep "^;" dig.out.test$n | cat_i
+digcomp dig3.good dig.out.test$n || tmp=1
 if test $tmp != 0 ; then echo_i "failed"; fi
 status=$((status+tmp))