This documentation relates to an earlier version of Confluence.
View this page in the current documentation or visit the current documentation home.

Skip to end of metadata
Go to start of metadata

This document tells you how to configure Confluence to enable access via HTTPS (HTTP over SSL), so that your Confluence logins and data are encrypted during transport to and from Confluence. SSL encryption is a good way to safeguard your Confluence data and user logins from being intercepted and read by outsiders.

These instructions apply to the following platforms:

  • Confluence Standalone or Confluence WAR distribution using Tomcat. Apache Tomcat is the application server shipped with Confluence, and is the only supported application server. If you are using a different application server or Apache HTTP Server ("httpd"), see the page on Apache with mod_proxy for instructions on how to terminate an SSL connection at the Apache web server.
  • Java 6. Sun JDK 1.6 is the supported Java version for Confluence. Note also that you need the JDK, since it includes the keytool utility used in the instructions below. The JRE is not enough. If you are using JDK 1.5, please refer to the Java SE documentation to see the differences in the keytool utility from JDK 1.5 to JDK 1.6.

On this page:

Step 1. Create or Request a New SSL Certificate

You will need a valid SSL certificate before you can enable HTTPS. If you already have a certificate prepared, skip to step 2 below.

You can choose to create a self-signed certificate or to use a certificate issued by a certificate authority (CA, sometimes also called a 'certification authority'). We described both options below.

Certificate Option 1 – Create a Self-Signed Certificate

Self-signed certificates are useful if you require encryption but do not need to verify the identity of the requesting website. In general, you might use a self-signed certificate on a test environment and on internal corporate networks (intranets).

Because the certificate is not signed by a certificate authority (CA), users may receive a message that the site is not trusted and may have to perform several steps to accept the certificate before they can access the site. This usually will only occur the first time they access the site.

Follow the steps below to generate a certificate using Java's keytool utility. This tool is included in the JDK.

  1. Use Java's keytool utility to generate the certificate:
    • On Windows, run the following command at the command prompt:
    • On OS X or UNIX-based systems, run the following command at the command prompt:
  2. When asked for a password:
    • Specify the password you want to use for the certificate (private key). Note that the password text will not appear as you type it.
    • Make a note of the password you choose, because you will need it in the next step when editing the configuration file.
    • The default password is 'changeit'.
  3. Follow the prompts to specify your name, organisation and location. This information is used to construct the X.500 Distinguished Name (DN) of the entity, such as:
    CN=Java Duke, OU=Java Software Division, O=Sun Microsystems Inc, C=US
  4. Enter 'y' to confirm the details.
  5. When asked for the password for 'tomcat' (the alias you entered in the keytool command above), press the 'Enter' key. This specifies that your keystore entry will have the same password as your private key. You MUST use the same password here as was used for the keystore password itself. This is a restriction of the Tomcat implementation.
  6. You certificate is now ready. Go to step 2 below.

Certificate Option 2 – Use a Certificate Issued by a Certificate Authority

When running Confluence in a production environment, you will need a certificate issued by a certificate authority (CA, sometimes also called a 'certification authority') such as VeriSign, Thawte or TrustCenter. The instructions below are adapted from the Tomcat documentation.

First you will generate a local certificate and create a 'certificate signing request' (CSR) based on that certificate. You will submit the CSR to your chosen certificate authority. The CA will use that CSR to generate a certificate for you.

  1. Use Java's keytool utility to generate a local certificate, as described in the previous section.
  2. Use the keytool utility to generate a CSR, replacing the text <MY_KEYSTORE_FILENAME> with the path to and file name of the .keystore file generated for your local certificate:
  3. Submit the generated file called certreq.csr to your chosen certificate authority. Refer to the documentation on the CA's website to find out how to do this.
  4. The CA will send you a certificate.
  5. Import the new certificate into your local keystore:

Step 2. Modify the Server Configuration File in your Confluence Installation

  1. Edit the server configuration file at this location: {CONFLUENCE-INSTALLATION}>/conf/server.xml.
  2. Uncomment the following lines:
  3. Replace the text <MY_CERTIFICATE_PASSWORD> with the password you specified for your certificate.
  4. Make sure that the attribute-value pair SSLEnabled="true" is part of the Connector element, as shown above. If this attribute is not present, attempts to access Confluence will time out.
  5. Save the server configuration file.

