Merge pull request #78134 from NinjaTrappeur/nin-harden-syncthing

nixos/syncthing.nix: Sandbox the systemd service.

Changed files
+18
nixos
modules
services
networking
+18
nixos/modules/services/networking/syncthing.nix
···
-gui-address=${cfg.guiAddress} \
-home=${cfg.configDir}
'';
+
MemoryDenyWriteExecute = true;
+
NoNewPrivileges = true;
+
PrivateDevices = true;
+
PrivateMounts = true;
+
PrivateTmp = true;
+
PrivateUsers = true;
+
ProtectControlGroups = true;
+
ProtectHostname = true;
+
ProtectKernelModules = true;
+
ProtectKernelTunables = true;
+
RestrictNamespaces = true;
+
RestrictRealtime = true;
+
RestrictSUIDSGID = true;
+
CapabilityBoundingSet = [
+
"~CAP_SYS_PTRACE" "~CAP_SYS_ADMIN"
+
"~CAP_SETGID" "~CAP_SETUID" "~CAP_SETPCAP"
+
"~CAP_SYS_TIME" "~CAP_KILL"
+
];
};
};
syncthing-init = mkIf (