<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000099">
One person suggested my openssl version might be too new (0.9.8). I
just removed it and installed 0.9.7i, older enough version to be safe
and one that I know another user has in a working configuration. After
compiling it, I then recompiled NRPE against it and copied the files in
place. It still fails with the same error.<br>
<br>
/var/log/system.log shows:<br>
<blockquote>Mar 19 10:45:17 seth xinetd[26057]: Started working: 1
available service<br>
Mar 19 10:45:25 seth nrpe[26064]: Error: NRPE daemon cannot be run as
user/group root!<br>
</blockquote>
I had it set to run as nobody:nobody, but that wasn’t working. I even
tried setting to run as daemon:wheel, but the same results. Finally, I
created a nagios user and configured /etc/xinetd.d/nrpe to run as
nagios:nagios and updated /etc/nagios/nrpe.cfg to use the same.
However, all remote tests still result in the following:<br>
<br>
>From the server:<br>
<blockquote>[nagios@nagios ~]$ /usr/local/nagios/libexec/check_nrpe -H
seth<br>
CHECK_NRPE: Error - Could not complete SSL handshake.<br>
</blockquote>
>From the client:<br>
<blockquote>Mar 19 10:45:17 seth xinetd[26057]: Started working: 1
available service<br>
Mar 19 10:45:25 seth nrpe[26064]: Error: NRPE daemon cannot be run as
user/group root!<br>
</blockquote>
Scouring Google shows that the “cannot be run as ... root” error is in
the nrpe.c code. What I can’t figure out is why its trying to run as
root instead of the configured user...<br>
<br>
Anyone running NRPE with xinetd for Mac’s? I’m frustrated enough that I
almost just want to use check_by_ssh, but I’d prefer to get this
working and keep things consistent (ie: with NRPE). My
/etc/nagios/nrpe.cfg and /etc/xinetd.d/nrpe are below:<br>
<blockquote>seth:/etc/xinetd.d root# pwd<br>
/etc/xinetd.d<br>
seth:/etc/xinetd.d root# cat nrpe <br>
# /etc/xinetd.d/nrpe<br>
# description: NRPE<br>
# default: on<br>
service nrpe<br>
{<br>
        flags           = REUSE<br>
        socket_type     = stream<br>
        port        = 5666<br>
        wait            = no<br>
        user            = nagios<br>
        group           = nagios<br>
        server          = /usr/local/sbin/nrpe<br>
        server_args     = -c /etc/nagios/nrpe.cfg --inetd<br>
        log_on_failure  += USERID<br>
        disable         = no<br>
        only_from       = 127.0.0.1 10.1.1.170<br>
}<br>
</blockquote>
---------------------------<br>
<blockquote>seth:/etc/nagios root# pwd<br>
/etc/nagios<br>
seth:/etc/nagios root# cat nrpe.cfg <br>
#############################################################################<br>
# Sample NRPE Config File <br>
# Written by: Ethan Galstad (<a class="moz-txt-link-abbreviated" href="mailto:nagios@nagios.org">nagios@nagios.org</a>)<br>
# <br>
# Last Modified: 11-23-2007<br>
#<br>
# NOTES:<br>
# This is a sample configuration file for the NRPE daemon.  It needs to
be<br>
# located on the remote host that is running the NRPE daemon, not the
host<br>
# from which the check_nrpe client is being executed.<br>
#############################################################################<br>
# LOG FACILITY<br>
# The syslog facility that should be used for logging purposes.<br>
  <br>
log_facility=daemon<br>
  <br>
# PID FILE<br>
# The name of the file in which the NRPE daemon should write it's
process ID<br>
# number.  The file is only written if the NRPE daemon is started by
the root<br>
# user and is running in standalone mode.<br>
  <br>
pid_file=/var/run/nrpe.pid<br>
  <br>
# PORT NUMBER<br>
# Port number we should wait for connections on.<br>
# NOTE: This must be a non-priviledged port (i.e. > 1024).<br>
# NOTE: This option is ignored if NRPE is running under either inetd or
xinetd<br>
  <br>
server_port=5666<br>
  <br>
# SERVER ADDRESS<br>
# Address that nrpe should bind to in case there are more than one
interface<br>
# and you do not want nrpe to bind on all interfaces.<br>
# NOTE: This option is ignored if NRPE is running under either inetd or
xinetd<br>
  <br>
#server_address=127.0.0.1<br>
  <br>
# NRPE USER<br>
# This determines the effective user that the NRPE daemon should run
as.  <br>
# You can either supply a username or a UID.<br>
# <br>
# NOTE: This option is ignored if NRPE is running under either inetd or
xinetd<br>
  <br>
nrpe_user=nagios<br>
  <br>
# NRPE GROUP<br>
# This determines the effective group that the NRPE daemon should run
as.  <br>
# You can either supply a group name or a GID.<br>
# <br>
# NOTE: This option is ignored if NRPE is running under either inetd or
xinetd<br>
  <br>
nrpe_group=nagios<br>
  <br>
# ALLOWED HOST ADDRESSES<br>
# This is an optional comma-delimited list of IP address or hostnames <br>
# that are allowed to talk to the NRPE daemon.<br>
#<br>
# Note: The daemon only does rudimentary checking of the client's IP<br>
# address.  I would highly recommend adding entries in your
/etc/hosts.allow<br>
# file to allow only the specified host to connect to the port<br>
# you are running this daemon on.<br>
#<br>
# NOTE: This option is ignored if NRPE is running under either inetd or
xinetd<br>
  <br>
allowed_hosts=127.0.0.1<br>
  <br>
# COMMAND ARGUMENT PROCESSING<br>
# This option determines whether or not the NRPE daemon will allow
clients<br>
# to specify arguments to commands that are executed.  This option only
works<br>
# if the daemon was configured with the --enable-command-args configure
script<br>
# option.  <br>
#<br>
# *** ENABLING THIS OPTION IS A SECURITY RISK! *** <br>
# Read the SECURITY file for information on some of the security
implications<br>
# of enabling this variable.<br>
#<br>
# Values: 0=do not allow arguments, 1=allow command arguments<br>
  <br>
dont_blame_nrpe=0<br>
  <br>
  <br>
  <br>
# COMMAND PREFIX<br>
# This option allows you to prefix all commands with a user-defined
string.<br>
# A space is automatically added between the specified prefix string
and the<br>
# command line from the command definition.<br>
#<br>
# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH
CAUTION! ***<br>
# Usage scenario: <br>
# Execute restricted commmands using sudo.  For this to work, you need
to add<br>
# the nagios user to your /etc/sudoers.  An example entry for alllowing
  <br>
# execution of the plugins from might be:<br>
#<br>
# nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/<br>
#<br>
# This lets the nagios user run all commands in that directory (and
only them)<br>
# without asking for a password.  If you do this, make sure you don't
give<br>
# random users write access to that directory or its contents!<br>
  <br>
# command_prefix=/usr/bin/sudo <br>
  <br>
  <br>
  <br>
# DEBUGGING OPTION<br>
# This option determines whether or not debugging messages are logged
to the<br>
# syslog facility.<br>
# Values: 0=debugging off, 1=debugging on<br>
  <br>
debug=0<br>
  <br>
  <br>
  <br>
# COMMAND TIMEOUT<br>
# This specifies the maximum number of seconds that the NRPE daemon will<br>
# allow plugins to finish executing before killing them off.<br>
  <br>
command_timeout=60<br>
  <br>
  <br>
  <br>
# CONNECTION TIMEOUT<br>
# This specifies the maximum number of seconds that the NRPE daemon will<br>
# wait for a connection to be established before exiting. This is
sometimes<br>
# seen where a network problem stops the SSL being established even
though<br>
# all network sessions are connected. This causes the nrpe daemons to<br>
# accumulate, eating system resources. Do not set this too low.<br>
  <br>
