Resolvd(8) – daemon to handle nameserver configuration
undeadly.org
undeadly.org
Then systemd came along and broke it (on linux), driving my hatred of that environment up another notch (see also things like ntp, syslog)
I hope BSD doesn’t follow the same path.
I mean, resolv.conf is only going to change based on some event happening in one of these other daemons (or user input), so this could just as well be an executable that is started to handle that event? Am I missing something?
Oh, wait, that would be pretty useful, and avoid having a daemon running all the time. And be easier to debug.
Similarly, reading /etc/resolv.conf and doing the resolving in-app will quickly lead to wrong results.
This would also solve the network namespace issue.
Programs are not supposed to read resolv.conf and implement their own resolver anyway (due to nss), but many still do.
We already use configuration management to do manage resolv.conf; any other method of modification is noncompliant. So this is just more at-best-wasteful cruft to strip out.
More generally, why make this a daemon? There is zero reason for it to be resident other than on network changes. Should we have dedicated daemons for /etc/hosts, ldap.conf, and nsswitch.conf, too? How about inittab?
We already use configuration management to do manage
resolv.conf; any other method of modification is
noncompliant.
So don't run resolvd. Problem solved forever.This exists as daemon because OpenBSD is in the process of rewriting certain parts of their code to have explicit privilege separation. They just committed another one to handle DHCP leases, for example.
> cruft to strip out
> rewriting certain parts of their code to have explicit privilege separation
I was unaware that this was the goal. If it is, that's a better explanation for changing things than I've heard elsewhere.
Still doesn't explain why it should be a daemon instead of a helper binary.
Indeed, that's what FreeBSD does, with resolvconf(8).
The reason this is a daemon is ... because a process started from dhclient/slaacd/unwind couldn't directly write to /etc/resolv.conf?
I would say couldn't or shouldn't:
resolvconf manages resolv.conf(5) files from multiple sources, such as
DHCP and VPN clients. Traditionally, the host runs just one client and
that updates /etc/resolv.conf. More modern systems frequently have wired
and wireless interfaces and there is no guarantee both are on the same
network. With the advent of VPN and other types of networking daemons,
many things now contend for the contents of /etc/resolv.conf.
FreeBSD's resolvconf comes with a configuration file which tells it how to combine instructions from multiple sources.A central piece of code managing that is therefore a good idea. Could be a library rather than a daemon. But a daemon would be one way to resolve races.
Strikes me that this is all a little bit "on the systemd spectrum" though.
Having a separate daemon also saves you from having to grant the other daemons credentials to edit the file.
again, just a hunch, but it helps me make sense of the world :)
A daemon running in the background consumes resources and generally increases attack surface re. security issues - though in this specific case the one-shot executable would admittedly need the same privileges.