Skip to content
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

Merged
merged 3 commits into from
Feb 28, 2018
Merged

Increase key size in GeneratePrivateKey() to 3072 #4354

merged 3 commits into from
Feb 28, 2018

Conversation

snelson-pp
Copy link
Contributor

@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.

@k8s-ci-robot
Copy link
Contributor

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.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please email the CNCF helpdesk: [email protected]

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 30, 2018
@chrislovecnm
Copy link
Contributor

You mind signing the cla? Thanks you only have to do it once

@snelson-pp
Copy link
Contributor Author

The CLA should now be properly signed.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 5, 2018
@chrislovecnm
Copy link
Contributor

/assign @justinsb

PTAL

@chrislovecnm
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 5, 2018
@justinsb
Copy link
Member

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:

  • We persuade ourselves it is safe (should be easy enough), and 3072 is the correct bump. (i.e. why not 4096)
  • I think once the CA key is created, it won't be changed. So an environment variable would be an easy fix, and wouldn't have the normal problem where if you forget to specify when using kops in the future things change "back".
  • We could also put it in a field or flag to kops create cluster. I don't think we want to put it into the cluster spec, because it would then be duplicating the information in the key itself.

Personally I think the environment variable is the easy option. What do you think @snelson-pp ?

@johngmyers
Copy link
Member

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.

@snelson-pp
Copy link
Contributor Author

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?

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 21, 2018
@snelson-pp
Copy link
Contributor Author

snelson-pp commented Feb 21, 2018

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.

@justinsb justinsb added this to the 1.9 milestone Feb 21, 2018

if os.Getenv("RSA_PRIVATE_KEY_SIZE") != "" {
var intErr error
rsaKeySize, intErr = strconv.ParseInt(os.Getenv("RSA_PRIVATE_KEY_SIZE"), 0, 0)
Copy link
Member

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 :-)

@justinsb
Copy link
Member

That looks great - I suggested prefixing the env var with KOPS_ (naming is always the hardest thing) but otherwise LGTM

@snelson-pp
Copy link
Contributor Author

@justinsb Thanks! I added the prefix.

@justinsb
Copy link
Member

Thanks @snelson-pp - looks great

/lgtm

/retest

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 28, 2018
@justinsb justinsb added blocks-next and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 28, 2018
@justinsb
Copy link
Member

/retest

@justinsb
Copy link
Member

/approve

Not sure why I removed approved but apparently I did.

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 28, 2018
@k8s-ci-robot k8s-ci-robot merged commit b6fc321 into kubernetes:master Feb 28, 2018
@snelson-pp snelson-pp deleted the increase-generated-cert-bits branch March 1, 2018 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. blocks-next cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants