How to add a trusted CA to the IntelliJ plugin?

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

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:

 

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.

Did you find an answer for this?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,715 views 17 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you