| Summary: | Can't connect to a server that is using several host keys of the same type | ||
|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | jatjasjem |
| Component: | sshd | Assignee: | Assigned to nobody <unassigned-bugs> |
| Status: | CLOSED FIXED | ||
| Severity: | normal | CC: | djm |
| Priority: | P5 | ||
| Version: | 8.4p1 | ||
| Hardware: | amd64 | ||
| OS: | Linux | ||
|
Description
jatjasjem
2020-10-03 07:40:34 AEST
The SSH protocol does allow a host to have multiple host keys, but only one is ever offered at a time. The protocol contains no support for requesting or learning additional host keys of the same type. See https://tools.ietf.org/html/rfc4253#page-22 - the key exchange only includes a single hostkey. If you want your client to learn all the hostkeys that a host offers then use the UpdateHostkeys option. This is an OpenSSH protocol extension designed to fix this situation that will be enabled by default in OpenSSH 8.5. I am not sure what would be the use of multiple host keys of the same type if only one is offered at the same time. It the protocol doesn't allow retrying using a different host key, perhaps the server could refuse to start if given several host keys of the same type? In either case, while is possible to connect using different ECDSA keys, the algorithms must be specified explicitly. This seems to be due to the fact that given an ECDSA key `order_hostkeyalgs` in `sshconnect2.c` will return all ECDSA host key algorithms, including the ones incompatible with the key. This, in turn, seems to be due to the fact that OpenSSH considers the three ECDSA keys as being of the same type. Since you can't verify e.g. ECDSA nistp521 signature using "ecdsa-sha2-nistp384", perhaps OpenSSH could view the ECDSA keys as different ones? (In reply to jatjasjem from comment #2) > I am not sure what would be the use of multiple host keys of the > same type if > only one is offered at the same time. It the protocol doesn't allow > retrying > using a different host key, perhaps the server could refuse to start > if given > several host keys of the same type? No, because we have a protocol extension (UpdateHostkeys) that makes multiple host keys of the same type actually useful, e.g. gracefully rotating keys. > In either case, while is possible to connect using different ECDSA > keys, the > algorithms must be specified explicitly. This seems to be due to the > fact that > given an ECDSA key `order_hostkeyalgs` in `sshconnect2.c` will > return all > ECDSA host key algorithms, including the ones incompatible with the > key. This, > in turn, seems to be due to the fact that OpenSSH considers the > three ECDSA > keys as being of the same type. > > Since you can't verify e.g. ECDSA nistp521 signature using > "ecdsa-sha2-nistp384", perhaps OpenSSH could view the ECDSA keys as > different ones? Yes, I'll fix that. close bugs that were resolved in OpenSSH 8.5 release cycle |