@@ -69,8 +69,9 @@ const (
6969 renewalInfoPath = "/acme/renewal-info/"
7070
7171 // Non-ACME paths.
72- getCertPath = "/get/cert/"
73- buildIDPath = "/build"
72+ getCertPath = "/get/cert/"
73+ getCertInfoPath = "/get/certinfo/"
74+ buildIDPath = "/build"
7475)
7576
7677const (
@@ -423,6 +424,7 @@ func (wfe *WebFrontEndImpl) Handler(stats prometheus.Registerer, oTelHTTPOptions
423424
424425 // Boulder specific endpoints
425426 wfe .HandleFunc (m , getCertPath , wfe .Certificate , "GET" )
427+ wfe .HandleFunc (m , getCertInfoPath , wfe .CertificateInfo , "GET" )
426428 wfe .HandleFunc (m , buildIDPath , wfe .BuildID , "GET" )
427429
428430 // Endpoint for draft-ietf-acme-ari
@@ -1627,6 +1629,34 @@ func (wfe *WebFrontEndImpl) Authorization(
16271629 }
16281630}
16291631
1632+ // CertificateInfo is a Boulder-specific endpoint to return notAfter, even for serials
1633+ // which only appear in a precertificate and don't have a corresponding final cert.
1634+ //
1635+ // This is used by our CRL monitoring infrastructure to determine when it is acceptable
1636+ // for a serial to be removed from a CRL.
1637+ func (wfe * WebFrontEndImpl ) CertificateInfo (ctx context.Context , logEvent * web.RequestEvent , response http.ResponseWriter , request * http.Request ) {
1638+ serial := request .URL .Path
1639+ if ! core .ValidSerial (serial ) {
1640+ wfe .sendError (response , logEvent , probs .NotFound ("Certificate not found" ), nil )
1641+ return
1642+ }
1643+ metadata , err := wfe .sa .GetSerialMetadata (ctx , & sapb.Serial {Serial : serial })
1644+ if err != nil {
1645+ wfe .sendError (response , logEvent , web .ProblemDetailsForError (err , "Error getting certificate metadata" ), err )
1646+ return
1647+ }
1648+ certInfoStruct := struct {
1649+ NotAfter time.Time `json:"notAfter"`
1650+ }{
1651+ NotAfter : metadata .Expires .AsTime (),
1652+ }
1653+ err = wfe .writeJsonResponse (response , logEvent , http .StatusOK , certInfoStruct )
1654+ if err != nil {
1655+ wfe .sendError (response , logEvent , probs .ServerInternal ("Error marshalling certInfoStruct" ), err )
1656+ return
1657+ }
1658+ }
1659+
16301660// Certificate is used by clients to request a copy of their current certificate, or to
16311661// request a reissuance of the certificate.
16321662func (wfe * WebFrontEndImpl ) Certificate (ctx context.Context , logEvent * web.RequestEvent , response http.ResponseWriter , request * http.Request ) {
0 commit comments