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

PKI Tidy Revocation List optionally Tidy Revoked Certs that are Unexp… #4916

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PKI Tidy Revocation List optionally Tidy Revoked Certs that are Unexp…
…ired

Removes added whitespace

PKI Tidy, `tidy_revoked_certs` documentation
dmicanzerofox committed Jul 13, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 555b0c8a06ed1eec10e5699b0320756ba03d2293
11 changes: 10 additions & 1 deletion builtin/logical/pki/path_tidy.go
Original file line number Diff line number Diff line change
@@ -31,6 +31,14 @@ the revocation list`,
Default: false,
},

"tidy_revoked_certs": &framework.FieldSchema{
Type: framework.TypeBool,
Description: `Set to true to expire all revoked
certificates, even if their duration has not yet passed. This will cause these
certificates to be removed from the CRL the next time the CRL is generated.`,
Default: false,
},

"safety_buffer": &framework.FieldSchema{
Type: framework.TypeDurationSecond,
Description: `The amount of extra time that must have passed
@@ -54,6 +62,7 @@ func (b *backend) pathTidyWrite(ctx context.Context, req *logical.Request, d *fr
safetyBuffer := d.Get("safety_buffer").(int)
tidyCertStore := d.Get("tidy_cert_store").(bool)
tidyRevocationList := d.Get("tidy_revocation_list").(bool)
tidyRevokedCerts := d.Get("tidy_revoked_certs").(bool)

if safetyBuffer < 1 {
return logical.ErrorResponse("safety_buffer must be greater than zero"), nil
@@ -163,7 +172,7 @@ func (b *backend) pathTidyWrite(ctx context.Context, req *logical.Request, d *fr
return errwrap.Wrapf(fmt.Sprintf("unable to parse stored revoked certificate with serial %q: {{err}}", serial), err)
}

if time.Now().After(revokedCert.NotAfter.Add(bufferDuration)) {
if tidyRevokedCerts || time.Now().After(revokedCert.NotAfter.Add(bufferDuration)) {
if err := req.Storage.Delete(ctx, "revoked/"+serial); err != nil {
return errwrap.Wrapf(fmt.Sprintf("error deleting serial %q from revoked list: {{err}}", serial), err)
}
4 changes: 4 additions & 0 deletions website/source/api/secret/pki/index.html.md
Original file line number Diff line number Diff line change
@@ -1532,6 +1532,10 @@ expiration time.
- `tidy_revocation_list` `(bool: false)` Specifies whether to tidy up the
revocation list (CRL).

- `tidy_revoked_certs` `(bool: false)` Set to true to expire all revoked
certificates, even if their duration has not yet passed. This will cause these
certificates to be removed from the CRL the next time the CRL is generated.

- `safety_buffer` `(string: "")` Specifies A duration (given as an integer
number of seconds or a string; defaults to `72h`) used as a safety buffer to
ensure certificates are not expunged prematurely; as an example, this can keep