eliminate rsa.GenerateKey and lib/auth/native #47768
Merged
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.
This PR eliminates almost all remaining calls of
rsa.GenerateKey
from the codebase. Most calls were going through thelib/auth/native
package, which this PR almost completely removes except for a few reference still called from teleport.e code, which will be removed in a follow-up PR. The RSA key precomputation logic used in 2 places in the codebase plus a number of tests is still supported, the code has just been moved tolib/cryptosuites/internal/rsa
.This change almost exclusively effects tests, most production code has already migrated away from hardcoding RSA key generation. The one change to product code is the removal of
lib/auth/native.GenerateEICEKey
, which has been replaced by a call tocryptosuites.GenerateKey(ctx, cryptosuites.GetCurrentSuiteFromAuthPreference(s.GetAccessPoint()), cryptosuites.EC2InstanceConnect)
which will now use ECDSAP256 instead of RSA2048 when the cluster is in FIPS mode.There will be a buddy PR to teleport.e removing some calls there, then a follow-up PR here to remove the unused functions and add a lint rule so that no-one can use rsa.GenerateKey in the future without explicitly ignoring the lint rule.