Is there a way for the standard java SSL sockets to disable hostname verfication for ssl connections with a property? The only way I found until now, is to write a hostname verifier which returns true all the time.
Weblogic provides this possibility, it is possible to disable the hostname verification with the following property:
-Dweblogic.security.SSL.ignoreHostnameVerify
Under Domain > Environment > Servers, double-click the server name. Click the SSL tab. Under Advanced, update Hostname Verification to None. Save the change.
A host name verifier ensures the host name in the URL to which the client connects matches the host name in the digital certificate that the server sends back as part of the SSL connection.
It should be possible to create custom java agent that overrides default HostnameVerifier
:
import javax.net.ssl.*; import java.lang.instrument.Instrumentation; public class LenientHostnameVerifierAgent { public static void premain(String args, Instrumentation inst) { HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { public boolean verify(String s, SSLSession sslSession) { return true; } }); } }
Then just add -javaagent:LenientHostnameVerifierAgent.jar
to program's java startup arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With