Skip to content

Commit

Permalink
webhooks, aggregation: add metrics to count certs with SHA1 signatures
Browse files Browse the repository at this point in the history
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.

Kubernetes-commit: 499ee65a9b0cd45d41716b513fae0d537f7f9c88
  • Loading branch information
stlaz authored and k8s-publishing-bot committed Mar 24, 2022
1 parent b4638dd commit b933b02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/apiserver/handler_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,10 @@ func (r *proxyHandler) updateAPIService(apiService *apiregistrationv1api.APIServ
CAData: apiService.Spec.CABundle,
},
}
clientConfig.Wrap(x509metrics.NewMissingSANRoundTripperWrapperConstructor(x509MissingSANCounter))
clientConfig.Wrap(x509metrics.NewDeprecatedCertificateRoundTripperWrapperConstructor(
x509MissingSANCounter,
x509InsecureSHA1Counter,
))

newInfo := proxyHandlingInfo{
name: apiService.Name,
Expand Down
13 changes: 13 additions & 0 deletions pkg/apiserver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ var x509MissingSANCounter = metrics.NewCounter(
},
)

var x509InsecureSHA1Counter = metrics.NewCounter(
&metrics.CounterOpts{
Subsystem: "kube_aggregator",
Namespace: "apiserver",
Name: "x509_insecure_sha1_total",
Help: "Counts the number of requests to servers with insecure SHA1 signatures " +
"in their serving certificate OR the number of connection failures " +
"due to the insecure SHA1 signatures (either/or, based on the runtime environment)",
StabilityLevel: metrics.ALPHA,
},
)

func init() {
legacyregistry.MustRegister(x509MissingSANCounter)
legacyregistry.MustRegister(x509InsecureSHA1Counter)
}

0 comments on commit b933b02

Please sign in to comment.