connection_timeout=300<br>
  <br>
  <br>
  <br>
# WEEK RANDOM SEED OPTION<br>
# This directive allows you to use SSL even if your system does not have<br>
# a /dev/random or /dev/urandom (on purpose or because the necessary
patches<br>
# were not applied). The random number generator will be seeded from a
file<br>
# which is either a file pointed to by the environment valiable
$RANDFILE<br>
# or $HOME/.rnd. If neither exists, the pseudo random number generator
will<br>
# be initialized and a warning will be issued.<br>
# Values: 0=only seed from /dev/[u]random, 1=also seed from weak
randomness<br>
  <br>
#allow_weak_random_seed=1<br>
  <br>
  <br>
  <br>
# INCLUDE CONFIG FILE<br>
# This directive allows you to include definitions from an external
config file.<br>
  <br>
#include=<somefile.cfg><br>
  <br>
  <br>
  <br>
# INCLUDE CONFIG DIRECTORY<br>
# This directive allows you to include definitions from config files
(with a<br>
# .cfg extension) in one or more directories (with recursion).<br>
  <br>
#include_dir=<somedirectory><br>
#include_dir=<someotherdirectory><br>
  <br>
  <br>
  <br>
# COMMAND DEFINITIONS<br>
# Command definitions that this daemon will run.  Definitions<br>
# are in the following format:<br>
#<br>
# command[<command_name>]=<command_line><br>
#<br>
# When the daemon receives a request to return the results of
<command_name><br>
# it will execute the command specified by the <command_line>
argument.<br>
#<br>
# Unlike Nagios, the command line cannot contain macros - it must be<br>
# typed exactly as it should be executed.<br>
#<br>
# Note: Any plugins that are used in the command lines must reside<br>
# on the machine that this daemon is running on!  The examples below<br>
# assume that you have plugins installed in a /usr/local/nagios/libexec<br>
# directory.  Also note that you will have to modify the definitions
below<br>
# to match the argument format the plugins expect.  Remember, these are<br>
# examples only!<br>
  <br>
# The following examples use hardcoded command arguments...<br>
  <br>
command[check_disks]=/usr/local/nagios/libexec/check_disk -m -e -w 10%
-c 5%<br>
command[check_load]=/usr/local/nagios/libexec/check_load -r -w 5.0 -c
10.0<br>
command[check_memory]=/usr/local/nagios/libexec/check_memory.pl -w 10%
-c 5%<br>
command[check_swap]=/usr/local/nagios/libexec/check_swap -a -w 50% -c
20%<br>
command[check_ntp]=/usr/local/nagios/libexec/check_ntp_time -H
10.1.1.14 -w 1.0 -c 1.5<br>
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5
-c 10 -s Z<br>
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150
-c 200<br>
command[check_users]=/usr/local/nagios/libexec/check_users -w 25 -c 50<br>
  <br>
  <br>
</blockquote>
<pre class="moz-signature" cols="72">  A. Davis
  Email:     <a class="moz-txt-link-abbreviated" href="mailto:nccomp@gmail.com">nccomp@gmail.com</a>

  "There is no limit to what a man can accomplish
   if he doesn't care who gets the credit." - Ronald Reagan
</pre>
<br>
<br>
Andrew Davis wrote:
<blockquote cite="mid:49C24156.8070803@gmail.com" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
My /etc/xinetd.d/nrpe is below:<br>
  <br>
# /etc/xinetd.d/nrpe<br>
# description: NRPE<br>
# default: on<br>
service nrpe<br>
{<br>
        flags           = REUSE<br>
        socket_type     = stream<br>
        port            = 5666<br>
        wait            = no<br>
#        user            = nobody<br>
        user            = daemon<br>
#        group           = nobody<br>
        group           = wheel<br>
        server          = /usr/local/sbin/nrpe<br>
        server_args     = -c /etc/nagios/nrpe.cfg --inetd<br>
        log_on_failure  += USERID<br>
        disable         = no<br>
        only_from       = 127.0.0.1 10.1.1.170<br>
}<br>
  <br>
Originally, it was set to nobody:nobody. As a test, I set it to
daemon:wheel. In all cases, it gives the "cannot run as root" error. I
guess I can try making a Nagios user & group and testing with that.<br>
  <pre class="moz-signature" cols="72">  A. Davis
  Email:     <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:nccomp@gmail.com">nccomp@gmail.com</a>

  "There is no limit to what a man can accomplish
   if he doesn't care who gets the credit." - Ronald Reagan
  </pre>
  <br>
  <br>
Allan Clark wrote:
  <blockquote
 cite="mid:37c712e0903181419q4fda28e8o83b1cd5464f69ab3@mail.gmail.com"
 type="cite">Reply is bottom-posted.<br>
    <br>
    <div class="gmail_quote">On Wed, Mar 18, 2009 at 16:57, Andrew
Davis <span dir="ltr"><<a moz-do-not-send="true"
 href="mailto:nccomp@gmail.com">nccomp@gmail.com</a>></span>
wrote:<br>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
      <div bgcolor="#ffffff" text="#000099">If I'm reading this
correctly, the line about "NRPE daemon cannot be
run as
user/group root!" is directly from the source code of NRPE. Its not an
xinetd thing. I've confirmed that xinetd is running and listening on
port 5666. I tried changing the owner/group from nobody:nobody to
another unprivileged user, but it didn't work. Same results. It appears
that despite my configuring the /etc/nagios/nrpe.cfg and the
/etc/xinetd.d/nrpe files to use a user other than root, it still tries
to start it as the root user and thus when an incoming connection comes
in, it gives the "NRPE daemon cannot be run as
user/group root!" error. Any thoughts on how to rectify this? Since
NRPE is working fine on Linux, is this just a Mac OS X thing? Any help
would be immensely appreciated.<br>
      <font color="#888888"><br>
AD</font>
      <div>
      <div class="h5"><br>
      <br>
Andrew Davis wrote:
      <blockquote type="cite"> FYI: /var/log/system.log on the client
shows:<br>
        <br>
Mar 18 16:08:07 shu xinetd[29066]: START: nrpe pid=557 from=10.1.1.170<br>
Mar 18 16:08:07 shu nrpe[557]: Error: NRPE daemon cannot be run as
user/group root!<br>
        <br>
whether I do the default test (with SSL) or use the -n flag to test w/o
SSL. The odd thing is that the nrpe config in /etc/xinetd.d is set to
run as nobody:nobody and /etc/nagios/nrpe.cfg is owned by
nobody:nobody. Only /usr/local/sbin/nrpe is owned by root (as it should
be), but is also set to 755 perms. I've compared to a Linux box I have
with NRPE and xinetd working properly and the permissions are identical.<br>
        <br>
I'm stumped...<br>
        <br>
Andrew Davis wrote:
        <blockquote type="cite">I have
two Mac OS X servers, one running 10.3, the other running 10.4.
Neither can be upgraded to 10.5 due to third party s/w constraints.
Both are PPC based XServe's.<br>
          <br>
Trying to compile nrpe with:<br>
          <blockquote><font color="#ff0000">./configure
--sysconfdir=/etc/nagios
--enable-ssl</font><br>
          </blockquote>
Initially, I got the "cannot find ssl libraries" error:<br>
          <blockquote><font color="#ff0000">~<br>
checking for SSL headers... SSL headers found in /usr/local/ssl<br>
checking for SSL libraries... configure: error: Cannot find ssl
libraries</font><br>
          </blockquote>
I downloaded the latest openssl and built it with:<br>
          <blockquote><font color="#ff0000">./config
--prefix=/usr/local
shared
--openssldir=/usr/local/openssl<br>
make<br>
make test<br>
make install</font><br>
          </blockquote>
I then had to edit ~/src/nrpe/configure and change the reference from
libssl.so to libssl.dylib<br>
          <br>
After that, nrpe compiled cleanly and I was able to move
~src/nrpe/src/nrpe to /usr/local/sbin and start xinetd up. I've
confirmed that port 5666 is open and xinetd is running:<br>
          <blockquote><font color="#ff0000">/usr/local/src/nrpe-2.12/src
root#
ps
waux|grep xinet|grep -v greproot   29066   0.0 -0.0    27484    308 
??  Ss    3:53PM   0:00.02 /usr/sbin/xinetd -pidfile
/var/run/xinetd.pid -stayalive<br>
/usr/local/src/nrpe-2.12/src root# netstat -an|grep 5666tcp4      
0      0  *.5666                 *.*                    LISTEN</font><br>
          </blockquote>
However, when connecting from the remote server, I get:<br>
          <blockquote><font color="#ff0000">/usr/local/nagios/libexec/check_nrpe
-H <a moz-do-not-send="true" href="http://host.mydomain.org"
 target="_blank">host.mydomain.org</a><br>
CHECK_NRPE: Error - Could not complete SSL handshake.</font><br>
          </blockquote>
The same test but w/o SSL gives yields:<br>
          <blockquote><font color="#ff0000">[nagios@nephilim src]$
/usr/local/nagios/libexec/check_nrpe -n -H <a moz-do-not-send="true"
 href="http://host.mydomain.org" target="_blank">host.mydomain.org</a><br>
CHECK_NRPE: Received 0 bytes from daemon.  Check the remote server logs
for error messages.</font><br>
          </blockquote>
So two questions:<br>
          <br>
1) I'm a UNIX guy, but obviously Mac's are A) different and B) a tad
different being BSD-based. So what's the proper way to stop/restart the
xinetd daemon?<br>
2) Any thoughts on SSL handshake error? I've googled it, but I'm not
getting very far.<br>
          <br>
