aws / aws-sdk-java

The official AWS SDK for Java 1.x. The AWS SDK for Java 2.x is available here: https://github.com/aws/aws-sdk-java-v2/
https://aws.amazon.com/sdkforjava
Apache License 2.0
4.12k stars 2.83k forks source link

AWS Java SDK does not respect custom JDK TrustStore #1294

Closed rcha closed 2 months ago

rcha commented 7 years ago

The SDK uses a custom HttpClientBuilder that does not respect the majority of system properties.

spfink commented 7 years ago

Which system properties are you trying to use?

shorea commented 7 years ago

This is a feature request to honor more system properties like javax.net.ssl.trustStore.

http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/HttpClientBuilder.html

apfritts commented 5 years ago

It would also be beneficial if we could provide a specific trust store just for the AWS SDK. In production, we remove root certificates from all servers and only trust a root certificate generated in-house.

shorea commented 5 years ago

@apfritts I believe you can do that via a custom socket factory. https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/ApacheHttpClientConfig.html#withSslSocketFactory-org.apache.http.conn.socket.ConnectionSocketFactory-

ClientConfiguration config = new ClientConfiguration();
config.getApacheHttpClientConfig().setSslSocketFactory(....);
toroc commented 4 years ago

@shorea are there any plans to support this feature to override the JDK truststore location? We are trying to use the Redshift JDBC driver with the AWS Java SDK in a containerized environment. We maintain a truststore in a persistent volume and need to have the driver pick up certificates from that truststore.

shorea commented 4 years ago

Hey no longer with the SDK team but I'm pretty sure the SDK now respects the Java system properties for custom trust stores. Can you give that a try and report your results?

-Djavax.net.ssl.trustStore -Djavax.net.ssl.trustStorePassword

apfritts commented 4 years ago

@apfritts I believe you can do that via a custom socket factory. https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/ApacheHttpClientConfig.html#withSslSocketFactory-org.apache.http.conn.socket.ConnectionSocketFactory-

ClientConfiguration config = new ClientConfiguration();
config.getApacheHttpClientConfig().setSslSocketFactory(....);

@shorea yes! Sorry I didn't respond earlier but this works fabulously. Thanks!

chandrabipin commented 3 years ago

@apfritts I believe you can do that via a custom socket factory. https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/ApacheHttpClientConfig.html#withSslSocketFactory-org.apache.http.conn.socket.ConnectionSocketFactory-

ClientConfiguration config = new ClientConfiguration();
config.getApacheHttpClientConfig().setSslSocketFactory(....);

@shorea yes! Sorry I didn't respond earlier but this works fabulously. Thanks!

Can you provide more details as how can we set the truststore here...

wojtasskorcz commented 2 years ago

Joining @chandrabipin question to @apfritts. Also, question to the repo maintainers -- could you confirm if what @shorea said above is true?

Hey no longer with the SDK team but I'm pretty sure the SDK now respects the Java system properties for custom trust stores. Can you give that a try and report your results?

-Djavax.net.ssl.trustStore -Djavax.net.ssl.trustStorePassword

apfritts commented 2 years ago

@wojtasskorcz @chandrabipin

I’m no longer with Box so I can look up what I did and I don’t play in the Java world any more. Sorry!

debora-ito commented 2 months ago

Yes, Java SDK v1 honors the system properties javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword.

github-actions[bot] commented 2 months ago

This issue is now closed.

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.