mirror of
https://github.com/systemd/systemd.git
synced 2025-03-16 10:50:18 +03:00
resolved: explicitly handle case when the trust anchor is empty
Since we honour RFC5011 revoked keys it might happen we end up with an empty trust anchor, or one where there's no entry for the root left. With this patch the logic is changed what to do in this case. Before this patch we'd end up requesting the root DS, which returns with NODATA but a signed NSEC we cannot verify, since the trust anchor is empty after all. Thus we'd return a DNSSEC result of "missing-key", as we lack a verified version of the key. With this patch in place, look-ups for the root DS are explicitly recognized, and not passed on to the DNS servers. Instead, if downgrade-ok mode is on an unsigned NODATA response is synthesized, so that the validator code continues under the assumption the root zone was unsigned. If downgrade-ok mode is off a new transaction failure is generated, that makes this case recognizable.
This commit is contained in:
parent
a761c1ca85
commit
b2b796b8ab
@ -75,6 +75,7 @@
|
||||
#define BUS_ERROR_CONNECTION_FAILURE "org.freedesktop.resolve1.ConnectionFailure"
|
||||
#define BUS_ERROR_NO_SUCH_SERVICE "org.freedesktop.resolve1.NoSuchService"
|
||||
#define BUS_ERROR_DNSSEC_FAILED "org.freedesktop.resolve1.DnssecFailed"
|
||||
#define BUS_ERROR_NO_TRUST_ANCHOR "org.freedesktop.resolve1.NoTrustAnchor"
|
||||
#define _BUS_ERROR_DNS "org.freedesktop.resolve1.DnsError."
|
||||
|
||||
#define BUS_ERROR_NO_SUCH_TRANSFER "org.freedesktop.import1.NoSuchTransfer"
|
||||
|
@ -67,6 +67,9 @@ static int reply_query_state(DnsQuery *q) {
|
||||
return sd_bus_reply_method_errorf(q->request, BUS_ERROR_DNSSEC_FAILED, "DNSSEC validation failed: %s",
|
||||
dnssec_result_to_string(q->answer_dnssec_result));
|
||||
|
||||
case DNS_TRANSACTION_NO_TRUST_ANCHOR:
|
||||
return sd_bus_reply_method_errorf(q->request, BUS_ERROR_NO_TRUST_ANCHOR, "No suitable trust anchor known");
|
||||
|
||||
case DNS_TRANSACTION_RCODE_FAILURE: {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
|
||||
|
@ -926,6 +926,41 @@ static int dns_transaction_prepare(DnsTransaction *t, usec_t ts) {
|
||||
dns_transaction_complete(t, DNS_TRANSACTION_SUCCESS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dns_name_is_root(DNS_RESOURCE_KEY_NAME(t->key)) &&
|
||||
t->key->type == DNS_TYPE_DS) {
|
||||
|
||||
/* Hmm, this is a request for the root DS? A
|
||||
* DS RR doesn't exist in the root zone, and
|
||||
* if our trust anchor didn't know it either,
|
||||
* this means we cannot do any DNSSEC logic
|
||||
* anymore. */
|
||||
|
||||
if (t->scope->dnssec_mode == DNSSEC_DOWNGRADE_OK) {
|
||||
/* We are in downgrade mode. In this
|
||||
* case, synthesize an unsigned empty
|
||||
* response, so that the any lookup
|
||||
* depending on this one can continue
|
||||
* assuming there was no DS, and hence
|
||||
* the root zone was unsigned. */
|
||||
|
||||
t->answer_rcode = DNS_RCODE_SUCCESS;
|
||||
t->answer_source = DNS_TRANSACTION_TRUST_ANCHOR;
|
||||
t->answer_authenticated = false;
|
||||
dns_transaction_complete(t, DNS_TRANSACTION_SUCCESS);
|
||||
} else
|
||||
/* If we are not in downgrade mode,
|
||||
* then fail the lookup, because we
|
||||
* cannot reasonably answer it. There
|
||||
* might be DS RRs, but we don't know
|
||||
* them, and the DNS server won't tell
|
||||
* them to us (and even if it would,
|
||||
* we couldn't validate it and trust
|
||||
* it). */
|
||||
dns_transaction_complete(t, DNS_TRANSACTION_NO_TRUST_ANCHOR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check the zone, but only if this transaction is not used
|
||||
@ -2438,6 +2473,7 @@ static const char* const dns_transaction_state_table[_DNS_TRANSACTION_STATE_MAX]
|
||||
[DNS_TRANSACTION_CONNECTION_FAILURE] = "connection-failure",
|
||||
[DNS_TRANSACTION_ABORTED] = "aborted",
|
||||
[DNS_TRANSACTION_DNSSEC_FAILED] = "dnssec-failed",
|
||||
[DNS_TRANSACTION_NO_TRUST_ANCHOR] = "no-trust-anchor",
|
||||
};
|
||||
DEFINE_STRING_TABLE_LOOKUP(dns_transaction_state, DnsTransactionState);
|
||||
|
||||
|
@ -39,6 +39,7 @@ enum DnsTransactionState {
|
||||
DNS_TRANSACTION_CONNECTION_FAILURE,
|
||||
DNS_TRANSACTION_ABORTED,
|
||||
DNS_TRANSACTION_DNSSEC_FAILED,
|
||||
DNS_TRANSACTION_NO_TRUST_ANCHOR,
|
||||
_DNS_TRANSACTION_STATE_MAX,
|
||||
_DNS_TRANSACTION_STATE_INVALID = -1
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user