Skip to content

Interface for plugging custom name resolution services into resolved #8518

Closed

Description

@Svedrin

Submission type

  • Request for enhancement (RFE)

systemd version the issue has been seen with

237

Used distribution

Debian unstable

Request

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:

  1. I start my custom tool, it provides a DBus API and registers it with resolved
  2. 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.

Activity

  1. added
    RFE 🎁
    on Mar 21, 2018
  2. Daniel-Abrecht commented on Mar 23, 2018

    @Daniel-Abrecht

    Not everyone uses resolved, and there are already better ways to do this:

    1. Make it provide a DNS Server. There are some good libraries out there.
    2. Use an existing DNS Resolver. Unbound for example has a nice scripting interface and a nice c library (libunbound):
      https://www.unbound.net/documentation/libunbound.html
      https://www.unbound.net/documentation/pythonmod/index.html
    3. Make a nsswitch module.

    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.

  3. lf- commented on May 3, 2023

    @lf-
    Contributor

    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.

  4. Winterhuman commented on May 3, 2023

    @Winterhuman
    Contributor

    @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)

  5. lf- commented on May 3, 2023

    @lf-
    Contributor

    @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.

  6. Winterhuman commented on May 4, 2023

    @Winterhuman
    Contributor

    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 system

  7. added 7 commits that reference this issue on Oct 13, 2025
    81b02eb
    1628026
    3beacae
    912dbc8
    1da4fa8
    7284027
    7d0b22b
  8. added a commit that references this issue on Oct 30, 2025
    23be28f
  9. added 2 commits that reference this issue on Nov 2, 2025
    f24dd34
    267e702
  10. added 5 commits that reference this issue on Nov 14, 2025
    53da266
    f64b1b9
    aab0bb7
    d764725
    8209f4a
  11. added a commit that references this issue on Nov 15, 2025
    c15bd80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFE 🎁resolve

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions