Bug 277704 - net-mgmt/nrpe changes /var/ ownership to nagios when rc.d/nrpe starts
Summary: net-mgmt/nrpe changes /var/ ownership to nagios when rc.d/nrpe starts
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-14 19:54 UTC by Steve Rikli
Modified: 2024-07-28 17:13 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (bofh)


Attachments
Proposed patch (496 bytes, patch)
2024-05-30 08:20 UTC, Oleksandr Kryvulia
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Rikli 2024-03-14 19:54:30 UTC
Installed net-mgmt/nrpe 4.1.0 pkg. Using /usr/local/etc/nrpe.cfg.sample as a template for the running nrpe.cfg gives this pidfile setting:

pid_file=/var/nrpe.pid

With the included rc.d/nrpe startup script this results in /var/ directory getting chown'd to the nagios user.

Presumably it happens due to this command in rc.d/nrpe nrpe_prestart()

        install -d -o ${nrpe_user:-nagios} ${pidfile%/*}

Which results in:

$ ls -lad /var
drwxr-xr-x  26 nagios wheel 1024 Mar 14 11:39 var
$ ls -la /var/nrpe.pid 
-rw-r--r--  1 root wheel 5 Mar 14 11:39 /var/nrpe.pid

The /var/ ownership change seems bad, and the pidfile location may not be optimal. A couple ideas for a fix:

1) comment-out pid_file from nrpe.cfg and let rc.d/nrpe pidfile logic choose the location
2) set a different path for pid_file in nrpe.cfg, e.g. /var/run/nrpe/nrpe.pid

I'm presently using option #1 and it does avoid the /var/ ownership change.
Comment 1 Oleksandr Kryvulia 2024-05-30 08:20:02 UTC
Created attachment 251079 [details]
Proposed patch
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-07-28 17:11:23 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6eec36c45b04c6d437453378dac08171775b2825

commit 6eec36c45b04c6d437453378dac08171775b2825
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2024-07-28 17:08:53 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2024-07-28 17:08:53 +0000

    net-mgmt/nrpe: Fix permission on /var

    - Fix build for ports users [1]

    PR:             277704, 280180 [1]
    Reported by:    sr@genyosha.net, eugen [1]

 net-mgmt/nrpe/Makefile  | 8 +++++---
 net-mgmt/nrpe/pkg-plist | 1 -
 2 files changed, 5 insertions(+), 4 deletions(-)
Comment 3 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2024-07-28 17:13:44 UTC
Sorry that I missed the patch and forgot to use your name as the author.