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

Re: Sample Code for SSH Port Forwarding Server


Hello,

I had to do the first steps by myself to understand what your code is
doing.  But now it's a big help to improve my code and to steal some
ideas... ;-)

I made the mistake to start coding without reading any RFCs or other
description of the SSH connection and channel open/close sequence. And
then it was difficult to understand which part libssh takes over and
which parts I have to implement myself. It took me a while to realize at
which point the direct-tcpip is requested and where I have to hook the
local TCP socket creation.

My code works, but it still has some deadlocks on closing channels, when
there are many channels in parallel. I think I should move  to V 0.8.x
now, then I can use the connector polling API.

Thanks for your support and your interest in this project.

Regards
Till


On 16.10.2018 22:23, Skalák, Zdeněk wrote:
> Hello,
>
> On Tue, Oct 16, 2018 at 6:39 PM, <g4-lisz@xxxxxxxxxxxx
> <mailto:g4-lisz@xxxxxxxxxxxx>> wrote:
>
>     Hi
>
>     I wanted to let you know that I have a working, very rough code
>     for sshd, which accepts a local port forwarding and pipes it to
>     stdout. I still have to add all the stuff for opening the net
>     socket on the server side, and the polling for reading and writing
>     back. But the first obstacle is overcome.
>
>
> glad to hear that. Hope my code helped you - at least a bit ....
>
> I remember the biggest pain when making HaaS-libssh work was to
> correctly fill/implement the callbacks in the
> ssh_channel_callbacks_struct, ssh_server_callbacks_struct and
> ssh_callbacks_struct :-(
> And the next hard thing was the 'main loop' with libssh events and
> polling - lot of 'deadlocks' there .....
>
> On the other hand, I have even prepared patch against libssh to
> implement/support some sort of security/welcome banner, but haven't
> convince myself yet to send it up.
>
> Regards
>
> Zdenek OGAR Skalak
>
>     Till
>
>     On 01.10.2018 14:31, Stefano Mtangoo wrote:
>>     I mean port forwarding. I use alot of ssh and do a lot of port
>>     forwarding for database connections.  So wanted to code utility
>>     for helping me with that. It could be contributed then as a sample. 
>>
>>     On Sun, Sep 30, 2018, 19:38 <g4-lisz@xxxxxxxxxxxx
>>     <mailto:g4-lisz@xxxxxxxxxxxx>> wrote:
>>
>>         Did you visit the GIT link of Zdenek? It seems that he got
>>         quite far with building a server... Or you are referring to
>>         port forwarding only?
>>
>>         Till
>>
>>
>>         On 30.09.2018 15:28, Stefano Mtangoo wrote:
>>>         It'll be really great. Once I tried and got nowhere. 
>>>
>>>         On Sun, Sep 30, 2018, 11:26 Andreas Schneider
>>>         <asn@xxxxxxxxxxxxxx <mailto:asn@xxxxxxxxxxxxxx>> wrote:
>>>
>>>             On Thursday, September 27, 2018 6:06:11 PM CEST
>>>             g4-lisz@xxxxxxxxxxxx <mailto:g4-lisz@xxxxxxxxxxxx> wrote:
>>>             > Thank you very much! This will help me a lot. I'll
>>>             will try to do this
>>>             > for Windows - wish me luck ;))
>>>
>>>             It would be great if someone could contribute an example ;-)
>>>
>>>
>>>
>>
>>
>>     On Sep 30, 2018 19:38, <g4-lisz@xxxxxxxxxxxx
>>     <mailto:g4-lisz@xxxxxxxxxxxx>> wrote:
>>
>>         Did you visit the GIT link of Zdenek? It seems that he got
>>         quite far with building a server... Or you are referring to
>>         port forwarding only?
>>
>>         Till
>>
>>
>>         On 30.09.2018 15:28, Stefano Mtangoo wrote:
>>>         It'll be really great. Once I tried and got nowhere. 
>>>
>>>         On Sun, Sep 30, 2018, 11:26 Andreas Schneider
>>>         <asn@xxxxxxxxxxxxxx <mailto:asn@xxxxxxxxxxxxxx>> wrote:
>>>
>>>             On Thursday, September 27, 2018 6:06:11 PM CEST
>>>             g4-lisz@xxxxxxxxxxxx <mailto:g4-lisz@xxxxxxxxxxxx> wrote:
>>>             > Thank you very much! This will help me a lot. I'll
>>>             will try to do this
>>>             > for Windows - wish me luck ;))
>>>
>>>             It would be great if someone could contribute an example ;-)
>>>
>>>
>>>
>>
>>
>
>
>
>


References:
Re: Sample Code for SSH Port Forwarding ServerSkalák, Zdeněk <zskalak@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org