Can no longer use disableCertChecking property with AmazonS3Client
In version 1.4.1, there is a problem that makes the property "com.amazonaws.sdk.disableCertChecking" used in the HttpClientFactory::createHttpClient() method to not persist through execution.
I have debugged through the code and the problem is in AmazonS3Client constructor. There was an "init()" function added. This init function calls client.disableStrictHostnameVerification() that reconstructs the https scheme and thus removing the https scheme established by the disableCertChecking property being set.
For context, these lines of code in HttpClientFactory::createHttpClient() is what was supposed to enable usage of self-signed certificates:
/*
* If SSL cert checking for endpoints has been explicitly disabled,
* register a new scheme for HTTPS that won't cause self-signed certs to
* error out.
*/
if (System.getProperty("com.amazonaws.sdk.disableCertChecking") != null) {
Scheme sch = new Scheme("https", 443, new TrustingSocketFactory());
httpClient.getConnectionManager().getSchemeRegistry().register(sch);
}
And the following routine in AmazonHttpClient.java removes it:
public void disableStrictHostnameVerification() {
try {
SchemeRegistry schemeRegistry = httpClient.getConnectionManager().getSchemeRegistry();
SSLSocketFactory sf = new SSLSocketFactory(
SSLContext.getDefault(),
SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
Scheme https = new Scheme("https", 443, sf);
schemeRegistry.register(https);
} catch (NoSuchAlgorithmException e) {
throw new AmazonClientException("Unable to access default SSL context to disable strict hostname verification");
}
}
Thanks for the heads up on this issue. This is definitely on our radar and we're working on a fix for a future release.
This is the commit that caused this issue in version 1.4.0:
https://github.com/aws/aws-sdk-java/commit/70840d0854e672c828c91b37a94d46448e1f8979#src/main/java/com/amazonaws/services/s3/AmazonS3Client.java
Hi @xyyxyyx, We have fixed this issue in version 1.4.5. Let us know if you are having any more problems!