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

webhooks,aggregation: add metrics to count certs with SHA1 signatures #109024

Merged
merged 4 commits into from
Mar 28, 2022

Conversation

stlaz
Copy link
Member

@stlaz stlaz commented Mar 25, 2022

What type of PR is this?
/kind feature

What this PR does / why we need it:
Extends the certificate attribute deprecation RoundTrippers wrapper with
a checker that counts certificates with sha-1 signatures in server responses.

Non-root non-self-signed SHA-1 certificate signatures were deprecated in
Golang 1.18

Which issue(s) this PR fixes:
#108940

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

(this release note includes log and audit annotation prefixes added in #109107)

Kubernetes 1.24 is built with go1.18, which will no longer validate certificates signed with a SHA-1 hash algorithm by default. See https://golang.org/doc/go1.18#sha1 for more details. If you are using certificates like this in admission or conversion webhooks or in aggregated API servers, you should replace those certificates as soon as possible, since SHA-1 is no longer considered secure. If you cannot replace those certificates before upgrading to Kubernetes 1.24, or do not know whether you have certificates like this, you can:
* temporarily re-enable honoring SHA-1 certificates by setting the `GODEBUG=x509sha1=1` environment variable when starting kube-apiserver
* monitor `apiserver_kube_aggregator_x509_insecure_sha1_total` and `apiserver_webhooks_x509_insecure_sha1_total` metrics in `kube-apiserver`, added in v1.24; non-zero values for these metrics indicate connections to aggregated API servers or webhooks are encountering SHA-1 certificates, and will stop working in the future when go removes SHA-1 support completely
* if metrics indicate SHA-1 certificates are being encountered, information about the specific hosts serving those certificates is available in the kube-apiserver log, containing `invalid-cert.kubernetes.io`, and in the kube-apiserver audit log, with an `insecure-sha1.invalid-cert.kubernetes.io/$hostname` audit annotation

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

[Other doc]: https://tip.golang.org/doc/go1.18#sha1

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Mar 25, 2022
@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 25, 2022
@k8s-ci-robot k8s-ci-robot requested a review from sttts March 25, 2022 16:14
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 25, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @stlaz. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 25, 2022
@MadhavJivrajani
Copy link
Contributor

/ok-to-test
/priority critical-urgent

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 26, 2022
@MadhavJivrajani
Copy link
Contributor

/remove-priority critical-urgent
/priority important-soon
(oops!)

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Mar 26, 2022
@stlaz
Copy link
Member Author

stlaz commented Mar 26, 2022

/test pull-kubernetes-integration
the logs say all the tests passed but the status still seems red here

@MadhavJivrajani
Copy link
Contributor

@liggitt fyi

Copy link
Member

@logicalhan logicalhan left a comment

Choose a reason for hiding this comment

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

/lgtm
(from a metrics side)

Extends the certificate attribute deprecation RoundTrippers wrapper with
a checker that counts certificates with sha-1 signatures in server responses.

Non-root non-self-signed SHA-1 certificate signatures were deprecated in
Golang 1.18.
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 28, 2022
@liggitt
Copy link
Member

liggitt commented Mar 28, 2022

/lgtm
/approve
/hold cancel
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 28, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, stlaz

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

@liggitt
Copy link
Member

liggitt commented Mar 28, 2022

I updated the release note to reference the go release notes, describe use of GODEBUG, the new metrics, and the kube-apiserver log.

@liggitt
Copy link
Member

liggitt commented Mar 28, 2022

I also marked it as action-required

@liggitt liggitt added release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Mar 28, 2022
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. labels Mar 28, 2022
@k8s-ci-robot k8s-ci-robot merged commit e0ca5cf into kubernetes:master Mar 28, 2022
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/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants