Skip to content

Commit 0efb2a0

Browse files
authored
Make authz reuse expiry cutoff proportional to authz lifetime (#8000)
Continue to use a 24-hour cutoff for authzs with "long" lifetimes, so that our behavior is unchanged for authzs created with no profile specified. Use a 1-hour cutoff for authzs with "short" (less than 24-hour) lifetimes, so that we can reuse authzs created with modern profiles. Use linear interpolation between those values. Fixes #7994
1 parent 64f4aab commit 0efb2a0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ra/ra.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,9 +2366,15 @@ func (ra *RegistrationAuthorityImpl) NewOrder(ctx context.Context, req *rapb.New
23662366
// `sa.GetAuthorizations` returned an authorization that was very close to
23672367
// expiry. The resulting pending order that references it would itself end up
23682368
// expiring very soon.
2369-
// To prevent this we only return authorizations that are at least 1 day away
2370-
// from expiring.
2371-
authzExpiryCutoff := ra.clk.Now().AddDate(0, 0, 1)
2369+
// What is considered "very soon" scales with the associated order's lifetime,
2370+
// up to a point.
2371+
minTimeToExpiry := profile.orderLifetime / 8
2372+
if minTimeToExpiry < time.Hour {
2373+
minTimeToExpiry = time.Hour
2374+
} else if minTimeToExpiry > 24*time.Hour {
2375+
minTimeToExpiry = 24 * time.Hour
2376+
}
2377+
authzExpiryCutoff := ra.clk.Now().Add(minTimeToExpiry)
23722378

23732379
var existingAuthz *sapb.Authorizations
23742380
if features.Get().NoPendingAuthzReuse {

0 commit comments

Comments
 (0)