Skip to content

Commit 24f7f72

Browse files
Merge remote-tracking branch 'origin/main' into add-vitess
2 parents 55dcd24 + f676b96 commit 24f7f72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1680
-445
lines changed

ca/ca_test.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,19 @@ func newCAArgs(t *testing.T) *caArgs {
134134
test.AssertNotError(t, err, "Couldn't set identifier policy")
135135

136136
legacy, err := issuance.NewProfile(issuance.ProfileConfig{
137-
IncludeCRLDistributionPoints: true,
138-
MaxValidityPeriod: config.Duration{Duration: time.Hour * 24 * 90},
139-
MaxValidityBackdate: config.Duration{Duration: time.Hour},
140-
IgnoredLints: []string{"w_subject_common_name_included"},
137+
MaxValidityPeriod: config.Duration{Duration: time.Hour * 24 * 90},
138+
MaxValidityBackdate: config.Duration{Duration: time.Hour},
139+
IgnoredLints: []string{"w_subject_common_name_included"},
141140
})
142141
test.AssertNotError(t, err, "Loading test profile")
143142
modern, err := issuance.NewProfile(issuance.ProfileConfig{
144-
OmitCommonName: true,
145-
OmitKeyEncipherment: true,
146-
OmitClientAuth: true,
147-
OmitSKID: true,
148-
IncludeCRLDistributionPoints: true,
149-
MaxValidityPeriod: config.Duration{Duration: time.Hour * 24 * 6},
150-
MaxValidityBackdate: config.Duration{Duration: time.Hour},
151-
IgnoredLints: []string{"w_ext_subject_key_identifier_missing_sub_cert"},
143+
OmitCommonName: true,
144+
OmitKeyEncipherment: true,
145+
OmitClientAuth: true,
146+
OmitSKID: true,
147+
MaxValidityPeriod: config.Duration{Duration: time.Hour * 24 * 6},
148+
MaxValidityBackdate: config.Duration{Duration: time.Hour},
149+
IgnoredLints: []string{"w_ext_subject_key_identifier_missing_sub_cert"},
152150
})
153151
test.AssertNotError(t, err, "Loading test profile")
154152
profiles := map[string]*issuance.Profile{
@@ -161,7 +159,6 @@ func newCAArgs(t *testing.T) *caArgs {
161159
issuers[i], err = issuance.LoadIssuer(issuance.IssuerConfig{
162160
Active: true,
163161
IssuerURL: fmt.Sprintf("http://not-example.com/i/%s", name),
164-
OCSPURL: "http://not-example.com/o",
165162
CRLURLBase: fmt.Sprintf("http://not-example.com/c/%s/", name),
166163
CRLShards: 10,
167164
Location: issuance.IssuerLoc{
@@ -886,7 +883,6 @@ func TestPickIssuer_Inactive(t *testing.T) {
886883
issuer, err := issuance.LoadIssuer(issuance.IssuerConfig{
887884
Active: i%2 == 0,
888885
IssuerURL: fmt.Sprintf("http://not-example.com/i/%s", name),
889-
OCSPURL: "http://not-example.com/o",
890886
CRLURLBase: fmt.Sprintf("http://not-example.com/c/%s/", name),
891887
CRLShards: 10,
892888
Location: issuance.IssuerLoc{

cmd/boulder-ca/main.go

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/letsencrypt/boulder/ca"
1313
capb "github.com/letsencrypt/boulder/ca/proto"
1414
"github.com/letsencrypt/boulder/cmd"
15-
"github.com/letsencrypt/boulder/config"
1615
"github.com/letsencrypt/boulder/ctpolicy/loglist"
1716
"github.com/letsencrypt/boulder/features"
1817
"github.com/letsencrypt/boulder/goodkey"
@@ -75,12 +74,6 @@ type Config struct {
7574
// configurations.
7675
MaxNames int `validate:"required,min=1,max=100"`
7776

78-
// LifespanOCSP is how long OCSP responses are valid for. Per the BRs,
79-
// Section 4.9.10, it MUST NOT be more than 10 days. Default 96h.
80-
//
81-
// Deprecated: TODO(#8345): Remove this.
82-
LifespanOCSP config.Duration
83-
8477
// GoodKey is an embedded config stanza for the goodkey library.
8578
GoodKey goodkey.Config
8679

@@ -89,17 +82,6 @@ type Config struct {
8982
// OCSP and CRL audit log emission. Recommended to be around 4000.
9083
OCSPLogMaxLength int
9184

92-
// Maximum period (in Go duration format) to wait to accumulate a max-length
93-
// OCSP audit log line. We will emit a log line at least once per period,
94-
// if there is anything to be logged. Keeping this low minimizes the risk
95-
// of losing logs during a catastrophic failure. Making it too high
96-
// means logging more often than necessary, which is inefficient in terms
97-
// of bytes and log system resources.
98-
// Recommended to be around 500ms.
99-
//
100-
// Deprecated: TODO(#8345): Remove this.
101-
OCSPLogPeriod config.Duration
102-
10385
// CTLogListFile is the path to a JSON file on disk containing the set of
10486
// all logs trusted by Chrome. The file must match the v3 log list schema:
10587
// https://www.gstatic.com/ct/log_list/v3/log_list_schema.json
@@ -108,11 +90,7 @@ type Config struct {
10890
// DisableCertService causes the CertificateAuthority gRPC service to not
10991
// start, preventing any certificates or precertificates from being issued.
11092
DisableCertService bool
111-
// DisableOCSPService causes the OCSPGenerator gRPC service to not start,
112-
// preventing any OCSP responses from being issued.
113-
//
114-
// Deprecated: TODO(#8345): Remove this.
115-
DisableOCSPService bool
93+
11694
// DisableCRLService causes the CRLGenerator gRPC service to not start,
11795
// preventing any CRLs from being issued.
11896
DisableCRLService bool

cmd/boulder-ra/main.go

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"flag"
66
"os"
7+
"time"
78

89
"github.com/jmhodges/clock"
910

@@ -44,9 +45,6 @@ type Config struct {
4445
CAService *cmd.GRPCClientConfig
4546
PublisherService *cmd.GRPCClientConfig
4647

47-
// Deprecated: TODO(#8345): Remove this.
48-
AkamaiPurgerService *cmd.GRPCClientConfig
49-
5048
// Deprecated: TODO(#8349): Remove this when removing the corresponding
5149
// service from the CA.
5250
OCSPService *cmd.GRPCClientConfig
@@ -69,13 +67,17 @@ type Config struct {
6967

7068
// Overrides is a path to a YAML file containing overrides for the
7169
// default rate limits. See: ratelimits/README.md for details. If
72-
// this field is not set, all requesters will be subject to the
73-
// default rate limits. Overrides passed in this file must be
74-
// identical to those in the WFE.
70+
// neither this field nor OverridesFromDB is set, all requesters
71+
// will be subject to the default rate limits. Overrides passed in
72+
// this file must be identical to those in the WFE.
7573
//
7674
// Note: At this time, only the Failed Authorizations overrides are
7775
// necessary in the RA.
7876
Overrides string
77+
78+
// OverridesFromDB causes the WFE and RA to retrieve rate limit overrides
79+
// from the database, instead of from a file.
80+
OverridesFromDB bool
7981
}
8082

8183
// MaxNames is the maximum number of subjectAltNames in a single cert.
@@ -100,15 +102,6 @@ type Config struct {
100102
// default.
101103
DefaultProfileName string `validate:"required"`
102104

103-
// MustStapleAllowList specified the path to a YAML file containing a
104-
// list of account IDs permitted to request certificates with the OCSP
105-
// Must-Staple extension.
106-
//
107-
// Deprecated: This field no longer has any effect, all Must-Staple requests
108-
// are rejected.
109-
// TODO(#8345): Remove this field.
110-
MustStapleAllowList string `validate:"omitempty"`
111-
112105
// GoodKey is an embedded config stanza for the goodkey library.
113106
GoodKey goodkey.Config
114107

@@ -271,8 +264,18 @@ func main() {
271264
source := ratelimits.NewRedisSource(limiterRedis.Ring, clk, scope)
272265
limiter, err = ratelimits.NewLimiter(clk, source, scope)
273266
cmd.FailOnError(err, "Failed to create rate limiter")
274-
txnBuilder, err = ratelimits.NewTransactionBuilderFromFiles(c.RA.Limiter.Defaults, c.RA.Limiter.Overrides)
267+
if c.RA.Limiter.OverridesFromDB {
268+
if c.RA.Limiter.Overrides != "" {
269+
cmd.Fail("OverridesFromDB and an overrides file were both defined, but are mutually exclusive")
270+
}
271+
saroc := sapb.NewStorageAuthorityReadOnlyClient(saConn)
272+
txnBuilder, err = ratelimits.NewTransactionBuilderFromDatabase(c.RA.Limiter.Defaults, saroc.GetEnabledRateLimitOverrides, scope, logger)
273+
} else {
274+
txnBuilder, err = ratelimits.NewTransactionBuilderFromFiles(c.RA.Limiter.Defaults, c.RA.Limiter.Overrides, scope, logger)
275+
}
275276
cmd.FailOnError(err, "Failed to create rate limits transaction builder")
277+
overrideRefresherShutdown := txnBuilder.NewRefresher(30 * time.Minute)
278+
defer overrideRefresherShutdown()
276279
}
277280

278281
rai := ra.NewRegistrationAuthorityImpl(

cmd/boulder-wfe2/main.go

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,15 @@ type Config struct {
151151

152152
// Overrides is a path to a YAML file containing overrides for the
153153
// default rate limits. See: ratelimits/README.md for details. If
154-
// this field is not set, all requesters will be subject to the
155-
// default rate limits. Overrides for the Failed Authorizations
156-
// overrides passed in this file must be identical to those in the
157-
// RA.
154+
// neither this field nor OverridesFromDB is set, all requesters
155+
// will be subject to the default rate limits. Overrides for the
156+
// Failed Authorizations overrides passed in this file must be
157+
// identical to those in the RA.
158158
Overrides string
159+
160+
// OverridesFromDB causes the WFE and RA to retrieve rate limit
161+
// overrides from the database, instead of from a file.
162+
OverridesFromDB bool
159163
}
160164

161165
// CertProfiles is a map of acceptable certificate profile names to
@@ -326,6 +330,7 @@ func main() {
326330
var limiter *ratelimits.Limiter
327331
var txnBuilder *ratelimits.TransactionBuilder
328332
var limiterRedis *bredis.Ring
333+
overridesRefresherShutdown := func() {}
329334
if c.WFE.Limiter.Defaults != "" {
330335
// Setup rate limiting.
331336
limiterRedis, err = bredis.NewRingFromConfig(*c.WFE.Limiter.Redis, stats, logger)
@@ -334,8 +339,16 @@ func main() {
334339
source := ratelimits.NewRedisSource(limiterRedis.Ring, clk, stats)
335340
limiter, err = ratelimits.NewLimiter(clk, source, stats)
336341
cmd.FailOnError(err, "Failed to create rate limiter")
337-
txnBuilder, err = ratelimits.NewTransactionBuilderFromFiles(c.WFE.Limiter.Defaults, c.WFE.Limiter.Overrides)
342+
if c.WFE.Limiter.OverridesFromDB {
343+
if c.WFE.Limiter.Overrides != "" {
344+
cmd.Fail("OverridesFromDB and an overrides file were both defined, but are mutually exclusive")
345+
}
346+
txnBuilder, err = ratelimits.NewTransactionBuilderFromDatabase(c.WFE.Limiter.Defaults, sac.GetEnabledRateLimitOverrides, stats, logger)
347+
} else {
348+
txnBuilder, err = ratelimits.NewTransactionBuilderFromFiles(c.WFE.Limiter.Defaults, c.WFE.Limiter.Overrides, stats, logger)
349+
}
338350
cmd.FailOnError(err, "Failed to create rate limits transaction builder")
351+
overridesRefresherShutdown = txnBuilder.NewRefresher(30 * time.Minute)
339352
}
340353

341354
var accountGetter wfe2.AccountGetter
@@ -413,6 +426,7 @@ func main() {
413426
defer func() {
414427
ctx, cancel := context.WithTimeout(context.Background(), c.WFE.ShutdownStopTimeout.Duration)
415428
defer cancel()
429+
overridesRefresherShutdown()
416430
_ = srv.Shutdown(ctx)
417431
_ = tlsSrv.Shutdown(ctx)
418432
limiterRedis.StopLookups()

cmd/crl-updater/main.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,6 @@ type Config struct {
7272
// of magnitude greater than our p99 update latency.
7373
UpdateTimeout config.Duration `validate:"-"`
7474

75-
// TemporallyShardedSerialPrefixes is a list of prefixes that were used to
76-
// issue certificates with no CRLDistributionPoints extension, and which are
77-
// therefore temporally sharded. If it's non-empty, the CRL Updater will
78-
// require matching serials when querying by temporal shard. When querying
79-
// by explicit shard, any prefix is allowed.
80-
//
81-
// This should be set to the current set of serial prefixes in production.
82-
// When deploying explicit sharding (i.e. the CRLDistributionPoints extension),
83-
// the CAs should be configured with a new set of serial prefixes that haven't
84-
// been used before.
85-
//
86-
// Deprecated: The updater no longer supports temporal sharding.
87-
// TODO(#8345): Remove this.
88-
TemporallyShardedSerialPrefixes []string
89-
9075
// MaxParallelism controls how many workers may be running in parallel.
9176
// A higher value reduces the total time necessary to update all CRL shards
9277
// that this updater is responsible for, but also increases the memory used

cmd/email-exporter/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type Config struct {
4545
ClientSecret cmd.PasswordConfig
4646

4747
// SalesforceBaseURL is the base URL for the Salesforce API. (e.g.,
48-
// "https://login.salesforce.com")
48+
// "https://company.salesforce.com")
4949
SalesforceBaseURL string `validate:"required"`
5050

5151
// PardotBaseURL is the base URL for the Pardot API. (e.g.,
@@ -100,7 +100,7 @@ func main() {
100100
cache = email.NewHashedEmailCache(c.EmailExporter.EmailCacheSize, scope)
101101
}
102102

103-
pardotClient, err := email.NewPardotClientImpl(
103+
sfClient, err := email.NewSalesforceClientImpl(
104104
clk,
105105
c.EmailExporter.PardotBusinessUnit,
106106
clientId,
@@ -109,7 +109,7 @@ func main() {
109109
c.EmailExporter.PardotBaseURL,
110110
)
111111
cmd.FailOnError(err, "Creating Pardot API client")
112-
exporterServer := email.NewExporterImpl(pardotClient, cache, c.EmailExporter.PerDayLimit, c.EmailExporter.MaxConcurrentRequests, scope, logger)
112+
exporterServer := email.NewExporterImpl(sfClient, cache, c.EmailExporter.PerDayLimit, c.EmailExporter.MaxConcurrentRequests, scope, logger)
113113

114114
tlsConfig, err := c.EmailExporter.TLS.Load(scope)
115115
cmd.FailOnError(err, "Loading email-exporter TLS config")

cmd/sfe/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func main() {
223223
source := ratelimits.NewRedisSource(limiterRedis.Ring, clk, stats)
224224
limiter, err = ratelimits.NewLimiter(clk, source, stats)
225225
cmd.FailOnError(err, "Failed to create rate limiter")
226-
txnBuilder, err = ratelimits.NewTransactionBuilderFromFiles(c.SFE.Limiter.Defaults, "")
226+
txnBuilder, err = ratelimits.NewTransactionBuilderFromFiles(c.SFE.Limiter.Defaults, "", stats, logger)
227227
cmd.FailOnError(err, "Failed to create rate limits transaction builder")
228228
}
229229

email/exporter.go

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ type ExporterImpl struct {
3939

4040
maxConcurrentRequests int
4141
limiter *rate.Limiter
42-
client PardotClient
42+
client SalesforceClient
4343
emailCache *EmailCache
4444
emailsHandledCounter prometheus.Counter
4545
pardotErrorCounter prometheus.Counter
46+
caseErrorCounter prometheus.Counter
4647
log blog.Logger
4748
}
4849

@@ -55,7 +56,7 @@ var _ emailpb.ExporterServer = (*ExporterImpl)(nil)
5556
// is assigned 40% (20,000 requests), it should also receive 40% of the max
5657
// concurrent requests (e.g., 2 out of 5). For more details, see:
5758
// https://developer.salesforce.com/docs/marketing/pardot/guide/overview.html?q=rate%20limits
58-
func NewExporterImpl(client PardotClient, cache *EmailCache, perDayLimit float64, maxConcurrentRequests int, scope prometheus.Registerer, logger blog.Logger) *ExporterImpl {
59+
func NewExporterImpl(client SalesforceClient, cache *EmailCache, perDayLimit float64, maxConcurrentRequests int, scope prometheus.Registerer, logger blog.Logger) *ExporterImpl {
5960
limiter := rate.NewLimiter(rate.Limit(perDayLimit/86400.0), maxConcurrentRequests)
6061

6162
emailsHandledCounter := prometheus.NewCounter(prometheus.CounterOpts{
@@ -70,6 +71,12 @@ func NewExporterImpl(client PardotClient, cache *EmailCache, perDayLimit float64
7071
})
7172
scope.MustRegister(pardotErrorCounter)
7273

74+
caseErrorCounter := prometheus.NewCounter(prometheus.CounterOpts{
75+
Name: "email_exporter_case_errors",
76+
Help: "Total number of errors encountered when sending Cases to the Salesforce REST API",
77+
})
78+
scope.MustRegister(caseErrorCounter)
79+
7380
impl := &ExporterImpl{
7481
maxConcurrentRequests: maxConcurrentRequests,
7582
limiter: limiter,
@@ -78,6 +85,7 @@ func NewExporterImpl(client PardotClient, cache *EmailCache, perDayLimit float64
7885
emailCache: cache,
7986
emailsHandledCounter: emailsHandledCounter,
8087
pardotErrorCounter: pardotErrorCounter,
88+
caseErrorCounter: caseErrorCounter,
8189
log: logger,
8290
}
8391
impl.wake = sync.NewCond(&impl.Mutex)
@@ -116,6 +124,33 @@ func (impl *ExporterImpl) SendContacts(ctx context.Context, req *emailpb.SendCon
116124
return &emptypb.Empty{}, nil
117125
}
118126

127+
// SendCase immediately submits a new Case to the Salesforce REST API using the
128+
// provided details. Any retries are handled internally by the SalesforceClient.
129+
// The following fields are required: Origin, Subject, ContactEmail.
130+
func (impl *ExporterImpl) SendCase(ctx context.Context, req *emailpb.SendCaseRequest) (*emptypb.Empty, error) {
131+
if core.IsAnyNilOrZero(req, req.Origin, req.Subject, req.ContactEmail) {
132+
return nil, berrors.InternalServerError("incomplete gRPC request message")
133+
}
134+
135+
err := impl.client.SendCase(Case{
136+
Origin: req.Origin,
137+
Subject: req.Subject,
138+
Description: req.Description,
139+
ContactEmail: req.ContactEmail,
140+
Organization: req.Organization,
141+
AccountId: req.AccountId,
142+
RateLimitName: req.RateLimitName,
143+
RateLimitTier: req.RateLimitTier,
144+
UseCase: req.UseCase,
145+
})
146+
if err != nil {
147+
impl.caseErrorCounter.Inc()
148+
return nil, berrors.InternalServerError("sending Case to the Salesforce REST API: %s", err)
149+
}
150+
151+
return &emptypb.Empty{}, nil
152+
}
153+
119154
// Start begins asynchronous processing of the email queue. When the parent
120155
// daemonCtx is cancelled the queue will be drained and the workers will exit.
121156
func (impl *ExporterImpl) Start(daemonCtx context.Context) {

0 commit comments

Comments
 (0)