summarylogtreecommitdiffstats
path: root/caddy-api.service
diff options
context:
space:
mode:
authorAlice Gaudon2020-07-02 15:53:16 +0200
committerAlice Gaudon2020-07-02 16:01:57 +0200
commit9401e800408cde5d4fb4d8a866dd604463c5a2ac (patch)
tree48cc13c9596fdf0370f608d9d499bf1a7f3e8d05 /caddy-api.service
parentd6a801c8ca2282b118d4f66c4b301f091349b982 (diff)
downloadaur-9401e800408cde5d4fb4d8a866dd604463c5a2ac.tar.gz
Remove caddy2.install and base the rest of the package on official current `next` branch
Diffstat (limited to 'caddy-api.service')
-rw-r--r--caddy-api.service52
1 files changed, 52 insertions, 0 deletions
diff --git a/caddy-api.service b/caddy-api.service
new file mode 100644
index 000000000000..53e1e22a3cac
--- /dev/null
+++ b/caddy-api.service
@@ -0,0 +1,52 @@
+# caddy-api.service
+#
+# For using Caddy with its API.
+#
+# This unit is "durable" in that it will automatically resume
+# the last active configuration if the service is restarted.
+#
+# See https://caddyserver.com/docs/install for instructions.
+
+[Unit]
+Description=Caddy API Server
+Documentation=https://caddyserver.com/docs/
+After=network-online.target
+Wants=network-online.target systemd-networkd-wait-online.service
+StartLimitIntervalSec=14400
+StartLimitBurst=10
+
+[Service]
+User=caddy
+Group=caddy
+Environment=XDG_DATA_HOME=/var/lib
+Environment=XDG_CONFIG_HOME=/var/lib
+ExecStart=/usr/bin/caddy run --environ --resume
+
+# Do not allow the process to be restarted in a tight loop. If the
+# process fails to start, something critical needs to be fixed.
+Restart=on-abnormal
+
+# Use graceful shutdown with a reasonable timeout
+KillMode=mixed
+KillSignal=SIGQUIT
+TimeoutStopSec=5s
+
+LimitNOFILE=1048576
+LimitNPROC=512
+
+# Hardening options
+PrivateTmp=true
+PrivateDevices=true
+ProtectHome=true
+ProtectSystem=strict
+ReadWritePaths=/var/lib/caddy /var/log/caddy
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+AmbientCapabilities=CAP_NET_BIND_SERVICE
+NoNewPrivileges=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectControlGroups=true
+LockPersonality=true
+
+[Install]
+WantedBy=multi-user.target \ No newline at end of file