cgivre commented on a change in pull request #2331:
URL: https://github.com/apache/drill/pull/2331#discussion_r727366808



##########
File path: 
contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/util/SimpleHttp.java
##########
@@ -116,6 +125,28 @@ private OkHttpClient setupHttpClient() {
     builder.writeTimeout(timeout, TimeUnit.SECONDS);
     builder.readTimeout(timeout, TimeUnit.SECONDS);
 
+    // Code to skip SSL Certificate validation
+    // Sourced from 
https://stackoverflow.com/questions/60110848/how-to-disable-ssl-verification
+    if (! scanDefn.tableSpec().connectionConfig().verifySSLCert()) {
+      try {
+        TrustManager[] trustAllCerts = getAllTrustingTrustManager();
+        SSLContext sslContext = SSLContext.getInstance("SSL");
+        sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
+        SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
+
+
+        builder.sslSocketFactory(sslSocketFactory, (X509TrustManager) 
trustAllCerts[0]);
+        builder.hostnameVerifier(new HostnameVerifier() {
+          @Override
+          public boolean verify(String hostname, SSLSession session) {
+            return true;
+          }
+        });

Review comment:
       Done!  Much cleaner.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to