server-config/systemd_units/caddy.service
Harsh Shandilya daec82e7ee
systemd/caddy: Allow access to AF_UNIX namespace
caddy connects to php-fpm through a unix socket and thus needs access to it aside from IPv4 and IPv6

http://man7.org/linux/man-pages/man2/socket.2.html
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
2020-01-09 09:55:45 +05:30

38 lines
1,019 B
Desktop File

[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
[Service]
Restart=on-abnormal
User=caddy
Group=caddy
Environment=CADDYPATH=/etc/ssl/caddy
ExecStart=/usr/local/bin/caddy -log stdout -agree=true -email msfjarvis@gmail.com -conf=/etc/caddy/Caddyfile -root=/var/tmp -envfile /etc/caddy/env
ExecReload=/bin/kill -USR1 $MAINPID
KillMode=mixed
KillSignal=SIGQUIT
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
ReadWriteDirectories=/etc/ssl/caddy /etc/logs
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
# Security
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
NoNewPrivileges=true
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=true
PrivateDevices=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=true
RestrictRealtime=true
SystemCallArchitectures=native
[Install]
WantedBy=multi-user.target