From fc9e22fca12e71f5a43ab616aa0e669392174e12 Mon Sep 17 00:00:00 2001 From: oaksoaj Date: Sat, 2 Jul 2022 18:20:27 +0200 Subject: [PATCH] yggdrasil: add group option back and remove systemd User= directive The group configuration parameter allow to share access to yggdrasil control socket with the users in the system. In the version we propose, it is null by default so that only root can access the control socket, but let user create their own group if they need. Remove User= durective in systemd unit. Should a user with the specified name already exist in the system, it would be used silently instead of a dynamic user which could be a security concern. --- nixos/modules/services/networking/yggdrasil.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/yggdrasil.nix b/nixos/modules/services/networking/yggdrasil.nix index 8e88064a9071..ae681988ea11 100644 --- a/nixos/modules/services/networking/yggdrasil.nix +++ b/nixos/modules/services/networking/yggdrasil.nix @@ -60,6 +60,13 @@ in { ''; }; + group = mkOption { + type = types.nullOr types.str; + default = null; + example = "wheel"; + description = "Group to grant access to the Yggdrasil control socket. If null, only root can access the socket."; + }; + openMulticastPort = mkOption { type = bool; default = false; @@ -147,7 +154,6 @@ in { ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; Restart = "always"; - User = "yggdrasil"; DynamicUser = true; StateDirectory = "yggdrasil"; RuntimeDirectory = "yggdrasil"; @@ -168,7 +174,9 @@ in { RestrictRealtime = true; SystemCallArchitectures = "native"; SystemCallFilter = "~@clock @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io @resources"; - }; + } // (if (cfg.group != null) then { + Group = cfg.group; + } else {}); }; networking.dhcpcd.denyInterfaces = cfg.denyDhcpcdInterfaces;