net/nut: Fix '/var/run' world readable warning

Use /var/run/nut as statepath and set appropriate owner
and permissions on /var/run/nut in order to avoid pidfile
for nut being world-readable.

Signed-off-by: Daniel Dickinson <lede@cshore.thecshore.com>
This commit is contained in:
Daniel Dickinson
2017-01-11 18:54:51 -05:00
parent c94e334c4e
commit c00d89593e
3 changed files with 17 additions and 5 deletions

View File

@@ -143,9 +143,6 @@ nut_upsmon_add() {
}
start_service() {
[ -d $RUN_D ] || mkdir -p $RUN_D
mkdir -p /var/etc/nut
chmod 640 /var/etc/nut
rm -f $UPSMON_C
config_load nut_monitor
@@ -159,6 +156,11 @@ start_service() {
chmod 640 $UPSMON_C
chmod 640 /var/etc/nut/nut.conf
[ -d /var/run/nut ] || {
mkdir -m 0750 -p /var/run/nut
chown ${runas:-root}:$(id -gn ${runas:-root}) /var/run/nut
}
chown ${runas:-root}:$(id -gn ${runas:-root}) $UPSMON_C
$DEBUG /usr/sbin/upsmon $UPSMON_OPTIONS
}