mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[GH-ISSUE #2195] [RFC] re-structure named.toml syntax to reject invalid configurations #918
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#918
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 @japaric on GitHub (Apr 25, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2195
According to this comment
The
enable_dnssecsetting is used to enable (runtime) signing of DNS records.Currently, this setting sits at the
zoneslevel, see belowHowever, in a recursive resolver (a
recursorstore) we don't want to (DNSSEC) sign records; instead we want to DNSSEC validate them. In RFC #2194, the idea is to put the setting inside thestoresfield (which maps to theRecursiveConfigtype). Once you pick adnssec_validationoption, theenabled_dnssecsetting one level above becomes irrelevant.Only in the case of authoritative name servers -- the
fileandsqlitestore types -- we want to be able to (DNSSEC) sign records. The forward resolver mode (theforwardstore type) should neither DNSSEC sign records nor DNSSEC validate the answers to the queries it forwards. To me that means, thatenable_dnssecshould be insideFileConfigandSqliteConfig, that is beneathzones.storesOverall, it seems that
ZoneConfigallows representing impossible configurations and storing settings unrelated to the operating mode of the zone (resolver vs authoritative name server). For example,zones.allow_axfronly applies to (secondary?) name servers that serve a zone filezones.zone_typetoPrimary(authoritative name server) but thestoreto therecursortype (recursive resolver) -- those are different roleszones.fileis "a short-hand forStoreConfig::FileConfig"; what happens if you set bothzones.fileandzones.stores.type = "file"? which one takes precedence? what happens if you setzones.stores.typeto something other thanfile.zones.keysare only going to be used ifenable_dnssecistruebut they can be specified whenenable_dnssecisfalseand you don't get a warning that they are not used (+)I think it would make sense to:
(1) rework the
ZoneConfigstruct so that in memory one cannot represent impossible configurations nor store settings that won't be used. I think that would mean using an enum-struct to represent theZoneType. Something like: (NOTE: very rough approximation as per my understanding of hickory's features)(2) lint the
named.tomlfile and emit warnings when settings that are not part ofZoneConfigare used (+)(+) the
tomlcrate is lax / permissive in this regard. it does not emit an error when the input includes a field that's not part of thestructis being deserialized into ( see example below ). performing the linting might require quite a bit of extra code -- unless serde has some "strict" mode that we could use hereprints
@djc commented on GitHub (Apr 25, 2024):
Reworking this sounds sensible. I found
#[serde(deny_unknown_fields)]which sounds like it'll do what we need?@japaric commented on GitHub (Apr 25, 2024):
nice finding. that indeed does the trick.
changing
ZoneConfigwould be a breaking change. are breaking changes currently being merged intomain?@djc commented on GitHub (Apr 25, 2024):
Yes, we're currently waiting on a new Quinn release which will let us bump Quinn and rustls and related dependencies and will plan to do a new (semver-incompatible) release soon after.
@marcus0x62 commented on GitHub (Nov 29, 2024):
@japaric the chained authority feature is going to make this a bit more complicated. The stores for a given zone can now be a TOML map or an array of tables, and in the array of tables case can use different authority implementations with different configuration options. See consulting blocklist for an example of this.
Also, there is a custom serde visitor to make parsing errors useful for a chained authority configuration due to how serde handles untagged enums.