cert-checker: only log database errors (#7077)

Fixes https://github.com/letsencrypt/boulder/issues/7040
This commit is contained in:
Aaron Gable 2023-09-18 15:46:51 -07:00 committed by GitHub
parent 6ce2ee3efd
commit cad7266d86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -65,6 +65,7 @@ type report struct {
end time.Time end time.Time
GoodCerts int64 `json:"good-certs"` GoodCerts int64 `json:"good-certs"`
BadCerts int64 `json:"bad-certs"` BadCerts int64 `json:"bad-certs"`
DbErrs int64 `json:"db-errs"`
Entries map[string]reportEntry `json:"entries"` Entries map[string]reportEntry `json:"entries"`
} }
@ -411,13 +412,15 @@ func (c *certChecker) checkCert(ctx context.Context, cert core.Certificate, igno
if features.Enabled(features.CertCheckerRequiresCorrespondence) { if features.Enabled(features.CertCheckerRequiresCorrespondence) {
precertDER, err := c.getPrecert(ctx, cert.Serial) precertDER, err := c.getPrecert(ctx, cert.Serial)
if err != nil { if err != nil {
problems = append(problems, // Log and continue, since we want the problems slice to only contains
fmt.Sprintf("fetching linting precertificate for %s: %s", cert.Serial, err)) // problems with the cert itself.
c.logger.Errf("fetching linting precertificate for %s: %s", cert.Serial, err)
atomic.AddInt64(&c.issuedReport.DbErrs, 1)
} else { } else {
err = precert.Correspond(precertDER, cert.DER) err = precert.Correspond(precertDER, cert.DER)
if err != nil { if err != nil {
problems = append(problems, problems = append(problems,
fmt.Sprintf("checking correspondence for %s: %s", cert.Serial, err)) fmt.Sprintf("Certificate does not correspond to precert for %s: %s", cert.Serial, err))
} }
} }
} }

View File

@ -647,7 +647,7 @@ func TestPrecertCorrespond(t *testing.T) {
} }
// Ensure that at least one of the problems was related to checking correspondence // Ensure that at least one of the problems was related to checking correspondence
for _, p := range problems { for _, p := range problems {
if strings.Contains(p, "checking correspondence for") { if strings.Contains(p, "does not correspond to precert") {
return return
} }
} }