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

ra: revoke with explicit CRL shard #7944

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Jan 13, 2025

In RA.RevokedCertificate, if the certificate being revoked has a crlDistributionPoints extension, parse the URL and pass the appropriate shard to the SA.

This required some changes to the admin tool. When a malformed certificate is revoked, we don't have a parsed copy of the certificate to extract a CRL URL from. So, specifically when a malformed certificate is being revoked, allow specifying a CRL shard. Because different certificates will have different shards, require one-at-a-time revocation for malformed certificates.

To support that refactoring, move the serial-cleaning functionality earlier in the admin tool's flow.

Also, split out one of the cases handled by the revokeCertificate helper in the RA. For admin revocations, we need to accept a human-specified ShardIdx, so call the SA directly in that case (and skip stat increment since admin revocations aren't useful for metrics). This allows revokeCertificate to be a more helpful helper, by extracting serial, issuer ID, and CRL shard automatically from an *x509.Certificate.

Note: we don't yet issue certificates with the crlDistributionPoints extension, so this code will not be active until we start doing so.

Part of #7094.

@jsha jsha requested a review from a team as a code owner January 13, 2025 20:41
@jsha jsha requested a review from aarongable January 13, 2025 20:41
@jsha jsha force-pushed the revoke-with-explicit-shard branch from 24ec095 to ae2e387 Compare January 13, 2025 23:26
cmd/admin/cert.go Show resolved Hide resolved
Code: int64(reason),
AdminName: u.Username,
SkipBlockKey: skipBlockKey,
Malformed: malformed,
// This is a well-formed certificate so send CrlShard 0
// to let the RA figure out the right shard from the cer.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// to let the RA figure out the right shard from the cer.
// to let the RA figure out the right shard from the cert.

assertRequestsContain(mra.revocationRequests, 0, false, false)
assertRequestsContain(mra.revocationRequests, 0, false)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

No new TestRevokeMalformed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, will add.

ra/proto/ra.proto Outdated Show resolved Hide resolved
ra/ra.go Show resolved Hide resolved
Comment on lines +1873 to +1874
// Assumes the shard number is represented in the URL as an integer that
// occurs in the last path component, optionally followed by ".crl".
Copy link
Contributor

Choose a reason for hiding this comment

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

I admit that this is the place that had me agonizing the most of what the "right thing to do" is when I was thinking about this six months ago. Your approach here is nice and flexible, in that it would allow us to change our CRLDP "base" (e.g. the hostname or first part of the path) without having to change this code. But it's also somewhat scary in that it will happily process a certificate with a very bizarre CRLDP and not complain.

I think the approach you've settled on here is probably the best path forward for now -- the main alternative I see is configuring the crldpBaseUrl in the RA as well as in the CA, and that's a deployability mess that has only become more complex with the advent of multiple issuers -- but I think we should explicitly document this potential footgun.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I agree on the scariness; but I think we're better off catching bizarre CRLDPs at linting time (which covers all certs, and can catch problems in advance) instead of revocation time.

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

Successfully merging this pull request may close these issues.

2 participants