Subject: Re: help in understanding _direct_tcpip_ex()

Re: help in understanding _direct_tcpip_ex()

From: Peter Stuge <peter_at_stuge.se>
Date: Thu, 1 Jul 2010 14:56:17 +0200

Dor Zaidenberg wrote:
> I am trying to use libssh2_channel_direct_tcpip_ex in order to establish a
> tunnel between the localmachine and a server. To this end I am working with
> the direct_tcpip exmaple (both local machine and remote server use linux)
>
> I figured this is going to be very simple.
> What I tried is :
> ./direct_tcpip <server_ip> <user> <pwd> 127.0.0.1 80 localhost 20000
> I hoped this will tunnel the my local machine's port 80 to the remote
> host at port 20000.

It will.

> Then at the remote server I will type :
> curl http://localhost:20000/test.php and it will be as if I
> connected to the local machine.

No, since then you would require a tunnel in the other direction, a
so-called "forwarded-tcpip" tunnel, going from the remote server to
your local machine.

That is a different type of channel from "direct-tcpip" and it is
currently not implemented in libssh2.

Part of the reason may be that this type of tunnel (forwarded-tcpip)
requires libssh2 to dynamically create channels, based on nothing but
packets from the remote host. This does not fit so well with how
libssh2 was designed.

That said, I think it would be great if libssh2 also supported
forwarded-tcpip channels, so please look into adding it! :)

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-07-01