fix(client): encode the negotiated hash algorithm for RSA certificates - #764
Merged
Merged
Conversation
`Method::FutureCertificate` carries a `hash_alg`, but both the probe request and the signed request encoded `cert.algorithm().to_certificate_type()`, which always yields `ssh-rsa-cert-v01@openssh.com` for an RSA certificate. Servers that reject SHA-1 signatures therefore refuse RSA user certificates even when the client selected SHA-256 or SHA-512. Thread the hash algorithm into `client_make_to_sign` and apply it with `with_hash_alg` in both places, so the wire carries `rsa-sha2-512-cert-v01@openssh.com` or `rsa-sha2-256-cert-v01@openssh.com` when one is selected. Non-RSA certificates and the self-signed `OpenSshCertificate` path are unaffected.
Owner
|
Thank you! @all-contributors add @inureyes for code |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Method::FutureCertificatecarries ahash_alg, but both the probe request and the signed request encodedcert.algorithm().to_certificate_type(), which always yieldsssh-rsa-cert-v01@openssh.comfor an RSA certificate. A server that rejects SHA-1 signatures therefore refuses RSA user certificates even when the client selected SHA-256 or SHA-512.client_make_to_signnow takes the certificate hash algorithm and applies it withwith_hash_algin both places, so the wire carriesrsa-sha2-512-cert-v01@openssh.comorrsa-sha2-256-cert-v01@openssh.comwhen one is selected. Non-RSA certificates encode identically to before, and the self-signedOpenSshCertificatepath passesNone, so its behavior is unchanged.A new test drives all three hash selections through both the probe and the signed request. Removing either
with_hash_algcall makes it fail withssh-rsa-cert-v01@openssh.com.compression::tests::partial_flush_packets_round_tripfails onmainat d3ae702 as well, and #757 looks like the fix. Everything else passes.