diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:37:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:37:14 +0000 |
commit | ea648e70a989cca190cd7403fe892fd2dcc290b4 (patch) | |
tree | e2b6b1c647da68b0d4d66082835e256eb30970e8 /bin/tests/system/xferquota | |
parent | Initial commit. (diff) | |
download | bind9-ea648e70a989cca190cd7403fe892fd2dcc290b4.tar.xz bind9-ea648e70a989cca190cd7403fe892fd2dcc290b4.zip |
Adding upstream version 1:9.11.5.P4+dfsg.upstream/1%9.11.5.P4+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bin/tests/system/xferquota')
-rw-r--r-- | bin/tests/system/xferquota/clean.sh | 23 | ||||
-rw-r--r-- | bin/tests/system/xferquota/ns1/changing1.db | 25 | ||||
-rw-r--r-- | bin/tests/system/xferquota/ns1/changing2.db | 25 | ||||
-rw-r--r-- | bin/tests/system/xferquota/ns1/named.conf.in | 43 | ||||
-rw-r--r-- | bin/tests/system/xferquota/ns1/root.db | 27 | ||||
-rw-r--r-- | bin/tests/system/xferquota/ns2/example.db | 144 | ||||
-rw-r--r-- | bin/tests/system/xferquota/ns2/named.conf.in | 38 | ||||
-rw-r--r-- | bin/tests/system/xferquota/setup.pl | 38 | ||||
-rw-r--r-- | bin/tests/system/xferquota/setup.sh | 26 | ||||
-rwxr-xr-x | bin/tests/system/xferquota/tests.sh | 62 |
10 files changed, 451 insertions, 0 deletions
diff --git a/bin/tests/system/xferquota/clean.sh b/bin/tests/system/xferquota/clean.sh new file mode 100644 index 0000000..e823c91 --- /dev/null +++ b/bin/tests/system/xferquota/clean.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# 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. + +# +# Clean up after zone transfer quota tests. +# + +rm -f ns1/zone*.example.db ns1/zones.conf +rm -f ns2/zone*.example.bk ns2/zones.conf +rm -f dig.out.* ns2/changing.bk +rm -f ns1/changing.db +rm -f */named.memstats +rm -f */named.conf +rm -f */named.run +rm -f ns*/named.lock diff --git a/bin/tests/system/xferquota/ns1/changing1.db b/bin/tests/system/xferquota/ns1/changing1.db new file mode 100644 index 0000000..f103492 --- /dev/null +++ b/bin/tests/system/xferquota/ns1/changing1.db @@ -0,0 +1,25 @@ +; 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 600 + +@ IN SOA dns1.changing. postmaster.changing. ( + 1 ;; serial + 3600 ;; refresh period + 1800 ;; retry interval + 604800 ;; expire time + 600 ) ;; default TTL + + IN NS dns1.changing. + NS dns2.changing. + +dns1 IN A 10.53.0.1 +dns2 IN A 10.53.0.2 + +a IN A 10.0.0.1 diff --git a/bin/tests/system/xferquota/ns1/changing2.db b/bin/tests/system/xferquota/ns1/changing2.db new file mode 100644 index 0000000..9afaf71 --- /dev/null +++ b/bin/tests/system/xferquota/ns1/changing2.db @@ -0,0 +1,25 @@ +; 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 600 + +@ IN SOA dns1.changing. postmaster.changing. ( + 2 ;; serial + 3600 ;; refresh period + 1800 ;; retry interval + 604800 ;; expire time + 600 ) ;; default TTL + + IN NS dns1.changing. + NS dns2.changing. + +dns1 IN A 10.53.0.1 +dns2 IN A 10.53.0.2 + +a IN A 10.0.0.2 diff --git a/bin/tests/system/xferquota/ns1/named.conf.in b/bin/tests/system/xferquota/ns1/named.conf.in new file mode 100644 index 0000000..290778e --- /dev/null +++ b/bin/tests/system/xferquota/ns1/named.conf.in @@ -0,0 +1,43 @@ +/* + * 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.1; + notify-source 10.53.0.1; + transfer-source 10.53.0.1; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.1; }; + listen-on-v6 { none; }; + recursion no; + notify yes; +}; + +key rndc_key { + secret "1234abcd8765"; + algorithm hmac-sha256; +}; + +controls { + inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; +}; + +zone "." { + type master; + file "root.db"; +}; + +zone "changing." { + type master; + file "changing.db"; +}; + +include "zones.conf"; diff --git a/bin/tests/system/xferquota/ns1/root.db b/bin/tests/system/xferquota/ns1/root.db new file mode 100644 index 0000000..91692f7 --- /dev/null +++ b/bin/tests/system/xferquota/ns1/root.db @@ -0,0 +1,27 @@ +; 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 +. IN SOA gson.nominum.com. a.root.servers.nil. ( + 2000042100 ; serial + 600 ; refresh + 600 ; retry + 1200 ; expire + 600 ; minimum + ) +. NS a.root-servers.nil. +a.root-servers.nil. A 10.53.0.1 + +example. NS ns2.example. +ns2.example. A 10.53.0.2 + +changing. NS dns1.changing. + A 10.53.0.1 + NS dns2.changing. + A 10.53.0.2 diff --git a/bin/tests/system/xferquota/ns2/example.db b/bin/tests/system/xferquota/ns2/example.db new file mode 100644 index 0000000..e47efcb --- /dev/null +++ b/bin/tests/system/xferquota/ns2/example.db @@ -0,0 +1,144 @@ +; 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. + +$ORIGIN . +$TTL 300 ; 5 minutes +example IN SOA mname1. . ( + 2000042795 ; serial + 20 ; refresh (20 seconds) + 20 ; retry (20 seconds) + 1814400 ; expire (3 weeks) + 3600 ; minimum (1 hour) + ) +example. NS ns2.example. +ns2.example. A 10.53.0.2 +example. NS ns3.example. +ns3.example. A 10.53.0.3 + +$ORIGIN example. +* MX 10 mail +a TXT "foo foo foo" + PTR foo.net. +$TTL 3600 ; 1 hour +a01 A 0.0.0.0 +a02 A 255.255.255.255 +a601 AAAA ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff +afsdb01 AFSDB 0 hostname +afsdb02 AFSDB 65535 . +$TTL 300 ; 5 minutes +b CNAME foo.net. +c A 73.80.65.49 +$TTL 3600 ; 1 hour +cert01 CERT 65534 65535 PRIVATEOID ( + MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi + WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl + d80jEeC8aTrO+KKmCaY= ) +cname01 CNAME cname-target. +cname02 CNAME cname-target +cname03 CNAME . +$TTL 300 ; 5 minutes +d A 73.80.65.49 +$TTL 3600 ; 1 hour +dname01 DNAME dname-target. +dname02 DNAME dname-target +dname03 DNAME . +$TTL 300 ; 5 minutes +e MX 10 mail + TXT "one" + TXT "three" + TXT "two" + A 73.80.65.49 + A 73.80.65.50 + A 73.80.65.52 + A 73.80.65.51 +f A 73.80.65.52 +$TTL 3600 ; 1 hour +gpos01 GPOS "-22.6882" "116.8652" "250.0" +gpos02 GPOS "" "" "" +hinfo01 HINFO "Generic PC clone" "NetBSD-1.4" +hinfo02 HINFO "PC" "NetBSD" +isdn01 ISDN "isdn-address" +isdn02 ISDN "isdn-address" "subaddress" +isdn03 ISDN "isdn-address" +isdn04 ISDN "isdn-address" "subaddress" +dnskey01 DNSKEY 512 255 1 ( + AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR + yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3 + GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o + jqf0BaqHT+8= ) +kx01 KX 10 kdc +kx02 KX 10 . +loc01 LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m +loc02 LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m +mb01 MG madname +mb02 MG . +mg01 MG mgmname +mg02 MG . +minfo01 MINFO rmailbx emailbx +minfo02 MINFO . . +mr01 MR mrname +mr02 MR . +mx01 MX 10 mail +mx02 MX 10 . +naptr01 NAPTR 0 0 "" "" "" . +naptr02 NAPTR 65535 65535 "blurgh" "blorf" ":(.*):\\1:" foo. +nsap-ptr01 NSAP-PTR foo. + NSAP-PTR . +nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100 +nsap02 NSAP 0x47000580005a0000000001e133ffffff00016100 +nsec01 NSEC a.secure ( NS SOA MX RRSIG DNSKEY LOC NSEC ) +nsec02 NSEC . ( NSAP-PTR NSEC ) +nsec03 NSEC . ( A ) +nsec04 NSEC . ( 127 ) +ptr01 PTR example. +px01 PX 65535 foo. bar. +px02 PX 65535 . . +rp01 RP mbox-dname txt-dname +rp02 RP . . +rt01 RT 0 intermediate-host +rt02 RT 65535 . +$TTL 300 ; 5 minutes +s NS ns.s +$ORIGIN s.example. +ns A 73.80.65.49 +$ORIGIN example. +$TTL 3600 ; 1 hour +rrsig01 RRSIG NSEC 1 3 3600 20000102030405 ( + 19961211100908 2143 foo + MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi + WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl + d80jEeC8aTrO+KKmCaY= ) +srv01 SRV 0 0 0 . +srv02 SRV 65535 65535 65535 old-slow-box.example.com. +$TTL 301 ; 5 minutes 1 second +t A 73.80.65.49 +$TTL 3600 ; 1 hour +txt01 TXT "foo" +txt02 TXT "foo" "bar" +txt03 TXT "foo" +txt04 TXT "foo" "bar" +txt05 TXT "foo bar" +txt06 TXT "foo bar" +txt07 TXT "foo bar" +txt08 TXT "foo\010bar" +txt09 TXT "foo\010bar" +txt10 TXT "foo bar" +txt11 TXT "\"foo\"" +txt12 TXT "\"foo\"" +$TTL 300 ; 5 minutes +u TXT "txt-not-in-nsec" +$ORIGIN u.example. +a A 73.80.65.49 +b A 73.80.65.49 +$ORIGIN example. +$TTL 3600 ; 1 hour +wks01 WKS 10.0.0.1 6 ( 0 1 2 21 23 ) +wks02 WKS 10.0.0.1 17 ( 0 1 2 53 ) +wks03 WKS 10.0.0.2 6 ( 65535 ) +x2501 X25 "123456789" diff --git a/bin/tests/system/xferquota/ns2/named.conf.in b/bin/tests/system/xferquota/ns2/named.conf.in new file mode 100644 index 0000000..8b68164 --- /dev/null +++ b/bin/tests/system/xferquota/ns2/named.conf.in @@ -0,0 +1,38 @@ +/* + * 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.2; + notify-source 10.53.0.2; + transfer-source 10.53.0.2; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.2; }; + listen-on-v6 { none; }; + recursion no; + notify no; + + transfers-in 5; + transfers-per-ns 5; +}; + +zone "." { + type hint; + file "../../common/root.hint"; +}; + +zone "changing." { + type slave; + masters { 10.53.0.1; }; + file "changing.bk"; +}; + +include "zones.conf"; diff --git a/bin/tests/system/xferquota/setup.pl b/bin/tests/system/xferquota/setup.pl new file mode 100644 index 0000000..6acbb73 --- /dev/null +++ b/bin/tests/system/xferquota/setup.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl +# +# 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. + +# +# Set up test data for zone transfer quota tests. +# +use FileHandle; + +my $masterconf = new FileHandle("ns1/zones.conf", "w") or die; +my $slaveconf = new FileHandle("ns2/zones.conf", "w") or die; + +for ($z = 0; $z < 300; $z++) { + my $zn = sprintf("zone%06d.example", $z); + print $masterconf "zone \"$zn\" { type master; file \"$zn.db\"; };\n"; + print $slaveconf "zone \"$zn\" { type slave; file \"$zn.bk\"; masterfile-format text; masters { 10.53.0.1; }; };\n"; + my $fn = "ns1/$zn.db"; + my $f = new FileHandle($fn, "w") or die "open: $fn: $!"; + print $f "\$TTL 300 +\@ IN SOA ns1 . 1 300 120 3600 86400 + NS ns1 + NS ns2 +ns1 A 10.53.0.1 +ns2 A 10.53.0.2 + MX 10 mail1.isp.example. + MX 20 mail2.isp.example. +www A 10.0.0.1 +xyzzy A 10.0.0.2 +"; + $f->close; +} diff --git a/bin/tests/system/xferquota/setup.sh b/bin/tests/system/xferquota/setup.sh new file mode 100644 index 0000000..5d41899 --- /dev/null +++ b/bin/tests/system/xferquota/setup.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# +# 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. + +# +# Set up test data for zone transfer quota tests. +# + +SYSTEMTESTTOP=.. +. $SYSTEMTESTTOP/conf.sh + +$SHELL clean.sh + +$PERL setup.pl + +cp -f ns1/changing1.db ns1/changing.db + +copy_setports ns1/named.conf.in ns1/named.conf +copy_setports ns2/named.conf.in ns2/named.conf diff --git a/bin/tests/system/xferquota/tests.sh b/bin/tests/system/xferquota/tests.sh new file mode 100755 index 0000000..0fbc114 --- /dev/null +++ b/bin/tests/system/xferquota/tests.sh @@ -0,0 +1,62 @@ +#!/bin/sh +# +# 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. + +SYSTEMTESTTOP=.. +. $SYSTEMTESTTOP/conf.sh + +DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" +RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s" + +# +# Perform tests +# + +count=0 +ticks=0 +while [ $count != 300 ]; do + if [ $ticks = 1 ]; then + echo_i "Changing test zone..." + cp -f ns1/changing2.db ns1/changing.db + if [ ! "$CYGWIN" ]; then + $KILL -HUP `cat ns1/named.pid` + else + $RNDCCMD 10.53.0.1 reload > /dev/null 2>&1 + fi + fi + sleep 1 + ticks=`expr $ticks + 1` + seconds=`expr $ticks \* 1` + if [ $ticks = 360 ]; then + echo_i "Took too long to load zones" + exit 1 + fi + count=`cat ns2/zone*.bk | grep xyzzy | wc -l` + echo_i "Have $count zones up in $seconds seconds" +done + +status=0 + +$DIG $DIGOPTS zone000099.example. @10.53.0.1 axfr > dig.out.ns1 || status=1 + +$DIG $DIGOPTS zone000099.example. @10.53.0.2 axfr > dig.out.ns2 || status=1 + +digcomp dig.out.ns1 dig.out.ns2 || status=1 + +sleep 15 + +$DIG $DIGOPTS a.changing. @10.53.0.1 a > dig.out.ns1 || status=1 + +$DIG $DIGOPTS a.changing. @10.53.0.2 a > dig.out.ns2 || status=1 + +digcomp dig.out.ns1 dig.out.ns2 || status=1 + +echo_i "exit status: $status" +[ $status -eq 0 ] || exit 1 |