diff --git a/bin/tests/system/cookie/ns7/from-no-cookie-server.example.db b/bin/tests/system/cookie/ns7/from-no-cookie-server.example.db new file mode 100644 index 0000000000..8e466a6921 --- /dev/null +++ b/bin/tests/system/cookie/ns7/from-no-cookie-server.example.db @@ -0,0 +1,14 @@ +; 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. + +@ SOA ns7 hostmaster.isc.org. 1 600 600 1200 600 +@ NS ns7 +ns7 A 10.53.0.7 diff --git a/bin/tests/system/cookie/ns7/named.conf.in b/bin/tests/system/cookie/ns7/named.conf.in index c9518ae051..c910880cb7 100644 --- a/bin/tests/system/cookie/ns7/named.conf.in +++ b/bin/tests/system/cookie/ns7/named.conf.in @@ -29,3 +29,8 @@ zone "." { type primary; file "root.db"; }; + +zone "from-no-cookie-server.example" { + type primary; + file "from-no-cookie-server.example.db"; +}; diff --git a/bin/tests/system/cookie/ns8/example.db b/bin/tests/system/cookie/ns8/example.db index 7fa64d602d..443d5db417 100644 --- a/bin/tests/system/cookie/ns8/example.db +++ b/bin/tests/system/cookie/ns8/example.db @@ -9,5 +9,7 @@ ; See the COPYRIGHT file distributed with this work for additional ; information regarding copyright ownership. -@ 3600 SOA . . 0 0 0 0 0 -@ 3600 NS . +@ 3600 SOA . . 0 0 0 0 0 +@ 3600 NS . +from-no-cookie-server 3600 NS ns7.from-no-cookie-server +ns7.from-no-cookie-server 3600 A 10.53.0.7 diff --git a/bin/tests/system/cookie/ns8/named.conf.in b/bin/tests/system/cookie/ns8/named.conf.in index 99ff66b1a2..693f06a81e 100644 --- a/bin/tests/system/cookie/ns8/named.conf.in +++ b/bin/tests/system/cookie/ns8/named.conf.in @@ -33,6 +33,8 @@ options { require-server-cookie yes; }; +server 10.53.0.7 { require-cookie yes; }; + zone "example" { type primary; file "example.db"; diff --git a/bin/tests/system/cookie/tests.sh b/bin/tests/system/cookie/tests.sh index 2e5de5ae90..fc8e4225b7 100755 --- a/bin/tests/system/cookie/tests.sh +++ b/bin/tests/system/cookie/tests.sh @@ -214,6 +214,17 @@ if [ $linecount != 2 ]; then ret=1; fi if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` +n=`expr $n + 1` +echo_i "checking 'server { require-cookie yes; };' triggers TCP when cookie not returned ($n)" +ret=0 +nextpart ns8/named.run > /dev/null +$DIG $DIGOPTS +cookie soa from-no-cookie-server.example @10.53.0.8 > dig.out.test$n +grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 +wait_for_log_peek 3 "missing required cookie from 10.53.0.7#" ns8/named.run || ret=1 +wait_for_log_peek 3 "from-no-cookie-server.example/SOA): connecting via TCP" ns8/named.run || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + n=`expr $n + 1` echo_i "send undersized cookie ($n)" ret=0