nixos/stargazer: harden systemd service
This commit is contained in:
@@ -225,6 +225,44 @@ in
|
||||
"CAP_SETGID"
|
||||
"CAP_SETUID"
|
||||
];
|
||||
|
||||
# Hardening
|
||||
UMask = "0077";
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
ProtectSystem = "full";
|
||||
ProtectClock = true;
|
||||
ProtectHostname = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectProc = "invisible";
|
||||
PrivateDevices = true;
|
||||
NoNewPrivileges = true;
|
||||
RestrictSUIDSGID = true;
|
||||
PrivateMounts = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
LockPersonality = true;
|
||||
RestrictRealtime = true;
|
||||
RemoveIPC = true;
|
||||
CapabilityBoundingSet = [
|
||||
"~CAP_SYS_PTRACE"
|
||||
"~CAP_SYS_ADMIN"
|
||||
"~CAP_SETPCAP"
|
||||
"~CAP_SYS_TIME"
|
||||
"~CAP_SYS_PACCT"
|
||||
"~CAP_SYS_TTY_CONFIG "
|
||||
"~CAP_SYS_CHROOT"
|
||||
"~CAP_SYS_BOOT"
|
||||
"~CAP_NET_ADMIN"
|
||||
] ++ lib.lists.optional (!cfg.allowCgiUser) [
|
||||
"~CAP_SETGID"
|
||||
"~CAP_SETUID"
|
||||
];
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = [ "~@cpu-emulation @debug @keyring @mount @obsolete" ]
|
||||
++ lib.lists.optional (!cfg.allowCgiUser) [ "@privileged @setuid" ];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user