nixos/vdirsyncer: only use ProtectHome=yes with DynamicUser=yes

If a user is given it seems likely that their home directory is accessed.

schnusch bc72dc08 cd06d2dd

Changed files
+1 -8
nixos
modules
services
networking
tests
+1 -1
nixos/modules/services/networking/vdirsyncer.nix
···
}
// (optionalAttrs (cfg'.user == null) {
DynamicUser = true;
})
// (optionalAttrs (cfg'.additionalGroups != [ ]) {
SupplementaryGroups = cfg'.additionalGroups;
···
PrivateTmp = true;
NoNewPrivileges = true;
ProtectSystem = "strict";
-
ProtectHome = true;
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectControlGroups = true;
···
}
// (optionalAttrs (cfg'.user == null) {
DynamicUser = true;
+
ProtectHome = true;
})
// (optionalAttrs (cfg'.additionalGroups != [ ]) {
SupplementaryGroups = cfg'.additionalGroups;
···
PrivateTmp = true;
NoNewPrivileges = true;
ProtectSystem = "strict";
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectControlGroups = true;
-7
nixos/tests/vdirsyncer.nix
···
};
};
-
# ProtectHome is the default, but we must access our storage
-
# in ~.
-
systemd.services = {
-
"vdirsyncer@alice".serviceConfig.ProtectHome = lib.mkForce false;
-
"vdirsyncer@bob".serviceConfig.ProtectHome = lib.mkForce false;
-
};
-
users.users = {
alice.isNormalUser = true;
bob.isNormalUser = true;
···
};
};
users.users = {
alice.isNormalUser = true;
bob.isNormalUser = true;