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

Update CRL handling for multiple issuers #15100

Merged
merged 5 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions builtin/logical/pki/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func Backend(conf *logical.BackendConfig) *backend {
LocalStorage: []string{
"revoked/",
"crl",
"crls/",
"certs/",
},

Expand Down
5 changes: 4 additions & 1 deletion builtin/logical/pki/cert_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ func fetchCertBySerial(ctx context.Context, req *logical.Request, prefix, serial
legacyPath = "revoked/" + colonSerial
path = "revoked/" + hyphenSerial
case serial == "crl":
path = "crl"
path, err = resolveIssuerCRLPath(ctx, req.Storage, defaultRef)
if err != nil {
return nil, err
}
default:
legacyPath = "certs/" + colonSerial
path = "certs/" + hyphenSerial
Expand Down
30 changes: 0 additions & 30 deletions builtin/logical/pki/cert_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,36 +86,6 @@ func TestPki_FetchCertBySerial(t *testing.T) {
t.Fatalf("error on %s for hyphen-based storage path: err: %v, entry: %v", name, err, certEntry)
}
}

noConvCases := map[string]struct {
Req *logical.Request
Prefix string
Serial string
}{
"crl": {
&logical.Request{
Storage: storage,
},
"",
"crl",
},
}

// Test for ca and crl case
for name, tc := range noConvCases {
err := storage.Put(context.Background(), &logical.StorageEntry{
Key: tc.Serial,
Value: []byte("some data"),
})
if err != nil {
t.Fatalf("error writing to storage on %s: %s", name, err)
}

certEntry, err := fetchCertBySerial(context.Background(), tc.Req, tc.Prefix, tc.Serial)
if err != nil || certEntry == nil {
t.Fatalf("error on %s: err: %v, entry: %v", name, err, certEntry)
}
}
}

// Demonstrate that multiple OUs in the name are handled in an
Expand Down