Skip to content

Commit f3e973a

Browse files
ca/cert-checker: Support test log submissions (#8522)
Fixes #8508
1 parent be957c2 commit f3e973a

File tree

6 files changed

+27
-15
lines changed

6 files changed

+27
-15
lines changed

cmd/boulder-ca/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ type Config struct {
8787
// https://www.gstatic.com/ct/log_list/v3/log_list_schema.json
8888
CTLogListFile string
8989

90+
// CTIncludeTestLogs allows logs marked as "test" to be included in the
91+
// CT log list used for linting. This should be enabled in environments
92+
// configured to submit SCTs to test logs.
93+
CTIncludeTestLogs bool
94+
9095
// DisableCertService causes the CertificateAuthority gRPC service to not
9196
// start, preventing any certificates or precertificates from being issued.
9297
DisableCertService bool
@@ -159,7 +164,7 @@ func main() {
159164
// Do this before creating the issuers to ensure the log list is loaded before
160165
// the linters are initialized.
161166
if c.CA.CTLogListFile != "" {
162-
err = loglist.InitLintList(c.CA.CTLogListFile)
167+
err = loglist.InitLintList(c.CA.CTLogListFile, c.CA.CTIncludeTestLogs)
163168
cmd.FailOnError(err, "Failed to load CT Log List")
164169
}
165170

cmd/cert-checker/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,11 @@ type Config struct {
559559
// https://www.gstatic.com/ct/log_list/v3/log_list_schema.json
560560
CTLogListFile string
561561

562+
// CTIncludeTestLogs allows logs marked as "test" to be included in the
563+
// CT log list used for linting. This should be enabled in environments
564+
// configured to submit SCTs to test logs.
565+
CTIncludeTestLogs bool
566+
562567
Features features.Config
563568
}
564569
PA cmd.PAConfig
@@ -616,7 +621,7 @@ func main() {
616621
cmd.FailOnError(err, "Failed to load HostnamePolicyFile")
617622

618623
if config.CertChecker.CTLogListFile != "" {
619-
err = loglist.InitLintList(config.CertChecker.CTLogListFile)
624+
err = loglist.InitLintList(config.CertChecker.CTLogListFile, config.CertChecker.CTIncludeTestLogs)
620625
cmd.FailOnError(err, "Failed to load CT Log List")
621626
}
622627

cmd/cert-checker/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ func TestIgnoredLint(t *testing.T) {
583583
saCleanup()
584584
}()
585585

586-
err = loglist.InitLintList("../../test/ct-test-srv/log_list.json")
586+
err = loglist.InitLintList("../../test/ct-test-srv/log_list.json", false)
587587
test.AssertNotError(t, err, "failed to load ct log list")
588588
testKey, _ := rsa.GenerateKey(rand.Reader, 2048)
589589
checker := newChecker(saDbMap, clock.NewFake(), pa, kp, time.Hour, testValidityDurations, nil, blog.NewMock())

ctpolicy/ctconfig/ctconfig.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ type CTConfig struct {
1111
// from one operator group to accept a certificate before attempting
1212
// submission to a log run by a different operator instead.
1313
Stagger config.Duration
14-
// LogListFile is a path to a JSON log list file. The file must match Chrome's
15-
// schema: https://www.gstatic.com/ct/log_list/v3/log_list_schema.json
14+
// LogListFile is the path to a JSON file on disk containing the set of all
15+
// logs trusted by Chrome. The file must match the v3 log list schema:
16+
// https://www.gstatic.com/ct/log_list/v3/log_list_schema.json
1617
LogListFile string `validate:"required"`
1718
// SCTLogs is a list of CT log names to submit precerts to in order to get SCTs.
1819
SCTLogs []string `validate:"min=1,dive,required"`

ctpolicy/loglist/lintlist.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ var lintlist struct {
99
}
1010

1111
// InitLintList creates and stores a loglist intended for linting (i.e. with
12-
// purpose Validation). We have to store this in a global because the zlint
13-
// framework doesn't (yet) support configuration, so the e_scts_from_same_operator
14-
// lint cannot load a log list on its own. Instead, we have the CA call this
15-
// initialization function at startup, and have the lint call the getter below
16-
// to get access to the cached list.
17-
func InitLintList(path string) error {
12+
// purpose Validation). Test logs are included only when submitToTestLogs is
13+
// true. We have to store this in a global because the zlint framework doesn't
14+
// (yet) support configuration, so the e_scts_from_same_operator lint cannot
15+
// load a log list on its own. Instead, we have the CA call this initialization
16+
// function at startup, and have the lint call the getter below to get access to
17+
// the cached list.
18+
func InitLintList(path string, submitToTestLogs bool) error {
1819
lintlist.Do(func() {
1920
l, err := New(path)
2021
if err != nil {
2122
lintlist.err = err
2223
return
2324
}
2425

25-
l, err = l.forPurpose(Validation, false)
26+
l, err = l.forPurpose(Validation, submitToTestLogs)
2627
if err != nil {
2728
lintlist.err = err
2829
return

issuance/cert_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ func TestIssueSCTList(t *testing.T) {
656656
fc := clock.NewFake()
657657
fc.Set(time.Now())
658658

659-
err := loglist.InitLintList("../test/ct-test-srv/log_list.json")
659+
err := loglist.InitLintList("../test/ct-test-srv/log_list.json", false)
660660
test.AssertNotError(t, err, "failed to load log list")
661661

662662
pc := defaultProfileConfig()
@@ -807,7 +807,7 @@ func TestInvalidProfile(t *testing.T) {
807807
fc := clock.NewFake()
808808
fc.Set(time.Now())
809809

810-
err := loglist.InitLintList("../test/ct-test-srv/log_list.json")
810+
err := loglist.InitLintList("../test/ct-test-srv/log_list.json", false)
811811
test.AssertNotError(t, err, "failed to load log list")
812812

813813
signer, err := newIssuer(defaultIssuerConfig(), issuerCert, issuerSigner, fc)
@@ -850,7 +850,7 @@ func TestInvalidProfile(t *testing.T) {
850850
func TestMismatchedProfiles(t *testing.T) {
851851
fc := clock.NewFake()
852852
fc.Set(time.Now())
853-
err := loglist.InitLintList("../test/ct-test-srv/log_list.json")
853+
err := loglist.InitLintList("../test/ct-test-srv/log_list.json", false)
854854
test.AssertNotError(t, err, "failed to load log list")
855855

856856
issuer1, err := newIssuer(defaultIssuerConfig(), issuerCert, issuerSigner, fc)

0 commit comments

Comments
 (0)