Connecting to SSL services

Atlassian applications allow the use of SSL within our applications, however Atlassian Support does not provide assistance for configuring it. Consequently, Atlassian can not guarantee providing any support for it.

  • If assistance with conversions of certificates is required, please consult with the vendor who provided the certificate.
  • If assistance with configuration is required, please raise a question on Atlassian Answers.

This page describes how to get web applications like Jira and Confluence connecting to external servers over SSL, via the various SSL-wrapped protocols. For instance, you may want to:

  • Refer to an https://... URL in a Confluence macro.
  • Use an IMAPS server to retrieve mail in Jira.
  • Use SMTP over SSL (SMTPS) to send mail in Jira.
  • Connect to a LDAP directory over SSL.
  • Set up Trusted Applications over SSL.

If you want to run Jira itself over SSL, see Running Jira applications over SSL or HTTPS or Integrating Jira with Apache using SSL.

tip/resting Created with Sketch.

Add SSL Certificates automatically!

We now have a Jira SSL Atlassian Labs app for this process. Please install and use the app before going through these docs.

On this page:

Problem Symptoms

Attempting to access URLs that are encrypted with SSL (for example HTTPS, LDAPS, IMAPS) throws an exception and Jira refuses to connect to it. For example: PKIX path building failed: unable to find valid certification path to requested target
 at com.sun.mail.imap.IMAPStore.protocolConnect(
 at javax.mail.Service.connect(
 at javax.mail.Service.connect(

This is the same as the following error that's generated in Chrome when visiting a page that's encrypted with a self-signed certificate, except Java can't "Proceed anyway", it just refuses the certificate:

The Cause

Whenever Jira attempts to connect to another application over SSL (e.g.: HTTPS, IMAPS, LDAPS), it will only be able to connect to that application if it can trust it. The way trust is handled in the Java world (this is what Jira is written in) is that you have a keystore (typically $JAVA_HOME/lib/security/cacerts) or also known as the trust store. This contains a list of all the known CA certificates and Java will only trust certificates that are signed by those CA certificate or public certificates that exist within that keystore. For example, if we look at the certificate for Atlassian:

We can see the * certificate has been signed by the intermediate certificates, DigiCert High Assurance EV Root CA and DigiCert High Assurance CA-3. These intermediate certificates have been signed by the root Secure Server CA. Those three certificates combined are referred to as the certificate chain. As all of those CA certificates are within the Java keystore (cacerts), Java will trust any certificates signed by them (in this case, * Alternatively, if the * certificate was in the keystore, Java would also trust that site.

This problem comes from a certificate that is either self-signed (a CA did not sign it) or the certificate chain does not exist within the Java keystore. Subsequently, Jira doesn't trust the certificate and fails to connect to the application.


In order to resolve this, the public certificate need to be imported in the Java keystore that Jira uses. In the example above, this is * and we cover how to install it below.

If you're unable to install Portecle on the server or prefer the command line please see our Command Line Installation section below.

Obtain and Import the Server's Public Certificate

  1. Download and install the Portecle app onto the server that runs Jira.
    (warning) This is a third-party application and not supported by Atlassian.
  2. Ensure the <JAVA_HOME> variable is pointing to the same version of Java that Jira uses. See our Setting JAVA_HOME docs for further information on this.
    (info) If running on a Linux/UNIX server, X11 will need to be forwarded when connecting to the server (so you can use the GUI), as below:

    ssh -X user@server
  3. Select the Examine menu and then click Examine SSL/TLS Connection:
  4. Enter the SSL Host and Port of the target system:
  5. Wait for it to load, then select the public certificate and click on PEM:
  6. Export the certificate and save it.
  7. Go back to the main screen and select the Open an existing keystore from disk option, select cacerts (for example $JAVA_HOME/lib/security/cacerts) then enter the password (the default is changeit).
  8. Select the Import a trusted certificate into the loaded keystore button:
  9. Select the certificate that was saved in step 6 and confirm that you trust it, giving it an appropriate alias (e.g.: confluence).
    1. You may hit this error: 
    2. If so, hit OK, and then accept the certificate as trusted.
  10. Save the Key Store to disk:
  11. Restart Jira.
  12. Test that you can connect to the host.

Command Line Installation

  1. Fetch the certificate, replacing with the FQDN of the server Jira is attempting to connect to:

    openssl s_client -connect < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > public.crt


    openssl s_client -connect < NUL | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > public.crt

    (info) The command above will only be executed if you have Sed for Windows as well as OpenSSL installed on your environment. If you don't have Sed you don't want to install it, use the instructions below as an alternative. Issue the following command:

    openssl s_client -connect

    Save the output to a file called public.cert. Edit the the public.cert file so it contains only what is between the BEGIN CERTIFCATE and END CERTIFICATE lines. This is how your file should look like after you edited it:

    < Certificate content as fetched by the command line. 
    Don't change this content, only remove what is before 
    That's what your Sed command is doing for you :-) >
    -----END CERTIFICATE-----
  2. Import the certificate:

    <JAVA_HOME>/keytool -import -alias <server_name> -keystore <JAVA_HOME>/lib/security/cacerts -file public.crt

    If you are using Windows, make sure to quote the entire cacerts path.

    <JAVA_HOME>\keytool -import -alias <server_name> -keystore "F:\Program Files\Atlassian\JIRA\jre\lib\security\cacerts" -file public.crt

Alternative KeyStore Locations

Java will normally use a system-wide keystore in $JAVA_HOME/jre/lib/security/cacerts, but it is possible to use a different keystore by specifying a parameter,, where '/path/to/keystore' is the absolute file path of the alternative keystore.

However, setting this is not recommended because if Java is told to use a custom keystore (eg. containing a self-signed certificate), then Java will not have access to the root certificates of signing authorities found in $JAVA_HOME/jre/lib/security/cacerts, and accessing most CA-signed SSL sites will fail. It is better to add new certificates (eg. self-signed) to the system-wide keystore (as above).


Problems are typically one of two forms:

  • The certificate was installed into the incorrect keystore.
  • The keystore does not contain the certificate of the SSL service you're connecting to.
See Also
Last modified on May 7, 2021

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.