nixos/avahi-daemon: disable the full mDNS NSS module by default (#526821)

This commit is contained in:
Sandro
2026-06-25 09:09:30 +00:00
committed by GitHub
2 changed files with 34 additions and 1 deletions
@@ -40,6 +40,8 @@
- `security.polkit.enablePkexecWrapper` has been introduced, making the `pkexec` setuid wrapper opt-in.
- When Avahi's mDNS resolver is enabled (`services.avahi.nssmdns4` or `services.avahi.nssmdns6`), only the minimal mDNS resolver is enabled by default to avoid adding a 5 second delay to every failed reverse hostname lookup (e.g., delaying ping by 5 seconds). The "full" mDNS resolver now remains disabled unless `services.avahi.nssmdnsFull` is also enabled. Users who have customized [`/etc/mdns.allow`](https://github.com/avahi/nss-mdns/tree/master#etcmdnsallow) to allow mDNS domains not ending `.local` must enable `services.avahi.nssmdnsFull` to continue to resolve such domains.
- `systemd.user.extraConfig` has been removed in favor of the structured [](#opt-systemd.user.settings.Manager) option. Use `systemd.user.settings.Manager` to set any `systemd-user.conf(5)` option directly. For example, replace `systemd.user.extraConfig = "DefaultTimeoutStartSec=60";` with `systemd.user.settings.Manager.DefaultTimeoutStartSec = 60;`.
- `services.timesyncd.extraConfig` has been removed in favor of the structured [](#opt-services.timesyncd.settings.Time) option. Use `services.timesyncd.settings.Time` to set any `timesyncd.conf(5)` option directly. For example, replace `services.timesyncd.extraConfig = "PollIntervalMaxSec=180";` with `services.timesyncd.settings.Time.PollIntervalMaxSec = 180;`.
@@ -262,6 +262,28 @@ in
'';
};
nssmdnsFull = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to enable the full mDNS NSS (Name Service Switch) plug-in.
By default, only the minimal module is enabled. The minimal module
will only resolve `.local` domains and only perform reverse hostname
lookups for `169.254.0.0/16`. The full module will use mDNS to resolve any
domain allowed by [`/etc/mdns.allow`][1] and will perform reverse hostname
lookups for any IP address.
[1]: https://github.com/avahi/nss-mdns/tree/master#etcmdnsallow
::: {.note}
Enabling this option will introduce a 5 second delay to failed reverse
hostname lookups. For example, this will often add a 5 second delay to
ping.
:::
'';
};
cacheEntriesMax = lib.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
@@ -287,6 +309,15 @@ in
(lib.mkIf cfg.wideArea "Enabling `services.avahi.wideArea` exposes this system to `CVE-2024-52615`.")
];
assertions = [
{
assertion = cfg.nssmdnsFull -> (cfg.nssmdns4 || cfg.nssmdns6);
message = ''
`services.avahi.nssmdnsFull` requires one or both of `services.avahi.nssmdns4` and/or `services.avahi.nssmdns6` to be enabled.
'';
}
];
users.users.avahi = {
description = "avahi-daemon privilege separation user";
home = "/var/empty";
@@ -312,7 +343,7 @@ in
lib.optionals (cfg.nssmdns4 || cfg.nssmdns6) (
lib.mkMerge [
(lib.mkBefore [ "${mdns}_minimal [NOTFOUND=return]" ]) # before resolve
(lib.mkAfter [ "${mdns}" ]) # after dns
(lib.mkAfter (lib.optional cfg.nssmdnsFull "${mdns}")) # after dns
]
);