You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Interface for plugging custom name resolution services into resolved #8518
I'd appreciate if I could hook a custom name resolution service into resolved, like an API version of /etc/hosts, so to speak. So that when I have a tool that resolves names into IPs but does not provide a DNS server, I can still make it useable by the rest of the system.
I imagine the flow to work like this:
I start my custom tool, it provides a DBus API and registers it with resolved
Now whenever resolved gets a query that other sources don't provide an answer for, resolved calls into my API so that I can provide one.
I'm not sure how exactly this feature could be fleshed out, especially since this could have security implications. Then again, it probably has the same impact that /etc/hosts itself does.
I would recommend option 1 or 2. A lot of common services like namecoin, tor, etc. use this approach. It has the additional benefit that you can also configure it for non-local name resolution, and you can make quiet sophisticated DNS resolution setups by combining multiple DNS resolvers, which can even be on different machines. I'm using this to resolve some special TLD's (like .bit), pass my traffic through dnscrypt, apply DNS based adblocking, change which parts of my machines & services in which networks are resolvable, etc. And that all without having to install everything on every device in my network.
Option 3 also has it's fair uses. It's often used to resolve IPs that can never be reached remotely, or if a different name resolution method that's used on the local network or on the same machine already exists and needs to be implemented. It's used to implement /etc/hosts, DNS resolution using /etc/resolv.conf, and there is also a module for mdns. It's less flexible than options 1 and 2 and not necessarely easier to implement, though.
I think resolved would be the worst possible place to put this, since programs relaying on this would depend on resolved and systemd, they wouldn't be as flexible as with option 1 and 2, and it doesn't offer any benefits over the other options. I think using dbus is mostly unnecessary too, if adding an entry to /etc/resolv.conf or your local resolver config or /etc/nsswitch.conf is too much to ask, and you insist on dbus, please at least don't implement it on top of resolved, because it could lead to a lot of other programs becoming unusable for me and a lot of other people.
There is also the possibility to use DNS zone updates to dynamically update DNS servers, which is used by some dhcp services and ACME clients, but that doesn't seam to me like what you're looking for.
I went looking for this bug filing because Tailscale keeps repeatedly breaking my DNS, since it needs to take over resolution of *.*.ts.net hostnames by more or less querying a service discovery system. It currently needs to accomplish this by overwriting /etc/resolv.conf, which I am pretty sure it pulls its upstream from (then, how do you change the upstream?), and I think that it also winds up breaking itself on network change sometimes. The real problem here is that it needs to be so aggressive about things due to everyone and their dog writing their own DNS client that can at best be assumed to read /etc/resolv.conf and send requests to the entry in there, ignoring nsswitch or anything else.
resolved almost solves this by being one, good daemon that receives all DNS requests, except for the feature request you are reading: sadly has no extensibility for attaching alternate name resolution systems to it. Setting the upstream to something like unbound as suggested in #20485 is not a solution in my opinion: it is not composable: you have to stack resolvers on more resolvers on more resolvers (each with a new loopback IP because nothing supports ports that are not 53) instead of having a flat list of plugins/etc that can pick up relevant requests. The final state of this is that someone writes a new daemon intended to implement such a composable list of plugins, at which point it might as well be resolved doing it, and would be greatly preferable for social reasons.
More to the point, unbound is not something that can be realistically used to fix the Tailscale problem for everyone as it requires custom configuration on every system and does not compose multiple services without manual configuration. This really needs to be in resolved so it is composable.
@lf- Isn't resolvconf the solution for having multiple applications control /etc/resolv.conf in this case? Last I check, it should let VPN apps take control when needed, and then give back control when it's done (or at least some VPNs like ProtonVPN are known to use this)
@Winterhuman I don't think so, since Tailscale is not like a typical VPN: it's not supposed to take all the traffic. I would consider it more analogous to an alternate name service like ENS or others.
Activity
Daniel-Abrecht commentedon Mar 23, 2018
Not everyone uses resolved, and there are already better ways to do this:
https://www.unbound.net/documentation/libunbound.html
https://www.unbound.net/documentation/pythonmod/index.html
I would recommend option 1 or 2. A lot of common services like namecoin, tor, etc. use this approach. It has the additional benefit that you can also configure it for non-local name resolution, and you can make quiet sophisticated DNS resolution setups by combining multiple DNS resolvers, which can even be on different machines. I'm using this to resolve some special TLD's (like .bit), pass my traffic through dnscrypt, apply DNS based adblocking, change which parts of my machines & services in which networks are resolvable, etc. And that all without having to install everything on every device in my network.
Option 3 also has it's fair uses. It's often used to resolve IPs that can never be reached remotely, or if a different name resolution method that's used on the local network or on the same machine already exists and needs to be implemented. It's used to implement /etc/hosts, DNS resolution using /etc/resolv.conf, and there is also a module for mdns. It's less flexible than options 1 and 2 and not necessarely easier to implement, though.
I think resolved would be the worst possible place to put this, since programs relaying on this would depend on resolved and systemd, they wouldn't be as flexible as with option 1 and 2, and it doesn't offer any benefits over the other options. I think using dbus is mostly unnecessary too, if adding an entry to /etc/resolv.conf or your local resolver config or /etc/nsswitch.conf is too much to ask, and you insist on dbus, please at least don't implement it on top of resolved, because it could lead to a lot of other programs becoming unusable for me and a lot of other people.
There is also the possibility to use DNS zone updates to dynamically update DNS servers, which is used by some dhcp services and ACME clients, but that doesn't seam to me like what you're looking for.
lf- commentedon May 3, 2023
I went looking for this bug filing because Tailscale keeps repeatedly breaking my DNS, since it needs to take over resolution of
*.*.ts.nethostnames by more or less querying a service discovery system. It currently needs to accomplish this by overwriting /etc/resolv.conf, which I am pretty sure it pulls its upstream from (then, how do you change the upstream?), and I think that it also winds up breaking itself on network change sometimes. The real problem here is that it needs to be so aggressive about things due to everyone and their dog writing their own DNS client that can at best be assumed to read/etc/resolv.confand send requests to the entry in there, ignoring nsswitch or anything else.resolved almost solves this by being one, good daemon that receives all DNS requests, except for the feature request you are reading: sadly has no extensibility for attaching alternate name resolution systems to it. Setting the upstream to something like
unboundas suggested in #20485 is not a solution in my opinion: it is not composable: you have to stack resolvers on more resolvers on more resolvers (each with a new loopback IP because nothing supports ports that are not 53) instead of having a flat list of plugins/etc that can pick up relevant requests. The final state of this is that someone writes a new daemon intended to implement such a composable list of plugins, at which point it might as well beresolveddoing it, and would be greatly preferable for social reasons.More to the point,
unboundis not something that can be realistically used to fix the Tailscale problem for everyone as it requires custom configuration on every system and does not compose multiple services without manual configuration. This really needs to be inresolvedso it is composable.Winterhuman commentedon May 3, 2023
@lf- Isn't
resolvconfthe solution for having multiple applications control/etc/resolv.confin this case? Last I check, it should let VPN apps take control when needed, and then give back control when it's done (or at least some VPNs like ProtonVPN are known to use this)lf- commentedon May 3, 2023
@Winterhuman I don't think so, since Tailscale is not like a typical VPN: it's not supposed to take all the traffic. I would consider it more analogous to an alternate name service like ENS or others.
Winterhuman commentedon May 4, 2023
Yeah, you're right. Closest thing that currently exists is setting search/routing domains for
~ts.net(see https://github.com/systemd/systemd/blob/main/docs/RESOLVED-VPNS.md), but that's a fixed list of domains rather than a dynamic systemresolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add hook api
resolved: add ability for external programs to hook into name resolut…