Check_by_ssh and ProxyCommand

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
donypie
Posts: 7
Joined: Tue Oct 11, 2016 8:44 am

Check_by_ssh and ProxyCommand

Post by donypie »

Hi all,

I would like to execute nagios plugins by using check_by_ssh. But, for security zones (DMZ), I have to pass by a proxy and so I would like to use the principle of Bastion host (SSH through the bastion).
Can you please tell me if I can use the ProxyCommand with check_by_ssh ?

Host destination.com
ProxyCommand ssh user@bastion.com -W %h:%p

Thanks.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Check_by_ssh and ProxyCommand

Post by dwhitfield »

According to this article http://blog.jasonantman.com/2009/10/nag ... h-and-nat/ it should be possible, but we have not tested this specifically.

I would like to note that that article is from 2009, so it might not be valid. It will depend upon, among other things, your version of Core. For the help of the community, do you mind posting your version of Core and whether you can get it working? Thanks!
donypie
Posts: 7
Joined: Tue Oct 11, 2016 8:44 am

Re: Check_by_ssh and ProxyCommand

Post by donypie »

Thanks for your answer. I'll test it and post a result asap.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Check_by_ssh and ProxyCommand

Post by dwhitfield »

What's your version of Core? That information will help community members test. Also, what OS and version are you running? That will help me get you your Nagios version # in case you don't know what it is. Thanks!
donypie
Posts: 7
Joined: Tue Oct 11, 2016 8:44 am

Re: Check_by_ssh and ProxyCommand

Post by donypie »

Hi all,

I have installed the current version of Nagiosxi (trial version - so I run Nagios Core 4.1.1.) running on a Centos server, a nagios proxy server and a nagios client also running on Centos; and tested SSH through the bastion. It seems to work fine in command line and with check_by_ssh :

Command line

Code: Select all

 ssh -o ProxyCommand="ssh -q -W %h:%p nagios-proxy" nagios-client -C uptime
 14:53:46 up 1 day,  2:37,  1 user,  load average: 0.00, 0.01, 0.05
With check_by-ssh

Code: Select all

[nagios@nagios-server libexec]$ ./check_by_ssh -v -H 10.29.2.28 -o ProxyCommand="ssh -q -W %h:%p nagios-proxy" -C uptime
Command: /usr/bin/ssh
Argument 1: -o
Argument 2: ProxyCommand=ssh -q -W %h:%p nagios-proxy
Argument 3: 10.29.2.28
Argument 4: uptime
 14:53:56 up 1 day,  2:37,  1 user,  load average: 0.00, 0.01, 0.05
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Check_by_ssh and ProxyCommand

Post by dwhitfield »

donypie wrote:It seems to work fine
Based on your statement, and your post happy face icon, I think you are good to go. Is it ok for us to lock this up? Thanks!
donypie
Posts: 7
Joined: Tue Oct 11, 2016 8:44 am

Re: Check_by_ssh and ProxyCommand

Post by donypie »

Yes, thanks.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Check_by_ssh and ProxyCommand

Post by dwhitfield »

Glad to hear it is resolved. I am going to lock the thread. Please feel free to post again if you have you another issue. Thank you for using the Nagios forums!
Locked