diff --git a/nixos/doc/manual/release-notes/rl-2605.section.md b/nixos/doc/manual/release-notes/rl-2605.section.md index 040de458b015..a080c27de73b 100644 --- a/nixos/doc/manual/release-notes/rl-2605.section.md +++ b/nixos/doc/manual/release-notes/rl-2605.section.md @@ -181,6 +181,8 @@ See . - `services.slurm` now supports slurmrestd usage through the `services.slurm.rest` NixOS options. +- The `services.calibre-web` systemd service has been hardened with additional sandboxing restrictions. + - `services.kanidm` options for server, client and unix were moved under dedicated namespaces. For each component `enableComponent` and `componentSettings` are now `component.enable` and `component.settings`. The unix module now supports using SSH keys from Kanidm via diff --git a/nixos/modules/services/web-apps/calibre-web.nix b/nixos/modules/services/web-apps/calibre-web.nix index c28c9b456b4a..c452f25b7984 100644 --- a/nixos/modules/services/web-apps/calibre-web.nix +++ b/nixos/modules/services/web-apps/calibre-web.nix @@ -184,6 +184,45 @@ in CacheDirectory = "calibre-web"; CacheDirectoryMode = "0750"; + + NoNewPrivileges = true; + ProtectSystem = "strict"; + PrivateTmp = true; + PrivateDevices = true; + PrivateIPC = true; + ProtectHostname = true; + ProtectClock = true; + ProtectKernelTunables = true; + ProtectKernelLogs = true; + ProtectControlGroups = true; + LockPersonality = true; + MemoryDenyWriteExecute = true; + RestrictSUIDSGID = true; + ProtectHome = true; + ProtectProc = "invisible"; + ProcSubset = "pid"; + RestrictRealtime = true; + SystemCallArchitectures = "native"; + RestrictNamespaces = true; + RemoveIPC = true; + CapabilityBoundingSet = ""; + AmbientCapabilities = ""; + ProtectKernelModules = true; + RestrictAddressFamilies = [ + "AF_INET" + "AF_INET6" + "AF_UNIX" + "AF_NETLINK" + ]; + SystemCallFilter = [ + "~@obsolete" + "~@privileged" + "~@raw-io" + "~@resources" + "~@mount" + "~@debug" + "~@cpu-emulation" + ]; } // lib.optionalAttrs (!(lib.hasPrefix "/" cfg.dataDir)) { StateDirectory = cfg.dataDir;