NRPE Agent Install failure when NIS is authenticator

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
teeljb
Posts: 3
Joined: Mon Aug 12, 2013 2:47 pm

NRPE Agent Install failure when NIS is authenticator

Post by teeljb »

While trying to install the NRPE agent for Linux (RHEL 5.8), it failed after the installation sub-script '2-usersgroups'. The script is written for local userids/groups only, and doesn't not work when NIS is the authentication mechanism for the server.

NIS normally only stores the userids in the /etc/passwd file of the master server; this server is a client, and has only base/utility userids in it. The creation fails because the usreids/groups are already defined; NRPE has already been installed on the NIS master server. The following verification step fails because it's assuming that the userids are in /etc/passwd, which they are not.

I can hack the script, but I'm curious if 1) anybody else has run into this, and 2) is there an officially supported workaround for this situation?
You do not have the required permissions to view the files attached to this post.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: NRPE Agent Install failure when NIS is authenticator

Post by slansing »

You can alter the installation scripts, but there is no official workaround. And as it stands we support installations when done following our guidelines, now we can try to help you through this if you run into any more issues but I do not believe this has been attempted on the forums before. Let us know!
teeljb
Posts: 3
Joined: Mon Aug 12, 2013 2:47 pm

Re: NRPE Agent Install failure when NIS is authenticator

Post by teeljb »

Where the script checked for the absence of the user:

if ! grep -q "^$nagiosuser:" /etc/passwd ...

I added an interior check for NIS user:

if ! (ypcat passwd | grep -q "^$nagiosuser:")

I did the same for checking the groups.

I did not verify the two prerequisite conditions (1-NIS is installed, 2-the NIS commands are available through the current $PATH), and did not test for if either of these is false, because I was in a hurry. But this does work. Here's a copy of the modified 2-usersgroups script.
teeljb
Posts: 3
Joined: Mon Aug 12, 2013 2:47 pm

Re: NRPE Agent Install failure when NIS is authenticator

Post by teeljb »

I got it working reasonably well. Here are the script modifications I made to /tmp/linux-nrpe-agent/2-usersgroups:

# Make sure user exists
if ! grep -q "^$nagiosuser:" /etc/passwd; then
if ! (ypcat passwd | grep -q "^$nagiosuser:"); then # <----- add this line
echo "ERROR: User '$nagiosuser' was not created - exiting." >&2
exit 1
fi # <----- add this line
fi

# Make sure groups exist
for group in "$nagiosgroup" "$nagioscmdgroup"; do
if ! grep -q "^$group:" /etc/group; then
if ! (ypcat group | grep -q "^$group:"); then # <----- add this line
echo "ERROR: Group '$group' was not created - exiting." >&2
exit 1
fi # <----- add this line
fi
done

This solution assumes 1) NIS is installed on the server where you're installing the NRPE agent, and 2) ypcat is available through the current $PATH.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: NRPE Agent Install failure when NIS is authenticator

Post by sreinhardt »

Cool thanks!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked