NagiosEnterprises / nrpe

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

check_nrpe: Could not connect / Receive header underflow #283

Closed nu111 closed 3 months ago

nu111 commented 3 months ago

Hi, I have installed Nagios Core 4.4.6 from Ubuntu 22.04 repo.

/usr/lib/nagios/plugins/check_nrpe -V says

NRPE Plugin for Nagios
Version: 4.0.3

when I run

/usr/lib/nagios/plugins/check_nrpe -n -H example.com -c check_lsb_release

this appears in /var/log/syslog:

May 22 09:11:50 vps-b0893967 check_nrpe: SSL Certificate File: None
May 22 09:11:50 vps-b0893967 check_nrpe: SSL Private Key File: None
May 22 09:11:50 vps-b0893967 check_nrpe: SSL CA Certificate File: None
May 22 09:11:50 vps-b0893967 check_nrpe: SSL Cipher List: ALL:!MD5:@STRENGTH:@SECLEVEL=0
May 22 09:11:50 vps-b0893967 check_nrpe: SSL Allow ADH: 1
May 22 09:11:50 vps-b0893967 check_nrpe: SSL Log Options: 0xffffffff
May 22 09:11:50 vps-b0893967 check_nrpe: SSL Version: TLSv1_plus And Above
May 22 09:11:50 vps-b0893967 check_nrpe: Connected to x.x.x.x
May 22 09:11:50 vps-b0893967 check_nrpe: Error: (nerrs = 0) Could not complete SSL handshake with x.x.x.x: rc=0 SSL-error=5

output

CHECK_NRPE: Error - Could not connect to x.x.x.x: Connection reset by peer

if I try /usr/lib/nagios/plugins/check_nrpe -n -s-1 -H example.com -u -t 20 -c check_lsb_release

syslog:

May 22 09:16:23 vps-b0893967 check_nrpe: SSL Certificate File: None
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Private Key File: None
May 22 09:16:23 vps-b0893967 check_nrpe: SSL CA Certificate File: None
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Cipher List: ALL:!MD5:@STRENGTH:@SECLEVEL=0
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Allow ADH: 1
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Log Options: 0xffffffff
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Version: TLSv1_plus And Above
May 22 09:16:23 vps-b0893967 check_nrpe: Connected to x.x.x.x
May 22 09:16:23 vps-b0893967 check_nrpe: Remote x.x.x.x does not support version 3/4 packets
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Certificate File: None
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Private Key File: None
May 22 09:16:23 vps-b0893967 check_nrpe: SSL CA Certificate File: None
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Cipher List: ALL:!MD5:@STRENGTH:@SECLEVEL=0
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Allow ADH: 1
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Log Options: 0xffffffff
May 22 09:16:23 vps-b0893967 check_nrpe: SSL Version: TLSv1_plus And Above
May 22 09:16:23 vps-b0893967 check_nrpe: Connected to x.x.x.x
May 22 09:16:23 vps-b0893967 check_nrpe: Remote x.x.x.x accepted a version 2 packet

and the output is

CHECK_NRPE: Receive header underflow - only -1 bytes received (4 expected).

I have compiled check_nrpe 4.1.0, running this version

/usr/lib/nagios/plugins/check_nrpe_4.1.0 -s-1 -H example.com -u -t 20 -c check_lsb_release

syslog:

May 22 09:12:43 vps-b0893967 check_nrpe_4.1.0: SSL Certificate File: None
May 22 09:12:43 vps-b0893967 check_nrpe_4.1.0: SSL Private Key File: None
May 22 09:12:43 vps-b0893967 check_nrpe_4.1.0: SSL CA Certificate File: None
May 22 09:12:43 vps-b0893967 check_nrpe_4.1.0: SSL Cipher List: ALL:!MD5:@STRENGTH:@SECLEVEL=0
May 22 09:12:43 vps-b0893967 check_nrpe_4.1.0: SSL Allow ADH: 1
May 22 09:12:43 vps-b0893967 check_nrpe_4.1.0: SSL Log Options: 0xffffffff
May 22 09:12:43 vps-b0893967 check_nrpe_4.1.0: SSL Version: TLSv1_plus And Above
May 22 09:12:43 vps-b0893967 check_nrpe_4.1.0: Connected to x.x.x.x
May 22 09:12:43 vps-b0893967 check_nrpe_4.1.0: Error: (nerrs = 0) Could not complete SSL handshake with x.x.x.x: rc=0 SSL-error=5

and with

/usr/lib/nagios/plugins/check_nrpe_4.1.0 -n -s-1 -H example.com -u -t 20 -c check_lsb_release
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Certificate File: None
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Private Key File: None
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL CA Certificate File: None
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Cipher List: ALL:!MD5:@STRENGTH:@SECLEVEL=0
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Allow ADH: 1
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Log Options: 0xffffffff
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Version: TLSv1_plus And Above
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: Connected to x.x.x.x
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: Remote x.x.x.x does not support version 3/4 packets
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Certificate File: None
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Private Key File: None
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL CA Certificate File: None
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Cipher List: ALL:!MD5:@STRENGTH:@SECLEVEL=0
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Allow ADH: 1
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Log Options: 0xffffffff
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: SSL Version: TLSv1_plus And Above
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: Connected to x.x.x.x
May 22 09:21:49 vps-b0893967 check_nrpe_4.1.0: Remote x.x.x.x accepted a version 2 packet

output:

CHECK_NRPE: Receive header underflow - only -1 bytes received (4 expected).

The same nagios configuration on Nagios Core 4.3.4 (compiled from source) on Debian 9.13 (stretch) works fine (check_nrpe version: 3.0.1), so I believe is not something related to the monitored server.

I have searched a lot on the web, my understanding is that the issue is related to the openssl version of Ubuntu 22.04.

What can I do? Workaounds? Idea? Fixes?

Thanks!

nu111 commented 3 months ago

The problem was just that in the allowed_hosts.cfg file inside the monitored server the IP of the monitoring server as missing! Shame on me!