-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase key size in GeneratePrivateKey() to 3072 #4354
Increase key size in GeneratePrivateKey() to 3072 #4354
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
You mind signing the cla? Thanks you only have to do it once |
The CLA should now be properly signed. |
/assign @justinsb PTAL |
/ok-to-test |
So I checked and it looks like GKE also uses a 2048 key. So while I think this PR is OK, but there's lots of fragile TLS code out there, so I'm a little worried. I think there are a few options:
Personally I think the environment variable is the easy option. What do you think @snelson-pp ? |
https://www.keylength.com/ has a good summary of various key size recommendations. Most of them recommend 3072 for protection after year 2030, though the most recent one, from BSI, recommends that for after year 2022. Why not 4096 would be because it consumes more CPU. |
I don't have a problem with passing it in as an environment variable. Are there conventions on how to pass environment variables? Or should I just use os.Getenv in the function? |
Now we look for the key size in an environment variable "RSA_PRIVATE_KEY_SIZE". I'm not sure if there are conventions to follow about accessing environment variables or their names, so please let me know, @justinsb. |
pkg/pki/privatekey.go
Outdated
|
||
if os.Getenv("RSA_PRIVATE_KEY_SIZE") != "" { | ||
var intErr error | ||
rsaKeySize, intErr = strconv.ParseInt(os.Getenv("RSA_PRIVATE_KEY_SIZE"), 0, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name it KOPS_RSA_PRIVATE_KEY_SIZE
just to avoid possible collisions - I think we've tried to prefix all our env vars like that just to keep them clear as well?
But then LGTM - and the strconv.ParseInt(s, 0, 0)
trick was new to me (I've always used strconv.Atoi
) but that's pretty cool :-)
That looks great - I suggested prefixing the env var with |
@justinsb Thanks! I added the prefix. |
Thanks @snelson-pp - looks great /lgtm /retest |
/retest |
/approve Not sure why I removed approved but apparently I did. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb, snelson-pp The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@justinsb Our SecOps group requires private keys be at 3072; others may be in the same boat. I talked to @chrislovecnm and he suggested I bump it and send a PR.