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

Merged
merged 11 commits into from
Jan 22, 2025
Merged

ra: revoke with explicit CRL shard #7944

merged 11 commits into from
Jan 22, 2025

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
cmd/admin/cert.go Outdated Show resolved Hide resolved
cmd/admin/cert_test.go Show resolved Hide resolved
ra/proto/ra.proto Outdated Show resolved Hide resolved
ra/ra.go Show resolved Hide resolved
ra/ra.go Show resolved Hide resolved
@@ -4081,3 +4069,60 @@ func TestUpdateRegistrationKey(t *testing.T) {
test.AssertContains(t, err.Error(), "failed to update registration key")
test.AssertContains(t, err.Error(), "mocked to always error")
}

func TestCRLShard(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: This does seem like a reasonable candidate for a table driven test with

type testCase struct {
  cdp []string
  wantShard int64
  wantErr error
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good suggestion, but I'm going to take the easy path and merge as written.

@aarongable aarongable requested review from a team and jprenken and removed request for a team January 17, 2025 20:55
@jsha jsha merged commit a908070 into main Jan 22, 2025
12 checks passed
@jsha jsha deleted the revoke-with-explicit-shard branch January 22, 2025 05:31
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.

3 participants