[v9_8] remove spurious signatures from glue
3404. [bug] dnssec-signzone: When re-signing a zone, remove RRSIG and NSEC records from nodes that used to be in-zone but are now below a zone cut. [RT #31556] (cherry picked from commit4b3d727d96) (cherry picked from commitd8861c4350)
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
3404. [bug] dnssec-signzone: When re-signing a zone, remove
|
||||
RRSIG and NSEC records from nodes that used to be
|
||||
in-zone but are now below a zone cut. [RT #31556]
|
||||
|
||||
3403. [bug] Silence noisy OpenSSL logging. [RT #31497]
|
||||
|
||||
3402. [bug] Correct interface numbers for IPv4 and IPv6 interfaces.
|
||||
|
||||
@@ -2027,7 +2027,9 @@ add_ds(dns_name_t *name, dns_dbnode_t *node, isc_uint32_t nsttl) {
|
||||
* Remove records of the given type and their signatures.
|
||||
*/
|
||||
static void
|
||||
remove_records(dns_dbnode_t *node, dns_rdatatype_t which) {
|
||||
remove_records(dns_dbnode_t *node, dns_rdatatype_t which,
|
||||
isc_boolean_t checknsec)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_rdatatype_t type, covers;
|
||||
dns_rdatasetiter_t *rdsiter = NULL;
|
||||
@@ -2048,10 +2050,12 @@ remove_records(dns_dbnode_t *node, dns_rdatatype_t which) {
|
||||
covers = rdataset.covers;
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
if (type == which || covers == which) {
|
||||
if (which == dns_rdatatype_nsec && !update_chain)
|
||||
if (which == dns_rdatatype_nsec &&
|
||||
checknsec && !update_chain)
|
||||
fatal("Zone contains NSEC records. Use -u "
|
||||
"to update to NSEC3.");
|
||||
if (which == dns_rdatatype_nsec3param && !update_chain)
|
||||
if (which == dns_rdatatype_nsec3param &&
|
||||
checknsec && !update_chain)
|
||||
fatal("Zone contains NSEC3 chains. Use -u "
|
||||
"to update to NSEC.");
|
||||
result = dns_db_deleterdataset(gdb, node, gversion,
|
||||
@@ -2063,6 +2067,39 @@ remove_records(dns_dbnode_t *node, dns_rdatatype_t which) {
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove signatures covering the given type (0 == all signatures).
|
||||
*/
|
||||
static void
|
||||
remove_sigs(dns_dbnode_t *node, dns_rdatatype_t which) {
|
||||
isc_result_t result;
|
||||
dns_rdatatype_t type, covers;
|
||||
dns_rdatasetiter_t *rdsiter = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
|
||||
dns_rdataset_init(&rdataset);
|
||||
result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter);
|
||||
check_result(result, "dns_db_allrdatasets()");
|
||||
for (result = dns_rdatasetiter_first(rdsiter);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdatasetiter_next(rdsiter)) {
|
||||
dns_rdatasetiter_current(rdsiter, &rdataset);
|
||||
type = rdataset.type;
|
||||
covers = rdataset.covers;
|
||||
dns_rdataset_disassociate(&rdataset);
|
||||
|
||||
if (type == dns_rdatatype_rrsig &&
|
||||
(covers == which || which == 0))
|
||||
{
|
||||
result = dns_db_deleterdataset(gdb, node, gversion,
|
||||
type, covers);
|
||||
check_result(result, "dns_db_deleterdataset()");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dns_rdatasetiter_destroy(&rdsiter);
|
||||
}
|
||||
|
||||
/*%
|
||||
* Generate NSEC records for the zone and remove NSEC3/NSEC3PARAM records.
|
||||
*/
|
||||
@@ -2139,14 +2176,17 @@ nsecify(void) {
|
||||
}
|
||||
|
||||
if (dns_name_equal(name, gorigin))
|
||||
remove_records(node, dns_rdatatype_nsec3param);
|
||||
remove_records(node, dns_rdatatype_nsec3param,
|
||||
ISC_TRUE);
|
||||
|
||||
if (delegation(name, node, &nsttl)) {
|
||||
zonecut = dns_fixedname_name(&fzonecut);
|
||||
dns_name_copy(name, zonecut, NULL);
|
||||
remove_sigs(node, 0);
|
||||
if (generateds)
|
||||
add_ds(name, node, nsttl);
|
||||
}
|
||||
|
||||
result = dns_dbiterator_next(dbiter);
|
||||
nextnode = NULL;
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
@@ -2164,6 +2204,9 @@ nsecify(void) {
|
||||
(zonecut != NULL &&
|
||||
dns_name_issubdomain(nextname, zonecut)))
|
||||
{
|
||||
remove_sigs(nextnode, 0);
|
||||
remove_records(nextnode, dns_rdatatype_nsec,
|
||||
ISC_FALSE);
|
||||
dns_db_detachnode(gdb, &nextnode);
|
||||
result = dns_dbiterator_next(dbiter);
|
||||
continue;
|
||||
@@ -2555,7 +2598,7 @@ nsec3ify(unsigned int hashalg, unsigned int iterations,
|
||||
}
|
||||
|
||||
if (dns_name_equal(name, gorigin))
|
||||
remove_records(node, dns_rdatatype_nsec);
|
||||
remove_records(node, dns_rdatatype_nsec, ISC_TRUE);
|
||||
|
||||
result = dns_dbiterator_next(dbiter);
|
||||
nextnode = NULL;
|
||||
@@ -2572,6 +2615,7 @@ nsec3ify(unsigned int hashalg, unsigned int iterations,
|
||||
if (!dns_name_issubdomain(nextname, gorigin) ||
|
||||
(zonecut != NULL &&
|
||||
dns_name_issubdomain(nextname, zonecut))) {
|
||||
remove_sigs(nextnode, 0);
|
||||
dns_db_detachnode(gdb, &nextnode);
|
||||
result = dns_dbiterator_next(dbiter);
|
||||
continue;
|
||||
@@ -2579,6 +2623,7 @@ nsec3ify(unsigned int hashalg, unsigned int iterations,
|
||||
if (delegation(nextname, nextnode, &nsttl)) {
|
||||
zonecut = dns_fixedname_name(&fzonecut);
|
||||
dns_name_copy(nextname, zonecut, NULL);
|
||||
remove_sigs(nextnode, 0);
|
||||
if (generateds)
|
||||
add_ds(nextname, nextnode, nsttl);
|
||||
if (OPTOUT(nsec3flags) &&
|
||||
|
||||
@@ -45,7 +45,7 @@ rm -f ns3/secure.nsec3.example.db
|
||||
rm -f ns3/secure.optout.example.db
|
||||
rm -f */named.secroots
|
||||
rm -f ns1/managed.key.id
|
||||
rm -f signer/example.db
|
||||
rm -f signer/*.db
|
||||
rm -f ns2/algroll.db
|
||||
rm -f ns3/kskonly.example.db
|
||||
rm -f ns4/named.conf
|
||||
|
||||
@@ -1029,6 +1029,72 @@ n=`expr $n + 1`
|
||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
echo "I:checking dnssec-signzone purges RRSIGs from formerly-owned glue (nsec) ($n)"
|
||||
ret=0
|
||||
key1=`$KEYGEN -K signer -q -r random.data -a NSEC3RSASHA1 -b 1024 -n zone example`
|
||||
key2=`$KEYGEN -K signer -q -r random.data -f KSK -a NSEC3RSASHA1 -b 1024 -n zone example`
|
||||
(
|
||||
cd signer
|
||||
cat example.db.in $key1.key $key2.key > example2.db
|
||||
cat << EOF >> example2.db
|
||||
sub1.example. IN A 10.53.0.1
|
||||
ns.sub2.example. IN A 10.53.0.2
|
||||
EOF
|
||||
$SIGNER -f tmp -o example example2.db > /dev/null 2>&1
|
||||
$CHECKZONE -D -o example2.db.signed example tmp > /dev/null 2>&1
|
||||
rm -f tmp
|
||||
) || ret=1
|
||||
grep "^sub1\.example\..*RRSIG[ ]A[ ]" signer/example2.db.signed > /dev/null 2>&1 || ret=1
|
||||
grep "^ns\.sub2\.example\..*RRSIG[ ]A[ ]" signer/example2.db.signed > /dev/null 2>&1 || ret=1
|
||||
(
|
||||
cd signer
|
||||
cp -f example2.db.signed example2.db
|
||||
cat << EOF >> example2.db
|
||||
sub1.example. IN NS sub1.example.
|
||||
sub2.example. IN NS ns.sub2.example.
|
||||
EOF
|
||||
$SIGNER -f tmp -o example example2.db > /dev/null 2>&1
|
||||
$CHECKZONE -D -o example2.db.signed example tmp > /dev/null 2>&1
|
||||
rm -f tmp
|
||||
) || ret=1
|
||||
grep "^sub1\.example\..*RRSIG[ ]A[ ]" signer/example2.db.signed > /dev/null 2>&1 && ret=1
|
||||
grep "^ns\.sub2\.example\..*RRSIG[ ]A[ ]" signer/example2.db.signed > /dev/null 2>&1 && ret=1
|
||||
n=`expr $n + 1`
|
||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
echo "I:checking dnssec-signzone purges RRSIGs from formerly-owned glue (nsec3) ($n)"
|
||||
ret=0
|
||||
(
|
||||
cd signer
|
||||
cat example.db.in $key1.key $key2.key > example2.db
|
||||
cat << EOF >> example2.db
|
||||
sub1.example. IN A 10.53.0.1
|
||||
ns.sub2.example. IN A 10.53.0.2
|
||||
EOF
|
||||
$SIGNER -3 feedabee -f tmp -o example example2.db > /dev/null 2>&1
|
||||
$CHECKZONE -D -o example2.db.signed example tmp > /dev/null 2>&1
|
||||
rm -f tmp
|
||||
) || ret=1
|
||||
grep "^sub1\.example\..*RRSIG[ ]A[ ]" signer/example2.db.signed > /dev/null 2>&1 || ret=1
|
||||
grep "^ns\.sub2\.example\..*RRSIG[ ]A[ ]" signer/example2.db.signed > /dev/null 2>&1 || ret=1
|
||||
(
|
||||
cd signer
|
||||
cp -f example2.db.signed example2.db
|
||||
cat << EOF >> example2.db
|
||||
sub1.example. IN NS sub1.example.
|
||||
sub2.example. IN NS ns.sub2.example.
|
||||
EOF
|
||||
$SIGNER -3 feedabee -f tmp -o example example2.db > /dev/null 2>&1
|
||||
$CHECKZONE -D -o example2.db.signed example tmp > /dev/null 2>&1
|
||||
rm -f tmp
|
||||
) || ret=1
|
||||
grep "^sub1\.example\..*RRSIG[ ]A[ ]" signer/example2.db.signed > /dev/null 2>&1 && ret=1
|
||||
grep "^ns\.sub2\.example\..*RRSIG[ ]A[ ]" signer/example2.db.signed > /dev/null 2>&1 && ret=1
|
||||
n=`expr $n + 1`
|
||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
echo "I:checking validated data are not cached longer than originalttl ($n)"
|
||||
ret=0
|
||||
$DIG $DIGOPTS +ttl +noauth a.ttlpatch.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1
|
||||
|
||||
Reference in New Issue
Block a user