Skip to content

use rsa-sha2-256 by default for RSA SSH signatures#45887

Merged
nklaassen merged 1 commit intomasterfrom
nklaassen/ssh-algs
Aug 27, 2024
Merged

use rsa-sha2-256 by default for RSA SSH signatures#45887
nklaassen merged 1 commit intomasterfrom
nklaassen/ssh-algs

Conversation

@nklaassen
Copy link
Copy Markdown
Contributor

@nklaassen nklaassen commented Aug 27, 2024

Back in #33169 golang.org/x/crypto/ssh was updated, and it switched the default SSH RSA signature algorithm from rsa-sha2-512 to rsa-sha2-256. At the time, we decided to explicitly continue to use rsa-sha2-512 for all RSA SSH signatures.

There is nothing wrong with rsa-sha2-512 and 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-256 for all RSA keys smaller than 4096 bits, and rsa-sha2-512 for 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 use rsa-sha2-256 which 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

@github-actions github-actions Bot requested review from vapopov and zmb3 August 27, 2024 01:37
@gravitational gravitational deleted a comment from github-actions Bot Aug 27, 2024
@gravitational gravitational deleted a comment from github-actions Bot Aug 27, 2024
@nklaassen nklaassen changed the title sign SSH certs with ssh-sha2-256 by default sign SSH certs with rsa-sha2-256 by default Aug 27, 2024
@nklaassen nklaassen changed the title sign SSH certs with rsa-sha2-256 by default use rsa-sha2-256 by default for RSA SSH signatures Aug 27, 2024
@nklaassen nklaassen added this pull request to the merge queue Aug 27, 2024
Merged via the queue into master with commit b4380e3 Aug 27, 2024
@nklaassen nklaassen deleted the nklaassen/ssh-algs branch August 27, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants