Confluence 5.6 has reached end of life
Check out the [latest version] of the documentation
This page documents configuration of SSL, rather than of Confluence itself. Atlassian will support Confluence with this configuration, but we cannot guarantee to help you debug problems with SSL. Please be aware that this material is provided for your information only, and that you use it at your own risk.
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:
keytool
utility used in the instructions below. The JRE is not enough. If you are using JDK 1.6 or older, please refer to the Java SE documentation to see the differences in the keytool
utility from your JDK to JDK 1.7. The default connector port for Confluence is 8090, while a plain Tomcat installation (used for EAR / WAR distribution) will default to 8080.
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.
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.
Use Java's keytool
utility to generate the certificate:
On Windows, run the following command at the command prompt:
"%JAVA_HOME%\bin\keytool" -genkeypair -alias tomcat -keyalg RSA
On OS X or UNIX-based systems, run the following command at the command prompt:
$JAVA_HOME/bin/keytool -genkeypair -alias tomcat -keyalg RSA
changeit
'.CN=confluence.example.com, OU=Java Software Division, O=Sun Microsystems Inc, C=US
y
' to confirm the details.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.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, DigiCert or Thawte. 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.
keytool
utility to generate a local certificate, as described in the previous section.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:
keytool -certreq -keyalg RSA -alias tomcat -file certreq.csr -keystore <MY_KEYSTORE_FILENAME>
certreq.csr
to your chosen certificate authority. Refer to the documentation on the CA's website to find out how to do this.Import the new certificate into your local keystore:
keytool -importcert -alias tomcat -keystore <MY_KEYSTORE_FILENAME> -file <MY_CERTIFICATE_FILENAME>
Please note that some CAs require you to install an intermediate certificate before importing your certificate. Please refer to your CA documentation to successfully install your certificate.
If you receive an error, and you use Verisign or GoDaddy, you may need to export the certificate to PKCS12 format along with the private key.
First, remove the certificate added above from the keystore:
keytool -delete -alias tomcat -keystore <MY_KEYSTORE_FILENAME>
Then export to PKCS12 format:
openssl pkcs12 -export -in <MY_CERTIFICATE_NAME> -inkey <MY_PRIVATEKEY_NAME> -out <MY_PKC12_KEYSTORE_NAME> -name tomcat -CAfile <MY_ROOTCERTIFICATE_NAME-alsoCalledBundleCertificateInGoDaddy> -caname root
Then import from PKCS12 to jks:
keytool -importkeystore -deststorepass <MY_DESTINATIONSTORE_PASSWORD> -destkeypass <MY_DESTINATIONKEY_PASSWORD> -destkeystore <MY_KEYSTORE_FILENAME> -srckeystore <MY_PKC12_KEYSTORE_NAME> -srcstoretype PKCS12 -srcstorepass <MY_PKC12_KEYSTORE_PASSWORD> -alias tomcat
CONFLUENCE-INSTALLATION}>/conf/server.xml
.Uncomment the following lines:
<Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" SSLEnabled="true" URIEncoding="UTF-8" keystorePass="<MY_CERTIFICATE_PASSWORD>"/>
MY_CERTIFICATE_PASSWORD>
with the password you specified for your certificate.SSLEnabled="true"
is part of the Connector
element, as shown above. If this attribute is not present, attempts to access Confluence will time out.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:
C:\Documents and Settings\\#CURRENT_USER#\.keystore
~/.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.
CONFLUENCE-INSTALLATION}>/conf/server.xml
Add the attribute keystoreFile="<MY_CERTIFICATE_LOCATION>"
to the Connector
element, so that the element looks like this:
<Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" SSLEnabled="true" URIEncoding="UTF-8" keystorePass="<MY_CERTIFICATE_PASSWORD>" keystoreFile="<MY_CERTIFICATE_LOCATION>"/>
<MY_CERTIFICATE_LOCATION>
with the path to your certificate, including the path and the name of the .keystore
file.https://<MY_BASE_URL>:8443/
.Although HTTPS is now activated and available, the old HTTP URLs (http://localhost:8090) 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.
web.xml
file. Skip the steps below and follow the steps on the RSS Feed Macro page instead.<CONFLUENCE_INSTALLATION>/confluence/WEB-INF/web.xml
.Add the following declaration to the end of the file, before the </web-app>
tag:
<security-constraint> <web-resource-collection> <web-resource-name>Restricted URLs</web-resource-name> <url-pattern>/</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
Confluence 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.
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.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.Multiple instances on the same host: When running more than one instance on the same host, it is important to specify the address attribute in the <CONFLUENCE_INSTALLATION>/conf/server.xml
file because by default the connector will listen on all available network interfaces, so specifying the address will prevent conflicts with connectors running on the same default port. See the Tomcat Connector documentation for more about setting the address attribute: http://tomcat.apache.org/tomcat-5.5-doc/config/http.html
<Connector port="8443" address="your.confluence.url.com" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" SSLEnabled="true" URIEncoding="UTF-8" keystorePass="<MY_CERTIFICATE_PASSWORD>" keystoreFile="<MY_CERTIFICATE_LOCATION>"/>
keytool
utility:-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.-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:
<Valve className="org.apache.catalina.authenticator.NonLoginAuthenticator" disableProxyCaching="true" securePagesWithPragma="false" />