Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vault 13350 acme add purge old unused accounts to tidy auto tidy #20227

Conversation

kitography
Copy link
Contributor

Basics of Tidy and Auto-Tidy of Acme Accounts

@kitography kitography requested a review from a team April 18, 2023 16:03
@kitography kitography added this to the 1.14 milestone Apr 18, 2023
@kitography kitography self-assigned this Apr 18, 2023
deleteCount := 0

for _, thumbprint := range list {
revoked, deleted, err := a.TidyAcmeAccount(acmeCtx, thumbprint, time.Now().Add(config.DeleteAcmeAccountsSafetyBuffer), time.Now().Add(config.RevokeAcmeAccountsSafetyBuffer))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's early, without coffee kicking in yet, but should we not be either subtracting the safety buffers here, or using After within TidyAcmeAccount and not the value .Before(<time.Now()+safetybuffer>)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding does work too - I've updated that on the new PR

@@ -146,6 +146,8 @@ type acmeAccount struct {
Contact []string `json:"contact"`
TermsOfServiceAgreed bool `json:"termsOfServiceAgreed"`
Jwk []byte `json:"jwk"`
LastAccessDate time.Time `json:"last_access_date"`
MarkedAsRevokedDate *time.Time `json:"marked_as_revoked_date"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any real value of differentiating between nil and IsZero() for MarkedAsRevokedDate to be a pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value that I saw was that it is far easier to remember when coding to check for nil value than for "0". It feels awkward because jan 1, 1970 is a totally valid date (and if something was revoked then, we'd totally want to delete it, so that's a bad error).

@kitography kitography closed this May 4, 2023
@kitography
Copy link
Contributor Author

We've changed the approach here: rather than revoke/remove old accounts after some last-used-by-date (which needs to be constantly updated), we'll be looking at whether the account has an active order or certificate associated with it - see the new PR: #20494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants