Kumar, Ashish wrote:
> If you know about "plink" which is a commandline putty utility , It
> has one feature as below
>
> plink -2 root_at_calis1 -nc cali11:22
Yes.
> In this case "calis1" is the target host and "calil1" is acting as
> a proxy server who has access to calis1 .
Almost. Let me clarify:
plink connects to the SSH server at calis1, and authenticates as
root. Then plink asks sshd on calis1 to open what is called a
direct-tcpip channel in SSH terminology. In this case you specify
that plink should ask sshd on calis1 to connect to the host cali11
on port 22.
> This "Proxy" feature is only supported by ssh2 protocol and not
> ssh1.
That's right. direct-tcpip channels were introduced in the SSH2 RFCs.
This feature is often called local port forwarding.
> I am looking for similar stuff and analyzing its feasibility with
> libssh2
libssh2_channel_direct_tcpip_ex() is the function call you want. You
can call this after libssh2 has authenticated successfully with a
server.
If you want to connect using libssh2 to another, internal, SSH server
via this channel then please remember that it is a separate SSH
connection and thus you must initialize a separate LIBSSH2_SESSION
for it.
The current design of libssh2 then also requires you to create a file
descriptor, e.g. using pipe(), and that you pump data between pipe
and channel. Again because of current design this can only work if
you are using non-blocking sockets.
//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2009-12-22