[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Global Request for tcpip reverse forward
[Thread Prev] | [Thread Next]
- Subject: RE: Global Request for tcpip reverse forward
- From: Meng Hourk Tan <mtan@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 29 Mar 2018 10:22:54 +0000
- To: "libssh@xxxxxxxxxx" <libssh@xxxxxxxxxx>
Hi Martin, I think your code lacks one step on server side: After the Server handles the request using callback global_request_function and responds with ssh_message_global_request_reply_success, You need to create a new channel and call ssh_channel_open_reverse_forward() on this channel. Then the client will receive the opening request of the reverse port forwarding channel. Hope it helps, Regards, Meng ________________________________ De : Martín Fernández <fmartin91@xxxxxxxxx> Envoyé : lundi 26 mars 2018 08:20:23 À : libssh@xxxxxxxxxx Objet : Global Request for tcpip reverse forward Hello! This is my first time writing in the mailing list, I’m really new to libssh. I’m trying to get a server and client implementation for reverse port forwarding. My understanding it that client requests the server for reverse port forwarding in a given port, server handles the petition and is responsible for managing the socket and redirecting data from socket to ssh channel. Client is responsible for reading ssh channel and sending data to the local server. I have successfully managed to get authentication between client and server work correctly. The part I’m probably missing something is on how to handle the global request from client and how to pull for data in the client. Basic pseudo code that I’m doing. - Client send global request to server using `ssh_channel_listen_forward`. - Server handles the request using callback global_request_function and responds with ssh_message_global_request_reply_success - Client calls ssh_channel_accept_forward to get a new channel My problem is that `ssh_channel_accept_forward` never returns. I’m not sure If I’m missing something on the server side to initiate the channel. I know that I then need to redirect data between socket and channel but first I think I need to get a valid channel for forwarding right ? My complete code can be found here: https://gist.github.com/bilby91/22d5cc5db0e6118f06d6d35051c32cc6 Thanks before hand! Martín
RE: Global Request for tcpip reverse forward | Martín Fernández <fmartin91@xxxxxxxxx> |
Global Request for tcpip reverse forward | Martín Fernández <fmartin91@xxxxxxxxx> |