On one of CentOS 7 servers I cannot perform sudo
from nrpe
user (Nagios daemon remote monitoring).
Error message:
Dec 31 08:28:10 ip-172-31-36-176 sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 31 08:28:10 ip-172-31-36-176 sudo: nrpe : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/check_pm2 -A
Dec 31 08:28:10 ip-172-31-36-176 sudo: pam_systemd(sudo:session): Failed to connect to system bus: Permission denied
Of course, nrpe
is in sudoers file:
Defaults:nrpe !requiretty
nrpe ALL = (root) NOPASSWD: /usr/local/bin/pm2_check_pm2
Contents of /usr/local/bin/pm2_check_pm2:
#!/bin/bash
sudo -u pm2 check_pm2 -A
(pm2 is unprivileged user here, sudo check_pm2 -A
has same problem).
setenforce 0
solves problem. Same configuration works nice on other servers.
semanage export
output:
boolean -D
login -D
interface -D
user -D
port -D
node -D
fcontext -D
module -D
boolean -m -1 httpd_can_network_connect
boolean -m -1 httpd_can_network_memcache
boolean -m -1 httpd_can_sendmail
boolean -m -1 nagios_run_sudo
fcontext -a -f a -t cert_t '/etc/(letsencrypt|certbot)/(live|archive)(/.*)?'
ll -Z /var/run/dbus/system_bus_socket
output:
srw-rw-rw-. root root system_u:object_r:system_dbusd_var_run_t:s0 /var/run/dbus/system_bus_socket
OS: CentOS 7.6 with latest updates. Reinstalling selinux* and dbus* did not help.
Please advise.