You may sometimes want to have a secure SSL-based connection between your agent and Controller. Even if you followed the instructions in the Enable SSL for the Java Agent documentation, given your environment OR agent configuration, the agent connectivity to your Controller over SSL may fail with the following PKIK error:
[system-thread-0] 02 Jun 2021 07:07:47,848 WARN SystemAgent - Certificate chain validation failed sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target attempting validation. [system-thread-0] 02 Jun 2021 07:07:47,850 ERROR ControllerTimeSkewHandler - Fatal transport error while connecting to URL [/controller/instance/1265056/current-time]: 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 [system-thread-0] 02 Jun 2021 07:07:47,850 ERROR ControllerTimeSkewHandler - Error response from controller: Fatal transport error while connecting to URL [/controller/instance/1265056/current-time]
PKIX stands for Public Key Infrastructure X509.
Whenever Java attempts to connect to another application over SSL, the connection will only succeed if it can trust the application.
In Java, trust is handled with a keystore, also known as the truststore (typically
<agent_home>/<version_number>/conf/cacerts.jks in the AppD agent context). This contains a list of all known certificate authority (CA) certificates, and Java will only trust certificates that are signed by one of the CAs or public certificates that exist within that keystore.
The PKIX ‘path building failed’ error can arise due to:
cacerts.jks), it won’t be able to validate the certificate produced by the Controller. Eventually, the PKIX ‘path building failed’ error will result.
The most convenient solution is to replace the Agent’s current truststore (
cacerts.jks) with a working agent’s truststore (i.e., an agent sitting in the same environment as the non-working agent node in question but communicating fine with the Controller).
To accomplish this::
cacerts.jksin the non-working agent node
cacerts.jksfrom an agent that is working fine and move it to the
cacerts.jksin the non-working agent node’s directory, below :
If importing the truststore from an agent that is working is not an option, then follow the steps under the 'Troubleshooting By Manually Importing the Certificates' [+internal link]
The following steps are a comprehensive approach to the problem.
Review the output of the command below:
<jre-home>/bin/keytool -printcert -sslserver <controller-host>:<controller-port> > cert.out
This command will print the content of the certificate being presented by the endpoint that your agent speaks to (given your environment).
For example, it could be directly talking to the SaaS Controller without an SSL interpreting proxy server OR there could be an SSL interpreting proxy server being managed by your organization intercepting all outgoing communication from all agents to the Controller. As a result, you may see two or more certificates in the certificate chain and metadata for those certificates which get captured in
cert.out in the above command.
<jre-home>/bin/keytool -printcert -sslserver <controller-host>:<controller-port> -rfc > cert_rfc.out
keytool -import -file root_ca.pem -alias root_ca -keystore cacerts.jks -storepass changeit keytool -import -file intermediate1.pem -alias intermediate1 -keystore cacerts.jks -storepass changeit keytool -import -file intermediate2.pem -alias intermediate2 -keystore cacerts.jks -storepass changeit
In the above code snippet, most of the time it will be enough to just import the root certificate. In rare cases, you might want to import the intermediate certificates as well.
If you continue to see the PKIX errors in the agent log even after importing the correct certificates, please contact AppDynamics Support.