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

[GEP-18] Introduce dedicated client CA for shoot clusters #5779

Merged
merged 6 commits into from
Apr 19, 2022

Conversation

rfranzke
Copy link
Member

@rfranzke rfranzke commented Apr 8, 2022

How to categorize this PR?

/area security
/kind enhancement

What this PR does / why we need it:
This PR introduces a dedicated client CA for shoot clusters as suggested in GEP-18.

For existing clusters, the new ca-client secret will have the same content like the ca secret for backwards-compatibility reasons.
For new clusters, the ca-client secret will be different from the ca secret.

The kube-apiserver always uses the client CA bundle containing the current and potential old client CA certificates. The kube-controller-manager always uses the current client CA certificate to ensure new client certificates are always signed with the most recent client CA certificate.

Which issue(s) this PR fixes:
Part of #3292

Special notes for your reviewer:
/cc @timebertt

Release note:

Newly created shoot clusters now get a dedicated CA certificate which is used for signing client certificates. Note that this client CA is different from the cluster CA. For existing clusters, the client CA is the same like the cluster CA to ensure backwards compatibility.

@rfranzke rfranzke requested a review from a team as a code owner April 8, 2022 11:19
@gardener-prow gardener-prow bot requested a review from timebertt April 8, 2022 11:19
@gardener-prow gardener-prow bot added area/security Security related kind/enhancement Enhancement, improvement, extension cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. labels Apr 8, 2022
@gardener-prow gardener-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 8, 2022
@timebertt
Copy link
Member

/test pull-gardener-publish-test-images

@timebertt
Copy link
Member

/test ?

@gardener-prow
Copy link
Contributor

gardener-prow bot commented Apr 12, 2022

@timebertt: The following commands are available to trigger required jobs:

  • /test pull-gardener-e2e-kind
  • /test pull-gardener-integration
  • /test pull-gardener-unit
  • /test pull-gardener-verify-image-build

The following commands are available to trigger optional jobs:

  • /test pull-gardener-apidiff
  • /test pull-gardener-publish-test-images

Use /test all to run the following jobs that were automatically triggered:

  • pull-gardener-apidiff
  • pull-gardener-e2e-kind
  • pull-gardener-integration
  • pull-gardener-unit
  • pull-gardener-verify-image-build

In response to this:

/test ?

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.

@timebertt
Copy link
Member

/test pull-gardener-publish-test-images

@timebertt
Copy link
Member

/test pull-gardener-e2e-kind

@rfranzke
Copy link
Member Author

/retest-required

@plkokanov
Copy link
Contributor

Just a small typo in the release note. I guess it should be Newly created shoot clusters now ... instead of Newly created shoot clusters no .... Otherwise it looks good.

@rfranzke
Copy link
Member Author

Thanks @plkokanov, fixed

@plkokanov
Copy link
Contributor

/lgtm

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Apr 14, 2022
@timebertt
Copy link
Member

/assign
will take a look today

Copy link
Member

@timebertt timebertt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. As discussed, only nits :)

pkg/operation/botanist/secrets.go Outdated Show resolved Hide resolved
pkg/utils/secrets/manager/generate.go Show resolved Hide resolved
For backwards-compatibility reasons, the client CA is the same like the cluster CA for existing clusters.
For new clusters, a CA certificate different from the cluster CA shall be generated right away. This is why we have to generate the client CA first and cannot simply add the certificate secret config to the `b.wantedCertificateAuthorities` map because the generation order is randomized. Otherwise, if the `ca` secret is generated before `ca-client` then the cluster CA certificate would be adopted (which is not what we want for new clusters).
@gardener-prow gardener-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 19, 2022
@rfranzke rfranzke requested a review from timebertt April 19, 2022 14:34
@gardener-prow
Copy link
Contributor

gardener-prow bot commented Apr 19, 2022

@rfranzke: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gardener-apidiff b7b2f33 link false /test pull-gardener-apidiff

Full PR test history. Your PR dashboard. Command help for this repository.

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.

@rfranzke
Copy link
Member Author

/test pull-gardener-e2e-kind

Copy link
Member

@timebertt timebertt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@gardener-prow
Copy link
Contributor

gardener-prow bot commented Apr 19, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: timebertt

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

@gardener-prow gardener-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Apr 19, 2022
@gardener-prow gardener-prow bot merged commit 190d44c into gardener:master Apr 19, 2022
@rfranzke rfranzke deleted the enh/clientca branch April 20, 2022 06:12
krgostev pushed a commit to krgostev/gardener that referenced this pull request Jul 5, 2022
)

* Introduce new client CA certificate for shoots

For backwards-compatibility reasons, the client CA is the same like the cluster CA for existing clusters.
For new clusters, a CA certificate different from the cluster CA shall be generated right away. This is why we have to generate the client CA first and cannot simply add the certificate secret config to the `b.wantedCertificateAuthorities` map because the generation order is randomized. Otherwise, if the `ca` secret is generated before `ca-client` then the cluster CA certificate would be adopted (which is not what we want for new clusters).

* Adapt `kubeapiserver` component to use client CA

* Adapt `kubecontrollermanager` component to use client CA

KCM always uses the current client CA secret which is used to sign new client certificates.

* Adapt `kubescheduler` component to use client CA

* Sign client certificates by new client CA

* Address PR review feedback
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. area/security Security related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/enhancement Enhancement, improvement, extension lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants