-
Notifications
You must be signed in to change notification settings - Fork 154
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
"Connection lost" with 2.2.1, works with 1.12.2 (logs included) #290
Comments
You may be running into #276, caused by Dropbear failing if it doesn't find one of its supported host key algorithms in the first 20 entries in the client's list. AsyncSSH supports more than 20 public key algorithms now, and the Dropbear-compatible args are way down at the end of the list, as they are the weakest. Try adding server_host_key_algs=['ssh-rsa'] in your connect() call and see if that makes a difference. Normally, this won't be seen if you are doing known_hosts checking, as AsyncSSH will default to only sending algorithms it has a known hosts entry for. However, when you disable that check, it sends its full list, and that can trigger this issue. |
Right, adding this param make the connection work again. Pretty hard to debug IMHO, would it be possible to detect dropbear while greeting and apply workaround ? Thanks |
In the next release of AsyncSSH, I'll be disabling DSA keys by default, and I think that will be enough to keep the RSA algorithm in the default list within Dropbear's limit, at least for now. As for applying the workaround automatically, I do have some workarounds for bugs I've run into in other clients/servers, but I've tried to write such code in a way that doesn't depend on the version string sent in the handshake. That'll be more difficult to do here, though, since the decision needs to be made before sending the kexinit, which is the first packet after the version strings are exchanged. If I add more public key algorithms in the future that trigger this, I'll revisit this. Perhaps I could do something to move ssh-rsa up in the list of allowed public keys, but only for dropbear and when known hosts checking is disabled. At that point, we're really not validating the server's host key anyway, so the ordering of allowed public key algorithms probably doesn't matter much. |
Fair enough, thanks a lot for the full explanation ! |
This issue should no longer occur with AsyncSSH 2.3.0, unless you enable all algorithms and leave ssh-rsa toward the very end of the list (beyond where Dropbear will look). |
Hello,
I wanted to upgrade to the newer version but my code isn't connecting anymore.
Here is a narrowed down script reproducing the issue:
With 1.12.2 it works as expected:
With 2.2.1 it fails:
The target device is a LTE modem running dropbear, so it might be a little "non standard" but still it worked before ;-)
I initially though this could be a cypher issue, because I had to also upgrade "cryptography" module but no, old asyncssh with new cryptography work as expected, so I really think this is a regression...
Thanks in advance,
Adam.
PS: Don't hesitate to ask me for more logs or tests, I'll provide asap.
The text was updated successfully, but these errors were encountered: