portfolio-page/backend/deploy/audit-endpoint.service

46 lines
1.3 KiB
Desktop File

[Unit]
Description=Audit request endpoint for sascha-bach.de
Documentation=https://git.sascha-bach.de/saschabach/portfolio-page
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=auditapi
Group=auditapi
WorkingDirectory=/opt/audit-endpoint/backend
ExecStart=/usr/bin/node server.js
Restart=always
RestartSec=5
# No EnvironmentFile on purpose: server.js already loads .env through dotenv,
# and dotenv handles quoting and special characters in SMTP passwords more
# predictably than systemd's parser.
# --- Hardening -------------------------------------------------------------
# The service needs exactly three things: read its own code, listen on
# loopback, open an outbound SMTP connection. Everything else is denied.
NoNewPrivileges=true
PrivateTmp=true
PrivateDevices=true
ProtectSystem=strict
ProtectHome=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
ProtectHostname=true
ProtectClock=true
RestrictAddressFamilies=AF_INET AF_INET6
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
LockPersonality=true
SystemCallArchitectures=native
# Node's JIT needs writable+executable memory, so this one stays off.
# Setting it to true makes V8 fail to start.
MemoryDenyWriteExecute=false
[Install]
WantedBy=multi-user.target