nixos/unit: update sandboxing mode

This commit is contained in:
Izorkin 2020-04-14 16:07:30 +03:00
parent 91a7f33b64
commit 3eb6012b64

View File

@ -113,23 +113,30 @@ in {
Group = cfg.group; Group = cfg.group;
# Capabilities # Capabilities
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" "CAP_SETGID" "CAP_SETUID" ]; AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" "CAP_SETGID" "CAP_SETUID" ];
# Runtime directory and mode
RuntimeDirectory = "unit";
RuntimeDirectoryMode = "0750";
# Access write directories
ReadWritePaths = [ cfg.stateDir cfg.logDir ];
# Security # Security
NoNewPrivileges = true; NoNewPrivileges = true;
# Sandboxing # Sandboxing
ProtectSystem = "full"; ProtectSystem = "strict";
ProtectHome = true; ProtectHome = true;
RuntimeDirectory = "unit";
RuntimeDirectoryMode = "0750";
PrivateTmp = true; PrivateTmp = true;
PrivateDevices = true; PrivateDevices = true;
ProtectHostname = true; ProtectHostname = true;
ProtectKernelTunables = true; ProtectKernelTunables = true;
ProtectKernelModules = true; ProtectKernelModules = true;
ProtectControlGroups = true; ProtectControlGroups = true;
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
LockPersonality = true; LockPersonality = true;
MemoryDenyWriteExecute = true; MemoryDenyWriteExecute = true;
RestrictRealtime = true; RestrictRealtime = true;
RestrictSUIDSGID = true;
PrivateMounts = true; PrivateMounts = true;
# System Call Filtering
SystemCallArchitectures = "native";
}; };
}; };