Skip to content

Commit f69f524

Browse files
authored
Remove default authorization lifetime values (letsencrypt#5931)
Enforce that authorizationLifetimeDays and pendingAuthorizationLifetimeDays values are configured and set to a value compliant with the v1.8.1 of the CA/B Forum Baseline Requirements. Fixes letsencrypt#5923
1 parent f6db0fe commit f69f524

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

cmd/boulder-ra/main.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,23 @@ func main() {
211211
}
212212
ctp = ctpolicy.New(pubc, c.RA.CTLogGroups2, c.RA.InformationalCTLogs, logger, scope)
213213

214-
// TODO(patf): remove once RA.authorizationLifetimeDays is deployed
215-
authorizationLifetime := 300 * 24 * time.Hour
216-
if c.RA.AuthorizationLifetimeDays != 0 {
217-
authorizationLifetime = time.Duration(c.RA.AuthorizationLifetimeDays) * 24 * time.Hour
214+
// Baseline Requirements v1.8.1 section 4.2.1: "any reused data, document,
215+
// or completed validation MUST be obtained no more than 398 days prior
216+
// to issuing the Certificate". If unconfigured or the configured value is
217+
// greater than 397 days, bail out.
218+
if c.RA.AuthorizationLifetimeDays <= 0 || c.RA.AuthorizationLifetimeDays > 397 {
219+
cmd.Fail("authorizationLifetimeDays value must be greater than 0 and less than 398")
218220
}
219-
220-
// TODO(patf): remove once RA.pendingAuthorizationLifetimeDays is deployed
221-
pendingAuthorizationLifetime := 7 * 24 * time.Hour
222-
if c.RA.PendingAuthorizationLifetimeDays != 0 {
223-
pendingAuthorizationLifetime = time.Duration(c.RA.PendingAuthorizationLifetimeDays) * 24 * time.Hour
221+
authorizationLifetime := time.Duration(c.RA.AuthorizationLifetimeDays) * 24 * time.Hour
222+
223+
// The Baseline Requirements v1.8.1 state that validation tokens "MUST
224+
// NOT be used for more than 30 days from its creation". If unconfigured
225+
// or the configured value pendingAuthorizationLifetimeDays is greater
226+
// than 29 days, bail out.
227+
if c.RA.PendingAuthorizationLifetimeDays <= 0 || c.RA.PendingAuthorizationLifetimeDays > 29 {
228+
cmd.Fail("pendingAuthorizationLifetimeDays value must be greater than 0 and less than 30")
224229
}
230+
pendingAuthorizationLifetime := time.Duration(c.RA.PendingAuthorizationLifetimeDays) * 24 * time.Hour
225231

226232
// TODO(#5851): Remove these fallbacks when the old config keys are gone.
227233
if c.RA.GoodKey.WeakKeyFile == "" && c.RA.WeakKeyFile != "" {

cmd/boulder-wfe2/main.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,23 @@ func main() {
406406
c.WFE.StaleTimeout.Duration = time.Minute * 10
407407
}
408408

409-
authorizationLifetime := 30 * (24 * time.Hour)
410-
if c.WFE.AuthorizationLifetimeDays != 0 {
411-
authorizationLifetime = time.Duration(c.WFE.AuthorizationLifetimeDays) * (24 * time.Hour)
409+
// Baseline Requirements v1.8.1 section 4.2.1: "any reused data, document,
410+
// or completed validation MUST be obtained no more than 398 days prior
411+
// to issuing the Certificate". If unconfigured or the configured value is
412+
// greater than 397 days, bail out.
413+
if c.WFE.AuthorizationLifetimeDays <= 0 || c.WFE.AuthorizationLifetimeDays > 397 {
414+
cmd.Fail("authorizationLifetimeDays value must be greater than 0 and less than 398")
412415
}
413-
414-
pendingAuthorizationLifetime := 7 * (24 * time.Hour)
415-
if c.WFE.PendingAuthorizationLifetimeDays != 0 {
416-
pendingAuthorizationLifetime = time.Duration(c.WFE.PendingAuthorizationLifetimeDays) * (24 * time.Hour)
416+
authorizationLifetime := time.Duration(c.WFE.AuthorizationLifetimeDays) * 24 * time.Hour
417+
418+
// The Baseline Requirements v1.8.1 state that validation tokens "MUST
419+
// NOT be used for more than 30 days from its creation". If unconfigured
420+
// or the configured value pendingAuthorizationLifetimeDays is greater
421+
// than 29 days, bail out.
422+
if c.WFE.PendingAuthorizationLifetimeDays <= 0 || c.WFE.PendingAuthorizationLifetimeDays > 29 {
423+
cmd.Fail("pendingAuthorizationLifetimeDays value must be greater than 0 and less than 30")
417424
}
425+
pendingAuthorizationLifetime := time.Duration(c.WFE.PendingAuthorizationLifetimeDays) * 24 * time.Hour
418426

419427
var accountGetter wfe2.AccountGetter
420428
if c.WFE.AccountCache != nil {

0 commit comments

Comments
 (0)