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

netcat SSH proxy using libssh


Hello list,

I want to open ssh connection to remote host "remote" via SSH proxy
"proxy" using netcat on proxy.

If I use openssh, I execute something like:
ssh user@remote -o ProxyCommand="ssh proxyuser@proxy nc remote 22"


Now I want to do same thing with libssh.

My idea is to open a session "proxy_session" to proxy, with this session
open a channel "proxy_channel" and execute a proxy command:
channel_request_exec ( proxy_channel, "nc remote 22" )

after that I should probably start an another SSH session
"remote_session" and create a socket which will transfer data between
proxy_channel and "remote_session" - read data from channel with
channel_read and write it to socket and read data from socket and write
it to channel with channel_write. This socket should be specified for
"remote_session" as file descriptor to use:
ssh_options_set(remote_session, SSH_OPTIONS_FD, &socket)

How do you think, will it work? Is there a more simple way to do this?
Have some one already did this?

Thank you for your opinions.

Regards,
Alex

-- 
Oleksandr Shneyder
Dipl. Informatik
X2go Core Developer Team

email:  oleksandr.shneyder@xxxxxxxxxxxxxxxxx
web: www.obviously-nice.de

--> X2go - everywhere@home

Attachment: signature.asc
Description: OpenPGP digital signature


References:
ssh_channel_read - expected behavior?Jonathan Walker <jwalker@xxxxxxxxxxxx>
Re: ssh_channel_read - expected behavior?Andreas Schneider <asn@xxxxxxxxxxxxxx>
RE: ssh_channel_read - expected behavior?Jonathan Walker <jwalker@xxxxxxxxxxxx>
Re: ssh_channel_read - expected behavior?Andreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org