use rsa-sha2-256 by default for RSA SSH signatures#45887
Merged
Conversation
zmb3
approved these changes
Aug 27, 2024
rsa-sha2-256 by default for RSA SSH signatures
vapopov
approved these changes
Aug 27, 2024
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.
Back in #33169
golang.org/x/crypto/sshwas updated, and it switched the default SSH RSA signature algorithm fromrsa-sha2-512torsa-sha2-256. At the time, we decided to explicitly continue to usersa-sha2-512for all RSA SSH signatures.There is nothing wrong with
rsa-sha2-512and we could continue to use it, but it has us in a weird state with GCP KMS. RSA2048 keys do not support SHA512 in GCP KMS, so currently we use RSA4096 keys on GCP KMS only.I have previously updated the code on master to use the default signing algorithm (with a SHA256 hash) for all non-RSA keys. This PR updates it so that we will now use
rsa-sha2-256for all RSA keys smaller than 4096 bits, andrsa-sha2-512for RSA keys that are 4096 bits or larger. I'm also removing the special case we have to generate 4096-bit keys on GCP KMS only. Going forward, all newly generated RSA keys will have 2048 bits.This is backward compatible with existing RSA4096 RSA keys in GCP KMS, they will continue to use
rsa-sha2-512. New and existing RSA2048 keys will now usersa-sha2-256which aligns with Go's new defaults. Non-RSA keys will use the only signature algorithm available for their key type, which we'll explicitly pin so that golang.org/x/crypto/ssh can't change it out from under us again if new signature algorithms are added.Changelog: RSA SSH signatures will use rsa-sha2-256 by default