Repository navigation
Reduce superfluous dnssec transactions - #31827
Conversation
761708b to
f9b746b
Compare
When validating insecure delegations we don't actually need to request the SOA for every single dns label. We need the DS records for the zone, and we can seek them by querying for DS directly (in case we are at a zone cut) and then following the SOA referrals or the parent name until we have found a chain of trust. Extra transactions and roundtrips, especially transactions for RRs that aren't actually needed to validate and therefore aren't likely to be in the recursive resolver's own cache are a big slowdown during validation. Consequently, this change results in an enourmous speed up in validating most names from our own cold-cache (10x or more), by eliminating a large number of superfluous dnssec transactions.
When validating, when we lookup a DNSKEY for validation we will almost certainly need the corresponding DS to complete the chain of trust. Let's go ahead and request it right away so that we don't have to wait in this common case.
f9b746b to
ce5b9d5
Compare
|
Thank you for looking into this. Any chance this fixes #9867 too? |
|
@jiripospisil Yeah. I can't actually reproduce with savannah.gnu.org on 255.4, and the logs are from too old a version of sd-resolved for me to recognize what went wrong. Manually querying, I don't see anything about that name that I know the old algorithm would trip over either. So I think that one had already been resolved, actually. sts.sky.blackbaud.com, the most recent name mentioned in a comment, appears to be a dupe of #24171 though. |
|
@bluca Can you check if some of the linked issues can be closed? Basically, all of the above are dupes of #24171 or #22131 I think. I resolved them by accident in 4769063. I hadn't previously considered this, but some of those superfluous queries could (legitimately) fail, causing us to reject valid answers. |
Afraid I am not a DNS expert by any meaning of the term - happy to close them if you tell me they are dups and solved by the recent changes |
|
@yuwata thanks, I made #31974 for those. @bluca Okay, well, I'm pretty sure they are resolved. The failing domains all have some way to convince sd-resolved it needed to find an SOA somewhere one doesn't exist. I didn't look too carefully at each one, especially since the dnssec status may have changed over time, but they don't reproduce after this PR. |
When validating insecure delegations, do not request the SOA for every DNS label. Instead, query for DS directly and follow SOA referrals or parent name until a chain of trust is found. Additionally, request DS records alongside DNSKEY lookups to avoid redundant roundtrips. This change results in an enormous speed up in validating most names from cold-cache (10x or more), by eliminating a large number of superfluous DNSSEC transactions. Changes: - Add debian/patches/fix-resolved-reduce-dnssec-transactions.patch - Modify debian/patches/series - Modify debian/changelog Upstream: systemd/systemd#31827 Generated-By: glm-5-turbo Co-Authored-By: deepin-ci-robot <[email protected]>
When validating insecure delegations, do not request the SOA for every DNS label. Instead, query for DS directly and follow SOA referrals or parent name until a chain of trust is found. Additionally, request DS records alongside DNSKEY lookups to avoid redundant roundtrips. This change results in an enormous speed up in validating most names from cold-cache (10x or more), by eliminating a large number of superfluous DNSSEC transactions. Changes: - Add debian/patches/fix-resolved-reduce-dnssec-transactions.patch - Modify debian/patches/series - Modify debian/changelog Upstream: systemd/systemd#31827 Generated-By: glm-5-turbo Co-Authored-By: deepin-ci-robot <[email protected]>
This dramatically reduces the number of transactions and round trips used to retrieve the necessary material for dnssec validation. Eliminating these transactions results in a massive speedup resolving beneath insecure delegations, which are far and away the most common case — only a tiny fraction of a fraction of internet domains are actually signed.
sd-resolved exhibited particularly poor performance for names with many dns labels, like the reverse nybble format used in ip6.arpa. A typical reverse lookup performed by ping -6 google.com could take well over 10 seconds to complete from cold-cache, even on a fast network, and even with a hot-cache forwarding resolver on the lan. In at least one case, this patch reduces the number of dns transactions used for such a lookup from 67 to 11, speeding up resolution 10x in the process, because the eliminated superfluous transactions are also the ones not likely to be present in the recursive resolver's own cache.
We also speculatively request DS records along with DNSKEY records, since we will almost certainly need them. Overall, the new method should be faster by some amount in every case.
I think it is correct, at least I don't know of any domains that are incorrectly accepted/rejected with the new code, but it is probably worth some careful review. If you can find/create a domain that doesn't validate correctly, please let me know and hopefully we can make a test case for it.
Fixes: #31826