From 7f13c9d3fa62bcdf128dd3914cfb7086a213e306 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 14 Mar 2023 13:13:14 +1100 Subject: [PATCH 1/2] When signing with a new algorithm preserve NSEC/NSEC3 chains If the zone already has existing NSEC/NSEC3 chains then zone_sign needs to continue to use them. If there are no chains then use kasp setting otherwise generate an NSEC chain. (cherry picked from commit 4b5520145969222e6482e4552e49e96cc7d9bd97) --- bin/tests/system/nsec3/tests.sh | 6 ------ lib/dns/zone.c | 34 ++++++++++++++++----------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/bin/tests/system/nsec3/tests.sh b/bin/tests/system/nsec3/tests.sh index d3832cb707..3ebf247182 100644 --- a/bin/tests/system/nsec3/tests.sh +++ b/bin/tests/system/nsec3/tests.sh @@ -398,12 +398,6 @@ then set_key_states "KEY1" "hidden" "omnipresent" "omnipresent" "omnipresent" "omnipresent" set_key_default_values "KEY2" echo_i "check zone ${ZONE} after reconfig" - - ret=0 - wait_for_log 10 "zone $ZONE/IN (signed): wait building NSEC3 chain until NSEC only DNSKEYs are removed" ns3/named.run || ret=1 - test "$ret" -eq 0 || echo_i "failed" - status=$((status+ret)) - check_nsec # Zone: nsec3-to-rsasha1.kasp. diff --git a/lib/dns/zone.c b/lib/dns/zone.c index c9bb345156..5f0c099dff 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -9582,23 +9582,23 @@ zone_sign(dns_zone_t *zone) { use_kasp ? "yes" : "no"); /* Determine which type of chain to build */ - if (use_kasp) { - build_nsec3 = dns_kasp_nsec3(kasp); - if (!dns_zone_check_dnskey_nsec3(zone, db, version, NULL, - (dst_key_t **)&zone_keys, - nkeys)) - { - dnssec_log(zone, ISC_LOG_INFO, - "wait building NSEC3 chain until NSEC only " - "DNSKEYs are removed"); - build_nsec3 = false; - } - build_nsec = !build_nsec3; - } else { - CHECK(dns_private_chains(db, version, zone->privatetype, - &build_nsec, &build_nsec3)); - /* If neither chain is found, default to NSEC */ - if (!build_nsec && !build_nsec3) { + CHECK(dns_private_chains(db, version, zone->privatetype, &build_nsec, + &build_nsec3)); + if (!build_nsec && !build_nsec3) { + if (use_kasp) { + build_nsec3 = dns_kasp_nsec3(kasp); + if (!dns_zone_check_dnskey_nsec3( + zone, db, version, NULL, + (dst_key_t **)&zone_keys, nkeys)) + { + dnssec_log(zone, ISC_LOG_INFO, + "wait building NSEC3 chain until " + "NSEC only DNSKEYs are removed"); + build_nsec3 = false; + } + build_nsec = !build_nsec3; + } else { + /* If neither chain is found, default to NSEC */ build_nsec = true; } } From 68fb8ad9ddade77d39845a4d2fa478e623dba448 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 14 Mar 2023 13:32:47 +1100 Subject: [PATCH 2/2] Add CHANGES for [GL #3937] (cherry picked from commit aafcb8611c387615b6e7dc0aad8622e9252f9665) --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index d3fb3e5c50..d4d9606b44 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +6124. [bug] When changing from a NSEC3 capable DNSSEC algorithm to + an NSEC3 incapable DNSSEC algorithm using KASP the zone + could sometimes be incompletely signed. [GL #3937] + 6120. [bug] Use two pairs of dns_db_t and dns_dbversion_t in a catalog zone structure to avoid a race between the dns__catz_update_cb() and dns_catz_dbupdate_callback()