blockbook/build/templates/backend/debian/service
2018-09-06 11:45:13 +02:00

49 lines
1.1 KiB
Plaintext

{{define "main" -}}
[Unit]
Description={{.Coin.Name}} backend daemon
After=network.target
[Service]
ExecStart={{template "Backend.ExecCommandTemplate" .}}
User={{.Backend.SystemUser}}
Restart=on-failure
TimeoutStopSec=300
WorkingDirectory={{.Env.BackendInstallPath}}/{{.Coin.Alias}}
{{if eq .Backend.ServiceType "forking" -}}
Type=forking
RuntimeDirectory={{.Coin.Alias}}
PIDFile=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid
{{else -}}
Type=simple
{{end}}
{{template "Backend.ServiceAdditionalParamsTemplate" .}}
# Resource limits
LimitNOFILE=500000
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
{{if .Backend.ProtectMemory -}}
# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true
{{end}}
[Install]
WantedBy=multi-user.target
{{end}}