Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renci.SSH Error in VB.Net, Getting Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server. #1569

Open
Jeffs-GitHub opened this issue Jan 9, 2025 · 1 comment

Comments

@Jeffs-GitHub
Copy link

Attempts to connect to a server using Renci.SSH result in an exception.

The device can be accessed usingTeraterm.

.Net gives this exception:
Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.CreateAndConnectSession()
at Renci.SshNet.BaseClient.Connect()

This is the output from Debug:
SshNet.Logging Verbose: 1 : Initiating connection to '<my_ip_addr>:22'.
SshNet.Logging Verbose: 1 : Server version '2.0' on 'OpenSSH_9.2p1 Debian-2+deb12u3'.
SshNet.Logging Verbose: 5 : [] Received message 'KeyExchangeInitMessage' from server: 'SSH_MSG_KEXINIT'.
SshNet.Logging Verbose: 5 : [] Sending message 'KeyExchangeInitMessage' to server: 'SSH_MSG_KEXINIT'.
SshNet.Logging Verbose: 5 : [] Sending message 'KeyExchangeDhGroupExchangeRequest' to server: 'SSH_MSG_KEX_DH_GEX_REQUEST'.
SshNet.Logging Verbose: 5 : [] Raised exception: Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.
SshNet.Logging Verbose: 1 : [] Disposing session.
SshNet.Logging Verbose: 1 : [] Disconnecting session.
SshNet.Logging Verbose: 1 : [] Shutting down socket.
SshNet.Logging Verbose: 1 : [] Disposing socket.
SshNet.Logging Verbose: 1 : [] Disposed socket.
SshNet.Logging Verbose: 5 : [] Disconnecting after exception: Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.CreateAndConnectSession()
Exception thrown: 'Renci.SshNet.Common.SshConnectionException' in Renci.SshNet.dll

Here is some version info:
Renci.SshNet, Version=2020.0.1.0
Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.10.1

It looks like my server did not like the key exchange request.

In Teraterm, it says "The server's host key fingerprint is: Fingerprint hash algorithm SHA256" then shows the hash.

Does anyone have any ideas that I could try? Is there any other information I could provide in helping find a solution?

@Rob-Hague
Copy link
Collaborator

Hi, do you see the same problem on the latest version 2024.2.0? Or at least 2023.0.1. Quite a lot has changed in the library since 2020.0.1

If the problem still occurs, the next step would probably be to capture a packet trace with wireshark or similar. That might inform a bit more about the exact contents and flow of the initial exchange packets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants