unbound: add basic split view DNS support #9055
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add the ability to return different DNS records based on the client's subnet.
For example, for host
foo.example.comclients from10.0.0.0/8may get1.1.1.1where clients from192.168.0.0/16may get2.2.2.2, etc.The new implementation is kept as separate as possible from existing Unbound code. Eg the model section, controllers and new UI tabs, are all separated. This means that
Note that unbound's view local-data (host) records are slightly different than standard local-data (host) entries:
compared with
The new
Split View DNSmenu under unbound has three UI tabs:"Views", "Subnets", "Hosts".
These match the following flow:
Users create a View, create a Subnet to scope the view to, then assign Hosts to that View.
A Host can be assigned to multiple Views. A Subnet can be assigned to a single View; multiple Subnets can be assigned to the same View. This behaviour is reflected in the model (and validation).
Subnets cannot overlap - this behaviour is recommended and means that View order does not matter.
If a View is deleted, Hosts are no longer assigned to that view. If the Host was assigned to multiple Views it remains assigned to the remaining existing views. Otherwise it it is unassigned, and can be associated with a different View if desired. (It does not become part of the "server:" section - that would be a potentially dangerous side effect.)
The Hosts table has a Views dropdown which can be used to filter Hosts based on View. This dropdown and all tables update automatically if changes are made (eg if a View name is changed that will be reflected automatically in the Hosts table, the Hosts filter, and the Subnets table).
There is no support for interface based views, but the design would easily support adding that. (Interfaces would be assigned to views in the same way as subnets.)
Reverse records are created automatically. Only A/AAAA record types are supported. Wildcards are supported using
*.Updates are saved atomically. E.g. If a view is deleted, it is removed from the Host state and the view state atomically, so there should be no stale references.
For some design discussion, and UI screenshots see:
#8952