mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
Add test for the proposed fix
This test asserts that option "deny-answer-aliases" works correctly when forwarding requests. As a matter of example, the behavior expected for a forwarder BIND instance, having an option such as deny-answer-aliases { "domain"; } is that when forwarding a request for *.anything-but-domain, it is expected that it will return SERVFAIL if any answer received has a CNAME for "*.domain". (cherry picked from commit 9bdb960a16a69997b08746e698b6b02c8dc6c795)
This commit is contained in:
committed by
Ondřej Surý
parent
cf7b0de1eb
commit
eb7a664274
13
bin/tests/system/forward/ns4/malicious.db
Normal file
13
bin/tests/system/forward/ns4/malicious.db
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
$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.
|
@@ -55,3 +55,8 @@ zone "grafted" {
|
|||||||
forward only;
|
forward only;
|
||||||
forwarders { 10.53.0.2; };
|
forwarders { 10.53.0.2; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
zone "malicious." {
|
||||||
|
type master;
|
||||||
|
file "malicious.db";
|
||||||
|
};
|
||||||
|
@@ -19,6 +19,7 @@ options {
|
|||||||
listen-on-v6 { none; };
|
listen-on-v6 { none; };
|
||||||
forward only;
|
forward only;
|
||||||
forwarders { 10.53.0.4; };
|
forwarders { 10.53.0.4; };
|
||||||
|
deny-answer-aliases { "rebind"; };
|
||||||
dnssec-validation yes;
|
dnssec-validation yes;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -26,3 +27,8 @@ zone "." {
|
|||||||
type hint;
|
type hint;
|
||||||
file "root.db";
|
file "root.db";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
zone "rebind" {
|
||||||
|
type master;
|
||||||
|
file "rebind.db";
|
||||||
|
};
|
||||||
|
13
bin/tests/system/forward/ns5/rebind.db
Normal file
13
bin/tests/system/forward/ns5/rebind.db
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
$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
|
@@ -218,5 +218,18 @@ grep "status: NOERROR" dig.out.$n.f8 > /dev/null || ret=1
|
|||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=$((status+ret))
|
status=$((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"
|
echo_i "exit status: $status"
|
||||||
[ $status -eq 0 ] || exit 1
|
[ $status -eq 0 ] || exit 1
|
||||||
|
Reference in New Issue
Block a user