Created
October 22, 2017 13:56
-
-
Save lucaswerkmeister/3cbf22bdca584d60a976702c30b1268f to your computer and use it in GitHub Desktop.
systemd sandbox for apache2.service on Debian Stretch (systemd v232)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Service] | |
# read /var/lib/dehydrated/ | |
CapabilityBoundingSet=CAP_DAC_OVERRIDE | |
# bind port 80 + 443 | |
CapabilityBoundingSet=CAP_NET_BIND_SERVICE | |
# drop privileges to www-data | |
CapabilityBoundingSet=CAP_SETUID CAP_SETGID | |
# call ulimit | |
CapabilityBoundingSet=CAP_SYS_RESOURCE | |
# partially mitigate CAP_DAC_OVERRIDE | |
InaccessiblePaths=/etc/ssh /etc/opendkim /etc/shadow /etc/gshadow /var/lib/sudo /var/lib/tor | |
# create lock files | |
ReadWritePaths=/var/lock/apache2 | |
# logging (TODO use LogsDirectory in systemd v235+) | |
ReadWritePaths=/var/log/apache2 | |
# bind on IPv4 and IPv6 addresses | |
RestrictAddressFamilies=AF_INET AF_INET6 | |
# use UNIX domain sockets (e. g. for fastcgi to gitweb) | |
RestrictAddressFamilies=AF_UNIX | |
# PID file (RuntimeDirectory implies ReadWritePaths) | |
RuntimeDirectory=apache2 | |
MemoryDenyWriteExecute=yes | |
NoNewPrivileges=yes | |
PrivateDevices=yes | |
ProtectControlGroups=yes | |
ProtectHome=yes | |
ProtectKernelModules=yes | |
ProtectKernelTunables=yes | |
ProtectSystem=strict | |
RestrictRealtime=yes | |
SystemCallArchitectures=native |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment