Created attachment 240092 [details] add NUT_GROUP=${NUT_GROUP} to SUB_LIST At present, the rc.d script contains this: [knew dan ~] % grep GROUP /usr/local/etc/rc.d/nut chgrp %%NUT_GROUP%% ${nut_prefix}/etc/nut/upsd.users The attache patch fixes the issue by adding NUT_GROUP=${NUT_GROUP} to SUB_LIST
I'm happy to commit this if you prefer.
Oops. Fixed.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=6b4b52c843c34374e12b0b894129549caf22b276 commit 6b4b52c843c34374e12b0b894129549caf22b276 Author: Cy Schubert <cy@FreeBSD.org> AuthorDate: 2023-02-11 16:13:05 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2023-02-11 16:15:46 +0000 sysutils/nut*: Add missing SUB_LIST a4cc1509a9b6 failed to add NUT_GROUP to SUB_LIST. This fixes the error. PR: 269497 Submitted by: dvl Reported by: dvl Fixes: a4cc1509a9b6 sysutils/nut-devel/Makefile | 4 ++-- sysutils/nut/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
FYI, I have since seen this this: Feb 11 15:27:34 knew upssched[16604]: Can't open /usr/local/etc/nut/upssched.conf: Permission denied Feb 11 15:32:39 knew upssched[18217]: Can't open /usr/local/etc/nut/upssched.conf: Permission denied Feb 11 15:37:39 knew upssched[19798]: Can't open /usr/local/etc/nut/upssched.conf: Permission denied % ls -l /usr/local/etc/nut/upssched.conf -rw-r----- 1 root uucp 417 2022.07.01 14:11 /usr/local/etc/nut/upssched.conf On a host upon which I had already done this: sudo chgrp nut /usr/local/etc/nut/ups.conf sudo chown nut:nut /usr/local/etc/nut/heartbeat.dev What uucp files do I have? [knew dan /usr/local/etc] % sudo find /usr/local -gid uucp /usr/local/etc/nut/upsd.conf /usr/local/etc/nut/upssched.conf /usr/local/etc/nut/nut.conf /usr/local/etc/nut/pushover.sh /usr/local/etc/nut/upsmon.conf [knew dan /usr/local/etc] % ls -l /usr/local/etc/nut | grep uucp -rw-r----- 1 root uucp 90 2020.09.05 19:27 nut.conf -rwxr-x--- 1 dan uucp 492 2022.07.01 14:23 pushover.sh -rw-r----- 1 root uucp 81 2023.01.03 15:26 upsd.conf -rw-r----- 1 root uucp 235 2020.09.12 14:48 upsmon.conf -rw-r----- 1 root uucp 417 2022.07.01 14:11 upssched.conf Repaired with: % sudo find /usr/local/etc/nut -gid uucp -exec chgrp nut {} \;
Created attachment 240103 [details] Seek out and chown/chgrp other nut files hiding in the cracks (In reply to Dan Langille from comment #4) Interesting. Mine is: cwfw# lh /usr/local/etc/nut/upssched.conf -rw-r--r-- 1 root wheel 4.1K Feb 11 18:43 /usr/local/etc/nut/upssched.conf cwfw# Likely because mine has not been altered while yours has. Attached is a more thorough patch. I'm kinda loathed to do a find here but considering the impact it's the only solution. The find should be removed a year or two from now -- what are your thoughts about this?
Created attachment 240109 [details] builds upon your patch This patch: * replaces nut with %%NUT_USER|GROUP%% in nut.newsyslog, now renamed to nut.newsyslog.in * more use of %%NUT_USER%% and %%NUT_GROUP%% in nut.in I had a more elaborate reply before I lost it and retyped this one. I had thought about an IF around the chmod/chown stuff in case the user wanted to turn it off. Something like nut_file_fixup=${nut_file_fixup:-"YES"} if [ ${nut_file_fixup} == "YES" ] then find ${nut_prefix}/etc/nut -user uucp -exec chown %%NUT_USER%% {} \; find ${nut_prefix}/etc/nut -group uucp -exec chgrp %%NUT_GROUP%% {} \; find %%STATEDIR%% -user uucp -exec chown nut {} \; find %%STATEDIR%% -group uucp -exec chgrp nut {} \; fi etc. I figure: fixing the file perms is the lesser evil of doing nothing.
(In reply to Dan Langille from comment #6) I already committed the patch. I'm not so sure about the if. I think this would confuse more users: more PRs and private emails asking questions about it. OTOH the "if" would save on cycles. I like that. But, how many people, other than you and me, would use it? Maybe an UPDATING entry to document it?
The "if", for me, wasn't to save cycles. It was to allow for users which have non-standard permissions on those files, for whatever reasons. I think an UPDATING entry is enough.
Created attachment 240132 [details] Patch to implement optional ownership fixes. Can you please review and comment?
Comment on attachment 240132 [details] Patch to implement optional ownership fixes. I see %%NUT_GROUP%% is use but not %%NUT_USER%%. Tomorrow I can amend that patch, but not tonight.
Created attachment 240143 [details] Fixed the last couple of errors This squashed commit should address all issues discussed here.
Comment on attachment 240143 [details] Fixed the last couple of errors Looks fine to me.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=6558c25069901328610d155bea362aeb7ab00f17 commit 6558c25069901328610d155bea362aeb7ab00f17 Author: Cy Schubert <cy@FreeBSD.org> AuthorDate: 2023-02-13 18:57:30 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2023-02-14 18:40:00 +0000 sysutils/nut*: Make nut file ownership fixes optional with default enabled The nut file ownership fixups due to the UID/GID change from uucp/uucp to nut/nut may not be desireable for all users. Some users with custom file ownership may wish ownership to remain untouched. This revision to the nut family of ports/packages allows users to optionally disable automatic fixup of nut file ownership. While at it, rather than use a hardcoded string for user/group ownerships, use the set parameters in Makefile. PR: 269497 suggested by: dvl UPDATING | 10 ++++++++++ sysutils/nut-devel/Makefile | 4 ++-- sysutils/nut-devel/files/nut.in | 11 +++++++---- sysutils/nut/Makefile | 4 ++-- sysutils/nut/files/nut.in | 11 +++++++---- 5 files changed, 28 insertions(+), 12 deletions(-)
Missed "; then" in line with "if" in sysutils/nut/files/nut.in: if [ "${nut_file_fixup}" == "YES" ] <== HERE find ${nut_prefix}/etc/nut -user uucp -exec chown nut {} \; find ${nut_prefix}/etc/nut -group uucp -exec chgrp nut {} \; find /var/db/nut -user uucp -exec chown nut {} \; find /var/db/nut -group uucp -exec chgrp nut {} \; fi
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=e2630f644fcb41ca2f9cba64a2e4416043b59fda commit e2630f644fcb41ca2f9cba64a2e4416043b59fda Author: Cy Schubert <cy@FreeBSD.org> AuthorDate: 2023-02-14 20:33:59 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2023-02-14 20:33:59 +0000 sysutils/nut*: Fix syntax error Add missing then. PR: 269497 Reported by: <vvd@unislabs.com> Fixes: 6558c2506990 sysutils/nut-devel/Makefile | 2 +- sysutils/nut-devel/files/nut.in | 2 +- sysutils/nut/Makefile | 2 +- sysutils/nut/files/nut.in | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
(In reply to VVD from comment #14) Thanks. That's the second time today (in 30 minutes). Once at $JOB and another here.
Fixed.