mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 19:25:56 +03:00
[GH-ISSUE #27] Client fails to verify records with uppercased names #19
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SAPikachu on GitHub (Aug 8, 2016).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/27
Test case:
This fails with
No DNSKEY proof availableerror while validating the returned NSEC record, but according to http://dnsviz.net/d/rollernet.us/dnssec/ , the server returns correct RRSIG. From what I can tell, this server returns uppercased names in the record, but all names are converted to lowercase on deserialization, which breaks verification.@bluejekyll commented on GitHub (Aug 8, 2016):
Thanks for the testcase and the description!
I will take a look later tonight and see about fixing it.
@bluejekyll commented on GitHub (Aug 9, 2016):
Nice work on the diagnosis. I knew that I had a problem here for other reasons, but you definitely found it. I'm adding your test case to the code for now, as an integration test.
I knew I had a query response issue to fix on improperly converting the case of this. I will try to push a fix tonight. Just adding some other test cases to validate cases.
@SAPikachu commented on GitHub (Aug 9, 2016):
Thanks and looking forward to the fix! I found this when writing my recursive resolver project. :)
@bluejekyll commented on GitHub (Aug 9, 2016):
Ok, I just pushed a patch to the 0.7.1_patch branch. Though, I have been having trouble with the UDP tests passing consistently, the TCP ones do regularly.
I'll have to look into why the UDP ones fail inconsistently. I will try and push a release to creates.io tomorrow for this. It also fixes an inconsistency issue with queries where the case of the responses was being changed.
@bluejekyll commented on GitHub (Aug 9, 2016):
btw, the integration tests are all marked with
#[ignored], you can enable these withcargo test -- --ignored@SAPikachu commented on GitHub (Aug 9, 2016):
Thanks for the fix! Will try it a bit later. :)
@SAPikachu commented on GitHub (Aug 11, 2016):
OK, have been fiddling with this over the last 2 days and I have the following observations:
us.exceeds 512 bytes so the server returns truncated result, and we have to revert to TCP to get validation to work.dig ds rollernet.us. @156.154.124.70 +dnssec) and fails to validate. I tried to replace the line of code to following snippet and it is fixed.Sidenote: Just a suggestion, maybe we should re-implement
Eq,PartialEqandHashforName? Since in most cases we should do case-insensitive comparison betweenNames.@bluejekyll commented on GitHub (Aug 11, 2016):
Thanks for all the hard work on this. I really appreciate it. Are you working off a release or HEAD? I'd like to start applying these changes to HEAD.
Do you want to submit separate patches for these against HEAD? Otherwise I can look at fixing them.
Sidenote: I definitely considered this, but I got caught in an internal debate. Do we want to also compare regardless of case, or do we want people to be explicit? The reason that I went the direction I did is that I decided we at least needed both. We can invert that decision though, and make Eq + Hash case insensitive, and then offer a case_sensitive compare function.
@SAPikachu commented on GitHub (Aug 12, 2016):
Sure, I will send my fixes to the 3 issues as pull request a bit later. :)
Regarding sidenote: I am actually biased as my project needs case insensitive comparison and hashing everywhere. :) Anyways I just did a bit of research and found RFC 4343 which explicitly states name comparison should be case-insensitive. I agree that maybe in some cases we need to do case-sensitive comparison, but it is much rarer and it will be more convenient to implement
Eq-related traits as case insensitive by default IMO.@bluejekyll commented on GitHub (Aug 12, 2016):
I'll work on fixing the name issue, if you want to send the other fixes, that would be a great help.
@SAPikachu commented on GitHub (Aug 12, 2016):
Oh I forgot to post about the UDP issue. If I remember correctly, the offending response is more than 1700 bytes so 1500 in our setting is not enough. Although the real issue is that it seems Google's server hardcoded 512 bytes in their EDNS header, so it will never send us the correct response and we have to revert to TCP anyways.
@SAPikachu commented on GitHub (Aug 12, 2016):
Just submitted patch for the TCP issue. Not quite sure where is the correct place for the
Namefix so I guess I'd better leave it to you. :)@SAPikachu commented on GitHub (Aug 12, 2016):
Here is a test case to help checking the verification issue:
@bluejekyll commented on GitHub (Aug 12, 2016):
@SAPikachu I added that test, and went through and adjusted all cases. I added the case-insensitive cmp, eq, and hash.
I got the test_dnssec_rollernet_td_tcp, this adjusts the case in the record labels in the RRSIG validation, but it doesn't adjust the signer_name. The spec seems to say that both should be lowercased, but when I do both test_dnssec_rollernet_td_tcp fails to validate.
neither change gets test_dnssec_rollernet_td_tcp_mixed_case passing.
To be clear, what is in the 0.7.3_name_patch has test_dnssec_rollernet_td_tcp passing, but not test_dnssec_rollernet_td_tcp_mixed_case
@SAPikachu commented on GitHub (Aug 12, 2016):
OK, I tested and found that SOA record of
Us.fails to validate. And then I found RFC 6840 5.1 mentions that only names in NSEC records need to keep their case, and other common records need to be converted. CloudFlare's DNSSEC validator also references this. Hope it is correct this time..@bluejekyll commented on GitHub (Aug 12, 2016):
And this is why case-insensitivity is dumb :)
I'll patch this up tonight. Thanks for doing all the research!
@bluejekyll commented on GitHub (Aug 13, 2016):
Ok, I think this recent patch fixes it up... I pulled your TCP patch in to make the connections more reliable. Good catch on that fix! I'm going to push a new version and then merge this back to master.
The serialization code could definitely be cleaned up at this point, it's a little ugly.
@SAPikachu commented on GitHub (Aug 13, 2016):
Thanks! I just submitted a patch to fix
Name::zone_ofwhich should be case-insensitive too. With that it works well here. :)@bluejekyll commented on GitHub (Aug 13, 2016):
Is this something you want in the 0.7.x release? Otherwise I'll just leave merged on master and then include it in the next release.
@SAPikachu commented on GitHub (Aug 14, 2016):
It doesn't matter for me since I can use master, so you decide. :)