]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add test for RPZ wildcard passthru ignored fix
authorDiego Fronza <diego@isc.org>
Tue, 21 Jul 2020 21:00:06 +0000 (18:00 -0300)
committerEvan Hunt <each@isc.org>
Mon, 27 Jul 2020 20:40:50 +0000 (13:40 -0700)
bin/tests/system/rpzrecurse/ns1/example.com.db [new file with mode: 0644]
bin/tests/system/rpzrecurse/ns1/named.conf.in
bin/tests/system/rpzrecurse/ns2/db.given [new file with mode: 0644]
bin/tests/system/rpzrecurse/ns2/db.passthru [new file with mode: 0644]
bin/tests/system/rpzrecurse/ns2/named.wildcard4.conf [new file with mode: 0644]
bin/tests/system/rpzrecurse/tests.sh
bin/tests/system/run.sh

diff --git a/bin/tests/system/rpzrecurse/ns1/example.com.db b/bin/tests/system/rpzrecurse/ns1/example.com.db
new file mode 100644 (file)
index 0000000..5bbe973
--- /dev/null
@@ -0,0 +1,16 @@
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+;
+; 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 http://mozilla.org/MPL/2.0/.
+;
+; See the COPYRIGHT file distributed with this work for additional
+; information regarding copyright ownership.
+
+$TTL 3600
+@ IN SOA ns.example.com. root.example.com. 1 3600 3600 3600 3600
+@    NS         ns.example.com.
+
+ns.example.com.     A   10.53.0.1
+@                   A   1.2.3.4
+www                 A   1.2.3.5
index e8105a2e1f9a2eb897c5d0a50bb0f1918d3d46f2..d3ae39f1d6d5a5b3cd76ceb541c0f7e0a4274ef2 100644 (file)
@@ -65,3 +65,8 @@ zone "test2.example.net" {
      type master;
      file "test2.example.net.db";
 };
+
+zone "example.com" {
+     type master;
+     file "example.com.db";
+};
diff --git a/bin/tests/system/rpzrecurse/ns2/db.given b/bin/tests/system/rpzrecurse/ns2/db.given
new file mode 100644 (file)
index 0000000..01c3bae
--- /dev/null
@@ -0,0 +1,10 @@
+$ORIGIN given.zone.
+$TTL 3600
+@               IN SOA ns.given.zone.  hostmaster.given.zone. 1 600 300 604800 3600
+                IN NS  ns.given.zone.
+
+ns IN A  127.0.0.1
+; this should be ignores as it matches earlier passthru entry.
+example.com CNAME .
+; this should be ignored as it matches earlier wildcard passthru entry.
+www.example.com CNAME .
diff --git a/bin/tests/system/rpzrecurse/ns2/db.passthru b/bin/tests/system/rpzrecurse/ns2/db.passthru
new file mode 100644 (file)
index 0000000..ec0e015
--- /dev/null
@@ -0,0 +1,8 @@
+$ORIGIN passthru.zone.
+$TTL 3600
+@               IN SOA ns.passthru.zone.  hostmaster.passthru.zone. 1 600 300 604800 3600
+                IN NS  ns.passthru.zone.
+
+ns IN A 127.0.0.1
+example.com     CNAME rpz-passthru.
+*.example.com   CNAME rpz-passthru.
diff --git a/bin/tests/system/rpzrecurse/ns2/named.wildcard4.conf b/bin/tests/system/rpzrecurse/ns2/named.wildcard4.conf
new file mode 100644 (file)
index 0000000..78915d6
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * 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 http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+# common configuration
+include "named.conf.header";
+
+view "recursive" {
+       # policy configuration to be tested
+       response-policy {
+               zone "passthru.zone" policy passthru;
+               zone "given.zone" policy given;
+       };
+
+       # policy zones to be tested
+       zone "passthru.zone" { type master; file "db.passthru"; };
+       zone "given.zone" { type master; file "db.given"; };
+
+       zone "." {
+               type hint;
+               file "root.hint";
+       };
+
+       recursion yes;
+       dnssec-validation yes;
+};
index 8a23955a876512447891702a56259f445b38e161..5ab2431bc6a94747e4e5615ce155edbacba959b1 100644 (file)
@@ -390,5 +390,19 @@ if test $p1 -le $p2; then ret=1; fi
 if test $ret != 0; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+t=`expr $t + 1`
+echo_i "testing wildcard passthru before explicit drop (${t})"
+run_server wildcard4
+$DIG $DIGOPTS example.com a @10.53.0.2 -p ${PORT} > dig.out.${t}.1
+grep "status: NOERROR" dig.out.${t}.1 > /dev/null || {
+       echo_i "test ${t} failed"
+       status=1
+}
+$DIG $DIGOPTS www.example.com a @10.53.0.2 -p ${PORT} > dig.out.${t}.2
+grep "status: NOERROR" dig.out.${t}.2 > /dev/null || {
+       echo_i "test ${t} failed"
+       status=1
+}
+
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1
index a6579e0d98829dc9c7f94751f4311bcad79aeb5f..c8190ec0839a24e7cd5c2fc54ea00dd7fcd0a057 100755 (executable)
@@ -230,6 +230,8 @@ elif [ "$assertion_failures" -ne 0 ]; then
 elif [ "$sanitizer_summaries" -ne 0 ]; then
     echoinfo "I:$systest:$sanitizer_summaries sanitizer report(s) found"
     echofail "R:$systest:FAIL"
+elif [ "$status" != 0 ]; then
+    echofail "R:$systest:FAIL"
 else
     echopass "R:$systest:PASS"
     if $clean; then