Skip to content

Commit

Permalink
Only warn if less than 28 days to cert expires (#5077)
Browse files Browse the repository at this point in the history
Fixes #5076 as much as reasonable.
  • Loading branch information
klauspost authored Nov 5, 2024
1 parent 95a03f5 commit 6ac1861
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/client-s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ func (n notifyExpiringTLS) RoundTrip(req *http.Request) (res *http.Response, err

cert := res.TLS.PeerCertificates[0] // leaf certificate
validityDur := cert.NotAfter.Sub(cert.NotBefore)
if time.Since(cert.NotBefore) > time.Duration(0.9*float64(validityDur)) {
// Warn if less than 10% of time left and it is less than 28 days.
if time.Until(cert.NotAfter) < time.Duration(min(0.1*float64(validityDur), 28*24*float64(time.Hour))) {
globalExpiringCerts.Store(req.Host, cert.NotAfter)
}

Expand Down

0 comments on commit 6ac1861

Please sign in to comment.