check_ssh 返回权限被拒绝

check_ssh 返回权限被拒绝

我是 Nagios 的忠实粉丝,大概有 15 年了。在我的某个环境中,我在多台 Linux 主机上运行了 Nagios 和 NRPE,几个月来一切都按预期运行。我最近在环境中添加了 3 台 Linux 8 (Rocky) 主机……这 3 台主机的配置相同,安装了 NRPE,Nagios 服务器正在监控这 3 台主机上的 9 项服务中的 8 项,没有任何问题。

但是 check_ssh不是在 3 台主机中的 2 台上工作。从 Nagios 服务器:

[root@nagios ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.0.71 -c check_ssh
SSH OK - OpenSSH_8.0 (protocol 2.0) | time=0.011923s;;;0.000000;10.000000

[root@nagios ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.0.72 -c check_ssh
connect to address 192.168.0.69 and port 22: Permission denied

[root@nagios ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.0.73 -c check_ssh
connect to address 192.168.0.69 and port 22: Permission denied

我能够在 2 个“坏”主机上以 root 和 nrpe 用户身份运行 check_ssh:

[[email protected] ~]# /usr/lib64/nagios/plugins/check_ssh -H 192.168.0.69
SSH OK - OpenSSH_8.0 (protocol 2.0) | time=0.011192s;;;0.000000;10.000000
[[email protected] ~]# runuser -u nrpe -- /usr/lib64/nagios/plugins/check_ssh -H 192.168.0.69
SSH OK - OpenSSH_8.0 (protocol 2.0) | time=0.010463s;;;0.000000;10.000000

[[email protected] ~]# /usr/lib64/nagios/plugins/check_ssh -H 192.168.0.69
SSH OK - OpenSSH_8.0 (protocol 2.0) | time=0.010107s;;;0.000000;10.000000
[[email protected] ~]# runuser -u nrpe -- /usr/lib64/nagios/plugins/check_ssh -H 192.168.0.69
SSH OK - OpenSSH_8.0 (protocol 2.0) | time=0.010427s;;;0.000000;10.000000

并且在主机和 nagios(或环境中的任何其他主机)之间运行 ssh 没有问题。

有什么建议吗?

答案1

最有可能的是 SELinux 阻止了 NRPE,正如它与 一起工作所证明的那样setenforce 0

验证您是否已nrpe-selinux安装该包。

相关内容