progmaweb
The site and account service of Progmasoft: a Next.js frontend and an ASP.NET Core API.
Clonegit clone https://git.progmasoft.com/progmaweb
Harden the systemd units of the API and the web frontend
- Commit
11d91cba681e48afe0fcec6640d07b9100301f86- Author
- Leitwolf11 ·
- Parents
46e526f91e80
Changes
ops/systemd/progmaweb-api.service | 11 +++++++++++ ops/systemd/progmaweb-web.service | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/ops/systemd/progmaweb-api.service b/ops/systemd/progmaweb-api.service index daab684..e2ff8e7 100644 --- a/ops/systemd/progmaweb-api.service +++ b/ops/systemd/progmaweb-api.service @@ -24,13 +24,24 @@ TimeoutStopSec=30s # The API has no writable application files. Its state is in PostgreSQL, reached through the local Unix socket; the # connection string is in the environment file above. +UMask=0077 +AmbientCapabilities= +CapabilityBoundingSet= NoNewPrivileges=true +PrivateDevices=true PrivateTmp=true +ProtectClock=true ProtectHome=true +ProtectHostname=true ProtectSystem=strict +ProtectKernelLogs=true ProtectKernelTunables=true ProtectKernelModules=true ProtectControlGroups=true +RemoveIPC=true +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=true +RestrictRealtime=true RestrictSUIDSGID=true LockPersonality=true # MemoryDenyWriteExecute is intentionally omitted: CoreCLR's JIT requires managed executable mappings at runtime. diff --git a/ops/systemd/progmaweb-web.service b/ops/systemd/progmaweb-web.service index acf4690..47698bd 100644 --- a/ops/systemd/progmaweb-web.service +++ b/ops/systemd/progmaweb-web.service @@ -26,13 +26,24 @@ TimeoutStopSec=30s SuccessExitStatus=143 # Standalone Next.js only reads immutable release files and opens its loopback listener. +UMask=0077 +AmbientCapabilities= +CapabilityBoundingSet= NoNewPrivileges=true +PrivateDevices=true PrivateTmp=true +ProtectClock=true ProtectHome=true +ProtectHostname=true ProtectSystem=strict +ProtectKernelLogs=true ProtectKernelTunables=true ProtectKernelModules=true ProtectControlGroups=true +RemoveIPC=true +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=true +RestrictRealtime=true RestrictSUIDSGID=true LockPersonality=true SystemCallArchitectures=native