grimm-nixos-laptop/hardening/systemd/cups.nix

31 lines
920 B
Nix
Raw Normal View History

2025-01-05 23:03:11 +01:00
{ lib, config, ... }:
{
config.systemd.services = lib.mkIf (config.specialisation != { }) {
cups.serviceConfig = {
2025-01-07 11:31:43 +01:00
CapabilityBoundingSet = [
2025-01-11 11:54:34 +01:00
"CAP_LEASE CAP_MKNOD CAP_SYS_RAWIO CAP_SYS_RESOURCE CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETUID CAP_SETGID CAP_CHOWN"
2025-01-07 11:31:43 +01:00
];
2025-01-05 23:03:11 +01:00
NoNewPrivileges = true;
RestrictNamespaces = "pid";
2025-01-07 11:31:43 +01:00
2025-01-05 23:03:11 +01:00
ProtectControlGroups = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
MemoryDenyWriteExecute = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
2025-01-11 11:54:34 +01:00
SystemCallFilter = "@system-service @privileged";
2025-01-05 23:03:11 +01:00
LockPersonality = true;
2025-01-07 11:31:43 +01:00
RestrictRealtime = true;
ProtectProc = "invisible";
2025-01-11 11:54:34 +01:00
ReadWritePaths = "/var/run/cups";
2025-01-07 11:31:43 +01:00
2025-01-05 23:03:11 +01:00
# PrivateUsers=true;
2025-01-07 11:31:43 +01:00
PrivateNetwork = true;
RestrictAddressFamilies = "AF_UNIX";
2025-01-05 23:03:11 +01:00
# ProtectSystem=true;
};
};
}