Skip to content

Commit

Permalink
Remove common config from publisher
Browse files Browse the repository at this point in the history
The old `config.Common.CT.IntermediateBundleFilename` format is no
longer used in any production configs, and can be removed safely.
  • Loading branch information
aarongable committed Mar 18, 2021
1 parent 98a0934 commit 0b03147
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 44 deletions.
33 changes: 7 additions & 26 deletions cmd/boulder-publisher/main.go
Expand Up @@ -10,7 +10,6 @@ import (
healthpb "google.golang.org/grpc/health/grpc_health_v1"

"github.com/letsencrypt/boulder/cmd"
"github.com/letsencrypt/boulder/core"
"github.com/letsencrypt/boulder/features"
bgrpc "github.com/letsencrypt/boulder/grpc"
"github.com/letsencrypt/boulder/issuance"
Expand All @@ -36,13 +35,6 @@ type config struct {
}

Syslog cmd.SyslogConfig

// TODO(5269): Remove this after all configs have migrated to `Chains`.
Common struct {
CT struct {
IntermediateBundleFilename string
}
}
}

func main() {
Expand Down Expand Up @@ -77,29 +69,18 @@ func main() {
defer logger.AuditPanic()
logger.Info(cmd.VersionString())

// TODO(5269): Refactor this after all configs have migrated to `Chains`.
if c.Common.CT.IntermediateBundleFilename == "" && c.Publisher.Chains == nil {
logger.AuditErr("No CT submission bundle file or chain files provided")
if c.Publisher.Chains == nil {
logger.AuditErr("No chain files provided")
os.Exit(1)
}

bundles := make(map[issuance.IssuerNameID][]ct.ASN1Cert)
if len(c.Publisher.Chains) > 0 {
for _, files := range c.Publisher.Chains {
chain, err := issuance.LoadChain(files)
cmd.FailOnError(err, "failed to load chain.")
issuer := chain[0]
id := issuer.NameID()
bundles[id] = publisher.GetCTBundleForChain(chain)
}
} else {
// TODO(5269): Remove this after all configs have migrated to
// `Chains`.
certs, err := core.LoadCertBundle(c.Common.CT.IntermediateBundleFilename)
cmd.FailOnError(err, "failed to load certs from PEM file")
issuer := &issuance.Certificate{Certificate: certs[0]}
for _, files := range c.Publisher.Chains {
chain, err := issuance.LoadChain(files)
cmd.FailOnError(err, "failed to load chain.")
issuer := chain[0]
id := issuer.NameID()
bundles[id] = publisher.GetCTBundleForCerts(certs)
bundles[id] = publisher.GetCTBundleForChain(chain)
}

tlsConfig, err := c.Publisher.TLS.Load()
Expand Down
36 changes: 18 additions & 18 deletions test/config-next/publisher.json
Expand Up @@ -2,23 +2,6 @@
"publisher": {
"userAgent": "boulder/1.0",
"blockProfileRate": 1000000000,
"debugAddr": ":8009",
"grpc": {
"maxConnectionAge": "30s",
"address": ":9091",
"clientNames": [
"health-checker.boulder",
"ocsp-updater.boulder",
"ra.boulder"
]
},
"tls": {
"caCertFile": "test/grpc-creds/minica.pem",
"certFile": "test/grpc-creds/publisher.boulder/cert.pem",
"keyFile": "test/grpc-creds/publisher.boulder/key.pem"
},
"features": {
},
"chains": [
[
"/tmp/intermediate-cert-rsa-a.pem",
Expand All @@ -36,7 +19,24 @@
"/tmp/intermediate-cert-ecdsa-b.pem",
"/tmp/root-cert-ecdsa.pem"
]
]
],
"debugAddr": ":8009",
"grpc": {
"maxConnectionAge": "30s",
"address": ":9091",
"clientNames": [
"health-checker.boulder",
"ocsp-updater.boulder",
"ra.boulder"
]
},
"tls": {
"caCertFile": "test/grpc-creds/minica.pem",
"certFile": "test/grpc-creds/publisher.boulder/cert.pem",
"keyFile": "test/grpc-creds/publisher.boulder/key.pem"
},
"features": {
}
},

"syslog": {
Expand Down
18 changes: 18 additions & 0 deletions test/config/publisher.json
Expand Up @@ -2,6 +2,24 @@
"publisher": {
"userAgent": "boulder/1.0",
"blockProfileRate": 1000000000,
"chains": [
[
"/tmp/intermediate-cert-rsa-a.pem",
"/tmp/root-cert-rsa.pem"
],
[
"/tmp/intermediate-cert-rsa-b.pem",
"/tmp/root-cert-rsa.pem"
],
[
"/tmp/intermediate-cert-ecdsa-a.pem",
"/tmp/root-cert-ecdsa.pem"
],
[
"/tmp/intermediate-cert-ecdsa-b.pem",
"/tmp/root-cert-ecdsa.pem"
]
],
"debugAddr": ":8009",
"grpc": {
"address": ":9091",
Expand Down

0 comments on commit 0b03147

Please sign in to comment.