Page 1 of 1
NRPE Agent Install failure when NIS is authenticator
Posted: Tue Aug 13, 2013 7:55 am
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?
Re: NRPE Agent Install failure when NIS is authenticator
Posted: Tue Aug 13, 2013 9:30 am
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!
Re: NRPE Agent Install failure when NIS is authenticator
Posted: Tue Aug 13, 2013 8:36 pm
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.
Re: NRPE Agent Install failure when NIS is authenticator
Posted: Wed Aug 14, 2013 6:57 am
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.
Re: NRPE Agent Install failure when NIS is authenticator
Posted: Wed Aug 14, 2013 10:36 am
by sreinhardt
Cool thanks!