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

Re: Tunneling


Hello,
So basically i need to do
rc = channel_open_forward(forwarding_channel,
"HostB", 22,
"localhost", 5555);
sock = create_socket("localhost",5555)
con_sock = wait_for_client( sock )
while true:
if have_things_to_read( con_sock ):

size_data = read_from_socket( con_sock, data_from_socket )

channel_write(forwarding_channel, data_from_socket, size_data )

else if have_things_to_read( forwarding_channel):

size_data = channel_read( forwarding_channel, data_from_server)

size_data = write_to_socket( con_sock, data_from_server )
else:
sleep(0.1)
Something similar to this with all the control logic in order to handle the
case of errors.

?
BR


On 27 November 2013 15:37, Dustin Oprea <myselfasunder@xxxxxxxxx> wrote:

> You need to bind the local port yourself, and send the data into libssh.
>
> Dustin
> On Nov 27, 2013 6:41 AM, "Joao Pedro Almeida Pereira" <
> joao.almeida@xxxxxxxxxxx> wrote:
>
>> Hello,
>> I am trying to develop a tunnel system using libssh but from what i could
>> find in the tutorials i am not sure that i can do it with libssh.
>> What i need is a tunnel to reach an SSH server, basically what i need is
>>
>> ssh -T -N -L 9999:HostB:22 user@HostA
>>
>>
>> My machine ====> HostA ====> HostB
>>
>> And then connect to HostB SSH server using the local port.
>> From what i saw in the tutor's i can do this but after receiving the
>> channel i would need to perform the authentication by hand and not use the
>> libssh to do the connection to that server.
>>
>> So basically what i want to know is if libssh is able to bind a local
>> port in order to be able to use libssh to handle the following connection
>>
>> BR
>> --
>> -----
>> --------
>> João Pereira
>>
>> Email: joao.almeida@xxxxxxxxxxx
>> Web: http://www.bluetc.es
>>
>


-- 
--
-----
--------
João Pereira

Email: joao.almeida@xxxxxxxxxxx
Web: http://www.bluetc.es

Follow-Ups:
Re: TunnelingAndreas Schneider <asn@xxxxxxxxxxxxxx>
References:
TunnelingJoao Pedro Almeida Pereira <joao.almeida@xxxxxxxxxxx>
Re: TunnelingDustin Oprea <myselfasunder@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org