From cf446c7c47ee6603cd473dbb99343481c4b5d596 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Mon, 27 Aug 2018 16:16:12 -0400 Subject: [PATCH] nut: Use diff non-privileged user for upsmon By default use a non-privileged user that is different than the server or driver (when they are running non-privileged). This is recommended by upstream. Signed-off-by: Daniel F. Dickinson --- net/nut/Makefile | 2 +- net/nut/files/nut-monitor.init | 6 ++++-- net/nut/files/nut_monitor | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/net/nut/Makefile b/net/nut/Makefile index a07921686..d139c9357 100644 --- a/net/nut/Makefile +++ b/net/nut/Makefile @@ -145,7 +145,7 @@ define Package/nut-upsmon $(call Package/nut/Default) TITLE+= (monitor) DEPENDS:=nut +nut-common - USERID:=nut=113:nut=113 + USERID:=nutmon=114:nutmon=114 endef define Package/nut-upsmon/description diff --git a/net/nut/files/nut-monitor.init b/net/nut/files/nut-monitor.init index c406746f5..9505408d9 100755 --- a/net/nut/files/nut-monitor.init +++ b/net/nut/files/nut-monitor.init @@ -6,11 +6,13 @@ UPSMON_C=/var/etc/nut/upsmon.conf nut_upsmon_conf() { local cfg="$1" + local RUNAS val optval echo "# Config file automatically generated from UCI config" > $UPSMON_C - config_get runas "$cfg" runas "nut" - [ -n "$runas" ] && echo "RUN_AS_USER $runas" >> $UPSMON_C + config_get RUNAS "$cfg" runas "nutmon" + [ -n "$RUNAS" ] && echo "RUN_AS_USER $RUNAS" >> "$UPSMON_C" + runas=$RUNAS config_get val "$cfg" minsupplies 1 echo "MINSUPPLIES $val" >> $UPSMON_C diff --git a/net/nut/files/nut_monitor b/net/nut/files/nut_monitor index 7dd55ff13..7b74bc31f 100644 --- a/net/nut/files/nut_monitor +++ b/net/nut/files/nut_monitor @@ -1,5 +1,5 @@ #config upsmon 'upsmon' -# option runas run-as-user +# option runas nutmon # option minsupplies 1 # option shutdowncmd '/usr/sbin/nutshutdown' # option notifycmd /path/to/cmd