--- /dev/null
+; 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 86400
+@ IN SOA malicious. admin.malicious. (
+ 1 ; Serial
+ 604800 ; Refresh
+ 86400 ; Retry
+ 2419200 ; Expire
+ 86400 ) ; Negative Cache TTL
+
+@ IN NS ns
+
+ns IN A 10.53.0.4
+
+target IN CNAME subdomain.rebind.
forward only;
forwarders { 10.53.0.2; };
};
+
+zone "malicious." {
+ type master;
+ file "malicious.db";
+};
listen-on-v6 { none; };
forward only;
forwarders { 10.53.0.4; };
+ deny-answer-aliases { "rebind"; };
+ dnssec-validation yes;
};
zone "." {
type hint;
file "root.db";
};
+
+zone "rebind" {
+ type master;
+ file "rebind.db";
+};
--- /dev/null
+; 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 86400
+@ IN SOA rebind. admin.rebind. (
+ 1 ; Serial
+ 604800 ; Refresh
+ 86400 ; Retry
+ 2419200 ; Expire
+ 86400 ) ; Negative Cache TTL
+
+@ IN NS ns
+
+ns IN A 10.53.0.5
+
+subdomain IN A 10.53.0.1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
+n=$((n+1))
+echo_i "checking that rebinding protection works in forward only mode ($n)"
+ret=0
+# 10.53.0.5 will forward target.malicious. query to 10.53.0.4
+# which in turn will return a CNAME for subdomain.rebind.
+# to honor the option deny-answer-aliases { "rebind"; };
+# ns5 should return a SERVFAIL to avoid potential rebinding attacks
+dig_with_opts +noadd +noauth @10.53.0.5 target.malicious. > dig.out.$n || ret=1
+grep "status: SERVFAIL" dig.out.$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1
./bin/tests/system/forward/ns2/root.db ZONE 2000,2001,2004,2007,2016,2018,2019,2020
./bin/tests/system/forward/ns3/named.conf.in CONF-C 2018,2019,2020
./bin/tests/system/forward/ns3/root.db ZONE 2000,2001,2004,2007,2016,2018,2019,2020
+./bin/tests/system/forward/ns4/malicious.db ZONE 2020
./bin/tests/system/forward/ns4/named.conf.in CONF-C 2018,2019,2020
./bin/tests/system/forward/ns4/root.db ZONE 2000,2001,2004,2007,2016,2018,2019,2020
./bin/tests/system/forward/ns5/named.conf.in CONF-C 2018,2019,2020
+./bin/tests/system/forward/ns5/rebind.db ZONE 2020
./bin/tests/system/forward/ns5/root.db ZONE 2011,2016,2018,2019,2020
./bin/tests/system/forward/ns7/named.conf.in CONF-C 2019,2020
./bin/tests/system/forward/ns7/root.db ZONE 2019,2020