-
Notifications
You must be signed in to change notification settings - Fork 25k
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 GCS Keystore Handling in FIPS Mode #75028
Conversation
In FIPS mode loading the `.p12` keystore used by the new SDK version is not supported because of "PBE AlgorithmParameters not available". Fortunately, the SDK still includes the old jks trust store so we can just manually load it the same way it was loaded by the previous version to fix things. Also, fixed `SocketAccess` to properly rethrow this kind of exception and not run into a class cast issue. Closes elastic#75023 relates googleapis/google-api-java-client#1738
Pinging @elastic/es-distributed (Team:Distributed) |
@@ -126,7 +128,11 @@ private Storage createClient(GoogleCloudStorageClientSettings clientSettings, | |||
final NetHttpTransport.Builder builder = new NetHttpTransport.Builder(); | |||
// requires java.lang.RuntimePermission "setFactory" | |||
// Pin the TLS trust certificates. | |||
builder.trustCertificates(GoogleUtils.getCertificateTrustStore()); | |||
final KeyStore certTrustStore = SecurityUtils.getJavaKeyStore(); | |||
try (InputStream keyStoreStream = GoogleUtils.class.getResourceAsStream("google.jks")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could you add a comment explaining why we have to load this key store?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - left a minor comment
@@ -126,7 +128,11 @@ private Storage createClient(GoogleCloudStorageClientSettings clientSettings, | |||
final NetHttpTransport.Builder builder = new NetHttpTransport.Builder(); | |||
// requires java.lang.RuntimePermission "setFactory" | |||
// Pin the TLS trust certificates. | |||
builder.trustCertificates(GoogleUtils.getCertificateTrustStore()); | |||
final KeyStore certTrustStore = SecurityUtils.getJavaKeyStore(); | |||
try (InputStream keyStoreStream = GoogleUtils.class.getResourceAsStream("google.jks")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a small comment why GoogleUtils.getCertificateTrustStore()
is not used directly?
Thanks Francisco + Tanguy! |
Fallout from upgrading the GCS dep. in #74938
In FIPS mode loading the
.p12
keystore used by the new SDK version is not supportedbecause of "PBE AlgorithmParameters not available". Fortunately, the SDK still includes
the old jks trust store so we can just manually load it the same way it was loaded by
the previous version to fix things.
Also, fixed
SocketAccess
to properly rethrow this kind of exception and not run intoa class cast issue.
Closes #75023
Relates googleapis/google-api-java-client#1738
non-issue as this hasn't been released yet