Harden Systemd configuration

This commit is contained in:
Alexandre Iooss 2022-03-20 09:43:58 +01:00
parent f0a6bdc21b
commit caf291b8a5
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
1 changed files with 22 additions and 0 deletions

View File

@ -11,5 +11,27 @@ Environment=PORT=8080
EnvironmentFile=-/etc/libreddit.conf
ExecStart=/usr/bin/libreddit -a ${ADDRESS} -p ${PORT}
# Hardening
DeviceAllow=
LockPersonality=yes
MemoryDenyWriteExecute=yes
PrivateDevices=yes
ProcSubset=pid
ProtectClock=yes
ProtectControlGroups=yes
ProtectHome=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectProc=invisible
RestrictAddressFamilies=AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service ~@privileged ~@resources
UMask=0077
[Install]
WantedBy=default.target