-
Notifications
You must be signed in to change notification settings - Fork 923
Bind-style views #15512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Bind-style views #15512
Conversation
Pull Request Test Coverage Report for Build 14754995094Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Some immediate thoughts after reading
Any plans on interacting with these mechanisms from dnsdist? (That was my immediate thought with a "PowerDNS-style" mindset) |
Views are set up by netmasks (base network address + prefix length), the narrowest netmask wins. There is no ordering concept.
TSIG-based selection of views is planned, but not in the initial Views release, more likely in 5.1 or 5.2.
I don't know! |
Ok, that sounds sensible. I think I would just wish for the matching behavior to be explicitly stated in the documentation; since while the approach makes sense it's also different from what someone who is used to BIND views would be used to.
Ok. As long as it's an expected (and preferably documented?) limitation that operations other than plain queries, like AXFR, UPDATE, etc have limited compatibility with a views-based setup, I guess it's fine if that aligns with priorities. That's essentially my reaction based on "All DNS operations (including DNSSEC) ought to work on views", which I may well have read too much into.
Ok. I think it would probably make sense (at some point) from a PowerDNS ecosystem perspective to be have some means of interacting with specific views also from dnsdist. (Maybe by a proxyv2 tag picking a view or something like that?) |
I am pondering to use several backends in dnsdist, connecting to the same auth IP, but with a different source address. Then auth can use the source address of the incoming request to select a view in the already existing way.
And the use rules to assign traffic to pool A or B. Note that I did not try this yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will write more soon
Yes, that really ought to work as long as you don't actually need the client address. But if you do need the client address, presumably you are already doing proxyv2 or something like that, and pdns will do its IP matching based on the proxyv2 source address, not the dnsdist source address, which is where I arrived at maybe pdns could also have for example proxyv2 KV-data as another option for matching. |
May I suggest '.' as view separator so a zone with a view will look something like this:
The benefit of this notation over the currently used ':' is that it is impossible put a view string with a '..' in it in a dnsname. So older pdns versions without views will automatically reject the new zone with a view format.
|
Hey, that's pretty smart! I'll rework the code to work this way. |
Updated to use |
1f03619
to
f6221de
Compare
...and now the documentation should match the new variant syntax as well. |
7d5b52c
to
8e8368a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packetcache changes look good
// - if we pass an address, only consider entries with a netmask matching that address | ||
// - if we don't pass an address, only consider entries with no netmask | ||
if (from != nullptr) { | ||
if (!iter->netmask || !iter->netmask->match(*from)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should continue searching for the longest match. I also still don't rule out that we'll be redoing this code with more knowledge of the configured networks at some point. But for now this will certainly do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and if I'm getting this right, we currently scale in O(n) for the number of netmask-differentiated answers to a question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes (assuming we have cached a packet for all of these networks). Which makes me think that we should probably advise, in the documentation, views users to increase the packet cache size because of this behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, and note the runtime performance implications on a TODO i guess
ZoneName zonename = apiNameToZoneName(stringFromJson(document, "name")); | ||
|
||
if (!backend.getDomainInfo(zonename, domainInfo)) { | ||
throw HttpNotFoundException(); // zone name not found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
404 feels like the wrong code for the -zone- not being an existing thing
Make the zone cache check for a possible view (based on the originating network address) and make it mutate its incoming ZoneName to fill the variant part if found and applicable.
Allow updates from the http api. Add zonecache unit test for views.
Note that this causes somewhat important plumbing changes, getSOA will now take an optional zone ID, which callers should provide if they know it, in order to save a possible expensive getDomainInfo call.
Annotate use of UnknownDomainID when it's safe to use.
Use this in order to produce the correct RRSIGs and DNSKEYs.
I can't believe I missed this when introducing variants. And of course, this causes subtle breakage due to the way the zone cache fills in the variant; add an ugly workaround for now, before going back to the drawing board.
Short description
This is a technology pre(view) of a maturing work in progress to implement Bind-style "views" in PowerDNS. In other words, this is a candidate for 5.0.0-alpha.
This feature is currently limited to the LMDB backend, and will require a database update; existing
pdns_server
will not be able to use the LMDB database once it has been touched by a server running this PR.All DNS operations (including DNSSEC) ought to work on views, and there should be no regression on existing, views-unaware, setups.
Please refer to the documentation updates in this PR (especially
docs/views.rst
) for more information and example setups.There are still debug output (with
VIEWS_DEBUG
markers for easy removal), and open questions or would-be issues (withFIXME
orTODO
markers, how unsurprising). We (@Habbie and I) intend to address these before the beta release. In the meantime this gives you a view (pun intended) of what we have been working on.Tests and feedback welcome.
Checklist
I have: