Repository navigation
Conversation
f1f1af1 to
df024e5
Compare
|
rebased, conflicts resolved |
df024e5 to
25771e9
Compare
|
I decided to change the style of this, and use the literal key type names. There's only the three ECDSA key types, and that set won't change any time soon, so the balance of simplicity/robustness in this case favors just writing them out, in my humble opinion. I haven't seen an opinion either way from the maintainer, and I would be happy to change the style back if that ends up being preferred. For reference, here's the previous version of this PR, which I thought was uglier and not really justified by the theoretical robustness: --- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -122,10 +122,10 @@ class Transport (threading.Thread, ClosingContextManager):
'hmac-md5-96',
'hmac-sha1',
)
- _preferred_keys = (
+ _preferred_keys = tuple(ECDSAKey.supported_key_format_identifiers()) + (
'ssh-rsa',
'ssh-dss',
- ) + tuple(ECDSAKey.supported_key_format_identifiers())
+ )
_preferred_kex = (
'diffie-hellman-group1-sha1',
'diffie-hellman-group14-sha1',
@@ -210,8 +210,11 @@ class Transport (threading.Thread, ClosingContextManager):
_key_info = {
'ssh-rsa': RSAKey,
'ssh-dss': DSSKey,
- 'ecdsa-sha2-nistp256': ECDSAKey,
}
+ _key_info.update(
+ (name, ECDSAKey)
+ for name in ECDSAKey.supported_key_format_identifiers()
+ )
_kex_info = {
'diffie-hellman-group1-sha1': KexGroup1,You can see the new version by looking at this PR's Files Changed |
25771e9 to
b4d97b3
Compare
|
... and then I split out half of this PR to #981 because it really is a bug fix that should be backported |
|
Had a second thought about "won't this bite anyone currently relying on the selection of the older key types, and thus shouldn't this be a 3.0 change", but that's more of a worry for user keys and not host keys, I think. |
b4d97b3 to
674fd06
Compare
|
resolved conflicts, put ecdsa keys even in front of ed25519, because this is the order openssh on macOS seems to use:
EDIT: preference of more recent openssh on ubuntu-16.04 is similar:
|
|
Seems reasonable. thanks! |
|
re: selection of keys: that's what #910 is about, often the wrong host key is selected ... |
|
... to clarify: and then after the wrong host key is selected, connection is silently allowed to continue under a MissingHostKeyPolicy variant which doesn't save. This happens for fabric and I think ansible as well |
|
Mildly amusing thought, shouldn't OpenSSH (and us) be preferring the larger-key-size variants of these algorithms over the smaller-key-size ones? (I.e. I kinda trust OpenSSH knows what it's doing so as always "do what they do" seems fine, but it made me think. Also presumably there's a cost to using larger keys. |
|
The reasoning might be that the larger key sizes are needlessly/wastefully large for today, but available in case of need in the future. |
|
Honestly, if this is backwards compatible & also just not very instability-causing, we might as well roll it back to 2.0 and treat it as an outright bugfix. Otherwise feels a little odd putting this in 2.2 but not 2.0.x/2.1.x. Can always revert it in those lines if somebody gets megafucked somehow. |
|
Agree it should probably be in 2.0 as well, but the conflict resolution when up-merging to 2.1 will be a bit tricky. I do have a branch with this change applied to 2.0 already, I'll push it up ... |
|
oh nvm I was thinking about #910 again |
The openssh client prefers ecdsa server host keys.
674fd06 to
bace976
Compare
|
rebased on 2.0 branch |
|
Ugh I thought I said I was in the middle of doing that, but, I did not say that. Sorry! Got hung up pushing it because of a stupid docs related rabbit hole. |
|
Pushed now, includes a newer changelog line. Thanks again. |
|
no problem, thank you :) |
fixes #794 and #900
second part of an alternative set of PRs to #899