nixos/calibre-web: harden service

This commit is contained in:
Aaron Kaiser
2026-02-25 13:15:56 +01:00
parent 93820326d2
commit 048661b0be
2 changed files with 41 additions and 0 deletions
@@ -181,6 +181,8 @@ See <https://github.com/NixOS/nixpkgs/issues/481673>.
- `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
@@ -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;