Debugging SSL Connectivity Issue
What was the Issue
Attempting to access applications that are encrypted with SSL (for example HTTPS, LDAPS, IMAPS) throws an exception and the connection is refused. This can happen when attempting to establish a secure connection to any of the target i.e. Azure, SalesForce, Active Directory etc.
Error
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
How to diagnosis
Download SSLPoke
Set Java Class path
export JAVA_HOME=<Java Path>
export PATH=$JAVA_HOME/bin:$PATH
Compile SSLPoke Java class
javac SSLPoke.java
java SSLPoke HOSTNAME PORT
i.e. java SSLPoke graph.microsoft.com 443
SSL connectivity check with keystore
java -Djavax.net.ssl.trustStore=$JAVA_HOME/jre/lib/security/cacerts SSLPoke login.microsoft.com 443
java -Djavax.net.ssl.trustStore=<Path to trust store>.jks SSLPoke login.microsoft.com 443