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

Fix deletion of issuers, CRLs #15254

Closed
wants to merge 3 commits into from

Conversation

cipherboy
Copy link
Contributor

Apparently I had this branch sitting around but haven't proposed it yet? :-D

We:

  • Delete the legacy CRL entry when we call DELETE /root.
  • When deleting an issuer, remove its corresponding CRL entry on next rebuild. This means CRLs will persist (on disk) until next CRL rebuild, even if all issuers using that CRL have been removed. I think this is fine.
  • Fix bug where chain is incorrect after deletion. :-) Oops.

When deleting a specific issuer, we might impact the chains. From a
consistency perspective, we need to ensure the remaining chains are
correct and don't refer to the since-deleted issuer, so trigger a full
rebuild here.

We don't need to call this in the delete-the-world (DELETE /root) code
path, as there shouldn't be any remaining issuers or chains to build.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
When calling DELETE /root, we should remove the legacy CRL bundle, since
we're deleting the legacy CA issuer bundle as well.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Since CRLs are no longer resolvable after deletion (due to missing
issuer ID, which will cause resolution to fail regardless of if an ID or
a name/default reference was used), we should delete these CRLs from
storage to avoid leaking them.

In the event that this issuer comes back (with key material), we can
simply rebuild the CRL at that time (from the remaining revoked storage
entries).

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
@cipherboy cipherboy force-pushed the cipherboy-fix-delete-stuff branch from 8967ca9 to 75632ef Compare May 2, 2022 15:43
@@ -360,6 +360,40 @@ func buildCRLs(ctx context.Context, b *backend, req *logical.Request, forceNew b
}
}

// Before persisting our updated CRL config, check to see if we have
Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment we do not call a CRL rebuild on a deleteIssuer API call, that feels wrong but maybe I'm missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you delete the issuer, the lookup (by ref) will fail, so you can't fetch it any more. The deletion of the actual CRL can be lazily done; the remaining pieces will either be the same (no certs were actually revoked, so its equivalent to previous CRLs) or there's presently not-deleted yet unaccessible CRL that nobody really cares about since they can't see it, that'll get removed on next CRL rebuild (if it was the last of its kind).

So I think its fine?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup I figured after I wrote the comment it was something along these lines, no need for additional changes.

One interesting but non-important point is that the secondary clusters now will force the rebuild I believe of the CRL while the primary will have lagged behind :)

Copy link
Contributor

@stevendpclark stevendpclark left a comment

Choose a reason for hiding this comment

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

This looks good, a comment about the deleteIssuer but technically the next revoke/tidy operation I believe will resolve that issue anyways.

@cipherboy
Copy link
Contributor Author

Thanks @stevendpclark! Manually merging...

@cipherboy cipherboy closed this May 3, 2022
@cipherboy cipherboy deleted the cipherboy-fix-delete-stuff branch May 17, 2022 14:33
@cipherboy
Copy link
Contributor Author

This PR was merged in #15277. See that PR and the relevant docs PR #15238 for more information about this change.

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.

None yet

2 participants