mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
tls: Final check of OCSP response validity date before stapling
This commit is contained in:
parent
c6a2911725
commit
a2db340378
1 changed files with 7 additions and 0 deletions
|
@ -151,6 +151,13 @@ func stapleOCSP(cert *Certificate, pemBundle []byte) error {
|
||||||
// the certificate. If the OCSP response was not loaded from
|
// the certificate. If the OCSP response was not loaded from
|
||||||
// storage, we persist it for next time.
|
// storage, we persist it for next time.
|
||||||
if ocspResp.Status == ocsp.Good {
|
if ocspResp.Status == ocsp.Good {
|
||||||
|
if ocspResp.NextUpdate.After(cert.NotAfter) {
|
||||||
|
// uh oh, this OCSP response expires AFTER the certificate does, that's kinda bogus.
|
||||||
|
// it was the reason a lot of Symantec-validated sites (not Caddy) went down
|
||||||
|
// in October 2017. https://twitter.com/mattiasgeniar/status/919432824708648961
|
||||||
|
return fmt.Errorf("invalid: OCSP response for %v valid after certificate expiration (%s)",
|
||||||
|
cert.Names, cert.NotAfter.Sub(ocspResp.NextUpdate))
|
||||||
|
}
|
||||||
cert.Certificate.OCSPStaple = ocspBytes
|
cert.Certificate.OCSPStaple = ocspBytes
|
||||||
cert.OCSP = ocspResp
|
cert.OCSP = ocspResp
|
||||||
if gotNewOCSP {
|
if gotNewOCSP {
|
||||||
|
|
Loading…
Reference in a new issue