SSH: Negotiation failed. Disconnected by the server ('Internal server error').

0 votes
asked Mar 27 by Selventhran (250 points)
edited Mar 27 by Selventhran

Any idea about this error? I am getting this while connecting to the SFTP server and tried all the possible solutions given in forums and it didn't work.

More logs:
2019-03-27 12:39:08.543 DEBUG Sftp(1)[9] SSH: Negotiating key.
2019-03-27 12:39:08.575 DEBUG Sftp(1)[9] SSH: Received 2048-bit Diffie-Hellman prime (minimum allowed size is 1024 bits).
2019-03-27 12:39:08.590 VERBOSE Sftp(1)[9] SSH: Sending packet SSHMSGKEXDHGEXINIT (262 bytes).
0000 |20-00-00-01-01-00-CA-0A 9D-58-C3-5C-27-C7-A9-FE| ........X.\'...
0010 |53-9D-36-E4-C9-C1-48-D2 74-EF-1B-CE-B3-F2-21-CC| S.6...H.t.....!.
0020 |1F-85-48-B7-D3-8C-18-47 E1-76-77-EB-54-C5-90-2F| ..H....G.vw.T../
0030 |43-BF-14-81-D6-CE-D1-22 DC-57-6B-34-F7-02-6B-C4| C......".Wk4..k.
0040 |BC-F4-96-E2-00-26-81-D1 D5-0C-68-25-1B-B4-7E-F8| .....&....h%..~.
0050 |AB-05-34-A1-4E-4C-8F-84 1F-A6-D6-90-2D-65-25-B0| ..4.NL......-e%.
0060 |48-94-87-71-92-8E-AE-D7 10-D5-C4-91-8F-1A-61-68| H..q..........ah
0070 |2D-4F-64-C5-51-0D-2C-DB 7C-FC-65-11-83-86-38-24| -Od.Q.,.|.e...8$
0080 |DA-B8-57-12-16-59-00-21 6D-28-01-A2-4D-44-FC-58| ..W..Y.!m(..MD.X
0090 |CF-3C-B9-9D-05-26-9B-5D D4-F5-C3-CD-88-FF-06-08| .<...&.]........
00A0 |FE-71-BB-88-EF-07-11-72 DC-48-E5-96-9B-FD-41-00| .q.....r.H....A.
00B0 |2A-41-DF-5D-36-55-13-0D 9A-14-ED-FE-E5-76-28-46| *A.]6U.......v(F
00C0 |E4-90-01-41-D1-9E-62-4F 7B-BF-6A-E6-28-2B-FF-4B| ...A..bO{.j.(+.K
00D0 |1E-99-4B-29-B5-57-10-76 4B-D4-C2-22-66-5A-B5-45| ..K).W.vK.."fZ.E
00E0 |74-CE-E1-31-BB-39-27-8B 7A-CD-D1-BF-D2-A0-89-87| t..1.9'.z.......
00F0 |0F-C6-CC-08-6A-95-23-21 61-36-CF-0C-31-75-BE-E7| ....j.#!a6..1u..
0100 |0A-8F-9F-92-01-A6 | ......
2019-03-27 12:39:08.731 VERBOSE Sftp(1)[11] SSH: Received packet SSH
MSGDISCONNECT (35 bytes).
0000 |01-00-00-00-0B-00-00-00 16-49-6E-74-65-72-6E-61| .........Interna
0010 |6C-20-73-65-72-76-65-72 20-65-72-72-6F-72-2E-00| l server error..
0020 |00-00-00 | ...
2019-03-27 12:39:08.731 INFO Sftp(1)[11] SSH: Disconnected by the server ('Internal server error').
2019-03-27 12:39:08.731 VERBOSE Sftp(1)[11] SSH: Sending packet SSH
MSG_DISCONNECT (27 bytes).
0000 |01-00-00-00-0B-00-00-00 0E-53-65-73-73-69-6F-6E| .........Session
0010 |20-63-6C-6F-73-65-64-00 00-00-00 | closed....
2019-03-27 12:39:08.793 ERROR Sftp(1)[9] SSH: Negotiation failed. Disconnected by the server ('Internal server error').
2019-03-27 12:39:08.856 ERROR Sftp(1)[9] Info: Rebex.Net.SshException: Disconnected by the server ('Internal server error').
at Rebex.Net.SshSession.tssd[b,c](dixd2 aga, Int32 agb, dixe agc, c agd, b age, b agf) at Rebex.Net.SshSession.tssc[b,c](dixd2 afy, c afz)
at Rebex.Net.SshSession.tssk(jcqm ago)
at jcqq.xkxw(SshSession bac, Byte[] bad, Byte[] bae, Byte[] baf, Byte[] bag, jcqg& bah, Byte[]& bai, SshPublicKey& baj)
at Rebex.Net.SshSession.tssm(Byte[] agp)
at Rebex.Net.SshSession.Negotiate()
at Rebex.Net.Sftp.mtxo.klsf(kuvq alr, Boolean als)
at Rebex.Net.Sftp.nqyl(String po, Int32 pp, SshParameters pq, kuvq pr)

Applies to: Rebex SFTP
commented Mar 28 by Lukas Pokorny (101,070 points)
1) Which version of Rebex SFTP do you use?
2) Try setting Sftp object's Settings.SshParameters.PreferredHostKeyAlgorithm to SshHostKeyAlgorithm.RSA and let us know whether it makes any difference.
commented Mar 28 by Selventhran (250 points)
Hi, I was using Rebex SFTP (2017 R4.1) for .NET 4.0-4.7 (FULL VERSION) and Rebex SFTP (2018 R4) for .NET 4.0 -4.7 (Trial Version).

