Problem access with NSclient Agent

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
pepe_carlos
Posts: 43
Joined: Wed Aug 17, 2011 9:09 am
Location: Madrid, Spain

Problem access with NSclient Agent

Post by pepe_carlos »

Hi,

I have a problem with nsclient agent when I try to access the check_nrpe command returns:
./check_nrpe -H xxxx
CHECK_NRPE: Error - Could not connect to xxxx: Connection reset by peer
Reviewing the nsclient.log appears next message:
Failed to establish secure connection: An existing connection was forcibly closed by the remote host: 1862
The access through telnet to port 5666 works correctly, but with the check_nrpe command not.

My nsclient.ini has the next configuration:

Code: Select all

[/settings/default]
allowed hosts=xxxxx
timeout=60

[/settings/log]
file name = nsclient.log
;level = debug


[/settings/NRPE/server]
allowed ciphers=ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
dh = ${certificate-path}/dhparam_1024.pem
cache allowed hosts=true
certificate format=PEM
verify mode = none
insecure = false
extended response=true
payload length=1024
performance data=true
port=5666
socket queue size=0
thread pool=10
timeout=30
use ssl=true
allow arguments = true
allow nasty characters = true
timeout=60


[/modules]
CheckHelpers = disabled
CheckNSCP = disabled
CheckDisk = enabled
WEBServer = enabled
CheckSystem = enabled
NSClientServer = enabled
CheckEventLog = enabled
NSCAClient = enabled
NRPEServer = enabled

; CheckExternalScripts - Module used to execute external scripts
CheckExternalScripts = enabled

[/settings/external scripts]
allow arguments = true

; Script wrappings - A list of templates for defining script commands. Enter any command line here and they will be expanded by scripts placed under the wrapped scripts section. %SCRIPT% will be replaced by the actual script an %ARGS% will be replaced by any given arguments.
[/settings/external scripts/wrappings]

; Batch file - Command used for executing wrapped batch files
bat = scripts\\%SCRIPT% %ARGS%


; Visual basic script - Command line used for wrapped vbs scripts
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%