Step 3. Specify the Location of your Certificate

By default, Tomcat expects the keystore file to be named .keystore and to be located in the user home directory under which Tomcat is running (which may or may not be the same as your own home directory). This means that, by default, Tomcat will look for your SSL certificates in the following location:

  • On Windows: C:\Documents and Settings\\#CURRENT_USER#\.keystore
  • On OS X and UNIX-based systems: ~/.keystore

You may decide to move the certificate to a custom location. If your certificate is not in the default location, you will need to update your server configuration file as outlined below, so that Tomcat can find the certificate.

  1. Edit the server configuration file at this location: {CONFLUENCE-INSTALLATION}>/conf/server.xml
  2. Add the attribute keystoreFile="<MY_CERTIFICATE_LOCATION>" to the Connector element, so that the element looks like this:
  3. Replace the text <MY_CERTIFICATE_LOCATION> with the path to your certificate, including the path and the name of the .keystore file.
  4. Save the server configuration file.

Step 4. Change your Confluence Base URL to HTTPS

  1. In your browser, go to the Confluence Administration Console.
  2. Change the Server Base URL to HTTPS. See the documentation on configuring the server base URL.
  3. Restart Tomcat and access Confluence on https://<MY_BASE_URL>:8443/.

Step 5. Add a Security Constraint to Cause Redirect of All URLs to HTTPS

Although HTTPS is now activated and available, the old HTTP URLs (http://localhost:8080) are still available. Now you need to redirect the URLs to their HTTPS equivalent. You will do this by adding a security constraint in web.xml. This will cause Tomcat to redirect requests that come in on a non-SSL port.

  1. Check whether your Confluence site uses the RSS macro. If your site has the RSS macro enabled, you may need to configure the URL redirection with a firewall rule, rather than by editing the web.xml file. Skip the steps below and follow the steps on the RSS Feed Macro page instead.
  2. Otherwise, Edit the file at <CONFLUENCE_INSTALLATION>/confluence/WEB-INF/web.xml.
  3. Add the following declaration to the end of the file, before the </web-app> tag:
  4. Restart Confluence and access http://localhost:8080. You should be redirected to https://localhost:8443/login.action.

(info) Confluence Standalone has two web.xml files. The other one is at <CONFLUENCE_INSTALLATION>/conf/web.xml. Please only add the security constraints to <CONFLUENCE_INSTALLATION>/confluence/WEB-INF/web.xml, as described above.

Notes

  • Background information on generating a certificate: The 'keytool -genkeypair' command generates a key pair consisting of a public key and the associated private key, and stores them in a keystore. The command packages the public key into an X.509 v3 self-signed certificate, which is stored as a single-element certificate chain. This certificate chain and the private key are stored in a new keystore entry, identified by the alias that you specify in the command. The Java SE documentation has a good overview of the utility.
  • Custom SSL port: If you have changed the port that the SSL connector is running on from the default value of 8443, you must update the redirectPort attribute of the standard HTTP connector to reflect the new SSL port. Tomcat needs this information to know which port to redirect to when an incoming request needs to be secure.
  • Protection for logins only or for individual spaces: As of Confluence 3.0, Atlassian does not support HTTPS for logins only or for specific pages. We support only site-wide HTTPS. To see the reasoning behind this decision, please see CONF-18120 and CONF-4116.

Troubleshooting

  • If any of your users will access Confluence from Internet Explorer 7 on Vista, please note the following additional points when using Java's keytool utility:
    • Make sure that you specify the -keyalg RSA option, as shown in the example of the keytool command above. The default is the SHA1 algorithm, which results in an error 'Internet Explorer cannot display the webpage' on IE7 on Vista.
    • You may also need to specify the -sigalg MD5withRSA option. Otherwise, SHA1 will be used even if you specify the -keyalg RSA option. See this Atlassian blogpost for more information.
  • Problems with Internet Explorer being unable to download attachments: Applying SSL site wide can prevent IE from downloading attachments correctly. To fix this problem, edit <CONFLUENCE_INSTALLATION>/conf/server.xml and add the following line within the <Context ... /> element:
RELATED TOPICS