mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
The supplied systemd unit file places some basic security restrictions on the rest service. This patch enhances those, and improves the overall security assessment score given by `systemd-analyze security` from "8.3 EXPOSED" to "1.3 OK". Closes #148
45 lines
989 B
Desktop File
45 lines
989 B
Desktop File
[Unit]
|
|
Description=Rest Server
|
|
After=syslog.target
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=www-data
|
|
Group=www-data
|
|
ExecStart=/usr/local/bin/rest-server --path /path/to/backups
|
|
Restart=always
|
|
RestartSec=5
|
|
# Makes created files group-readable, but inaccessible by others
|
|
UMask=027
|
|
|
|
# Recommended security enhancements using features present in systemd version 247
|
|
CapabilityBoundingSet=
|
|
LockPersonality=true
|
|
MemoryDenyWriteExecute=true
|
|
NoNewPrivileges=yes
|
|
PrivateTmp=yes
|
|
PrivateDevices=true
|
|
PrivateUsers=true
|
|
ProtectSystem=strict
|
|
ProtectHome=yes
|
|
ProtectClock=true
|
|
ProtectControlGroups=true
|
|
ProtectKernelLogs=true
|
|
ProtectKernelModules=true
|
|
ProtectKernelTunables=true
|
|
ProtectProc=invisible
|
|
ProtectHostname=true
|
|
ProcSubset=pid
|
|
ReadWritePaths=/path/to/backups
|
|
RemoveIPC=true
|
|
RestrictNamespaces=true
|
|
RestrictAddressFamilies=AF_INET AF_INET6
|
|
RestrictSUIDSGID=true
|
|
RestrictRealtime=true
|
|
SystemCallArchitectures=native
|
|
SystemCallFilter=@system-service
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|