Re: Issue with check_log over nrpe for Linux remote host
Posted: Thu Nov 10, 2016 11:22 am
good idea,
its running as the nrpe user!
this gave me an idea, this was installed from the EPEL repo, not from source. Maybe a little background would explain: I am rolling out nagios monitoring to the entire company, this box is just a test box the UNIX team gave me to work out an autodeployment script and configuration. There are rules here preventing compile tools being install on production, so I can't rollout source tarballs across the fleet and have each server install it. I also would prefer not to compile and then roll out the binaries because of the fragmentation across versions and the (probable) need to roll out associated libraries as well. So, the last option is the EPEL repo, there must have been a setting in the RPM for RHEL 7 that is affecting this.
less /usr/lib/systemd/system/nrpe.service:
BOOM!
changed the service to use nagios but it is still writing to the /var/secure/log the command i'm running so it's still only detecting itself...
from nagios:
check_AuthFailures
This service is flapping between states
CRITICAL 11-10-2016 11:01:48 0d 0h 58m 18s 4/4 (1) < Nov 10 11:01:30 remotehost sudo: nagios : TTY=unknown : PWD=/ : USER=root : COMMAND=/usr/lib64/nagios/plugins/check_log -F /var/log/secure -O /home/nagios/authFailures -q authentication failure
tried running these commands on the command line again as the nagios user. Got a normal result when I ran
ran with sudo and got the error:
removed "sudo -n" from the nrpe.cfg file and got the correct result in nagios:
Check_AuthFailures
This service is flapping between states
OK 11-10-2016 11:06:49 0d 0h 2m 12s 1/4 Log check ok - 0 pattern matches found
Opened SSH terminal to the remote host and tried to log into root with a bad password
Check_AuthFailures
This service is flapping between states
CRITICAL 11-10-2016 11:12:25 0d 0h 0m 30s 1/4 (2) < Nov 10 11:11:43 remotehost sshd[32684]: PAM 2 more authentication failures: logname= uid=0 euid=0 tty=ssh ruser= rhost=my_desktop.domain.ad user=root
HUZZAH!
this is why I much prefer tarballs.
If you install the rpms for nrpe for RHEL 7.2 from the EPEL database, the service may use the nrpe user REGARDLESS of what is in the nrpe.cfg file for the systemd service!! (for any lurkers with this issue) I do NOT know if this is the case for other service managers or inet/xinetd
Now I need to go back and check the 4.x, 5.x, and 6.x test boxes. I'll post back with results, the other versions use init as well, 7.x is the only place we are using systemd so maybe that's the issue?

its running as the nrpe user!
Code: Select all
nrpe 28399 1 0 10:03 ? 00:00:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
less /usr/lib/systemd/system/nrpe.service:
Code: Select all
[Unit]
Description=NRPE
After=network.target
Requires=network.target
[Service]
Type=forking
User=nrpe
Group=nrpe
EnvironmentFile=/etc/sysconfig/nrpe
ExecStart=/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d $NRPE_SSL_OPT
[Install]
WantedBy=multi-user.target
changed the service to use nagios but it is still writing to the /var/secure/log the command i'm running so it's still only detecting itself...
from nagios:
check_AuthFailures
This service is flapping between states
CRITICAL 11-10-2016 11:01:48 0d 0h 58m 18s 4/4 (1) < Nov 10 11:01:30 remotehost sudo: nagios : TTY=unknown : PWD=/ : USER=root : COMMAND=/usr/lib64/nagios/plugins/check_log -F /var/log/secure -O /home/nagios/authFailures -q authentication failure
tried running these commands on the command line again as the nagios user. Got a normal result when I ran
Code: Select all
/usr/lib64/nagios/plugins/check_log -F /var/log/secure -O /home/nagios/authFailures -q "authentication failure"
Log check ok - 0 pattern matches found
Code: Select all
sudo -n /usr/lib64/nagios/plugins/check_log -F /var/log/secure -O /home/nagios/authFailures -q "authentication failure"
(1) < Nov 10 11:05:35 remotehost sudo: nagios : TTY=pts/1 ; PWD=/root ; USER=root ; COMMAND=/usr/lib64/nagios/plugins/check_log -F /var/log/secure -O /home/nagios/authFailures -q authentication failure
Check_AuthFailures
This service is flapping between states
OK 11-10-2016 11:06:49 0d 0h 2m 12s 1/4 Log check ok - 0 pattern matches found
Opened SSH terminal to the remote host and tried to log into root with a bad password
Check_AuthFailures
This service is flapping between states
CRITICAL 11-10-2016 11:12:25 0d 0h 0m 30s 1/4 (2) < Nov 10 11:11:43 remotehost sshd[32684]: PAM 2 more authentication failures: logname= uid=0 euid=0 tty=ssh ruser= rhost=my_desktop.domain.ad user=root
HUZZAH!
this is why I much prefer tarballs.
If you install the rpms for nrpe for RHEL 7.2 from the EPEL database, the service may use the nrpe user REGARDLESS of what is in the nrpe.cfg file for the systemd service!! (for any lurkers with this issue) I do NOT know if this is the case for other service managers or inet/xinetd
Now I need to go back and check the 4.x, 5.x, and 6.x test boxes. I'll post back with results, the other versions use init as well, 7.x is the only place we are using systemd so maybe that's the issue?