; POWERSHELL WRAPPING - Command line used for executing wrapped ps1 (powershell) scripts
ps1 = cmd /c echo If (-Not (Test-Path "scripts\%SCRIPT%") ) { Write-Host "UNKNOWN: Script `"%SCRIPT%`" not found."; exit(3) }; scripts\%SCRIPT% $ARGS$; exit($lastexitcode) | powershell.exe /noprofile -command -
[/settings/external scripts/scripts]

check_es_ok=scripts\check_ok.bat
top=cmd /c echo scripts\top.ps1 | powershell.exe -ExecutionPolicy Bypass -command -
check_file_date=cmd /c echo scripts\file_check_date.ps1| powershell.exe -command -
in nsclient log in debug mode appear the next lines:

Code: Select all

2021-11-15 13:58:33: debug:c:\source\master\service\NSClient++.cpp:219: On crash: restart: nscp
2021-11-15 13:58:33: debug:c:\source\master\service\NSClient++.cpp:231: Archiving crash dumps in: C:\Program Files\NSClient++/crash-dumps
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:150: Found: CheckDisk
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:150: Found: CheckEventLog
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:150: Found: CheckExternalScripts
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:150: Found: CheckSystem
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:150: Found: NRPEServer
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:150: Found: NSCAClient
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:150: Found: NSClientServer
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:150: Found: WEBServer
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:306: Loading module C:\Program Files\NSClient++\modules\CheckDisk.dll ()
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:306: Loading module C:\Program Files\NSClient++\modules\CheckEventLog.dll ()
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:306: Loading module C:\Program Files\NSClient++\modules\CheckExternalScripts.dll ()
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:306: Loading module C:\Program Files\NSClient++\modules\CheckSystem.dll ()
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:306: Loading module C:\Program Files\NSClient++\modules\NRPEServer.dll ()
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:306: Loading module C:\Program Files\NSClient++\modules\NSCAClient.dll ()
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:306: Loading module C:\Program Files\NSClient++\modules\NSClientServer.dll ()
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:306: Loading module C:\Program Files\NSClient++\modules\WEBServer.dll ()
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:227: Loading plugin: CheckDisk
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:227: Loading plugin: CheckEventLog
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:227: Loading plugin: CheckExternalScripts
2021-11-15 13:58:33: debug:c:\source\master\modules\CheckExternalScripts\CheckExternalScripts.cpp:127: No aliases found (adding default)
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:227: Loading plugin: CheckSystem
2021-11-15 13:58:33: debug:c:\source\master\service\plugin_manager.cpp:227: Loading plugin: NRPEServer
2021-11-15 13:58:33: debug:c:\source\master\modules\NRPEServer\NRPEServer.cpp:126: Allowed hosts definition: xxxx
2021-11-15 13:58:33: debug:c:\source\master\modules\NRPEServer\NRPEServer.cpp:127: Server config: address: :5666, ssl enabled: none, cert: C:\Program Files\NSClient++/security/certificate.pem (PEM), , dh: C:\Program Files\NSClient++/security/dhparam_1024.pem, ciphers: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH, ca: C:\Program Files\NSClient++/security/ca.pem, options: 
2021-11-15 13:58:34: debug:c:\source\master\include\socket/server.hpp:111: Binding to: [::]:5666(ipv6)
2021-11-15 13:58:34: debug:c:\source\master\include\socket/server.hpp:214: Attempting to bind to: [::]:5666(ipv6)
2021-11-15 13:58:34: debug:c:\source\master\include\socket/server.hpp:107: Binding to: 0.0.0.0:5666(ipv4), reopen: true, reuse: true
2021-11-15 13:58:34: debug:c:\source\master\include\socket/server.hpp:214: Attempting to bind to: 0.0.0.0:5666(ipv4)
2021-11-15 13:58:34: debug:c:\source\master\service\plugin_manager.cpp:227: Loading plugin: NSCAClient
2021-11-15 13:58:34: debug:c:\source\master\service\plugin_manager.cpp:227: Loading plugin: NSClientServer
2021-11-15 13:58:34: debug:c:\source\master\modules\NSClientServer\NSClientServer.cpp:86: Allowed hosts definition: xxxx
2021-11-15 13:58:34: debug:c:\source\master\include\socket/server.hpp:111: Binding to: [::]:12489(ipv6)
2021-11-15 13:58:34: debug:c:\source\master\include\socket/server.hpp:214: Attempting to bind to: [::]:12489(ipv6)
2021-11-15 13:58:34: debug:c:\source\master\include\socket/server.hpp:107: Binding to: 0.0.0.0:12489(ipv4), reopen: true, reuse: true
2021-11-15 13:58:34: debug:c:\source\master\include\socket/server.hpp:214: Attempting to bind to: 0.0.0.0:12489(ipv4)
2021-11-15 13:58:34: debug:c:\source\master\service\plugin_manager.cpp:227: Loading plugin: WEBServer
2021-11-15 13:58:34: debug:c:\source\master\modules\WEBServer\WEBServer.cpp:161: Using certificate: C:\Program Files\NSClient++/security/certificate.pem
2021-11-15 13:58:34: debug:c:\source\master\modules\WEBServer\WEBServer.cpp:185: Loading webserver on port: 8443
2021-11-15 13:58:34: debug:c:\source\master\service\NSClient++.cpp:317: NSClient++ - 0.5.2.35 2018-01-28 Started!
2021-11-15 13:58:34: debug:c:\source\master\service\NSClient++.cpp:441: Starting: DONE
2021-11-15 13:58:35: debug:c:\source\master\modules\CheckSystem\pdh_thread.cpp:169: Loading counter: disk_queue_length_0 C: E: = \\server1\PhysicalDisk(0 C: E:)\% Disk Time
2021-11-15 13:58:35: debug:c:\source\master\modules\CheckSystem\pdh_thread.cpp:169: Loading counter: disk_queue_length_1 F: = \\server1\PhysicalDisk(1 F:)\% Disk Time
2021-11-15 13:58:35: debug:c:\source\master\modules\CheckSystem\pdh_thread.cpp:169: Loading counter: disk_queue_length__Total = \\server1\PhysicalDisk(_Total)\% Disk Time
2021-11-15 13:58:42: debug:c:\source\master\include\nrpe/server/protocol.hpp:92: Accepting connection from: xxxxx, count=1
2021-11-15 13:58:44: error:c:\source\master\include\socket/connection.hpp:273: Seems we other end is not using ssl: unknown protocol
2021-11-15 13:58:44: error:c:\source\master\include\socket/connection.hpp:274: Please review the ssl option as well as ssl options in settings.
2021-11-15 13:58:46: debug:c:\source\master\include\nrpe/server/protocol.hpp:92: Accepting connection from: xxxxx, count=1
2021-11-15 13:58:46: error:c:\source\master\include\socket/connection.hpp:276: Failed to establish secure connection: An existing connection was forcibly closed by the remote host: 1862

I try to execute check_nrpe command with the "-n" option but fails for timeout

Can you help me?

Thanks
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Problem access with NSclient Agent

Post by gormank »

Assuming your allowed hosts is set to the Nagios host, it looks like maybe an SSL issue. I had to add:
--v2-packets-only
to the nrpe arguments after an upgrade a while back to get it to work with nsclient.
Locked