From f72946794ffa7afa200fa4df98424c12e88441b3 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Sun, 19 Sep 2021 09:34:33 +1000 Subject: [PATCH] Check that 'check-names master ignore;' works (cherry picked from commit 9107c8caeb11b9f5e4262a86fd1f09b8be86ba83) --- bin/tests/system/checknames/clean.sh | 2 ++ bin/tests/system/checknames/ns4/named.conf.in | 4 +-- ...date.db.in => primary-ignore.update.db.in} | 0 .../checknames/ns5/master-ignore.update.db.in | 14 ++++++++ bin/tests/system/checknames/ns5/named.conf.in | 35 +++++++++++++++++++ bin/tests/system/checknames/ns5/root.hints | 12 +++++++ bin/tests/system/checknames/setup.sh | 5 ++- bin/tests/system/checknames/tests.sh | 23 ++++++++++-- 8 files changed, 89 insertions(+), 6 deletions(-) rename bin/tests/system/checknames/ns4/{master-ignore.update.db.in => primary-ignore.update.db.in} (100%) create mode 100644 bin/tests/system/checknames/ns5/master-ignore.update.db.in create mode 100644 bin/tests/system/checknames/ns5/named.conf.in create mode 100644 bin/tests/system/checknames/ns5/root.hints diff --git a/bin/tests/system/checknames/clean.sh b/bin/tests/system/checknames/clean.sh index 1f439b08db..9131a7f2c1 100644 --- a/bin/tests/system/checknames/clean.sh +++ b/bin/tests/system/checknames/clean.sh @@ -17,6 +17,8 @@ rm -f ns1/*.update.db rm -f ns1/*.update.db.jnl rm -f ns4/*.update.db rm -f ns4/*.update.db.jnl +rm -f ns5/*.update.db +rm -f ns5/*.update.db.jnl rm -f */named.memstats rm -f */named.run rm -f ns*/named.lock diff --git a/bin/tests/system/checknames/ns4/named.conf.in b/bin/tests/system/checknames/ns4/named.conf.in index 9043dbd381..dd6e8fd1a1 100644 --- a/bin/tests/system/checknames/ns4/named.conf.in +++ b/bin/tests/system/checknames/ns4/named.conf.in @@ -28,8 +28,8 @@ zone "." { file "root.hints"; }; -zone "master-ignore.update" { +zone "primary-ignore.update" { type primary; - file "master-ignore.update.db"; + file "primary-ignore.update.db"; allow-update { any; }; }; diff --git a/bin/tests/system/checknames/ns4/master-ignore.update.db.in b/bin/tests/system/checknames/ns4/primary-ignore.update.db.in similarity index 100% rename from bin/tests/system/checknames/ns4/master-ignore.update.db.in rename to bin/tests/system/checknames/ns4/primary-ignore.update.db.in diff --git a/bin/tests/system/checknames/ns5/master-ignore.update.db.in b/bin/tests/system/checknames/ns5/master-ignore.update.db.in new file mode 100644 index 0000000000..f7864ab322 --- /dev/null +++ b/bin/tests/system/checknames/ns5/master-ignore.update.db.in @@ -0,0 +1,14 @@ +; 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 300 +@ SOA ns1.ignore.update. hostmaster.ignore.update. ( + 1 3600 1200 604800 3600 ) + NS ns1.ignore.update. +ns1.ignore.update. A 10.53.0.1 diff --git a/bin/tests/system/checknames/ns5/named.conf.in b/bin/tests/system/checknames/ns5/named.conf.in new file mode 100644 index 0000000000..51344b507e --- /dev/null +++ b/bin/tests/system/checknames/ns5/named.conf.in @@ -0,0 +1,35 @@ +/* + * 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. + */ + +options { + query-source address 10.53.0.5; + notify-source 10.53.0.5; + transfer-source 10.53.0.5; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.5; }; + listen-on-v6 { none; }; + recursion yes; + dnssec-validation yes; + check-names master ignore; + notify yes; +}; + +zone "." { + type hint; + file "root.hints"; +}; + +zone "master-ignore.update" { + type primary; + file "master-ignore.update.db"; + allow-update { any; }; +}; diff --git a/bin/tests/system/checknames/ns5/root.hints b/bin/tests/system/checknames/ns5/root.hints new file mode 100644 index 0000000000..962d33d9d0 --- /dev/null +++ b/bin/tests/system/checknames/ns5/root.hints @@ -0,0 +1,12 @@ +; 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 300 +. NS ns1. +ns1. A 10.53.0.1 diff --git a/bin/tests/system/checknames/setup.sh b/bin/tests/system/checknames/setup.sh index 56ac92590c..0aadd45d42 100644 --- a/bin/tests/system/checknames/setup.sh +++ b/bin/tests/system/checknames/setup.sh @@ -16,6 +16,7 @@ copy_setports ns1/named.conf.in ns1/named.conf copy_setports ns2/named.conf.in ns2/named.conf copy_setports ns3/named.conf.in ns3/named.conf copy_setports ns4/named.conf.in ns4/named.conf +copy_setports ns5/named.conf.in ns5/named.conf cp ns1/ignore.example.db.in ns1/ignore.example.db cp ns1/warn.example.db.in ns1/warn.example.db @@ -25,4 +26,6 @@ cp ns1/ignore.update.db.in ns1/ignore.update.db cp ns1/warn.update.db.in ns1/warn.update.db cp ns1/fail.update.db.in ns1/fail.update.db -cp ns4/master-ignore.update.db.in ns4/master-ignore.update.db +cp ns4/primary-ignore.update.db.in ns4/primary-ignore.update.db + +cp ns5/master-ignore.update.db.in ns5/master-ignore.update.db diff --git a/bin/tests/system/checknames/tests.sh b/bin/tests/system/checknames/tests.sh index 8cf77fc7b7..0ab333ce7b 100644 --- a/bin/tests/system/checknames/tests.sh +++ b/bin/tests/system/checknames/tests.sh @@ -133,16 +133,33 @@ not=1 $NSUPDATE -d < nsupdate.out.test$n 2>&1 || ret=1 check-names off server 10.53.0.4 ${PORT} -update add xxx_xxx.master-ignore.update. 600 A 10.10.10.1 +update add xxx_xxx.primary-ignore.update. 600 A 10.10.10.1 send END -grep "xxx_xxx.master-ignore.update/A.*(check-names)" ns1/named.run > /dev/null || not=0 +grep "xxx_xxx.primary-ignore.update/A.*(check-names)" ns4/named.run > /dev/null || not=0 if [ $not != 0 ]; then ret=1; fi -$DIG $DIGOPTS xxx_xxx.master-ignore.update @10.53.0.4 A > dig.out.ns4.test$n || ret=1 +$DIG $DIGOPTS xxx_xxx.primary-ignore.update @10.53.0.4 A > dig.out.ns4.test$n || ret=1 grep NOERROR dig.out.ns4.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=`expr $n + 1` +echo_i "check that updates to 'check-names master ignore;' succeed and are not logged ($n)" +ret=0 +not=1 +$NSUPDATE -d < nsupdate.out.test$n 2>&1 || ret=1 +check-names off +server 10.53.0.5 ${PORT} +update add xxx_xxx.master-ignore.update. 600 A 10.10.10.1 +send +END +grep "xxx_xxx.master-ignore.update/A.*(check-names)" ns5/named.run > /dev/null || not=0 +if [ $not != 0 ]; then ret=1; fi +$DIG $DIGOPTS xxx_xxx.master-ignore.update @10.53.0.5 A > dig.out.ns5.test$n || ret=1 +grep NOERROR dig.out.ns5.test$n > /dev/null || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) +n=$((n+1)) + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1