Merge branch '742-isc-support-13767-nsec3-typemap-improperly-includes-dnskey-rrset-instead-of-ignoring-it-as-out-of-zone-v9_11' into 'v9_11'

Resolve "[ISC-support

See merge request isc-projects/bind9!1233
This commit is contained in:
Mark Andrews
2018-12-13 22:58:25 -05:00
17 changed files with 278 additions and 98 deletions
+3
View File
@@ -1,3 +1,6 @@
5111. [bug] Occluded DNSKEY records could make it into the
delegating NSEC/NSEC3 bitmap. [GL #742]
5108. [bug] Named could fail to determine bottom of zone when
removing out of date keys leading to invalid NSEC
and NSEC3 records being added to the zone. [GL #771]
+4 -2
View File
@@ -796,8 +796,10 @@ static isc_result_t
cname_compatibility_action(void *data, dns_rdataset_t *rrset) {
UNUSED(data);
if (rrset->type != dns_rdatatype_cname &&
! dns_rdatatype_isdnssec(rrset->type))
! dns_rdatatype_atcname(rrset->type))
{
return (ISC_R_EXISTS);
}
return (ISC_R_SUCCESS);
}
@@ -2844,7 +2846,7 @@ update_action(isc_task_t *task, isc_event_t *event) {
dns_rdatatype_cname, 0,
&flag));
if (flag &&
! dns_rdatatype_isdnssec(rdata.type))
! dns_rdatatype_atcname(rdata.type))
{
update_log(client, zone,
LOGLEVEL_PROTOCOL,
+93 -87
View File
@@ -9,90 +9,96 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
rm -f */K* */keyset-* */dsset-* */dlvset-* */signedkey-* */*.signed
rm -f */example.bk
rm -f */named.conf
rm -f */named.memstats
rm -f */named.run
rm -f */named.secroots
rm -f */tmp* */*.jnl */*.bk */*.jbk
rm -f */trusted.conf */managed.conf */revoked.conf
rm -f Kexample.*
rm -f canonical?.*
rm -f delv.out*
rm -f delve.out*
rm -f dig.out.*
rm -f dsfromkey.out.*
rm -f keygen.err
rm -f named.secroots.test*
rm -f nosign.before
rm -f ns*/*.nta
rm -f ns*/managed-keys.bind* ns*/*.mkeys*
rm -f ns*/named.lock
rm -f ns1/managed.key.id
rm -f ns1/root.db ns2/example.db ns3/secure.example.db
rm -f ns2/algroll.db
rm -f ns2/badparam.db ns2/badparam.db.bad
rm -f ns2/cdnskey-update.secure.db
rm -f ns2/cdnskey.secure.db
rm -f ns2/cds-auto.secure.db ns2/cds-auto.secure.db.jnl
rm -f ns2/cds-update.secure.db ns2/cds-update.secure.db.jnl
rm -f ns2/cds.secure.db
rm -f ns2/dlv.db
rm -f ns2/in-addr.arpa.db
rm -f ns2/nsec3chain-test.db
rm -f ns2/private.secure.example.db
rm -f ns2/single-nsec3.db
rm -f ns3/auto-nsec.example.db ns3/auto-nsec3.example.db
rm -f ns3/badds.example.db
rm -f ns3/dname-at-apex-nsec3.example.db
rm -f ns3/dnskey-nsec3-unknown.example.db
rm -f ns3/dnskey-nsec3-unknown.example.db.tmp
rm -f ns3/dnskey-unknown.example.db
rm -f ns3/dnskey-unknown.example.db.tmp
rm -f ns3/dynamic.example.db ns3/dynamic.example.db.signed.jnl
rm -f ns3/expired.example.db ns3/update-nsec3.example.db
rm -f ns3/expiring.example.db ns3/nosign.example.db
rm -f ns3/future.example.db ns3/trusted-future.key
rm -f ns3/inline.example.db.signed
rm -f ns3/kskonly.example.db
rm -f ns3/lower.example.db ns3/upper.example.db ns3/upper.example.db.lower
rm -f ns3/multiple.example.db ns3/nsec3-unknown.example.db ns3/nsec3.example.db
rm -f ns3/nsec3.nsec3.example.db
rm -f ns3/nsec3.optout.example.db
rm -f ns3/optout-unknown.example.db ns3/optout.example.db
rm -f ns3/optout.nsec3.example.db
rm -f ns3/optout.optout.example.db
rm -f ns3/publish-inactive.example.db
rm -f ns3/rsasha256.example.db ns3/rsasha512.example.db
rm -f ns3/secure.below-cname.example.db
rm -f ns3/secure.nsec3.example.db
rm -f ns3/secure.optout.example.db
rm -f ns3/siginterval.conf
rm -f ns3/siginterval.example.db
rm -f ns3/split-dnssec.example.db
rm -f ns3/split-smart.example.db
rm -f ns3/ttlpatch.example.db ns3/ttlpatch.example.db.signed
rm -f ns3/ttlpatch.example.db.patched
rm -f ns3/unsecure.example.db ns3/bogus.example.db ns3/keyless.example.db
rm -f ns3/revkey.example.db
rm -f ns3/managed-future.example.db
rm -f ns4/managed-keys.bind*
rm -f ns4/named_dump.db
rm -f ns6/optout-tld.db
rm -f ns7/multiple.example.bk ns7/nsec3.example.bk ns7/optout.example.bk
rm -f ns7/split-rrsig.db ns7/split-rrsig.db.unsplit
rm -f nsupdate.out*
rm -f python.out.*
rm -f rndc.out.*
rm -f signer/*.db
rm -f signer/example.db.after signer/example.db.before
rm -f signer/example.db.changed
rm -f signer/general/dsset*
rm -f signer/general/signed.zone
rm -f signer/general/signer.out.*
rm -f signer/nsec3param.out
rm -f signer/signer.out.*
rm -f signing.out*
rm -f signer/*.signed.pre*
rm -f signer/*.signed.post*
set -e
rm -f ./*/K* ./*/keyset-* ./*/dsset-* ./*/dlvset-* ./*/signedkey-* ./*/*.signed
rm -f ./*/example.bk
rm -f ./*/named.conf
rm -f ./*/named.memstats
rm -f ./*/named.run
rm -f ./*/named.secroots
rm -f ./*/tmp* ./*/*.jnl ./*/*.bk ./*/*.jbk
rm -f ./*/trusted.conf ./*/managed.conf ./*/revoked.conf
rm -f ./Kexample.*
rm -f ./canonical?.*
rm -f ./delv.out*
rm -f ./delve.out*
rm -f ./dig.out.*
rm -f ./dsfromkey.out.*
rm -f ./keygen.err
rm -f ./named.secroots.test*
rm -f ./nosign.before
rm -f ./ns*/*.nta
rm -f ./ns*/managed-keys.bind* ./ns*/*.mkeys*
rm -f ./ns*/named.lock
rm -f ./ns1/managed.key.id
rm -f ./ns1/root.db ./ns2/example.db ./ns3/secure.example.db
rm -f ./ns2/algroll.db
rm -f ./ns2/badparam.db ./ns2/badparam.db.bad
rm -f ./ns2/cdnskey-kskonly.secure.db
rm -f ./ns2/cdnskey-update.secure.db
rm -f ./ns2/cdnskey-x.secure.db
rm -f ./ns2/cdnskey.secure.db
rm -f ./ns2/cds-auto.secure.db ./ns2/cds-auto.secure.db.jnl
rm -f ./ns2/cds-kskonly.secure.db
rm -f ./ns2/cds-update.secure.db ./ns2/cds-update.secure.db.jnl
rm -f ./ns2/cds.secure.db ./ns2/cds-x.secure.db
rm -f ./ns2/dlv.db
rm -f ./ns2/in-addr.arpa.db
rm -f ./ns2/nsec3chain-test.db
rm -f ./ns2/private.secure.example.db
rm -f ./ns2/single-nsec3.db
rm -f ./ns3/auto-nsec.example.db ./ns3/auto-nsec3.example.db
rm -f ./ns3/badds.example.db
rm -f ./ns3/dname-at-apex-nsec3.example.db
rm -f ./ns3/dnskey-nsec3-unknown.example.db
rm -f ./ns3/dnskey-nsec3-unknown.example.db.tmp
rm -f ./ns3/dnskey-unknown.example.db
rm -f ./ns3/dnskey-unknown.example.db.tmp
rm -f ./ns3/dynamic.example.db ./ns3/dynamic.example.db.signed.jnl
rm -f ./ns3/expired.example.db ./ns3/update-nsec3.example.db
rm -f ./ns3/expiring.example.db ./ns3/nosign.example.db
rm -f ./ns3/future.example.db ./ns3/trusted-future.key
rm -f ./ns3/inline.example.db.signed
rm -f ./ns3/kskonly.example.db
rm -f ./ns3/lower.example.db ./ns3/upper.example.db ./ns3/upper.example.db.lower
rm -f ./ns3/managed-future.example.db
rm -f ./ns3/multiple.example.db ./ns3/nsec3-unknown.example.db ./ns3/nsec3.example.db
rm -f ./ns3/nsec3.nsec3.example.db
rm -f ./ns3/nsec3.optout.example.db
rm -f ./ns3/occluded.example.db
rm -f ./ns3/optout-unknown.example.db ./ns3/optout.example.db
rm -f ./ns3/optout.nsec3.example.db
rm -f ./ns3/optout.optout.example.db
rm -f ./ns3/publish-inactive.example.db
rm -f ./ns3/revkey.example.db
rm -f ./ns3/rsasha256.example.db ./ns3/rsasha512.example.db
rm -f ./ns3/secure.below-cname.example.db
rm -f ./ns3/secure.nsec3.example.db
rm -f ./ns3/secure.optout.example.db
rm -f ./ns3/siginterval.conf
rm -f ./ns3/siginterval.example.db
rm -f ./ns3/split-dnssec.example.db
rm -f ./ns3/split-smart.example.db
rm -f ./ns3/ttlpatch.example.db ./ns3/ttlpatch.example.db.signed
rm -f ./ns3/ttlpatch.example.db.patched
rm -f ./ns3/unsecure.example.db ./ns3/bogus.example.db ./ns3/keyless.example.db
rm -f ./ns4/managed-keys.bind*
rm -f ./ns4/named_dump.db
rm -f ./ns6/optout-tld.db
rm -f ./ns7/multiple.example.bk ./ns7/nsec3.example.bk ./ns7/optout.example.bk
rm -f ./ns7/split-rrsig.db ./ns7/split-rrsig.db.unsplit
rm -f ./nsupdate.out*
rm -f ./python.out.*
rm -f ./rndc.out.*
rm -f ./signer/*.db
rm -f ./signer/*.signed.post*
rm -f ./signer/*.signed.pre*
rm -f ./signer/example.db.after ./signer/example.db.before
rm -f ./signer/example.db.changed
rm -f ./signer/general/dsset*
rm -f ./signer/general/signed.zone
rm -f ./signer/general/signer.out.*
rm -f ./signer/nsec3param.out
rm -f ./signer/signer.out.*
rm -f ./signing.out*
+1 -1
View File
@@ -25,7 +25,7 @@ for subdomain in secure badds bogus dynamic keyless nsec3 optout \
kskonly update-nsec3 auto-nsec auto-nsec3 secure.below-cname \
ttlpatch split-dnssec split-smart expired expiring upper lower \
dnskey-unknown dnskey-nsec3-unknown managed-future revkey \
dname-at-apex-nsec3
dname-at-apex-nsec3 occluded
do
cp ../ns3/dsset-$subdomain.example$TP .
done
@@ -298,6 +298,11 @@ zone "dname-at-apex-nsec3.example" {
file "dname-at-apex-nsec3.example.db.signed";
};
zone "occluded.example" {
type master;
file "occluded.example.db.signed";
};
include "siginterval.conf";
include "trusted.conf";
@@ -0,0 +1,24 @@
; 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 ; 5 minutes
@ IN SOA mname1. . (
2000042407 ; serial
20 ; refresh (20 seconds)
20 ; retry (20 seconds)
1814400 ; expire (3 weeks)
3600 ; minimum (1 hour)
)
NS ns
ns A 10.53.0.3
a.b A 10.0.0.1
delegation NS ns
A 10.53.0.3
AAAA 2002::
+15
View File
@@ -554,3 +554,18 @@ kskname=`$KEYGEN -q -r $RANDFILE -a RSASHA256 -b 1024 -3fk $zone`
zskname=`$KEYGEN -q -r $RANDFILE -a RSASHA256 -b 1024 -3 $zone`
cat $infile $kskname.key $zskname.key >$zonefile
$SIGNER -P -r $RANDFILE -3 - -o $zone $zonefile > /dev/null 2>&1
#
# A NSEC zone with occuded data at the delegation
#
zone=occluded.example
infile=occluded.example.db.in
zonefile=occluded.example.db
kskname=`"$KEYGEN" -q -r $RANDFILE -a RSASHA256 -b 1024 -fk "$zone"`
zskname=`"$KEYGEN" -q -r $RANDFILE -a RSASHA256 -b 1024 "$zone"`
keyname=`"$KEYGEN" -q -r $RANDFILE -a RSASHA1 -b 1024 -n ENTITY -T KEY "delegation.$zone"`
dnskeyname=`"$KEYGEN" -q -r $RANDFILE -a RSASHA256 -b 1024 -fk "delegation.$zone"`
$DSFROMKEY "$dnskeyname.key" > "dsset-delegation.${zone}$TP"
cat "$infile" "${kskname}.key" "${zskname}.key" "${keyname}.key" \
"${dnskeyname}.key" "dsset-delegation.${zone}$TP" >"$zonefile"
"$SIGNER" -P -r $RANDFILE -o "$zone" "$zonefile" > /dev/null 2>&1
+10
View File
@@ -3521,5 +3521,15 @@ n=`expr $n + 1`
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
echo_i "check that DNSKEY and other occluded data are excluded from the delegating bitmap ($n)"
ret=0
$DIG $DIGOPTS axfr occluded.example @10.53.0.3 > dig.out.ns3.test$n || ret=1
grep "^delegation.occluded.example..*NSEC.*NS KEY DS RRSIG NSEC$" dig.out.ns3.test$n > /dev/null || ret=1
grep "^delegation.occluded.example..*DNSKEY.*" dig.out.ns3.test$n > /dev/null || ret=1
grep "^delegation.occluded.example..*AAAA.*" dig.out.ns3.test$n > /dev/null || ret=1
n=`expr $n + 1`
test "$ret" -eq 0 || echo_i "failed"
status=`expr $status + $ret`
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1
+13 -2
View File
@@ -586,7 +586,6 @@ dns_rdatatype_isknown(dns_rdatatype_t type);
*
*/
isc_result_t
dns_rdata_additionaldata(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
void *arg);
@@ -679,6 +678,16 @@ dns_rdatatype_atparent(dns_rdatatype_t type);
*
*/
bool
dns_rdatatype_atcname(dns_rdatatype_t type);
/*%<
* Return true iff rdata of type 'type' can appear beside a cname.
*
* Requires:
* \li 'type' is a valid rdata type.
*
*/
unsigned int
dns_rdatatype_attributes(dns_rdatatype_t rdtype);
/*%<
@@ -707,10 +716,12 @@ dns_rdatatype_attributes(dns_rdatatype_t rdtype);
#define DNS_RDATATYPEATTR_UNKNOWN 0x00000040U
/*% Is META, and can only be in a question section */
#define DNS_RDATATYPEATTR_QUESTIONONLY 0x00000080U
/*% is META, and can NOT be in a question section */
/*% Is META, and can NOT be in a question section */
#define DNS_RDATATYPEATTR_NOTQUESTION 0x00000100U
/*% Is present at zone cuts in the parent, not the child */
#define DNS_RDATATYPEATTR_ATPARENT 0x00000200U
/*% Can exist along side a CNAME */
#define DNS_RDATATYPEATTR_ATCNAME 0x00000400U
dns_rdatatype_t
dns_rdata_covers(dns_rdata_t *rdata);
+11 -2
View File
@@ -2299,6 +2299,14 @@ dns_rdatatype_questiononly(dns_rdatatype_t type) {
return (false);
}
bool
dns_rdatatype_atcname(dns_rdatatype_t type) {
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ATCNAME) != 0) {
return (true);
}
return (false);
}
bool
dns_rdatatype_atparent(dns_rdatatype_t type) {
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ATPARENT) != 0)
@@ -2326,10 +2334,11 @@ dns_rdatatype_isdnssec(dns_rdatatype_t type) {
bool
dns_rdatatype_iszonecutauth(dns_rdatatype_t type) {
if ((dns_rdatatype_attributes(type)
& (DNS_RDATATYPEATTR_DNSSEC | DNS_RDATATYPEATTR_ZONECUTAUTH))
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ZONECUTAUTH)
!= 0)
{
return (true);
}
return (false);
}
+2 -1
View File
@@ -16,7 +16,8 @@
#define RDATA_GENERIC_DS_43_C
#define RRTYPE_DS_ATTRIBUTES \
(DNS_RDATATYPEATTR_DNSSEC|DNS_RDATATYPEATTR_ATPARENT)
( DNS_RDATATYPEATTR_DNSSEC | DNS_RDATATYPEATTR_ZONECUTAUTH | \
DNS_RDATATYPEATTR_ATPARENT )
#include <isc/sha1.h>
#include <isc/sha2.h>
+2 -1
View File
@@ -16,7 +16,8 @@
#include <dst/dst.h>
#define RRTYPE_KEY_ATTRIBUTES (0)
#define RRTYPE_KEY_ATTRIBUTES \
( DNS_RDATATYPEATTR_ATCNAME | DNS_RDATATYPEATTR_ZONECUTAUTH )
static inline isc_result_t
generic_fromtext_key(ARGS_FROMTEXT) {
+3 -1
View File
@@ -18,7 +18,9 @@
* The attributes do not include DNS_RDATATYPEATTR_SINGLETON
* because we must be able to handle a parent/child NSEC pair.
*/
#define RRTYPE_NSEC_ATTRIBUTES (DNS_RDATATYPEATTR_DNSSEC)
#define RRTYPE_NSEC_ATTRIBUTES \
( DNS_RDATATYPEATTR_DNSSEC | DNS_RDATATYPEATTR_ZONECUTAUTH | \
DNS_RDATATYPEATTR_ATCNAME )
static inline isc_result_t
fromtext_nsec(ARGS_FROMTEXT) {
+3 -1
View File
@@ -14,7 +14,9 @@
#ifndef RDATA_GENERIC_RRSIG_46_C
#define RDATA_GENERIC_RRSIG_46_C
#define RRTYPE_RRSIG_ATTRIBUTES (DNS_RDATATYPEATTR_DNSSEC)
#define RRTYPE_RRSIG_ATTRIBUTES \
( DNS_RDATATYPEATTR_DNSSEC | DNS_RDATATYPEATTR_ZONECUTAUTH | \
DNS_RDATATYPEATTR_ATCNAME )
static inline isc_result_t
fromtext_rrsig(ARGS_FROMTEXT) {
+87
View File
@@ -1486,6 +1486,90 @@ wks(void **state) {
dns_rdatatype_wks, sizeof(dns_rdata_in_wks_t));
}
static void
atcname(void **state) {
unsigned int i;
UNUSED(state);
#define UNR "# Unexpected result from dns_rdatatype_atcname for type %u\n"
for (i = 0; i < 0xffffU; i++) {
bool tf = dns_rdatatype_atcname((dns_rdatatype_t)i);
switch (i) {
case dns_rdatatype_nsec:
case dns_rdatatype_key:
case dns_rdatatype_rrsig:
if (!tf) {
print_message(UNR, i);
}
assert_true(tf);
break;
default:
if (tf) {
print_message(UNR, i);
}
assert_false(tf);
break;
}
}
#undef UNR
}
static void
atparent(void **state) {
unsigned int i;
UNUSED(state);
#define UNR "# Unexpected result from dns_rdatatype_atparent for type %u\n"
for (i = 0; i < 0xffffU; i++) {
bool tf = dns_rdatatype_atparent((dns_rdatatype_t)i);
switch (i) {
case dns_rdatatype_ds:
if (!tf) {
print_message(UNR, i);
}
assert_true(tf);
break;
default:
if (tf) {
print_message(UNR, i);
}
assert_false(tf);
break;
}
}
#undef UNR
}
static void
iszonecutauth(void **state) {
unsigned int i;
UNUSED(state);
#define UNR "# Unexpected result from dns_rdatatype_iszonecutauth for type %u\n"
for (i = 0; i < 0xffffU; i++) {
bool tf = dns_rdatatype_iszonecutauth((dns_rdatatype_t)i);
switch (i) {
case dns_rdatatype_ns:
case dns_rdatatype_ds:
case dns_rdatatype_nsec:
case dns_rdatatype_key:
case dns_rdatatype_rrsig:
if (!tf) {
print_message(UNR, i);
}
assert_true(tf);
break;
default:
if (tf) {
print_message(UNR, i);
}
assert_false(tf);
break;
}
}
#undef UNR
}
int
main(void) {
const struct CMUnitTest tests[] = {
@@ -1503,6 +1587,9 @@ main(void) {
cmocka_unit_test_setup_teardown(nsec3, _setup, _teardown),
cmocka_unit_test_setup_teardown(nxt, _setup, _teardown),
cmocka_unit_test_setup_teardown(wks, _setup, _teardown),
cmocka_unit_test_setup_teardown(atcname, NULL, NULL),
cmocka_unit_test_setup_teardown(atparent, NULL, NULL),
cmocka_unit_test_setup_teardown(iszonecutauth, NULL, NULL),
};
return (cmocka_run_group_tests(tests, dns_test_init, dns_test_final));
+1
View File
@@ -865,6 +865,7 @@ dns_rdataslab_merge
dns_rdataslab_size
dns_rdataslab_subtract
dns_rdataslab_tordataset
dns_rdatatype_atcname
dns_rdatatype_atparent
dns_rdatatype_attributes
dns_rdatatype_format
+1
View File
@@ -1114,6 +1114,7 @@
./bin/tests/system/dnssec/ns3/nsec3.example.db.in ZONE 2006,2008,2016,2018
./bin/tests/system/dnssec/ns3/nsec3.nsec3.example.db.in ZONE 2008,2016,2018
./bin/tests/system/dnssec/ns3/nsec3.optout.example.db.in ZONE 2008,2016,2018
./bin/tests/system/dnssec/ns3/occluded.example.db.in ZONE 2018
./bin/tests/system/dnssec/ns3/optout-unknown.example.db.in ZONE 2006,2008,2016,2018
./bin/tests/system/dnssec/ns3/optout.example.db.in ZONE 2006,2008,2016,2018
./bin/tests/system/dnssec/ns3/optout.nsec3.example.db.in ZONE 2008,2016,2018