Run as non-root-user
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kekskurse 2021-11-29 06:12:26 +01:00
parent 554593a045
commit 1ec4407008
Signed by: kekskurse
GPG key ID: 728ACCB59341E7E4
5 changed files with 10 additions and 3 deletions

View file

@ -54,3 +54,5 @@ nfpms:
dst: /etc/http-server-status/config.yml.sample
scripts:
postinstall: "scripts/postinstall.sh"
preinstall: "scripts/preinstall.sh"
postremove: "scripts/postremove.sh"

View file

@ -4,7 +4,7 @@ After=syslog.target
[Service]
Type=simple
User=root
User=http-server-status
ExecStart=/usr/local/bin/http-server-status
SyslogIdentifier=http-server-status
StandardOutput=syslog

View file

@ -1,2 +1,2 @@
systemctl daemon-reload
systemctl restart http-server-status
systemctl is-active --quiet http-server-status && systemctl restart http-server-status && echo "Restart Service"

1
scripts/postremove.sh Normal file
View file

@ -0,0 +1 @@
deluser --remove-home http-server-status

4
scripts/preinstall.sh Normal file
View file

@ -0,0 +1,4 @@
#/bin/sh
if ! id -u http-server-status > /dev/null 2>&1; then
adduser --system http-server-status
fi