Run as non-root-user
continuous-integration/drone/push Build is passing Details

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

@ -53,4 +53,6 @@ nfpms:
- src: config.yml
dst: /etc/http-server-status/config.yml.sample
scripts:
postinstall: "scripts/postinstall.sh"
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