I tried setting up preferred Host Key algorithm as RSA and still getting the same error.

We are getting this error while connecting to one specific SFTP server using Rebex, but we are able to connect to this SFTP server using other clients such as FileZilla, WinSCP.

Here is the Debug level log while connecting to one specific SFTP server.


2019-03-28 09:29:45.678 INFO FileLogWriter(1)[8] Info: Assembly: Rebex.Common 2018 R4 for .NET 4.0-4.7
2019-03-28 09:29:45.690 INFO FileLogWriter(1)[8] Info: Platform: Windows 6.2.9200 32-bit; CLR: 4.0.30319.42000
2019-03-28 09:29:45.691 DEBUG FileLogWriter(1)[8] Info: Culture: en; Windows-1252
2019-03-28 09:29:45.772 INFO Sftp(1)[8] Info: Connecting to sftp1.xxxxxxxxxxx.com:22 using Sftp.
2019-03-28 09:29:45.774 INFO Sftp(1)[8] Info: Assembly: Rebex.Sftp 2018 R4 for .NET 4.0-4.7 (Trial)
2019-03-28 09:29:45.774 INFO Sftp(1)[8] Info: Platform: Windows 6.2.9200 32-bit; CLR: 4.0.30319.42000
2019-03-28 09:29:45.774 DEBUG Sftp(1)[8] Info: Culture: en; Windows-1252
2019-03-28 09:29:45.883 DEBUG Sftp(1)[8] Proxy: Resolving 'sftp1.xxxxxxxxxxx.com'.
2019-03-28 09:29:46.338 DEBUG Sftp(1)[8] Proxy: Connecting to 23.xx.xxx.104:22 (no proxy).
2019-03-28 09:29:46.937 DEBUG Sftp(1)[8] SSH: Server is 'SSH-2.0-RebexSSH_1.0.6051.2'.
2019-03-28 09:29:46.947 INFO Sftp(1)[8] SSH: Negotiation started.
2019-03-28 09:29:47.226 DEBUG Sftp(1)[8] SSH: Group exchange.
2019-03-28 09:29:47.711 DEBUG Sftp(1)[8] SSH: Negotiating key.
2019-03-28 09:29:47.756 DEBUG Sftp(1)[8] SSH: Received 2048-bit Diffie-Hellman prime (minimum allowed size is 1024 bits).
2019-03-28 09:29:48.158 INFO Sftp(1)[10] SSH: Disconnected by the server ('Internal server error').
2019-03-28 09:29:48.232 ERROR Sftp(1)[8] SSH: Negotiation failed. Disconnected by the server ('Internal server error').
2019-03-28 09:29:48.286 ERROR Sftp(1)[8] Info: Rebex.Net.SshException: Disconnected by the server ('Internal server error').
   at Rebex.Net.SshSession.tssd[b,c](dixd`2 aga, Int32 agb, dixe agc, c agd, b age, b agf)
   at Rebex.Net.SshSession.tssc[b,c](dixd`2 afy, c afz)
   at Rebex.Net.SshSession.tssk(jcqm ago)
   at jcqq.xkxw(SshSession bac, Byte[] bad, Byte[] bae, Byte[] baf, Byte[] bag, jcqg& bah, Byte[]& bai, SshPublicKey& baj)
   at Rebex.Net.SshSession.tssm(Byte[] agp)
   at Rebex.Net.SshSession.Negotiate()
   at Rebex.Net.Sftp.mtxo.klsf(kuvq alr, Boolean als)
   at Rebex.Net.Sftp.nqyl(String po, Int32 pp, SshParameters pq, kuvq pr)

2 Answers

0 votes
answered Mar 28 by Lukas Pokorny (101,070 points)
selected Mar 28 by Selventhran
 
Best answer

Thanks again! It looks like there is some issue in the 3-year-old Rebex File Server beta that makes it to fail when the client attempts to negotiate a session with ssh-rsa-sha256@ssh.com host key cipher. SFTP client's that don't support ssh-rsa-sha256@ssh.com cipher are able to connect without issues. Disabling the cipher in Rebex SFTP client (by only enabling ssh-rsa) works around the issue:

var sftp = new Sftp();
sftp.Settings.SshParameters.SetHostKeyAlgorithms("ssh-rsa");
sftp.Connect(...);
commented Mar 28 by Selventhran (250 points)
Thanks a lot! This trick worked :)
0 votes
answered Mar 28 by Lukas Pokorny (101,070 points)

Thanks for the additional information.

a) Is the SFTP server under your control? It appears to be running a 3-year-old beta of Rebex File Server, so its log hopefully contains more information about the exception that caused the "Internal server error" to occur. In any case, upgrading to a recent version of Rebex File Server is strongly recommended. The beta has not been sufficiently tested and may contain bugs.

b) Alternatively (or if the server is not under your control), configuring Rebex SFTP to behave more like FileZilla or WinSCP should work around the issue. To do this, you would have to determine the ciphers used by FileZilla or WinSCP and configure Sftp object's Settings.SshParameters accordingly - contact us at support@rebex.net for help with this.

c) Could we try connecting to this server? If we were able to reproduce the issue, we can try (b) ourselves and hopefully work around the issue in minutes. (We don't need any credentials for this because the error occurs before authentication takes place. Just the server address.)

commented Mar 28 by Selventhran (250 points)
We don't have a control on SFTP server and server address is sftp1.supplylogix.com. Thanks!
...