resolved: don't insist in RRSIG metadata for NSEC3 RRs that have not been authenticated
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Jan 2016 17:43:41 +0000 (18:43 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 25 Jan 2016 16:19:20 +0000 (17:19 +0100)
In some cases we get NSEC3 RRs that have not been authenticated (because the chain of trust to the root is somewhere
broken). We can use these for checking negative replies, as long as we don't claim they were ultimately authenticated.
This means we need to be able to deal with NSEC3 RRs that lack RRSIG metadata.

src/resolve/resolved-dns-dnssec.c

index eb217b1..8e3c78e 100644 (file)
@@ -1267,11 +1267,12 @@ static int nsec3_is_good(DnsResourceRecord *rr, DnsResourceRecord *nsec3) {
         if (rr->nsec3.iterations > NSEC3_ITERATIONS_MAX)
                 return 0;
 
-        /* Ignore NSEC3 RRs generated from wildcards */
-        if (rr->n_skip_labels_source != 0)
+        /* Ignore NSEC3 RRs generated from wildcards. If these NSEC3 RRs weren't correctly signed we can't make this
+         * check (since rr->n_skip_labels_source is -1), but that's OK, as we won't trust them anyway in that case. */
+        if (rr->n_skip_labels_source != 0 && rr->n_skip_labels_source != (unsigned) -1)
                 return 0;
         /* Ignore NSEC3 RRs that are located anywhere else than one label below the zone */
-        if (rr->n_skip_labels_signer != 1)
+        if (rr->n_skip_labels_signer != 1 && rr->n_skip_labels_signer != (unsigned) -1)
                 return 0;
 
         if (!nsec3)