nixos/scrutiny: harden systemd service (#490630)

This commit is contained in:
Sandro
2026-04-26 20:11:16 +00:00
committed by GitHub
@@ -236,6 +236,44 @@ in
RuntimeDirectoryMode = "0700";
StateDirectory = "scrutiny";
StateDirectoryMode = "0750";
RemoveIPC = true;
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
MemoryDenyWriteExecute = true;
SystemCallFilter = [
"@system-service"
"~@privileged"
"~@resources"
];
SystemCallArchitectures = "native";
LockPersonality = true;
CapabilityBoundingSet = "";
NoNewPrivileges = true;
PrivateTmp = true;
PrivateMounts = true;
PrivateDevices = true;
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectSystem = "strict";
ProtectProc = "invisible";
ProcSubset = "pid";
RestrictAddressFamilies = [
"AF_NETLINK"
"AF_INET"
"AF_INET6"
"AF_UNIX"
];
SocketBindDeny = "any";
SocketBindAllow = [
"tcp:${toString cfg.settings.web.listen.port}"
];
};
};
})