blockbook/build/templates/backend/debian/service
2018-07-26 12:49:57 +02:00

47 lines
1.0 KiB
Plaintext

{{define "main" -}}
[Unit]
Description={{.Coin.Name}} backend daemon
After=network.target
[Service]
ExecStart={{template "Backend.ExecCommandTemplate" .}}
User={{.Backend.SystemUser}}
Restart=on-failure
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}}
# 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}}