|
|
bd9435 |
From 54e281c11ee13eabc3c51d6391a58fc90836000c Mon Sep 17 00:00:00 2001
|
|
|
bd9435 |
From: Evan Hunt <each@isc.org>
|
|
|
bd9435 |
Date: Wed, 9 Nov 2022 21:56:16 -0800
|
|
|
bd9435 |
Subject: [PATCH] test failure conditions
|
|
|
bd9435 |
|
|
|
bd9435 |
verify that updates are refused when the client is disallowed by
|
|
|
bd9435 |
allow-query, and update forwarding is refused when the client is
|
|
|
bd9435 |
is disallowed by update-forwarding.
|
|
|
bd9435 |
|
|
|
bd9435 |
verify that "too many DNS UPDATEs" appears in the log file when too
|
|
|
bd9435 |
many simultaneous updates are processing.
|
|
|
bd9435 |
|
|
|
bd9435 |
(cherry picked from commit b91339b80e5b82a56622c93cc1e3cca2d0c11bc0)
|
|
|
bd9435 |
---
|
|
|
bd9435 |
bin/tests/system/nsupdate/ns1/named.conf.in | 2 +
|
|
|
bd9435 |
bin/tests/system/nsupdate/tests.sh | 28 +++++++++++++
|
|
|
bd9435 |
bin/tests/system/upforwd/clean.sh | 2 +
|
|
|
bd9435 |
.../ns3/{named.conf.in => named1.conf.in} | 13 ++++--
|
|
|
bd9435 |
bin/tests/system/upforwd/ns3/named2.conf.in | 41 +++++++++++++++++++
|
|
|
bd9435 |
bin/tests/system/upforwd/setup.sh | 2 +-
|
|
|
bd9435 |
bin/tests/system/upforwd/tests.sh | 39 ++++++++++++++++++
|
|
|
bd9435 |
7 files changed, 123 insertions(+), 4 deletions(-)
|
|
|
bd9435 |
rename bin/tests/system/upforwd/ns3/{named.conf.in => named1.conf.in} (78%)
|
|
|
bd9435 |
create mode 100644 bin/tests/system/upforwd/ns3/named2.conf.in
|
|
|
bd9435 |
|
|
|
bd9435 |
diff --git a/bin/tests/system/nsupdate/ns1/named.conf.in b/bin/tests/system/nsupdate/ns1/named.conf.in
|
|
|
bd9435 |
index 436c97d..83fe884 100644
|
|
|
bd9435 |
--- a/bin/tests/system/nsupdate/ns1/named.conf.in
|
|
|
bd9435 |
+++ b/bin/tests/system/nsupdate/ns1/named.conf.in
|
|
|
bd9435 |
@@ -21,6 +21,7 @@ options {
|
|
|
bd9435 |
recursion no;
|
|
|
bd9435 |
notify yes;
|
|
|
bd9435 |
minimal-responses no;
|
|
|
bd9435 |
+ update-quota 1;
|
|
|
bd9435 |
};
|
|
|
bd9435 |
|
|
|
bd9435 |
acl named-acl {
|
|
|
bd9435 |
@@ -81,6 +82,7 @@ zone "other.nil" {
|
|
|
bd9435 |
check-integrity no;
|
|
|
bd9435 |
check-mx warn;
|
|
|
bd9435 |
update-policy local;
|
|
|
bd9435 |
+ allow-query { !10.53.0.2; any; };
|
|
|
bd9435 |
allow-query-on { 10.53.0.1; 127.0.0.1; };
|
|
|
bd9435 |
allow-transfer { any; };
|
|
|
bd9435 |
};
|
|
|
bd9435 |
diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh
|
|
|
bd9435 |
index b5f562f..13ba577 100755
|
|
|
bd9435 |
--- a/bin/tests/system/nsupdate/tests.sh
|
|
|
bd9435 |
+++ b/bin/tests/system/nsupdate/tests.sh
|
|
|
bd9435 |
@@ -1268,6 +1268,34 @@ END
|
|
|
bd9435 |
grep "NSEC3PARAM has excessive iterations (> 150)" nsupdate.out-$n >/dev/null || ret=1
|
|
|
bd9435 |
[ $ret = 0 ] || { echo_i "failed"; status=1; }
|
|
|
bd9435 |
|
|
|
bd9435 |
+n=$((n + 1))
|
|
|
bd9435 |
+ret=0
|
|
|
bd9435 |
+echo_i "check that update is rejected if query is not allowed ($n)"
|
|
|
bd9435 |
+{
|
|
|
bd9435 |
+ $NSUPDATE -d <
|
|
|
bd9435 |
+ local 10.53.0.2
|
|
|
bd9435 |
+ server 10.53.0.1 ${PORT}
|
|
|
bd9435 |
+ update add reject.other.nil 3600 IN TXT Whatever
|
|
|
bd9435 |
+ send
|
|
|
bd9435 |
+END
|
|
|
bd9435 |
+} > nsupdate.out.test$n 2>&1
|
|
|
bd9435 |
+grep 'failed: REFUSED' nsupdate.out.test$n > /dev/null || ret=1
|
|
|
bd9435 |
+[ $ret = 0 ] || { echo_i "failed"; status=1; }
|
|
|
bd9435 |
+
|
|
|
bd9435 |
+n=$((n + 1))
|
|
|
bd9435 |
+ret=0
|
|
|
bd9435 |
+echo_i "check that update is rejected if quota is exceeded ($n)"
|
|
|
bd9435 |
+for loop in 1 2 3 4 5 6 7 8 9 10; do
|
|
|
bd9435 |
+{
|
|
|
bd9435 |
+ $NSUPDATE -4 -l -p ${PORT} -k ns1/session.key > /dev/null 2>&1 <
|
|
|
bd9435 |
+ update add txt-$loop.other.nil 3600 IN TXT Whatever
|
|
|
bd9435 |
+ send
|
|
|
bd9435 |
+END
|
|
|
bd9435 |
+} &
|
|
|
bd9435 |
+done
|
|
|
bd9435 |
+wait_for_log 10 "too many DNS UPDATEs queued" ns1/named.run || ret=1
|
|
|
bd9435 |
+[ $ret = 0 ] || { echo_i "failed"; status=1; }
|
|
|
bd9435 |
+
|
|
|
bd9435 |
if ! $FEATURETEST --gssapi ; then
|
|
|
bd9435 |
echo_i "SKIPPED: GSSAPI tests"
|
|
|
bd9435 |
else
|
|
|
bd9435 |
diff --git a/bin/tests/system/upforwd/clean.sh b/bin/tests/system/upforwd/clean.sh
|
|
|
bd9435 |
index 2025252..12311df 100644
|
|
|
bd9435 |
--- a/bin/tests/system/upforwd/clean.sh
|
|
|
bd9435 |
+++ b/bin/tests/system/upforwd/clean.sh
|
|
|
bd9435 |
@@ -29,3 +29,5 @@ rm -f keyname keyname.err
|
|
|
bd9435 |
rm -f ns*/named.lock
|
|
|
bd9435 |
rm -f ns1/example2.db
|
|
|
bd9435 |
rm -f ns*/managed-keys.bind*
|
|
|
bd9435 |
+rm -f nsupdate.out.*
|
|
|
bd9435 |
+rm -f ns*/named.run.prev
|
|
|
bd9435 |
diff --git a/bin/tests/system/upforwd/ns3/named.conf.in b/bin/tests/system/upforwd/ns3/named1.conf.in
|
|
|
bd9435 |
similarity index 78%
|
|
|
bd9435 |
rename from bin/tests/system/upforwd/ns3/named.conf.in
|
|
|
bd9435 |
rename to bin/tests/system/upforwd/ns3/named1.conf.in
|
|
|
bd9435 |
index 7bd13d3..2f690ff 100644
|
|
|
bd9435 |
--- a/bin/tests/system/upforwd/ns3/named.conf.in
|
|
|
bd9435 |
+++ b/bin/tests/system/upforwd/ns3/named1.conf.in
|
|
|
bd9435 |
@@ -28,20 +28,27 @@ key rndc_key {
|
|
|
bd9435 |
};
|
|
|
bd9435 |
|
|
|
bd9435 |
controls {
|
|
|
bd9435 |
- inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
|
|
bd9435 |
+ inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
|
|
bd9435 |
};
|
|
|
bd9435 |
|
|
|
bd9435 |
zone "example" {
|
|
|
bd9435 |
type secondary;
|
|
|
bd9435 |
file "example.bk";
|
|
|
bd9435 |
- allow-update-forwarding { any; };
|
|
|
bd9435 |
+ allow-update-forwarding { 10.53.0.1; };
|
|
|
bd9435 |
primaries { 10.53.0.1; };
|
|
|
bd9435 |
};
|
|
|
bd9435 |
|
|
|
bd9435 |
zone "example2" {
|
|
|
bd9435 |
type secondary;
|
|
|
bd9435 |
file "example2.bk";
|
|
|
bd9435 |
- allow-update-forwarding { any; };
|
|
|
bd9435 |
+ allow-update-forwarding { 10.53.0.1; };
|
|
|
bd9435 |
+ primaries { 10.53.0.1; };
|
|
|
bd9435 |
+};
|
|
|
bd9435 |
+
|
|
|
bd9435 |
+zone "example3" {
|
|
|
bd9435 |
+ type secondary;
|
|
|
bd9435 |
+ file "example3.bk";
|
|
|
bd9435 |
+ allow-update-forwarding { 10.53.0.1; };
|
|
|
bd9435 |
primaries { 10.53.0.1; };
|
|
|
bd9435 |
};
|
|
|
bd9435 |
|
|
|
bd9435 |
diff --git a/bin/tests/system/upforwd/ns3/named2.conf.in b/bin/tests/system/upforwd/ns3/named2.conf.in
|
|
|
bd9435 |
new file mode 100644
|
|
|
bd9435 |
index 0000000..e15459a
|
|
|
bd9435 |
--- /dev/null
|
|
|
bd9435 |
+++ b/bin/tests/system/upforwd/ns3/named2.conf.in
|
|
|
bd9435 |
@@ -0,0 +1,41 @@
|
|
|
bd9435 |
+/*
|
|
|
bd9435 |
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
bd9435 |
+ *
|
|
|
bd9435 |
+ * SPDX-License-Identifier: MPL-2.0
|
|
|
bd9435 |
+ *
|
|
|
bd9435 |
+ * This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
bd9435 |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
bd9435 |
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
bd9435 |
+ *
|
|
|
bd9435 |
+ * See the COPYRIGHT file distributed with this work for additional
|
|
|
bd9435 |
+ * information regarding copyright ownership.
|
|
|
bd9435 |
+ */
|
|
|
bd9435 |
+
|
|
|
bd9435 |
+options {
|
|
|
bd9435 |
+ query-source address 10.53.0.3;
|
|
|
bd9435 |
+ notify-source 10.53.0.3;
|
|
|
bd9435 |
+ transfer-source 10.53.0.3;
|
|
|
bd9435 |
+ port @PORT@;
|
|
|
bd9435 |
+ pid-file "named.pid";
|
|
|
bd9435 |
+ listen-on { 10.53.0.3; };
|
|
|
bd9435 |
+ listen-on-v6 { none; };
|
|
|
bd9435 |
+ recursion no;
|
|
|
bd9435 |
+ notify yes;
|
|
|
bd9435 |
+ update-quota 1;
|
|
|
bd9435 |
+};
|
|
|
bd9435 |
+
|
|
|
bd9435 |
+key rndc_key {
|
|
|
bd9435 |
+ secret "1234abcd8765";
|
|
|
bd9435 |
+ algorithm hmac-sha256;
|
|
|
bd9435 |
+};
|
|
|
bd9435 |
+
|
|
|
bd9435 |
+controls {
|
|
|
bd9435 |
+ inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
|
|
bd9435 |
+};
|
|
|
bd9435 |
+
|
|
|
bd9435 |
+zone "example" {
|
|
|
bd9435 |
+ type secondary;
|
|
|
bd9435 |
+ file "example.bk";
|
|
|
bd9435 |
+ allow-update-forwarding { any; };
|
|
|
bd9435 |
+ primaries { 10.53.0.1; };
|
|
|
bd9435 |
+};
|
|
|
bd9435 |
diff --git a/bin/tests/system/upforwd/setup.sh b/bin/tests/system/upforwd/setup.sh
|
|
|
bd9435 |
index e748078..88ab28d 100644
|
|
|
bd9435 |
--- a/bin/tests/system/upforwd/setup.sh
|
|
|
bd9435 |
+++ b/bin/tests/system/upforwd/setup.sh
|
|
|
bd9435 |
@@ -17,7 +17,7 @@ cp -f ns3/nomaster.db ns3/nomaster1.db
|
|
|
bd9435 |
|
|
|
bd9435 |
copy_setports ns1/named.conf.in ns1/named.conf
|
|
|
bd9435 |
copy_setports ns2/named.conf.in ns2/named.conf
|
|
|
bd9435 |
-copy_setports ns3/named.conf.in ns3/named.conf
|
|
|
bd9435 |
+copy_setports ns3/named1.conf.in ns3/named.conf
|
|
|
bd9435 |
|
|
|
bd9435 |
if $FEATURETEST --enable-dnstap
|
|
|
bd9435 |
then
|
|
|
bd9435 |
diff --git a/bin/tests/system/upforwd/tests.sh b/bin/tests/system/upforwd/tests.sh
|
|
|
bd9435 |
index 8062d68..20fc46f 100644
|
|
|
bd9435 |
--- a/bin/tests/system/upforwd/tests.sh
|
|
|
bd9435 |
+++ b/bin/tests/system/upforwd/tests.sh
|
|
|
bd9435 |
@@ -80,6 +80,7 @@ if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
|
|
|
bd9435 |
echo_i "updating zone (signed) ($n)"
|
|
|
bd9435 |
ret=0
|
|
|
bd9435 |
$NSUPDATE -y hmac-sha256:update.example:c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K -- - <
|
|
|
bd9435 |
+local 10.53.0.1
|
|
|
bd9435 |
server 10.53.0.3 ${PORT}
|
|
|
bd9435 |
update add updated.example. 600 A 10.10.10.1
|
|
|
bd9435 |
update add updated.example. 600 TXT Foo
|
|
|
bd9435 |
@@ -138,6 +139,7 @@ fi
|
|
|
bd9435 |
echo_i "updating zone (unsigned) ($n)"
|
|
|
bd9435 |
ret=0
|
|
|
bd9435 |
$NSUPDATE -- - <
|
|
|
bd9435 |
+local 10.53.0.1
|
|
|
bd9435 |
server 10.53.0.3 ${PORT}
|
|
|
bd9435 |
update add unsigned.example. 600 A 10.10.10.1
|
|
|
bd9435 |
update add unsigned.example. 600 TXT Foo
|
|
|
bd9435 |
@@ -194,6 +196,7 @@ while [ $count -lt 5 -a $ret -eq 0 ]
|
|
|
bd9435 |
do
|
|
|
bd9435 |
(
|
|
|
bd9435 |
$NSUPDATE -- - <
|
|
|
bd9435 |
+local 10.53.0.1
|
|
|
bd9435 |
server 10.53.0.3 ${PORT}
|
|
|
bd9435 |
zone nomaster
|
|
|
bd9435 |
update add unsigned.nomaster. 600 A 10.10.10.1
|
|
|
bd9435 |
@@ -225,6 +228,7 @@ then
|
|
|
bd9435 |
ret=0
|
|
|
bd9435 |
keyname=`cat keyname`
|
|
|
bd9435 |
$NSUPDATE -k $keyname.private -- - <
|
|
|
bd9435 |
+ local 10.53.0.1
|
|
|
bd9435 |
server 10.53.0.3 ${PORT}
|
|
|
bd9435 |
zone example2
|
|
|
bd9435 |
update add unsigned.example2. 600 A 10.10.10.1
|
|
|
bd9435 |
@@ -249,5 +253,40 @@ EOF
|
|
|
bd9435 |
fi
|
|
|
bd9435 |
fi
|
|
|
bd9435 |
|
|
|
bd9435 |
+echo_i "attempting an update that should be rejected by ACL ($n)"
|
|
|
bd9435 |
+ret=0
|
|
|
bd9435 |
+{
|
|
|
bd9435 |
+ $NSUPDATE -- - << EOF
|
|
|
bd9435 |
+ local 10.53.0.2
|
|
|
bd9435 |
+ server 10.53.0.3 ${PORT}
|
|
|
bd9435 |
+ update add another.unsigned.example. 600 A 10.10.10.2
|
|
|
bd9435 |
+ update add another.unsigned.example. 600 TXT Bar
|
|
|
bd9435 |
+ send
|
|
|
bd9435 |
+EOF
|
|
|
bd9435 |
+} > nsupdate.out.$n 2>&1
|
|
|
bd9435 |
+grep REFUSED nsupdate.out.$n > /dev/null || ret=1
|
|
|
bd9435 |
+if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
|
|
|
bd9435 |
+n=`expr $n + 1`
|
|
|
bd9435 |
+
|
|
|
bd9435 |
+n=$((n + 1))
|
|
|
bd9435 |
+ret=0
|
|
|
bd9435 |
+echo_i "attempting updates that should exceed quota ($n)"
|
|
|
bd9435 |
+# lower the update quota to 1.
|
|
|
bd9435 |
+copy_setports ns3/named2.conf.in ns3/named.conf
|
|
|
bd9435 |
+rndc_reconfig ns3 10.53.0.3
|
|
|
bd9435 |
+nextpart ns3/named.run > /dev/null
|
|
|
bd9435 |
+for loop in 1 2 3 4 5 6 7 8 9 10; do
|
|
|
bd9435 |
+{
|
|
|
bd9435 |
+ $NSUPDATE -- - > /dev/null 2>&1 <
|
|
|
bd9435 |
+ local 10.53.0.1
|
|
|
bd9435 |
+ server 10.53.0.3 ${PORT}
|
|
|
bd9435 |
+ update add txt-$loop.unsigned.example 300 IN TXT Whatever
|
|
|
bd9435 |
+ send
|
|
|
bd9435 |
+END
|
|
|
bd9435 |
+} &
|
|
|
bd9435 |
+done
|
|
|
bd9435 |
+wait_for_log 10 "too many DNS UPDATEs queued" ns3/named.run || ret=1
|
|
|
bd9435 |
+[ $ret = 0 ] || { echo_i "failed"; status=1; }
|
|
|
bd9435 |
+
|
|
|
bd9435 |
echo_i "exit status: $status"
|
|
|
bd9435 |
[ $status -eq 0 ] || exit 1
|
|
|
bd9435 |
--
|
|
|
bd9435 |
2.39.2
|
|
|
bd9435 |
|