From: Evan Hunt Date: Wed, 6 Jun 2018 22:57:48 +0000 (-0700) Subject: add a regression test for default allow-recursion settings X-Git-Tag: v9.11.4rc1~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe4f9058d275b04c6627b43e0e73d9d5f4f5dd73;p=thirdparty%2Fbind9.git add a regression test for default allow-recursion settings --- diff --git a/bin/tests/system/allow-query/clean.sh b/bin/tests/system/allow-query/clean.sh index a36dbf6923f..1d02bf591a6 100644 --- a/bin/tests/system/allow-query/clean.sh +++ b/bin/tests/system/allow-query/clean.sh @@ -14,7 +14,8 @@ # rm -f dig.out.* -rm -f ns2/named.conf ns2/controls.conf +rm -f ns*/named.conf +rm -f ns2/controls.conf rm -f */named.memstats rm -f ns*/named.lock rm -f ns*/named.run ns*/named.run.prev diff --git a/bin/tests/system/allow-query/ns1/named.conf.in b/bin/tests/system/allow-query/ns1/named.conf.in new file mode 100644 index 00000000000..607925b26e2 --- /dev/null +++ b/bin/tests/system/allow-query/ns1/named.conf.in @@ -0,0 +1,23 @@ +/* + * 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 { + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.1; }; + listen-on-v6 { none; }; + recursion no; +}; + +zone "." { + type master; + file "root.db"; +}; diff --git a/bin/tests/system/allow-query/ns1/root.db b/bin/tests/system/allow-query/ns1/root.db new file mode 100644 index 00000000000..0040271648a --- /dev/null +++ b/bin/tests/system/allow-query/ns1/root.db @@ -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 300 +@ SOA ns1. hostmaster.localhost. 1 3600 1200 604800 3600 + NS ns1. +ns1. A 10.53.0.1 + +normal.example. NS ns2.normal.example. +ns2.normal.example. A 10.53.0.2 diff --git a/bin/tests/system/allow-query/ns3/named.args b/bin/tests/system/allow-query/ns3/named.args new file mode 100644 index 00000000000..a8f679b8a24 --- /dev/null +++ b/bin/tests/system/allow-query/ns3/named.args @@ -0,0 +1,2 @@ +# this server only has 127.0.0.1 in its localhost/localnets ACLs +-m record,size,mctx -c named.conf -d 99 -X named.lock -g -T clienttest -T fixedlocal diff --git a/bin/tests/system/allow-query/ns3/named.conf.in b/bin/tests/system/allow-query/ns3/named.conf.in new file mode 100644 index 00000000000..6eace597bbf --- /dev/null +++ b/bin/tests/system/allow-query/ns3/named.conf.in @@ -0,0 +1,24 @@ +/* + * 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 { + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.3; }; + listen-on-v6 { none; }; + recursion yes; + dnssec-validation no; +}; + +zone "." { + type hint; + file "../../common/root.hint"; +}; diff --git a/bin/tests/system/allow-query/setup.sh b/bin/tests/system/allow-query/setup.sh index 3d2c2c82c43..10b3c934a5e 100644 --- a/bin/tests/system/allow-query/setup.sh +++ b/bin/tests/system/allow-query/setup.sh @@ -13,4 +13,6 @@ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ../common/controls.conf.in ns2/controls.conf +copy_setports ns1/named.conf.in ns1/named.conf copy_setports ns2/named01.conf.in ns2/named.conf +copy_setports ns3/named.conf.in ns3/named.conf diff --git a/bin/tests/system/allow-query/tests.sh b/bin/tests/system/allow-query/tests.sh index f36e5db6113..fb6059d5b88 100644 --- a/bin/tests/system/allow-query/tests.sh +++ b/bin/tests/system/allow-query/tests.sh @@ -602,5 +602,16 @@ grep '^a.aclnotallow.example' dig.out.ns2.2.$n > /dev/null && ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` +# Test 58 - allow-recursion inheritance +n=`expr $n + 1` +echo_i "test $n: default recursion configuration" +ret=0 +$DIG -p ${PORT} @10.53.0.3 -b 127.0.0.1 a.normal.example a > dig.out.ns3.1.$n +grep 'status: NOERROR' dig.out.ns3.1.$n > /dev/null || ret=1 +$DIG -p ${PORT} @10.53.0.3 -b 10.53.0.1 a.normal.example a > dig.out.ns3.2.$n +grep 'status: REFUSED' dig.out.ns3.2.$n > /dev/null || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 diff --git a/util/copyrights b/util/copyrights index 756c8f5806b..b3e95aa809b 100644 --- a/util/copyrights +++ b/util/copyrights @@ -568,6 +568,8 @@ ./bin/tests/system/addzone/tests.sh SH 2010,2011,2012,2013,2014,2015,2016,2017,2018 ./bin/tests/system/allow-query/.gitignore X 2018 ./bin/tests/system/allow-query/clean.sh SH 2018 +./bin/tests/system/allow-query/ns1/named.conf.in CONF-C 2018 +./bin/tests/system/allow-query/ns1/root.db ZONE 2018 ./bin/tests/system/allow-query/ns2/generic.db ZONE 2018 ./bin/tests/system/allow-query/ns2/named01.conf.in CONF-C 2018 ./bin/tests/system/allow-query/ns2/named02.conf.in CONF-C 2018 @@ -601,6 +603,8 @@ ./bin/tests/system/allow-query/ns2/named55.conf.in CONF-C 2018 ./bin/tests/system/allow-query/ns2/named56.conf.in CONF-C 2018 ./bin/tests/system/allow-query/ns2/named57.conf.in CONF-C 2018 +./bin/tests/system/allow-query/ns3/named.args X 2018 +./bin/tests/system/allow-query/ns3/named.conf.in CONF-C 2018 ./bin/tests/system/allow-query/setup.sh SH 2018 ./bin/tests/system/allow-query/tests.sh SH 2018 ./bin/tests/system/ans.pl PERL 2011,2012,2014,2016,2017,2018