How to add a trusted CA to the IntelliJ plugin?

Jason Steenstra-Pickens May 31, 2016

I am trying to connect to our hosted JIRA/Bamboo server which uses a certificate that is signed by an internal trusted CA (and an intermediate). This is in the Windows trust store and I have also added it to the IntelliJ accepted certificates (in fact I added all 3 for good measure). However, no matter what I do the certificate validation fails.

Is this a bug or is there something I haven't done right?

Here is the stack trace:

com.atlassian.theplugin.commons.remoteapi.RemoteApiLoginException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at com.atlassian.theplugin.commons.bamboo.api.LoginBambooSession.login(LoginBambooSession.java:130)
	at com.atlassian.theplugin.commons.bamboo.BambooServerFacadeImpl.testServerConnection(BambooServerFacadeImpl.java:99)
	at com.atlassian.connector.intellij.bamboo.IntelliJBambooServerFacade.testServerConnection(IntelliJBambooServerFacade.java:225)
	at com.atlassian.theplugin.idea.config.serverconfig.ProductConnector.connect(ProductConnector.java:35)
	at com.atlassian.theplugin.ConnectionWrapper.run(ConnectionWrapper.java:63)
Caused by: com.atlassian.theplugin.commons.remoteapi.RemoteApiException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at com.atlassian.theplugin.commons.remoteapi.rest.AbstractHttpSession.retrievePostResponseInternalImpl(AbstractHttpSession.java:512)
	at com.atlassian.theplugin.commons.bamboo.api.LoginBambooSession.login(LoginBambooSession.java:94)
	... 4 more
Caused by: 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
	at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
	at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1506)
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
	at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
	at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
	at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:747)
	at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
	at shadow.org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
	at shadow.org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
	at shadow.org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
	at shadow.org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
	at shadow.org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
	at shadow.org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
	at shadow.org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
	at com.atlassian.theplugin.commons.remoteapi.rest.AbstractHttpSession.retrievePostResponseInternalImpl(AbstractHttpSession.java:436)
	... 5 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
	at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
	at sun.security.validator.Validator.validate(Validator.java:260)
	at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:105)
	at com.atlassian.theplugin.commons.ssl.ConnectorTrustManager.checkServerTrusted(ConnectorTrustManager.java:92)
	at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:922)
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1488)
	... 22 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:146)
	at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131)
	at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
	at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
	... 30 more

3 answers

0 votes
Fausto Oliveira March 26, 2018

Did you find an answer for this?

0 votes
roded September 1, 2016

I think I've encountered a similar issue.

Adding the certificate to the cacerts of the JRE Intellij uses allows access to the customly signed site.

neshantsharma September 29, 2020

are you sure you mean cacerts or you wanted to say keystore ?

0 votes
Jason Steenstra-Pickens June 1, 2016

I'm beginning to think that this doesn't support HTTPS at all. I can't see anywhere where it is setting the SSL context for the HTTPClient, in fact it seems that the version of HTTPClient that is used does not even have this method.

Apache HTTPClient references:

 

Suggest an answer

Log in or Sign up to answer