mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #118] calculation of key_tag is wrong #58
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#58
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 @jannic on GitHub (Apr 21, 2017).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/118
In
client/src/rr/dnssec/signer.rs,pub fn calculate_key_tag, the algorithm to calculate the key tag is applied to the public key (self.key.to_public_bytes()).But according to the RFC (as quoted in the comment above the code), the algorithm should be applied to "the RDATA part of the KEY RR", which also includes the fieds flags, protocol and algorithm. (https://tools.ietf.org/html/rfc2535#section-3.1)
Unfortunately, AFAICT, Signer doesn't even contain enough information to properly fill the 'flags' field.
To verify my assumption that the current behavior is wrong, I patched calculate_key_tag to use an RDATA structure with fixed values:
This code calculates the same key tag (AKA key id) as bind's
dnssec-keygen.@bluejekyll commented on GitHub (Apr 22, 2017):
Thanks! Do you want to submit a PR?
I wasn't very confident in this code, but wasn't relying on it for much so hadn't needed to go back to it.
@bluejekyll commented on GitHub (Apr 22, 2017):
Btw, the
key_pairhas a functionto_dnskey()on it. We can change this to take in the booleans, right now it's assumed that all KeyPairs are zone signing keys.@jannic commented on GitHub (Apr 22, 2017):
The code I posted isn't ready for an PR. It doesn't cover the flags possible in a KEY RR. The flags are different from DNSKEY flags, even though those resource records are very similar:
In the example code, I just selected DNSKEY flags which happen to have the same bit pattern as the KEY flags of the key I was using. But a clean solution whould need a way to specify KEY flags, directly.
I am trying to use trust_dns to send dynamic DNS updates to a BIND server, so I'll have a look if I can prepare a proper PR. But my time is quite limited, and this is not a high-priority task, so don't hold your breath :-)
@bluejekyll commented on GitHub (Apr 22, 2017):
Ok. No problem. I'll take a look at getting this into the 0.10.1 release I'm working on.
DNSKEY and KEY are basically identical, which is why I implemented them with the same RData. I'll look at some options for changing the impl for the two to cleanup the flags section.
Btw, what are you using KEY for, if you don't mind my asking?
@jannic commented on GitHub (Apr 22, 2017):
I'm signing dynamic DNS updates. As described here: http://jpmens.net/2010/12/01/securing-dynamic-dns-updates-ddns-with-sig0/ (But with an RSASHA256 key.)
The data to be put into DNS is coming from some software written in rust, so I'd prefer to use a rust library to send out the DNS updates. Even tough just calling an external nsupdate process would work as well, I guess.
This is just a hobby project, so I'm free to use whatever technology I like, even if it's new and still has some bugs.
@bluejekyll commented on GitHub (Apr 22, 2017):
Cool. Thanks for the link, maybe I can make some compatibility tests for validating that my SIG0 impl is cross compatible, I definitely want it to be. My trust-dns server implementation doesn't rely on the key-id, and is obviously currently only testing against itself.
Thanks!
@jannic commented on GitHub (Apr 22, 2017):
If you don't have a bind server at hand or want to save the time configuring it, I can send you a key which you can use to send updates to a test domain I already configured.
@bluejekyll commented on GitHub (Apr 22, 2017):
If you want to send along the configuration, that would be a big help.
I've wanted to set this up for a while, I already have a reproducible build for bind that I use for a benchmark. I can build off that to create a repeatable build for compatibility and then run that in a travis-ci job.
@bluejekyll commented on GitHub (May 7, 2017):
fixed in #119