aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2023-02-09 16:03:07 +0000
committerCy Schubert <cy@FreeBSD.org>2023-02-10 18:26:33 +0000
commita4cc1509a9b65367f76bbdf6b684035d0c3bfbc3 (patch)
treeed2826e95cf6e0b34d891af7d257b65eb71b6563
parent65305c65424f26601292162f9d021cf0c4826952 (diff)
downloadports-a4cc1509a9b65367f76bbdf6b684035d0c3bfbc3.tar.gz
ports-a4cc1509a9b65367f76bbdf6b684035d0c3bfbc3.zip
sysutils/nut*: Fix nut file access
Preexisting nut files will have uucp group permissions, which will no longer be available to nut because it runs under its own GID. For the time being add code to nut_prestart() adjusting the ownership of the files to UID nut and GID nut. This code should be removed approximately a year from now as it is expected that most if not all nut installations will have correct file ownership by then. While here, also fix nut.newsyslog to refer to the new nut UID/GID. Reported by: avg, Mathieu <sigsys@gmail.com> Fixes: 02c038c8cc15
-rw-r--r--sysutils/nut-devel/Makefile2
-rw-r--r--sysutils/nut-devel/files/nut.in11
-rw-r--r--sysutils/nut-devel/files/nut.newsyslog2
-rw-r--r--sysutils/nut/Makefile2
-rw-r--r--sysutils/nut/files/nut.in11
-rw-r--r--sysutils/nut/files/nut.newsyslog2
6 files changed, 26 insertions, 4 deletions
diff --git a/sysutils/nut-devel/Makefile b/sysutils/nut-devel/Makefile
index 1f94319584fe..bff162740c92 100644
--- a/sysutils/nut-devel/Makefile
+++ b/sysutils/nut-devel/Makefile
@@ -1,6 +1,6 @@
PORTNAME= nut
PORTVERSION= ${NUT_COMMIT_DATE}
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
PKGNAMESUFFIX= -devel
# MASTER_SITES= http://www.networkupstools.org/source/${PORTVERSION:R}/
diff --git a/sysutils/nut-devel/files/nut.in b/sysutils/nut-devel/files/nut.in
index 0e4cb9e8a618..ae9ee30f03f5 100644
--- a/sysutils/nut-devel/files/nut.in
+++ b/sysutils/nut-devel/files/nut.in
@@ -32,6 +32,17 @@ start_precmd="nut_prestart"
stop_postcmd="nut_poststop"
nut_prestart() {
+ #
+ # As of PR/268960 UID/GID uucp is no longer used by nut.
+ # Instead UID/GID nut is used. Make sure preexisting nut files
+ # and directories are owned by nut instead of uucp.
+ #
+ if [ -f ${nut_prefix}/etc/nut/upsd.users ]; then
+ chgrp %%NUT_GROUP%% ${nut_prefix}/etc/nut/upsd.users
+ fi
+ find %%STATEDIR%% -user uucp -exec chown nut {} \;
+ find %%STATEDIR%% -group uucp -exec chgrp nut {} \;
+
${nut_prefix}/sbin/upsdrvctl start
}
diff --git a/sysutils/nut-devel/files/nut.newsyslog b/sysutils/nut-devel/files/nut.newsyslog
index fc50b6c1be32..4a3a4350cee5 100644
--- a/sysutils/nut-devel/files/nut.newsyslog
+++ b/sysutils/nut-devel/files/nut.newsyslog
@@ -3,5 +3,5 @@
# see newsyslog.conf(5) for details
#
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
-/var/log/nut/upsd.log uucp:uucp 644 7 100 * J /var/db/nut/upslog.pid
+/var/log/nut/upsd.log nut:nut 644 7 100 * J /var/db/nut/upslog.pid
diff --git a/sysutils/nut/Makefile b/sysutils/nut/Makefile
index 81b4ebea94a9..3635e4d550fd 100644
--- a/sysutils/nut/Makefile
+++ b/sysutils/nut/Makefile
@@ -1,6 +1,6 @@
PORTNAME= nut
PORTVERSION= 2.8.0
-PORTREVISION= 16
+PORTREVISION= 17
CATEGORIES= sysutils
MASTER_SITES= http://www.networkupstools.org/source/${PORTVERSION:R}/
diff --git a/sysutils/nut/files/nut.in b/sysutils/nut/files/nut.in
index 0e4cb9e8a618..ae9ee30f03f5 100644
--- a/sysutils/nut/files/nut.in
+++ b/sysutils/nut/files/nut.in
@@ -32,6 +32,17 @@ start_precmd="nut_prestart"
stop_postcmd="nut_poststop"
nut_prestart() {
+ #
+ # As of PR/268960 UID/GID uucp is no longer used by nut.
+ # Instead UID/GID nut is used. Make sure preexisting nut files
+ # and directories are owned by nut instead of uucp.
+ #
+ if [ -f ${nut_prefix}/etc/nut/upsd.users ]; then
+ chgrp %%NUT_GROUP%% ${nut_prefix}/etc/nut/upsd.users
+ fi
+ find %%STATEDIR%% -user uucp -exec chown nut {} \;
+ find %%STATEDIR%% -group uucp -exec chgrp nut {} \;
+
${nut_prefix}/sbin/upsdrvctl start
}
diff --git a/sysutils/nut/files/nut.newsyslog b/sysutils/nut/files/nut.newsyslog
index fc50b6c1be32..4a3a4350cee5 100644
--- a/sysutils/nut/files/nut.newsyslog
+++ b/sysutils/nut/files/nut.newsyslog
@@ -3,5 +3,5 @@
# see newsyslog.conf(5) for details
#
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
-/var/log/nut/upsd.log uucp:uucp 644 7 100 * J /var/db/nut/upslog.pid
+/var/log/nut/upsd.log nut:nut 644 7 100 * J /var/db/nut/upslog.pid