issue with Sbridge ssh sftp client disconnect on sbridge server

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
tcaduto12068
Posts: 132
Joined: Wed 17 Aug 2016 05:57

issue with Sbridge ssh sftp client disconnect on sbridge server

Post by tcaduto12068 » Wed 18 Dec 2019 19:34

I'm having a error popup when I connect to my sbridge server using a sbridge client:
(using latest version of sbridge on Lazarus 2.06)

Code: Select all

12/18/2019 01:30:00 PM:[Error] SSH Client(127.0.0.1:50920) ERROR for user:testuser:Error on data reading from the connection:
An established connection was aborted by the software in your host machine..
This only happens with the sbridge sftp and ssh client, if I use filezilla etc no error.

Is this the proper way to use the devart SFTP Client?

Code: Select all

sftpmod.SSH.HostName:=maindatamod.FTPAddress;
          sftpmod.SSH.Port:=10022;
          sftpmod.SSH.User:=username;
          sftpmod.SSH.Password:=PassWord;
          sftpmod.SSH.Connect;
          if sftpmod.SSH.Connected then
              begin
                   if not sftpmod.SFTP.Active then
                      sftpmod.SFTP.Initialize;
                   sftpmod.SFTP.UploadFromStream(astream,'/'+testfilename,true);
                   MessageDlg(self,'Success','Test file uploaded successfully.',mtInformation,[mbok],0);
                   sftpmod.sftp.Disconnect;
                   sftpmod.SSH.Connected:=false; 
       end;  
Last edited by tcaduto12068 on Thu 19 Dec 2019 14:24, edited 2 times in total.

tcaduto12068
Posts: 132
Joined: Wed 17 Aug 2016 05:57

Re: issue with Sbridge ssh sftp disconnect on sbridge server

Post by tcaduto12068 » Wed 18 Dec 2019 19:50

Well no idea why this works but it gets rid of the error on the server:

Code: Select all

                   sftpmod.sftp.Disconnect;
                   sleep(500);
                   sftpmod.SSH.Disconnect;
                   sleep(500); 
Anyone have any idea why I have to add sleeps ?

The error on the Sbridge server is occurring in the OnClientError Event.

It's almost as if there is some kind of threading issue (missing a wait maybe?)with the SFTPClient component. I can go as low as 200ms in the sleeps before the error happens again.
I tried a bunch of other SFTP clients and the error does not happen with any of them, just the SecureBridge client component.
Any hints on if I am not using the SFTP and SSH client components properly?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: issue with Sbridge ssh sftp client disconnect on sbridge server

Post by ViktorV » Fri 20 Dec 2019 09:35

Please try to use night build of SecureBridge which we sent you and inform us about the results.

tcaduto12068
Posts: 132
Joined: Wed 17 Aug 2016 05:57

Re: issue with Sbridge ssh sftp client disconnect on sbridge server

Post by tcaduto12068 » Fri 20 Dec 2019 14:01

ok, I will check it out and report back :-) Thanks :-)

tcaduto12068
Posts: 132
Joined: Wed 17 Aug 2016 05:57

Re: issue with Sbridge ssh sftp client disconnect on sbridge server

Post by tcaduto12068 » Fri 20 Dec 2019 14:19

No change with the nightly build:

Code: Select all

12/20/2019 08:13:37 AM:[Error] SSH Client(127.0.0.1:59332) ERROR for user:testuser:Error on data reading from the connection:
An established connection was aborted by the software in your host machine..
Socket Error Code: 10053($2745)
This is the disconnect code I used on the client side:

Code: Select all

if (SSH.Connected) then
                begin
                     SFTP.Disconnect;
                     //sleep(100);
                     SSH.Disconnect;
                    // sleep(100);
                end;
                 


I can get that same error with Filezilla or other client if I kill it from the task manager. It's like the client component is not waiting for the response from the server when shutting down.

tcaduto12068
Posts: 132
Joined: Wed 17 Aug 2016 05:57

Re: issue with Sbridge ssh sftp client disconnect on sbridge server

Post by tcaduto12068 » Fri 20 Dec 2019 22:04

Update, I also ran everything on Linux and the error behavior is different and worse on Linux (Manjaro latest)

What happens on Linux is I connect with the client component do a directory listing and that works fine, then I let the client sit and it disconnects by itself on exactly the 15 second timeout defined in the client components properties with this error

Image

https://photos.app.goo.gl/hFpgz2WyaWSBvNzC6

As on windows the server is working perfectly with other clients like the Linux version of FileZilla, ssh command line etc.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Re: issue with Sbridge ssh sftp client disconnect on sbridge server

Post by Dimon » Mon 23 Dec 2019 15:14

Thank you for the information.
A distinctive feature of SSH protocol is that it doesn't send any special package to the server when closing the connection -- SSH simply closes the physical connection. This error suggests that the connection was closed on the SSH client side. We'll change the behavior of the SSH server to prevent the associated event for this error.

tcaduto12068
Posts: 132
Joined: Wed 17 Aug 2016 05:57

Re: issue with Sbridge ssh sftp client disconnect on sbridge server

Post by tcaduto12068 » Sat 28 Dec 2019 03:25

The secure bridge client did not exhibit this behavior a few versions ago and other clients don't cause the error on the secure bridge server, it seems to be a issue with the sb client. I started to notice this behavior maybe around April 2019.

tcaduto12068
Posts: 132
Joined: Wed 17 Aug 2016 05:57

Re: issue with Sbridge ssh sftp client disconnect on sbridge server

Post by tcaduto12068 » Mon 30 Dec 2019 07:11

I just installed the latest version you guys released on Friday and the issue is gone on Windows.
Will try on Linux in the morning. Thanks :-)

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: issue with Sbridge ssh sftp client disconnect on sbridge server

Post by ViktorV » Mon 30 Dec 2019 12:33

When you get any results concerning this question, please let us know.

Post Reply