| Summary: | known_hosts @cert-authority with legacy plain key entry drops incorrect set of HostKeyAlgorithms | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Paul Kapp <paullkapp> | ||||||
| Component: | ssh | Assignee: | Damien Miller <djm> | ||||||
| Status: | CLOSED FIXED | ||||||||
| Severity: | normal | CC: | djm, dtucker | ||||||
| Priority: | P5 | ||||||||
| Version: | 8.1p1 | ||||||||
| Hardware: | All | ||||||||
| OS: | Mac OS X | ||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 3162 | ||||||||
| Attachments: |
|
||||||||
|
Description
Paul Kapp
2020-05-04 06:50:04 AEST
Created attachment 3389 [details]
Consider CA keys when automatically determining host key order
Nice catch. Could you please try this patch?
It is different, but not quite correct either, IMO. The CA key type listed as the @cert-authority entry could be used to sign any key type. If a @cert-authority is applicable from known_hosts, the client should include all the available certificate types in the list offered to the server, since the client is prepared to trust any of the certificate types SignedBy the CA, and has no way to predict which type(s) may be available on the server. Ordering of the list is probably suitable, moving some certificate types to the head of the list, based on other plain key types matched in known_hosts, as the fallback to plain keys logic may still be used. However, the full list (as appears in HostKeyAlgorithms) ought to be represented. Yes, this patch does happen to fix the particular case, but not the general case. From my example, my test server had an ed25519 host key signed by an ed25519 CA, and the client did include a request for host key/cert of type ssh-ed25519-cert-v01@openssh.com. The remote host may have a certificate of type ecdsa-sha2-nistp256-cert-v01@openssh.com signed by that same ed25519 CA, which would also be acceptable. If the remote host had only that cert available, the host validation would fail, since the client does not include ecdsa-sha2-nistp256-cert-v01@openssh.com in its priority list. Created attachment 3390 [details]
Prefer certificate algorithm if @cert-authority line appears in hostkeys
yeah, I realised my mistake yesterday too.
Please try this one: it prefers all default certificate algorithms if the hostkeys files contain a @cert-authority line.
Looks good to me. Thanks for the quick action on this. This has been committed and will be in openssh-8.4. Thanks! Mass close of all bugs fixed in 8.4 release. |