[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ssh connection via a proxy

On Monday, August 2, 2021 11:28:10 PM CEST Jeremy Fix wrote:
> Hello,


> I would like to use libssh for connecting to a remote host via a
> gateway, executing a command on the remote host and parsing its standard
> outputs/errors; So the picture is  localhost -> gateway -> remote
> I'm pretty new with libssh. I used to do that with command line ssh by
> specifying 
>     ssh -o ProxyCommand='ssh -W %h:%p mylogin@gateway' mylogin@remote
> mycommand
> It is not obvious to me how to do that with libssh; One track I have in
> mind is a variant of the above with :
>     ssh -L 9999:remote:22 mylogin@gateway
>     ssh -p 9999 mylogin@localhost mycommand
> therefore I would establish a tunnel then create a new libssh session on
> localhost and execute the command in a channel on this new session.

Which part to do you want to implement with libssh exactly. The client side or 
the proxy or both?

libssh supports the proxy command see the options:

SSH_OPTIONS_PROXYCOMMAND: Set the command to be executed in order to connect 
to server (const char *).


Andreas Schneider                 asn@xxxxxxxxxxxxxx
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D

Re: ssh connection via a proxyJeremy Fix <Jeremy.Fix@xxxxxxxxxxxxxxxxxx>
ssh connection via a proxyJeremy Fix <Jeremy.Fix@xxxxxxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org