Anyone have a step-by-step for compiling nagios plugins and NRPE from
source on OS X 10.x (specifically 10.3 and 10.4)? I'm using NRPE for
all other internal hosts, so I prefer to use it for the Mac's too. I
know I could do it via check_by_ssh and get around this, but I prefer
to use NRPE if I can.<br>
          <pre cols="72">-- 
        </pre>
        </blockquote>
      </blockquote>
      </div>
      </div>
      </div>
    </blockquote>
    <div><br>
On a Mac, your xinetd is a bolt-on over the launchd that's there by
default; you've obviously got it running.  Since you're in
/etc/xinetd.d/<something>, you need to cnfigure a different
username via xinetd's config.  Look for a /etc/xinetd.d/nrpe file, or
similar, containing the config for your nrpe service.  I tend to grep
for the port number in order to find the file.  Remember to check
/local/*<br>
    <br>
The time service has an example with juicy comments:<br>
    <br>
    <br>
service time<br>
{<br>
# This is for quick on or off of the service<br>
        disable         = yes<br>
...<br>
...<br>
# External services must fill out the following<br>
#       user            =<br>
#       group           =<br>
...<br>
...<br>
}<br>
    <br>
    <br>
Take a look there, see if you can choose a better username and/or group
and if your port of xinetd honours it.  I don't know if you have a nrpe
user, or run it as nobody.<br>
    <br>
A better option would be a proper launchd config, allowing you to
shutdown xinetd if you're installing it there for this purpose only,
but then it's a Mac-only thing, and would be more difficult to maintain
for non-Mac people.<br>
    <br>
Allan<br>
    <br>
    </div>
    </div>
  </blockquote>
</blockquote>
</body>
</html>