From 673e966d375adf3307f4b64c36e4374cf9c6f912 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 17 Oct 2023 15:28:22 +1100 Subject: [PATCH] Check "records but is not served by" warnings This checks that "zone has A records but is not served by IPv4 servers" and "zone has AAAA records but is not served by IPv6 servers" are emitted when they should be and not when they shouldn't be. --- bin/tests/system/checkzone/tests.sh | 36 +++++++++++++++++++ .../checkzone/zones/warn.no-a.server.db | 22 ++++++++++++ .../checkzone/zones/warn.no-a.server.glue.db | 23 ++++++++++++ .../checkzone/zones/warn.no-aaaa.server.db | 22 ++++++++++++ .../zones/warn.no-aaaa.server.glue.db | 23 ++++++++++++ 5 files changed, 126 insertions(+) create mode 100644 bin/tests/system/checkzone/zones/warn.no-a.server.db create mode 100644 bin/tests/system/checkzone/zones/warn.no-a.server.glue.db create mode 100644 bin/tests/system/checkzone/zones/warn.no-aaaa.server.db create mode 100644 bin/tests/system/checkzone/zones/warn.no-aaaa.server.glue.db diff --git a/bin/tests/system/checkzone/tests.sh b/bin/tests/system/checkzone/tests.sh index aa26c8fb43..fb6bcab82a 100644 --- a/bin/tests/system/checkzone/tests.sh +++ b/bin/tests/system/checkzone/tests.sh @@ -218,5 +218,41 @@ echo $lines if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) +echo_i "Checking for 'zone has A records but is not served by IPv4 servers' warning ($n)" +ret=0 +$CHECKZONE example zones/warn.no-a.server.db >test.out1.$n 2>&1 || ret=1 +grep "zone has A records but is not served by IPv4 servers" test.out1.$n >/dev/null || ret=1 +grep "zone has AAAA records but is not served by IPv6 servers" test.out1.$n >/dev/null && ret=1 +n=$((n + 1)) +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) + +echo_i "Checking for 'zone has AAAA records but is not served by IPv6 servers' warning ($n)" +ret=0 +$CHECKZONE example zones/warn.no-aaaa.server.db >test.out1.$n 2>&1 || ret=1 +grep "zone has AAAA records but is not served by IPv6 servers" test.out1.$n >/dev/null || ret=1 +grep "zone has A records but is not served by IPv4 servers" test.out1.$n >/dev/null && ret=1 +n=$((n + 1)) +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) + +echo_i "Checking for 'zone has A records but is not served by IPv4 servers' warning for glue ($n)" +ret=0 +$CHECKZONE example zones/warn.no-a.server.glue.db >test.out1.$n 2>&1 || ret=1 +grep "zone has A records but is not served by IPv4 servers" test.out1.$n >/dev/null || ret=1 +grep "zone has AAAA records but is not served by IPv6 servers" test.out1.$n >/dev/null && ret=1 +n=$((n + 1)) +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) + +echo_i "Checking for 'zone has AAAA records but is not served by IPv6 servers' warning for glue ($n)" +ret=0 +$CHECKZONE example zones/warn.no-aaaa.server.glue.db >test.out1.$n 2>&1 || ret=1 +grep "zone has AAAA records but is not served by IPv6 servers" test.out1.$n >/dev/null || ret=1 +grep "zone has A records but is not served by IPv4 servers" test.out1.$n >/dev/null && ret=1 +n=$((n + 1)) +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 diff --git a/bin/tests/system/checkzone/zones/warn.no-a.server.db b/bin/tests/system/checkzone/zones/warn.no-a.server.db new file mode 100644 index 0000000000..a27c247f02 --- /dev/null +++ b/bin/tests/system/checkzone/zones/warn.no-a.server.db @@ -0,0 +1,22 @@ +; 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. + +@ 30 IN SOA ns1 hostmaster 2017052201 3600 600 604800 30 +@ 7200 IN NS ns1 +@ 7200 IN NS ns2 +@ 7200 IN NS ns3 +@ 7200 IN NS ns4 +ns1 3600 IN AAAA fd92:7065:b8e:ffff::1 +ns2 3600 IN AAAA fd92:7065:b8e:ffff::2 +ns3 3600 IN AAAA fd92:7065:b8e:ffff::4 +ns4 3600 IN AAAA fd92:7065:b8e:ffff::4 +dualstack 300 IN AAAA 2001:db8::1 +dualstack 300 IN A 10.53.0.5 diff --git a/bin/tests/system/checkzone/zones/warn.no-a.server.glue.db b/bin/tests/system/checkzone/zones/warn.no-a.server.glue.db new file mode 100644 index 0000000000..0bbfdde4e7 --- /dev/null +++ b/bin/tests/system/checkzone/zones/warn.no-a.server.glue.db @@ -0,0 +1,23 @@ +; 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. + +@ 30 IN SOA ns1 hostmaster 2017052201 3600 600 604800 30 +@ 7200 IN NS ns1 +@ 7200 IN NS ns2 +@ 7200 IN NS ns3 +@ 7200 IN NS ns4 +ns1 3600 IN AAAA fd92:7065:b8e:ffff::1 +ns2 3600 IN AAAA fd92:7065:b8e:ffff::2 +ns3 3600 IN AAAA fd92:7065:b8e:ffff::4 +ns4 3600 IN AAAA fd92:7065:b8e:ffff::4 +child 3600 IN NS ns1.child +ns1.child 300 IN AAAA 2001:db8::1 +ns1.child 300 IN A 10.53.0.5 diff --git a/bin/tests/system/checkzone/zones/warn.no-aaaa.server.db b/bin/tests/system/checkzone/zones/warn.no-aaaa.server.db new file mode 100644 index 0000000000..afb52d3743 --- /dev/null +++ b/bin/tests/system/checkzone/zones/warn.no-aaaa.server.db @@ -0,0 +1,22 @@ +; 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. + +@ 30 IN SOA ns1 hostmaster 2017052201 3600 600 604800 30 +@ 7200 IN NS ns1 +@ 7200 IN NS ns2 +@ 7200 IN NS ns3 +@ 7200 IN NS ns4 +ns1 3600 IN A 10.53.0.1 +ns2 3600 IN A 10.53.0.2 +ns3 3600 IN A 10.53.0.4 +ns4 3600 IN A 10.53.0.4 +dualstack 300 IN AAAA 2001:db8::1 +dualstack 300 IN A 10.53.0.5 diff --git a/bin/tests/system/checkzone/zones/warn.no-aaaa.server.glue.db b/bin/tests/system/checkzone/zones/warn.no-aaaa.server.glue.db new file mode 100644 index 0000000000..165a1141bb --- /dev/null +++ b/bin/tests/system/checkzone/zones/warn.no-aaaa.server.glue.db @@ -0,0 +1,23 @@ +; 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. + +@ 30 IN SOA ns1 hostmaster 2017052201 3600 600 604800 30 +@ 7200 IN NS ns1 +@ 7200 IN NS ns2 +@ 7200 IN NS ns3 +@ 7200 IN NS ns4 +ns1 3600 IN A 10.53.0.1 +ns2 3600 IN A 10.53.0.2 +ns3 3600 IN A 10.53.0.4 +ns4 3600 IN A 10.53.0.4 +child 3600 IN NS ns1.child +ns1.child 300 IN AAAA 2001:db8::1 +ns1.child 300 IN A 10.53.0.5