This month's Index
Subject: Direct TCP/IP proxying SSH server
Direct TCP/IP proxying SSH server
From: Pan K <zuboci_at_yandex.com>
Date: Tue, 05 Dec 2017 16:43:21 +0000
From the direct TCP/IP example code:
Must use non-blocking IO hereafter due to the current libssh2 API"
If I understand correctly, this means that direct TCP/IP forwarding cannot be used to proxy another SSH server that will be connected to with libssh2 via the forwarded connection. Is this understanding correct?
Basically trying to do client -> SSH proxy server <- direct TCP/IP forward -> SSH target server
Client is a libssh2 using application, so that client connects to target server via an intermediate SSH proxy/bastion host.
Using just libssh2, this means connecting/authenticating with the proxy server, creating a direct TCP/IP connection from proxy server to target server:22, running a 'tunneler' service to forward all data from and to the created forwarding connection and then creating another libssh2 session on the tunneler service.
In my testing code, the proxied libssh2 session always gets blocked until socket timeout on session handshake which cannot be used in non-blocking mode. Same behaviour when set_blocking(0) is called prior to handshake/auth.
Thanks for reading.