Skip to content

Disable hostname verification for HttpsURLConnection requests in Java programs.

License

Notifications You must be signed in to change notification settings

panopticdotcom/LenientHostnameVerifierAgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disable hostname verification for HttpsURLConnection requests

While disabling hostname verification significantly reduces security, sometimes you have no other option than to do it.

For example, when you get the following exception:

javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching <FQDN> found.

Building

$ make

This should produce dist/LenientHostnameVerifierAgent.jar, which is already included in this repository for convenience.

Usage

$ java -javaagent:LenientHostnameVerifierAgent.jar \
       -jar YourJarFile.jar

Credits

The code in src/LenientHostnameVerifierAgent.java was taken from the following page:

https://stackoverflow.com/questions/6031258/java-ssl-how-to-disable-hostname-verification

Thank you, Vadzim.

Licensing

This project is licensed under the terms of the MIT license.

Code taken from Stack Overflow is licensed CC BY-SA 4.0.

About

Disable hostname verification for HttpsURLConnection requests in Java programs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published