|
|
a9e10b |
From 557de3210e8d3d5da8c85dfc94042620049f4292 Mon Sep 17 00:00:00 2001
|
|
|
a9e10b |
From: Mark Andrews <marka@isc.org>
|
|
|
a9e10b |
Date: Tue, 18 Jan 2022 00:19:47 +1100
|
|
|
a9e10b |
Subject: [PATCH] Add tests for forwarder cache poisoning scenarios
|
|
|
a9e10b |
|
|
|
a9e10b |
- Check that an NS in an authority section returned from a forwarder
|
|
|
a9e10b |
which is above the name in a configured "forward first" or "forward
|
|
|
a9e10b |
only" zone (i.e., net/NS in a response from a forwarder configured for
|
|
|
a9e10b |
local.net) is not cached.
|
|
|
a9e10b |
- Test that a DNAME for a parent domain will not be cached when sent
|
|
|
a9e10b |
in a response from a forwarder configured to answer for a child.
|
|
|
a9e10b |
- Check that glue is rejected if its name falls below that of zone
|
|
|
a9e10b |
configured locally.
|
|
|
a9e10b |
- Check that an extra out-of-bailiwick data in the answer section is
|
|
|
a9e10b |
not cached (this was already working correctly, but was not explicitly
|
|
|
a9e10b |
tested before).
|
|
|
a9e10b |
|
|
|
a9e10b |
- v9_11 backport: Revert primary/secondary to master/slave,
|
|
|
a9e10b |
backport rndc helper, backport ns8 config.
|
|
|
a9e10b |
|
|
|
a9e10b |
(cherry picked from commit bf3fffff67e1de78e9387a93674d471bf4291604)
|
|
|
a9e10b |
(cherry picked from commit 29f08170f05c2c96fb67f3b561b46aa0bae356f7)
|
|
|
a9e10b |
---
|
|
|
a9e10b |
bin/tests/system/forward/ans11/ans.py | 136 ++++++++++++++++++
|
|
|
a9e10b |
bin/tests/system/forward/clean.sh | 2 +
|
|
|
a9e10b |
bin/tests/system/forward/ns1/diditwork.net.db | 20 +++
|
|
|
a9e10b |
bin/tests/system/forward/ns1/named.conf.in | 20 +++
|
|
|
a9e10b |
bin/tests/system/forward/ns1/net.example.lll | 13 ++
|
|
|
a9e10b |
bin/tests/system/forward/ns1/spoofed.net.db | 20 +++
|
|
|
a9e10b |
bin/tests/system/forward/ns1/sub.local.net.db | 20 +++
|
|
|
a9e10b |
bin/tests/system/forward/ns10/fakenet.zone | 15 ++
|
|
|
a9e10b |
bin/tests/system/forward/ns10/fakenet2.zone | 13 ++
|
|
|
a9e10b |
.../system/forward/ns10/fakesublocalnet.zone | 13 ++
|
|
|
a9e10b |
.../system/forward/ns10/fakesublocaltld.zone | 13 ++
|
|
|
a9e10b |
bin/tests/system/forward/ns10/named.conf.in | 51 +++++++
|
|
|
a9e10b |
bin/tests/system/forward/ns10/net.example.lll | 13 ++
|
|
|
a9e10b |
bin/tests/system/forward/ns10/spoofednet.zone | 14 ++
|
|
|
a9e10b |
bin/tests/system/forward/ns4/named.conf.in | 5 +
|
|
|
a9e10b |
bin/tests/system/forward/ns4/sibling.tld.db | 20 +++
|
|
|
a9e10b |
bin/tests/system/forward/ns8/named.conf.in | 33 +++++
|
|
|
a9e10b |
bin/tests/system/forward/ns8/root.db | 11 ++
|
|
|
a9e10b |
bin/tests/system/forward/ns8/sub.local.tld.db | 13 ++
|
|
|
a9e10b |
bin/tests/system/forward/ns9/local.net.db | 14 ++
|
|
|
a9e10b |
bin/tests/system/forward/ns9/local.tld.db | 13 ++
|
|
|
a9e10b |
bin/tests/system/forward/ns9/named1.conf.in | 65 +++++++++
|
|
|
a9e10b |
bin/tests/system/forward/ns9/named2.conf.in | 68 +++++++++
|
|
|
a9e10b |
bin/tests/system/forward/ns9/named3.conf.in | 48 +++++++
|
|
|
a9e10b |
bin/tests/system/forward/ns9/named4.conf.in | 45 ++++++
|
|
|
a9e10b |
bin/tests/system/forward/ns9/root.db | 11 ++
|
|
|
a9e10b |
bin/tests/system/forward/prereq.sh | 35 +++++
|
|
|
a9e10b |
bin/tests/system/forward/setup.sh | 3 +
|
|
|
a9e10b |
bin/tests/system/forward/tests.sh | 130 +++++++++++++++++
|
|
|
a9e10b |
bin/tests/system/ifconfig.sh | 8 +-
|
|
|
a9e10b |
30 files changed, 881 insertions(+), 4 deletions(-)
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ans11/ans.py
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns1/diditwork.net.db
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns1/net.example.lll
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns1/spoofed.net.db
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns1/sub.local.net.db
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns10/fakenet.zone
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns10/fakenet2.zone
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns10/fakesublocalnet.zone
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns10/fakesublocaltld.zone
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns10/named.conf.in
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns10/net.example.lll
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns10/spoofednet.zone
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns4/sibling.tld.db
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns8/named.conf.in
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns8/root.db
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns8/sub.local.tld.db
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns9/local.net.db
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns9/local.tld.db
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns9/named1.conf.in
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns9/named2.conf.in
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns9/named3.conf.in
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns9/named4.conf.in
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/ns9/root.db
|
|
|
a9e10b |
create mode 100644 bin/tests/system/forward/prereq.sh
|
|
|
a9e10b |
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ans11/ans.py b/bin/tests/system/forward/ans11/ans.py
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..2956cf6
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ans11/ans.py
|
|
|
a9e10b |
@@ -0,0 +1,136 @@
|
|
|
a9e10b |
+############################################################################
|
|
|
a9e10b |
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+# See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+# information regarding copyright ownership.
|
|
|
a9e10b |
+############################################################################
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+from __future__ import print_function
|
|
|
a9e10b |
+import os
|
|
|
a9e10b |
+import sys
|
|
|
a9e10b |
+import signal
|
|
|
a9e10b |
+import socket
|
|
|
a9e10b |
+import select
|
|
|
a9e10b |
+from datetime import datetime, timedelta
|
|
|
a9e10b |
+import time
|
|
|
a9e10b |
+import functools
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+import dns, dns.message, dns.query, dns.flags
|
|
|
a9e10b |
+from dns.rdatatype import *
|
|
|
a9e10b |
+from dns.rdataclass import *
|
|
|
a9e10b |
+from dns.rcode import *
|
|
|
a9e10b |
+from dns.name import *
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+# Log query to file
|
|
|
a9e10b |
+def logquery(type, qname):
|
|
|
a9e10b |
+ with open("qlog", "a") as f:
|
|
|
a9e10b |
+ f.write("%s %s\n", type, qname)
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+############################################################################
|
|
|
a9e10b |
+# Respond to a DNS query.
|
|
|
a9e10b |
+############################################################################
|
|
|
a9e10b |
+def create_response(msg):
|
|
|
a9e10b |
+ m = dns.message.from_wire(msg)
|
|
|
a9e10b |
+ qname = m.question[0].name.to_text()
|
|
|
a9e10b |
+ rrtype = m.question[0].rdtype
|
|
|
a9e10b |
+ typename = dns.rdatatype.to_text(rrtype)
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+ with open("query.log", "a") as f:
|
|
|
a9e10b |
+ f.write("%s %s\n" % (typename, qname))
|
|
|
a9e10b |
+ print("%s %s" % (typename, qname), end=" ")
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+ r = dns.message.make_response(m)
|
|
|
a9e10b |
+ r.set_rcode(NOERROR)
|
|
|
a9e10b |
+ if rrtype == A:
|
|
|
a9e10b |
+ tld=qname.split('.')[-2] + '.'
|
|
|
a9e10b |
+ ns="local." + tld
|
|
|
a9e10b |
+ r.answer.append(dns.rrset.from_text(qname, 300, IN, A, "10.53.0.11"))
|
|
|
a9e10b |
+ r.answer.append(dns.rrset.from_text(tld, 300, IN, NS, "local." + tld))
|
|
|
a9e10b |
+ r.additional.append(dns.rrset.from_text(ns, 300, IN, A, "10.53.0.11"))
|
|
|
a9e10b |
+ elif rrtype == NS:
|
|
|
a9e10b |
+ r.answer.append(dns.rrset.from_text(qname, 300, IN, NS, "."))
|
|
|
a9e10b |
+ elif rrtype == SOA:
|
|
|
a9e10b |
+ r.answer.append(dns.rrset.from_text(qname, 300, IN, SOA, ". . 0 0 0 0 0"))
|
|
|
a9e10b |
+ else:
|
|
|
a9e10b |
+ r.authority.append(dns.rrset.from_text(qname, 300, IN, SOA, ". . 0 0 0 0 0"))
|
|
|
a9e10b |
+ r.flags |= dns.flags.AA
|
|
|
a9e10b |
+ return r
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+def sigterm(signum, frame):
|
|
|
a9e10b |
+ print ("Shutting down now...")
|
|
|
a9e10b |
+ os.remove('ans.pid')
|
|
|
a9e10b |
+ running = False
|
|
|
a9e10b |
+ sys.exit(0)
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+############################################################################
|
|
|
a9e10b |
+# Main
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+# Set up responder and control channel, open the pid file, and start
|
|
|
a9e10b |
+# the main loop, listening for queries on the query channel or commands
|
|
|
a9e10b |
+# on the control channel and acting on them.
|
|
|
a9e10b |
+############################################################################
|
|
|
a9e10b |
+ip4 = "10.53.0.11"
|
|
|
a9e10b |
+ip6 = "fd92:7065:b8e:ffff::11"
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+try: port=int(os.environ['PORT'])
|
|
|
a9e10b |
+except: port=5300
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+query4_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
|
a9e10b |
+query4_socket.bind((ip4, port))
|
|
|
a9e10b |
+havev6 = True
|
|
|
a9e10b |
+try:
|
|
|
a9e10b |
+ query6_socket = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
|
|
|
a9e10b |
+ try:
|
|
|
a9e10b |
+ query6_socket.bind((ip6, port))
|
|
|
a9e10b |
+ except:
|
|
|
a9e10b |
+ query6_socket.close()
|
|
|
a9e10b |
+ havev6 = False
|
|
|
a9e10b |
+except:
|
|
|
a9e10b |
+ havev6 = False
|
|
|
a9e10b |
+signal.signal(signal.SIGTERM, sigterm)
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+f = open('ans.pid', 'w')
|
|
|
a9e10b |
+pid = os.getpid()
|
|
|
a9e10b |
+print (pid, file=f)
|
|
|
a9e10b |
+f.close()
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+running = True
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+print ("Listening on %s port %d" % (ip4, port))
|
|
|
a9e10b |
+if havev6:
|
|
|
a9e10b |
+ print ("Listening on %s port %d" % (ip6, port))
|
|
|
a9e10b |
+print ("Ctrl-c to quit")
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+if havev6:
|
|
|
a9e10b |
+ input = [query4_socket, query6_socket]
|
|
|
a9e10b |
+else:
|
|
|
a9e10b |
+ input = [query4_socket]
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+while running:
|
|
|
a9e10b |
+ try:
|
|
|
a9e10b |
+ inputready, outputready, exceptready = select.select(input, [], [])
|
|
|
a9e10b |
+ except select.error as e:
|
|
|
a9e10b |
+ break
|
|
|
a9e10b |
+ except socket.error as e:
|
|
|
a9e10b |
+ break
|
|
|
a9e10b |
+ except KeyboardInterrupt:
|
|
|
a9e10b |
+ break
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+ for s in inputready:
|
|
|
a9e10b |
+ if s == query4_socket or s == query6_socket:
|
|
|
a9e10b |
+ print ("Query received on %s" %
|
|
|
a9e10b |
+ (ip4 if s == query4_socket else ip6), end=" ")
|
|
|
a9e10b |
+ # Handle incoming queries
|
|
|
a9e10b |
+ msg = s.recvfrom(65535)
|
|
|
a9e10b |
+ rsp = create_response(msg[0])
|
|
|
a9e10b |
+ if rsp:
|
|
|
a9e10b |
+ print(dns.rcode.to_text(rsp.rcode()))
|
|
|
a9e10b |
+ s.sendto(rsp.to_wire(), msg[1])
|
|
|
a9e10b |
+ else:
|
|
|
a9e10b |
+ print("NO RESPONSE")
|
|
|
a9e10b |
+ if not running:
|
|
|
a9e10b |
+ break
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/clean.sh b/bin/tests/system/forward/clean.sh
|
|
|
a9e10b |
index 3052d27..4ab2a03 100644
|
|
|
a9e10b |
--- a/bin/tests/system/forward/clean.sh
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/clean.sh
|
|
|
a9e10b |
@@ -10,8 +10,10 @@
|
|
|
a9e10b |
#
|
|
|
a9e10b |
# Clean up after forward tests.
|
|
|
a9e10b |
#
|
|
|
a9e10b |
+rm -f ./ans11/query.log
|
|
|
a9e10b |
rm -f dig.out.*
|
|
|
a9e10b |
rm -f */named.conf
|
|
|
a9e10b |
rm -f */named.memstats
|
|
|
a9e10b |
rm -f */named.run
|
|
|
a9e10b |
+rm -f ./*/named_dump.db
|
|
|
a9e10b |
rm -f ns*/named.lock
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns1/diditwork.net.db b/bin/tests/system/forward/ns1/diditwork.net.db
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..be9a7f7
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns1/diditwork.net.db
|
|
|
a9e10b |
@@ -0,0 +1,20 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 300 ; 5 minutes
|
|
|
a9e10b |
+@ IN SOA ns root (
|
|
|
a9e10b |
+ 2000082401 ; serial
|
|
|
a9e10b |
+ 1800 ; refresh (30 minutes)
|
|
|
a9e10b |
+ 1800 ; retry (30 minutes)
|
|
|
a9e10b |
+ 1814400 ; expire (3 weeks)
|
|
|
a9e10b |
+ 3600 ; minimum (1 hour)
|
|
|
a9e10b |
+ )
|
|
|
a9e10b |
+ NS ns
|
|
|
a9e10b |
+ TXT "recursed"
|
|
|
a9e10b |
+ns A 10.53.0.1
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns1/named.conf.in b/bin/tests/system/forward/ns1/named.conf.in
|
|
|
a9e10b |
index 7ce81dd..442b928 100644
|
|
|
a9e10b |
--- a/bin/tests/system/forward/ns1/named.conf.in
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns1/named.conf.in
|
|
|
a9e10b |
@@ -54,3 +54,23 @@ zone "example5." {
|
|
|
a9e10b |
zone "example6" {
|
|
|
a9e10b |
type forward;
|
|
|
a9e10b |
};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "diditwork.net" {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "diditwork.net.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "spoofed.net" {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "spoofed.net.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "sub.local.net" {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "sub.local.net.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "net.example.lll" {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "net.example.lll";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns1/net.example.lll b/bin/tests/system/forward/ns1/net.example.lll
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..d179853
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns1/net.example.lll
|
|
|
a9e10b |
@@ -0,0 +1,13 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 86400
|
|
|
a9e10b |
+net.example.lll. SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+net.example.lll. NS attackSecureDomain.net.
|
|
|
a9e10b |
+didItWork.net.example.lll. TXT "if you can see this record the attack worked"
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns1/spoofed.net.db b/bin/tests/system/forward/ns1/spoofed.net.db
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..d498d5f
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns1/spoofed.net.db
|
|
|
a9e10b |
@@ -0,0 +1,20 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 300 ; 5 minutes
|
|
|
a9e10b |
+@ IN SOA ns root (
|
|
|
a9e10b |
+ 2000082401 ; serial
|
|
|
a9e10b |
+ 1800 ; refresh (30 minutes)
|
|
|
a9e10b |
+ 1800 ; retry (30 minutes)
|
|
|
a9e10b |
+ 1814400 ; expire (3 weeks)
|
|
|
a9e10b |
+ 3600 ; minimum (1 hour)
|
|
|
a9e10b |
+ )
|
|
|
a9e10b |
+ NS ns
|
|
|
a9e10b |
+ns A 10.53.0.1
|
|
|
a9e10b |
+sub TXT "recursed"
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns1/sub.local.net.db b/bin/tests/system/forward/ns1/sub.local.net.db
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..be9a7f7
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns1/sub.local.net.db
|
|
|
a9e10b |
@@ -0,0 +1,20 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 300 ; 5 minutes
|
|
|
a9e10b |
+@ IN SOA ns root (
|
|
|
a9e10b |
+ 2000082401 ; serial
|
|
|
a9e10b |
+ 1800 ; refresh (30 minutes)
|
|
|
a9e10b |
+ 1800 ; retry (30 minutes)
|
|
|
a9e10b |
+ 1814400 ; expire (3 weeks)
|
|
|
a9e10b |
+ 3600 ; minimum (1 hour)
|
|
|
a9e10b |
+ )
|
|
|
a9e10b |
+ NS ns
|
|
|
a9e10b |
+ TXT "recursed"
|
|
|
a9e10b |
+ns A 10.53.0.1
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns10/fakenet.zone b/bin/tests/system/forward/ns10/fakenet.zone
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..14e5c77
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns10/fakenet.zone
|
|
|
a9e10b |
@@ -0,0 +1,15 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 86400
|
|
|
a9e10b |
+net. SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+net. NS attackSecureDomain.net.
|
|
|
a9e10b |
+attackSecureDomain.net. A 10.53.0.10
|
|
|
a9e10b |
+didItWork.net. TXT "if you can see this record the attack worked"
|
|
|
a9e10b |
+ns.spoofed.net. A 10.53.0.10
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns10/fakenet2.zone b/bin/tests/system/forward/ns10/fakenet2.zone
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..7ca28a9
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns10/fakenet2.zone
|
|
|
a9e10b |
@@ -0,0 +1,13 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 86400
|
|
|
a9e10b |
+net2. SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+net2. NS attackSecureDomain.net.
|
|
|
a9e10b |
+net2. DNAME net.example.lll.
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns10/fakesublocalnet.zone b/bin/tests/system/forward/ns10/fakesublocalnet.zone
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..6caa071
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns10/fakesublocalnet.zone
|
|
|
a9e10b |
@@ -0,0 +1,13 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 86400
|
|
|
a9e10b |
+sub.local.net. SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+sub.local.net. NS ns.spoofed.net.
|
|
|
a9e10b |
+sub.local.net. TXT "if you see this attacker overrode local delegation"
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns10/fakesublocaltld.zone b/bin/tests/system/forward/ns10/fakesublocaltld.zone
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..6a431de
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns10/fakesublocaltld.zone
|
|
|
a9e10b |
@@ -0,0 +1,13 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+sub.local.tld. 3600 IN SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+sub.local.tld. 3600 IN NS ns.sub.local.tld.
|
|
|
a9e10b |
+sub.local.tld. 3600 IN TXT bad
|
|
|
a9e10b |
+ns.sub.local.tld. 3600 IN A 10.53.0.8
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns10/named.conf.in b/bin/tests/system/forward/ns10/named.conf.in
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..025c108
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns10/named.conf.in
|
|
|
a9e10b |
@@ -0,0 +1,51 @@
|
|
|
a9e10b |
+/*
|
|
|
a9e10b |
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+ * information regarding copyright ownership.
|
|
|
a9e10b |
+ */
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+options {
|
|
|
a9e10b |
+ query-source address 10.53.0.10;
|
|
|
a9e10b |
+ notify-source 10.53.0.10;
|
|
|
a9e10b |
+ transfer-source 10.53.0.10;
|
|
|
a9e10b |
+ port @PORT@;
|
|
|
a9e10b |
+ pid-file "named.pid";
|
|
|
a9e10b |
+ listen-on { 10.53.0.10; };
|
|
|
a9e10b |
+ listen-on-v6 { none; };
|
|
|
a9e10b |
+ minimal-responses no;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "net." {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "fakenet.zone";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "spoofed.net." {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "spoofednet.zone";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "sub.local.net." {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "fakesublocalnet.zone";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "net2" {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "fakenet2.zone";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "net.example.lll" {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "net.example.lll";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "sub.local.tld." {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "fakesublocaltld.zone";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns10/net.example.lll b/bin/tests/system/forward/ns10/net.example.lll
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..d179853
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns10/net.example.lll
|
|
|
a9e10b |
@@ -0,0 +1,13 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 86400
|
|
|
a9e10b |
+net.example.lll. SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+net.example.lll. NS attackSecureDomain.net.
|
|
|
a9e10b |
+didItWork.net.example.lll. TXT "if you can see this record the attack worked"
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns10/spoofednet.zone b/bin/tests/system/forward/ns10/spoofednet.zone
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..13921a0
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns10/spoofednet.zone
|
|
|
a9e10b |
@@ -0,0 +1,14 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 86400
|
|
|
a9e10b |
+spoofed.net. SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+spoofed.net. NS ns.spoofed.net.
|
|
|
a9e10b |
+ns.spoofed.net. A 10.53.0.10
|
|
|
a9e10b |
+spoofed.net. TXT "this record is clearly spoofed"
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns4/named.conf.in b/bin/tests/system/forward/ns4/named.conf.in
|
|
|
a9e10b |
index fee76b4..5fda95c 100644
|
|
|
a9e10b |
--- a/bin/tests/system/forward/ns4/named.conf.in
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns4/named.conf.in
|
|
|
a9e10b |
@@ -60,3 +60,8 @@ zone "malicious." {
|
|
|
a9e10b |
type master;
|
|
|
a9e10b |
file "malicious.db";
|
|
|
a9e10b |
};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "sibling.tld" {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "sibling.tld.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns4/sibling.tld.db b/bin/tests/system/forward/ns4/sibling.tld.db
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..58037d0
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns4/sibling.tld.db
|
|
|
a9e10b |
@@ -0,0 +1,20 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+$TTL 86400
|
|
|
a9e10b |
+@ IN SOA malicious. admin.malicious. (
|
|
|
a9e10b |
+ 1 ; Serial
|
|
|
a9e10b |
+ 604800 ; Refresh
|
|
|
a9e10b |
+ 86400 ; Retry
|
|
|
a9e10b |
+ 2419200 ; Expire
|
|
|
a9e10b |
+ 86400 ) ; Negative Cache TTL
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+@ IN NS ns
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+ns IN A 10.53.0.4
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns8/named.conf.in b/bin/tests/system/forward/ns8/named.conf.in
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..9260f69
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns8/named.conf.in
|
|
|
a9e10b |
@@ -0,0 +1,33 @@
|
|
|
a9e10b |
+/*
|
|
|
a9e10b |
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+ * information regarding copyright ownership.
|
|
|
a9e10b |
+ */
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+options {
|
|
|
a9e10b |
+ query-source address 10.53.0.8;
|
|
|
a9e10b |
+ notify-source 10.53.0.8;
|
|
|
a9e10b |
+ transfer-source 10.53.0.8;
|
|
|
a9e10b |
+ port @PORT@;
|
|
|
a9e10b |
+ pid-file "named.pid";
|
|
|
a9e10b |
+ listen-on { 10.53.0.8; };
|
|
|
a9e10b |
+ listen-on-v6 { none; };
|
|
|
a9e10b |
+ forwarders { 10.53.0.2; }; // returns referrals
|
|
|
a9e10b |
+ forward first;
|
|
|
a9e10b |
+ dnssec-validation yes;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "." {
|
|
|
a9e10b |
+ type hint;
|
|
|
a9e10b |
+ file "root.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "sub.local.tld" {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "sub.local.tld.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns8/root.db b/bin/tests/system/forward/ns8/root.db
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..4f30322
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns8/root.db
|
|
|
a9e10b |
@@ -0,0 +1,11 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+. NS a.root-servers.nil.
|
|
|
a9e10b |
+a.root-servers.nil. A 10.53.0.1
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns8/sub.local.tld.db b/bin/tests/system/forward/ns8/sub.local.tld.db
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..eb20683
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns8/sub.local.tld.db
|
|
|
a9e10b |
@@ -0,0 +1,13 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+sub.local.tld. 3600 IN SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+sub.local.tld. 3600 IN NS ns.sub.local.tld.
|
|
|
a9e10b |
+sub.local.tld. 3600 IN TXT good
|
|
|
a9e10b |
+ns.sub.local.tld. 3600 IN A 10.53.0.8
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns9/local.net.db b/bin/tests/system/forward/ns9/local.net.db
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..2c971e1
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns9/local.net.db
|
|
|
a9e10b |
@@ -0,0 +1,14 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+local.net. 3600 IN SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+local.net. 3600 IN NS localhost.
|
|
|
a9e10b |
+ns.local.net. 3600 IN A 10.53.0.9
|
|
|
a9e10b |
+txt.local.net. 3600 IN TXT "something in the local auth zone"
|
|
|
a9e10b |
+sub.local.net. 3600 IN NS ns.spoofed.net. ; attacker will try to override this
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns9/local.tld.db b/bin/tests/system/forward/ns9/local.tld.db
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..5940391
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns9/local.tld.db
|
|
|
a9e10b |
@@ -0,0 +1,13 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+local.tld. 3600 IN SOA . . 0 0 0 0 0
|
|
|
a9e10b |
+local.tld. 3600 IN NS localhost.
|
|
|
a9e10b |
+sub.local.tld. 3600 IN NS ns.sub.local.tld.
|
|
|
a9e10b |
+ns.sub.local.tld. 3600 IN A 10.53.0.8
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns9/named1.conf.in b/bin/tests/system/forward/ns9/named1.conf.in
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..943e037
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns9/named1.conf.in
|
|
|
a9e10b |
@@ -0,0 +1,65 @@
|
|
|
a9e10b |
+/*
|
|
|
a9e10b |
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+ * information regarding copyright ownership.
|
|
|
a9e10b |
+ */
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+options {
|
|
|
a9e10b |
+ query-source address 10.53.0.9;
|
|
|
a9e10b |
+ notify-source 10.53.0.9;
|
|
|
a9e10b |
+ transfer-source 10.53.0.9;
|
|
|
a9e10b |
+ port @PORT@;
|
|
|
a9e10b |
+ pid-file "named.pid";
|
|
|
a9e10b |
+ listen-on { 10.53.0.9; };
|
|
|
a9e10b |
+ listen-on-v6 { none; };
|
|
|
a9e10b |
+ dnssec-validation no;
|
|
|
a9e10b |
+ edns-udp-size 1232;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+key rndc_key {
|
|
|
a9e10b |
+ secret "1234abcd8765";
|
|
|
a9e10b |
+ algorithm hmac-sha256;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+controls {
|
|
|
a9e10b |
+ inet 10.53.0.9 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+server 10.53.0.10 {
|
|
|
a9e10b |
+ edns no;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+server 10.53.0.11 {
|
|
|
a9e10b |
+ edns no;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "." {
|
|
|
a9e10b |
+ type hint;
|
|
|
a9e10b |
+ file "root.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "attacksecuredomain.net." {
|
|
|
a9e10b |
+ type forward;
|
|
|
a9e10b |
+ forwarders { 10.53.0.10; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "attacksecuredomain.net2." {
|
|
|
a9e10b |
+ type forward;
|
|
|
a9e10b |
+ forwarders { 10.53.0.10; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "attacksecuredomain.net3." {
|
|
|
a9e10b |
+ type forward;
|
|
|
a9e10b |
+ forwarders { 10.53.0.11; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "local.net." {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "local.net.db";
|
|
|
a9e10b |
+ forwarders {};
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns9/named2.conf.in b/bin/tests/system/forward/ns9/named2.conf.in
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..5a17d19
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns9/named2.conf.in
|
|
|
a9e10b |
@@ -0,0 +1,68 @@
|
|
|
a9e10b |
+/*
|
|
|
a9e10b |
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+ * information regarding copyright ownership.
|
|
|
a9e10b |
+ */
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+options {
|
|
|
a9e10b |
+ query-source address 10.53.0.9;
|
|
|
a9e10b |
+ notify-source 10.53.0.9;
|
|
|
a9e10b |
+ transfer-source 10.53.0.9;
|
|
|
a9e10b |
+ port @PORT@;
|
|
|
a9e10b |
+ pid-file "named.pid";
|
|
|
a9e10b |
+ listen-on { 10.53.0.9; };
|
|
|
a9e10b |
+ listen-on-v6 { none; };
|
|
|
a9e10b |
+ dnssec-validation no;
|
|
|
a9e10b |
+ edns-udp-size 1232;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+key rndc_key {
|
|
|
a9e10b |
+ secret "1234abcd8765";
|
|
|
a9e10b |
+ algorithm hmac-sha256;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+controls {
|
|
|
a9e10b |
+ inet 10.53.0.9 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+server 10.53.0.10 {
|
|
|
a9e10b |
+ edns no;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+server 10.53.0.11 {
|
|
|
a9e10b |
+ edns no;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "." {
|
|
|
a9e10b |
+ type hint;
|
|
|
a9e10b |
+ file "root.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "attacksecuredomain.net." {
|
|
|
a9e10b |
+ type forward;
|
|
|
a9e10b |
+ forward only;
|
|
|
a9e10b |
+ forwarders { 10.53.0.10; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "attacksecuredomain.net2." {
|
|
|
a9e10b |
+ type forward;
|
|
|
a9e10b |
+ forward only;
|
|
|
a9e10b |
+ forwarders { 10.53.0.10; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "attacksecuredomain.net3." {
|
|
|
a9e10b |
+ type forward;
|
|
|
a9e10b |
+ forward only;
|
|
|
a9e10b |
+ forwarders { 10.53.0.11; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "local.net." {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "local.net.db";
|
|
|
a9e10b |
+ forwarders {};
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns9/named3.conf.in b/bin/tests/system/forward/ns9/named3.conf.in
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..1e70d1a
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns9/named3.conf.in
|
|
|
a9e10b |
@@ -0,0 +1,48 @@
|
|
|
a9e10b |
+/*
|
|
|
a9e10b |
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+ * information regarding copyright ownership.
|
|
|
a9e10b |
+ */
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+options {
|
|
|
a9e10b |
+ query-source address 10.53.0.9;
|
|
|
a9e10b |
+ notify-source 10.53.0.9;
|
|
|
a9e10b |
+ transfer-source 10.53.0.9;
|
|
|
a9e10b |
+ port @PORT@;
|
|
|
a9e10b |
+ pid-file "named.pid";
|
|
|
a9e10b |
+ listen-on { 10.53.0.9; };
|
|
|
a9e10b |
+ listen-on-v6 { none; };
|
|
|
a9e10b |
+ dnssec-validation no;
|
|
|
a9e10b |
+ edns-udp-size 1232;
|
|
|
a9e10b |
+ forward only;
|
|
|
a9e10b |
+ forwarders { 10.53.0.10; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+key rndc_key {
|
|
|
a9e10b |
+ secret "1234abcd8765";
|
|
|
a9e10b |
+ algorithm hmac-sha256;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+controls {
|
|
|
a9e10b |
+ inet 10.53.0.9 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+server 10.53.0.10 {
|
|
|
a9e10b |
+ edns no;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "." {
|
|
|
a9e10b |
+ type hint;
|
|
|
a9e10b |
+ file "root.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "local.net." {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "local.net.db";
|
|
|
a9e10b |
+ forwarders {};
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns9/named4.conf.in b/bin/tests/system/forward/ns9/named4.conf.in
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..6f7b107
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns9/named4.conf.in
|
|
|
a9e10b |
@@ -0,0 +1,45 @@
|
|
|
a9e10b |
+/*
|
|
|
a9e10b |
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+ *
|
|
|
a9e10b |
+ * See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+ * information regarding copyright ownership.
|
|
|
a9e10b |
+ */
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+options {
|
|
|
a9e10b |
+ query-source address 10.53.0.9;
|
|
|
a9e10b |
+ notify-source 10.53.0.9;
|
|
|
a9e10b |
+ transfer-source 10.53.0.9;
|
|
|
a9e10b |
+ port @PORT@;
|
|
|
a9e10b |
+ pid-file "named.pid";
|
|
|
a9e10b |
+ listen-on { 10.53.0.9; };
|
|
|
a9e10b |
+ listen-on-v6 { none; };
|
|
|
a9e10b |
+ dnssec-validation no;
|
|
|
a9e10b |
+ edns-udp-size 1232;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+key rndc_key {
|
|
|
a9e10b |
+ secret "1234abcd8765";
|
|
|
a9e10b |
+ algorithm hmac-sha256;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+controls {
|
|
|
a9e10b |
+ inet 10.53.0.9 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+server 10.53.0.10 {
|
|
|
a9e10b |
+ edns no;
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "." {
|
|
|
a9e10b |
+ type hint;
|
|
|
a9e10b |
+ file "root.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+zone "local.tld." {
|
|
|
a9e10b |
+ type master;
|
|
|
a9e10b |
+ file "local.tld.db";
|
|
|
a9e10b |
+};
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/ns9/root.db b/bin/tests/system/forward/ns9/root.db
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..4f30322
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/ns9/root.db
|
|
|
a9e10b |
@@ -0,0 +1,11 @@
|
|
|
a9e10b |
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+;
|
|
|
a9e10b |
+; See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+; information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+. NS a.root-servers.nil.
|
|
|
a9e10b |
+a.root-servers.nil. A 10.53.0.1
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/prereq.sh b/bin/tests/system/forward/prereq.sh
|
|
|
a9e10b |
new file mode 100644
|
|
|
a9e10b |
index 0000000..53fb581
|
|
|
a9e10b |
--- /dev/null
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/prereq.sh
|
|
|
a9e10b |
@@ -0,0 +1,35 @@
|
|
|
a9e10b |
+#!/bin/sh
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a9e10b |
+# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a9e10b |
+# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+# See the COPYRIGHT file distributed with this work for additional
|
|
|
a9e10b |
+# information regarding copyright ownership.
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+SYSTEMTESTTOP=..
|
|
|
a9e10b |
+. $SYSTEMTESTTOP/conf.sh
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+if test -n "$PYTHON"
|
|
|
a9e10b |
+then
|
|
|
a9e10b |
+ if $PYTHON -c "import dns" 2> /dev/null
|
|
|
a9e10b |
+ then
|
|
|
a9e10b |
+ :
|
|
|
a9e10b |
+ else
|
|
|
a9e10b |
+ echo_i "This test requires the dnspython module." >&2
|
|
|
a9e10b |
+ exit 1
|
|
|
a9e10b |
+ fi
|
|
|
a9e10b |
+else
|
|
|
a9e10b |
+ echo_i "This test requires Python and the dnspython module." >&2
|
|
|
a9e10b |
+ exit 1
|
|
|
a9e10b |
+fi
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+if $PERL -e 'use Net::DNS;' 2>/dev/null
|
|
|
a9e10b |
+then
|
|
|
a9e10b |
+ :
|
|
|
a9e10b |
+else
|
|
|
a9e10b |
+ echo_i "This test requires the Net::DNS library." >&2
|
|
|
a9e10b |
+ exit 1
|
|
|
a9e10b |
+fi
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/setup.sh b/bin/tests/system/forward/setup.sh
|
|
|
a9e10b |
index d64579e..b89cb30 100644
|
|
|
a9e10b |
--- a/bin/tests/system/forward/setup.sh
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/setup.sh
|
|
|
a9e10b |
@@ -19,3 +19,6 @@ copy_setports ns3/named.conf.in ns3/named.conf
|
|
|
a9e10b |
copy_setports ns4/named.conf.in ns4/named.conf
|
|
|
a9e10b |
copy_setports ns5/named.conf.in ns5/named.conf
|
|
|
a9e10b |
copy_setports ns7/named.conf.in ns7/named.conf
|
|
|
a9e10b |
+copy_setports ns8/named.conf.in ns8/named.conf
|
|
|
a9e10b |
+copy_setports ns9/named1.conf.in ns9/named.conf
|
|
|
a9e10b |
+copy_setports ns10/named.conf.in ns10/named.conf
|
|
|
a9e10b |
diff --git a/bin/tests/system/forward/tests.sh b/bin/tests/system/forward/tests.sh
|
|
|
a9e10b |
index 1da4136..f0907f2 100644
|
|
|
a9e10b |
--- a/bin/tests/system/forward/tests.sh
|
|
|
a9e10b |
+++ b/bin/tests/system/forward/tests.sh
|
|
|
a9e10b |
@@ -12,6 +12,14 @@ SYSTEMTESTTOP=..
|
|
|
a9e10b |
|
|
|
a9e10b |
DIGOPTS="-p ${PORT}"
|
|
|
a9e10b |
|
|
|
a9e10b |
+dig_with_opts() (
|
|
|
a9e10b |
+ "$DIG" -p "$PORT" "$@"
|
|
|
a9e10b |
+)
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+rndccmd() {
|
|
|
a9e10b |
+ "$RNDC" -c ../common/rndc.conf -p "$CONTROLPORT" -s "$@"
|
|
|
a9e10b |
+}
|
|
|
a9e10b |
+
|
|
|
a9e10b |
root=10.53.0.1
|
|
|
a9e10b |
hidden=10.53.0.2
|
|
|
a9e10b |
f1=10.53.0.3
|
|
|
a9e10b |
@@ -156,5 +164,127 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
a9e10b |
status=$((status+ret))
|
|
|
a9e10b |
|
|
|
a9e10b |
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+# Check various spoofed response scenarios. The same tests will be
|
|
|
a9e10b |
+# run twice, with "forward first" and "forward only" configurations.
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+run_spooftests () {
|
|
|
a9e10b |
+ n=$((n+1))
|
|
|
a9e10b |
+ echo_i "checking spoofed response scenario 1 - out of bailiwick NS ($n)"
|
|
|
a9e10b |
+ ret=0
|
|
|
a9e10b |
+ # prime
|
|
|
a9e10b |
+ dig_with_opts @10.53.0.9 attackSecureDomain.net > dig.out.$n.prime || ret=1
|
|
|
a9e10b |
+ # check 'net' is not poisoned.
|
|
|
a9e10b |
+ dig_with_opts @10.53.0.9 diditwork.net. TXT > dig.out.$n.net || ret=1
|
|
|
a9e10b |
+ grep '^diditwork\.net\..*TXT.*"recursed"' dig.out.$n.net > /dev/null || ret=1
|
|
|
a9e10b |
+ # check 'sub.local.net' is not poisoned.
|
|
|
a9e10b |
+ dig_with_opts @10.53.0.9 sub.local.net TXT > dig.out.$n.sub || ret=1
|
|
|
a9e10b |
+ grep '^sub\.local\.net\..*TXT.*"recursed"' dig.out.$n.sub > /dev/null || ret=1
|
|
|
a9e10b |
+ if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
a9e10b |
+ status=$((status+ret))
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+ n=$((n+1))
|
|
|
a9e10b |
+ echo_i "checking spoofed response scenario 2 - inject DNAME/net2. ($n)"
|
|
|
a9e10b |
+ ret=0
|
|
|
a9e10b |
+ # prime
|
|
|
a9e10b |
+ dig_with_opts @10.53.0.9 attackSecureDomain.net2 > dig.out.$n.prime || ret=1
|
|
|
a9e10b |
+ # check that net2/DNAME is not cached
|
|
|
a9e10b |
+ dig_with_opts @10.53.0.9 net2. DNAME > dig.out.$n.net2 || ret=1
|
|
|
a9e10b |
+ grep "ANSWER: 0," dig.out.$n.net2 > /dev/null || ret=1
|
|
|
a9e10b |
+ grep "status: NXDOMAIN" dig.out.$n.net2 > /dev/null || ret=1
|
|
|
a9e10b |
+ if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
a9e10b |
+ status=$((status+ret))
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+ n=$((n+1))
|
|
|
a9e10b |
+ echo_i "checking spoofed response scenario 3 - extra answer ($n)"
|
|
|
a9e10b |
+ ret=0
|
|
|
a9e10b |
+ # prime
|
|
|
a9e10b |
+ dig_with_opts @10.53.0.9 attackSecureDomain.net3 > dig.out.$n.prime || ret=1
|
|
|
a9e10b |
+ # check extra net3 records are not cached
|
|
|
a9e10b |
+ rndccmd 10.53.0.9 dumpdb -cache 2>&1 | sed 's/^/ns9 /' | cat_i
|
|
|
a9e10b |
+ for try in 1 2 3 4 5; do
|
|
|
a9e10b |
+ lines=$(grep "net3" ns9/named_dump.db | wc -l)
|
|
|
a9e10b |
+ if [ ${lines} -eq 0 ]; then
|
|
|
a9e10b |
+ sleep 1
|
|
|
a9e10b |
+ continue
|
|
|
a9e10b |
+ fi
|
|
|
a9e10b |
+ [ ${lines} -eq 1 ] || ret=1
|
|
|
a9e10b |
+ grep -q '^attackSecureDomain.net3' ns9/named_dump.db || ret=1
|
|
|
a9e10b |
+ grep -q '^local.net3' ns9/named_dump.db && ret=1
|
|
|
a9e10b |
+ done
|
|
|
a9e10b |
+ if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
a9e10b |
+ status=$((status+ret))
|
|
|
a9e10b |
+}
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+echo_i "checking spoofed response scenarios with forward first zones"
|
|
|
a9e10b |
+run_spooftests
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+copy_setports ns9/named2.conf.in ns9/named.conf
|
|
|
a9e10b |
+rndccmd 10.53.0.9 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i
|
|
|
a9e10b |
+rndccmd 10.53.0.9 flush 2>&1 | sed 's/^/ns3 /' | cat_i
|
|
|
a9e10b |
+sleep 1
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+echo_i "rechecking spoofed response scenarios with forward only zones"
|
|
|
a9e10b |
+run_spooftests
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+# This scenario expects the spoofed response to succeed. The tests are
|
|
|
a9e10b |
+# similar to the ones above, but not identical.
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+echo_i "rechecking spoofed response scenarios with 'forward only' set globally"
|
|
|
a9e10b |
+copy_setports ns9/named3.conf.in ns9/named.conf
|
|
|
a9e10b |
+rndccmd 10.53.0.9 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i
|
|
|
a9e10b |
+rndccmd 10.53.0.9 flush 2>&1 | sed 's/^/ns3 /' | cat_i
|
|
|
a9e10b |
+sleep 1
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+n=$((n+1))
|
|
|
a9e10b |
+echo_i "checking spoofed response scenario 1 - out of bailiwick NS ($n)"
|
|
|
a9e10b |
+ret=0
|
|
|
a9e10b |
+# prime
|
|
|
a9e10b |
+dig_with_opts @10.53.0.9 attackSecureDomain.net > dig.out.$n.prime || ret=1
|
|
|
a9e10b |
+# check 'net' is poisoned.
|
|
|
a9e10b |
+dig_with_opts @10.53.0.9 diditwork.net. TXT > dig.out.$n.net || ret=1
|
|
|
a9e10b |
+grep '^didItWork\.net\..*TXT.*"if you can see this record the attack worked"' dig.out.$n.net > /dev/null || ret=1
|
|
|
a9e10b |
+# check 'sub.local.net' is poisoned.
|
|
|
a9e10b |
+dig_with_opts @10.53.0.9 sub.local.net TXT > dig.out.$n.sub || ret=1
|
|
|
a9e10b |
+grep '^sub\.local\.net\..*TXT.*"if you see this attacker overrode local delegation"' dig.out.$n.sub > /dev/null || ret=1
|
|
|
a9e10b |
+if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
a9e10b |
+status=$((status+ret))
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+n=$((n+1))
|
|
|
a9e10b |
+echo_i "checking spoofed response scenario 2 - inject DNAME/net2. ($n)"
|
|
|
a9e10b |
+ret=0
|
|
|
a9e10b |
+# prime
|
|
|
a9e10b |
+dig_with_opts @10.53.0.9 attackSecureDomain.net2 > dig.out.$n.prime || ret=1
|
|
|
a9e10b |
+# check that net2/DNAME is cached
|
|
|
a9e10b |
+dig_with_opts @10.53.0.9 net2. DNAME > dig.out.$n.net2 || ret=1
|
|
|
a9e10b |
+grep "ANSWER: 1," dig.out.$n.net2 > /dev/null || ret=1
|
|
|
a9e10b |
+grep "net2\..*IN.DNAME.net\.example\.lll\." dig.out.$n.net2 > /dev/null || ret=1
|
|
|
a9e10b |
+if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
a9e10b |
+status=$((status+ret))
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+# This test doesn't use any forwarder clauses but is here because it
|
|
|
a9e10b |
+# is similar to forwarders, as the set of servers that can populate
|
|
|
a9e10b |
+# the namespace is defined by the zone content.
|
|
|
a9e10b |
+#
|
|
|
a9e10b |
+echo_i "rechecking spoofed response scenarios glue below local zone"
|
|
|
a9e10b |
+copy_setports ns9/named4.conf.in ns9/named.conf
|
|
|
a9e10b |
+rndccmd 10.53.0.9 reconfig 2>&1 | sed 's/^/ns3 /' | cat_i
|
|
|
a9e10b |
+rndccmd 10.53.0.9 flush 2>&1 | sed 's/^/ns3 /' | cat_i
|
|
|
a9e10b |
+sleep 1
|
|
|
a9e10b |
+
|
|
|
a9e10b |
+n=$((n+1))
|
|
|
a9e10b |
+echo_i "checking sibling glue below zone ($n)"
|
|
|
a9e10b |
+ret=0
|
|
|
a9e10b |
+# prime
|
|
|
a9e10b |
+dig_with_opts @10.53.0.9 sibling.tld > dig.out.$n.prime || ret=1
|
|
|
a9e10b |
+# check for glue A record for sub.local.tld is not used
|
|
|
a9e10b |
+dig_with_opts @10.53.0.9 sub.local.tld TXT > dig.out.$n.sub || ret=1
|
|
|
a9e10b |
+grep "ANSWER: 1," dig.out.$n.sub > /dev/null || ret=1
|
|
|
a9e10b |
+grep 'sub\.local\.tld\..*IN.TXT."good"$' dig.out.$n.sub > /dev/null || ret=1
|
|
|
a9e10b |
+if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
a9e10b |
+status=$((status+ret))
|
|
|
a9e10b |
+
|
|
|
a9e10b |
echo_i "exit status: $status"
|
|
|
a9e10b |
[ $status -eq 0 ] || exit 1
|
|
|
a9e10b |
diff --git a/bin/tests/system/ifconfig.sh b/bin/tests/system/ifconfig.sh
|
|
|
a9e10b |
index ed45417..03a24fc 100755
|
|
|
a9e10b |
--- a/bin/tests/system/ifconfig.sh
|
|
|
a9e10b |
+++ b/bin/tests/system/ifconfig.sh
|
|
|
a9e10b |
@@ -12,10 +12,10 @@
|
|
|
a9e10b |
#
|
|
|
a9e10b |
# Set up interface aliases for bind9 system tests.
|
|
|
a9e10b |
#
|
|
|
a9e10b |
-# IPv4: 10.53.0.{1..8} RFC 1918
|
|
|
a9e10b |
+# IPv4: 10.53.0.{1..11} RFC 1918
|
|
|
a9e10b |
# 10.53.1.{0..2}
|
|
|
a9e10b |
# 10.53.2.{0..2}
|
|
|
a9e10b |
-# IPv6: fd92:7065:b8e:ffff::{1..8} ULA
|
|
|
a9e10b |
+# IPv6: fd92:7065:b8e:ffff::{1..11} ULA
|
|
|
a9e10b |
# fd92:7065:b8e:99ff::{1..2}
|
|
|
a9e10b |
# fd92:7065:b8e:ff::{1..2}
|
|
|
a9e10b |
#
|
|
|
a9e10b |
@@ -73,7 +73,7 @@ case "$1" in
|
|
|
a9e10b |
2) ipv6="00" ;;
|
|
|
a9e10b |
*) ipv6="" ;;
|
|
|
a9e10b |
esac
|
|
|
a9e10b |
- for ns in 1 2 3 4 5 6 7 8
|
|
|
a9e10b |
+ for ns in 1 2 3 4 5 6 7 8 9 10 11
|
|
|
a9e10b |
do
|
|
|
a9e10b |
[ $i -gt 0 -a $ns -gt 2 ] && break
|
|
|
a9e10b |
int=`expr $i \* 10 + $ns - 1`
|
|
|
a9e10b |
@@ -179,7 +179,7 @@ case "$1" in
|
|
|
a9e10b |
2) ipv6="00" ;;
|
|
|
a9e10b |
*) ipv6="" ;;
|
|
|
a9e10b |
esac
|
|
|
a9e10b |
- for ns in 8 7 6 5 4 3 2 1
|
|
|
a9e10b |
+ for ns in 11 10 9 8 7 6 5 4 3 2 1
|
|
|
a9e10b |
do
|
|
|
a9e10b |
[ $i -gt 0 -a $ns -gt 2 ] && continue
|
|
|
a9e10b |
int=`expr $i \* 10 + $ns - 1`
|
|
|
a9e10b |
--
|
|
|
a9e10b |
2.38.1
|
|
|
a9e10b |
|