diff --git a/nixos/doc/manual/release-notes/rl-2611.section.md b/nixos/doc/manual/release-notes/rl-2611.section.md index b0df63100530..8d0cd236e6c0 100644 --- a/nixos/doc/manual/release-notes/rl-2611.section.md +++ b/nixos/doc/manual/release-notes/rl-2611.section.md @@ -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;`. diff --git a/nixos/modules/services/networking/avahi-daemon.nix b/nixos/modules/services/networking/avahi-daemon.nix index 6ff86daf6a9e..2e61b39835a2 100644 --- a/nixos/modules/services/networking/avahi-daemon.nix +++ b/nixos/modules/services/networking/avahi-daemon.nix @@ -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 ] );