NagiosEnterprises / nrpe

NRPE Agent
GNU General Public License v2.0
259 stars 133 forks source link

Ubuntu16 upgrade to ubuntu18,Nrpe[1145]: WARNING: my_system() seteuid(0): Operation not permitted #198

Open hom7 opened 6 years ago

hom7 commented 6 years ago

Nagios-nrpe-server (3.2.1-1ubuntu1) has failed, debug mode is displayed Nrpe[1145]: WARNING: my_system() seteuid(0): Operation not permitted

Unable to create a new file under /tmp. Add permissions in /etc/sudoers, still can't run detection scripts properly Nrpe ALL=(ALL) NOPASSWD:/usr/lib/nagios/plugins/vlndhcp/check_passwd Nagios ALL=(ALL) NOPASSWD:/usr/lib/nagios/plugins/vlndhcp/check_passwd Nrpe ALL=(ALL:ALL) ALL Nagios ALL=(ALL:ALL) ALL

And cat /tmp can't succeed

What should I do?

box293 commented 6 years ago

Is NRPE installed via apt or was it built from source?

Have you tried uninstalling / re-installing? This would be worth it considering it was a major upgrade.

hom7 commented 6 years ago

Apt installed(apt install nagios-nrpe-server). Try uninstalling / re-installing? The problem remains.

Rico29 commented 4 years ago

Hello. I don't know it it is related, but I get the same problem today after upgrading from debian 9 (nrpe 2.15) to debian 10 (nrpe 3.2.1) nrpe is installed from debian repositories. I tried to uninstall / reinstall without success.

here's my setup : nrpe.cfg :

nrpe_user=nagios
command[check_opensips_channels]=/opt/celya/opensips_channels.pl -f calls -w 180 -c 220

/opt/celya/opensips_channels.pl contains a command with "sudo" : /usr/bin/sudo /usr/sbin/opensipsctl fifo dlg_list my /etc/sudoers.d/nagios :

Defaults:nagios    !requiretty
nagios  ALL= NOPASSWD: /usr/sbin/opensipsctl

what I get in the nrpe debug when calling this :

Apr  9 09:23:05 orange-pa2 nrpe[8322]: Host address is in allowed_hosts
Apr  9 09:23:05 orange-pa2 nrpe[8322]: Host 192.168.156.58 is asking for command 'check_opensips_channels' to be run...
Apr  9 09:23:05 orange-pa2 nrpe[8322]: Running command: /opt/celya/opensips_channels.pl -f calls -w 180 -c 220
Apr  9 09:23:05 orange-pa2 nrpe[8323]: WARNING: my_system() seteuid(0): Operation not permitted
Apr  9 09:23:05 orange-pa2 nrpe[8322]: Command completed with return code 0 and output: OK - 0 active calls | SIP_channel=0;SIP_channel_in=0;SIP_channel_out=0;SIP_max_channel=256;

return code is 0 but values are empty. no error in auth.log

when running the same command under user nagios on server, I get correct values

and it works perfectly with nrpe 2.15-1

any help would be precious ! Regards

Rico29 commented 4 years ago

my problem was related to systemd starter of nagios-nrpe-server, which had "privateTmp=true" and was trying to access data in /tmp/ so it is solved for me.

mf69 commented 3 years ago

@Rico29 your solution worked for me too. The setting of PrivateTmp=true seems to be new? And it affects files not only in /tmp but /var/tmp as well. Nothing useful is/was printed in the log even when nrpe is in debug mode. Thanks!