Skip to content

Commit

Permalink
resolved: validate noerror response for CNAMEs
Browse files Browse the repository at this point in the history
CNAME doesn't exist at the zone apex. When we get an unsigned noerror
response to a direct query for a CNAME record, we don't yet know if this
name is zone apex. We already request the correct DS record in this
case, but previously skipped it at validation time, causing the answer
to appear bogus. Make sure to also consider the DS record for the query
name for negative replies.

(cherry picked from commit afdb38a)
  • Loading branch information
rpigott authored and bluca committed Nov 13, 2024
1 parent 6bbefb5 commit 94b03cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/resolve/resolved-dns-transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -3071,16 +3071,6 @@ static int dns_transaction_requires_nsec(DnsTransaction *t) {

name = dns_resource_key_name(dns_transaction_key(t));

if (IN_SET(dns_transaction_key(t)->type, DNS_TYPE_DS, DNS_TYPE_CNAME, DNS_TYPE_DNAME)) {
/* We got a negative reply for this DS/CNAME/DNAME lookup? Check the parent in this case to
* see if this answer should have been signed. */
r = dns_name_parent(&name);
if (r < 0)
return r;
if (r == 0)
return true;
}

/* For all other RRs we check the DS on the same level to see
* if it's signed. */

Expand Down
2 changes: 2 additions & 0 deletions test/units/TEST-75-RESOLVED.sh
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ testcase_08_resolved() {
grep -qF "15 mail.unsigned.test." "$RUN_OUT"
run resolvectl query --legend=no -t MX unsigned.test
grep -qF "unsigned.test IN MX 15 mail.unsigned.test" "$RUN_OUT"
run dig @ns1.unsigned.test +noall +comments unsigned.test CNAME
grep -qF "status: NOERROR" "$RUN_OUT"

: "--- ZONE: signed.test (static DNSSEC) ---"
# Check the trust chain (with and without systemd-resolved in between
Expand Down

0 comments on commit 94b03cf

Please sign in to comment.