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

Backport of Address OCSP client caching issue into release/1.15.x #26013

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions builtin/logical/pki/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,6 @@ func TestIntegrationOCSPClientWithPKI(t *testing.T) {
return testLogger
}, 10)

err = ocspClient.VerifyLeafCertificate(context.Background(), cert, issuer, conf)
require.NoError(t, err)

_, err = client.Logical().Write("pki/revoke", map[string]interface{}{
"serial_number": serialNumber,
})
Expand Down
3 changes: 3 additions & 0 deletions changelog/25986.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
auth/cert: Address an issue in which OCSP query responses were not cached
```
17 changes: 16 additions & 1 deletion sdk/helper/ocsp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,14 +776,29 @@ func (c *Client) extractOCSPCacheResponseValue(cacheValue *ocspCachedResponse, s
}, nil
}

sdkOcspStatus := internalStatusCodeToSDK(cacheValue.status)

return validateOCSP(&ocsp.Response{
ProducedAt: time.Unix(int64(cacheValue.producedAt), 0).UTC(),
ThisUpdate: time.Unix(int64(cacheValue.thisUpdate), 0).UTC(),
NextUpdate: time.Unix(int64(cacheValue.nextUpdate), 0).UTC(),
Status: int(cacheValue.status),
Status: sdkOcspStatus,
})
}

func internalStatusCodeToSDK(internalStatusCode ocspStatusCode) int {
switch internalStatusCode {
case ocspStatusGood:
return ocsp.Good
case ocspStatusRevoked:
return ocsp.Revoked
case ocspStatusUnknown:
return ocsp.Unknown
default:
return int(internalStatusCode)
}
}

/*
// writeOCSPCache writes a OCSP Response cache
func (c *Client) writeOCSPCache(ctx context.Context, storage logical.Storage) error {
Expand Down
Loading