JIRA 4.3 : Running JIRA over SSL or HTTPS
This page last changed on Nov 08, 2010 by lamendes.
When web applications are being accessed across the internet, there is always the possibility of usernames and passwords being intercepted by intermediaries between your computer and the ISP/company. It is often a good idea to enable access via HTTPS (HTTP over SSL) and make this a requirement for pages where passwords are sent. Note, however, that using HTTPS may result in slower performance. In some cases where issue data is sensitive, all pages should be accessed via HTTPS.
The process of enabling SSL access is specific to each application server, but the process for specifying which pages require protection is generic.
On this page: Running JIRA over HTTPSThe following flowchart shows the process involved in configuring HTTPS on Tomcat. Click the links below this chart to go to the instructions for that step.
Configure HTTPS in TomcatEdit conf/server.xml, and at the bottom before the </Service> tag, add this section (or uncomment it where you find it) in Tomcat 6: <Connector port="8443" maxHttpHeaderSize="8192" SSLEnabled="true" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" useBodyEncodingForURI="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> This enables SSL access on port 8443 (the default for HTTPS is 443, but just as Tomcat uses 8080 instead of 80 to avoid conflicts, 8443 is used instead of 443 here). Generate Self-Signed Certificate
The following approach to create the certificate uses Java's keytool, and has been formatted for use with Java 1.6.
Windows Standalone "<install_dir>\jre\bin\keytool" -genkey -alias tomcat -keyalg RSA Windows WAR/EAR "%JAVA_HOME%\bin\keytool" -genkey -alias tomcat -keyalg RSA Unix/Linux $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA This will create (if it doesn't already exist) a new .keystore file located in the home directory of the user you used to run the keytool command. You will now need to export the certificate to make it ready for importing into the Trust-store with the following command: Windows Standalone "<install_dir>\jre\bin\keytool" -export -alias tomcat -file file.cer Windows WAR/EAR "%JAVA_HOME%\bin\keytool" -export -alias tomcat -file file.cer Unix/Linux $JAVA_HOME/bin/keytool -export -alias tomcat -file file.cer Next, import the certificate into the Trust-store. Obtain CA CertificateDigital Certificate that are issued by trusted 3rd party CAs (Certification Authority) provide verification that your Website does indeed represent your company, thereby verifying your company's identity. Many CAs simply verify the domain name and issue the certificate, whereas other such as VeriSign verifies the existence of your business, the ownership of your domain name, and your authority to apply for the certificate, providing a higher standard of authentication. A list of CA's can be found here. Next, import the certificate into the Trust-store. Import Certificate into the Trust-store
Assuming your certificate is called "file.cer" whether obtained by a CA or self-generated, the following command will add this certificate to the Trust-store: Windows Standalone "<install_dir>\jre\bin\keytool" -import -alias tomcat -file file.cer -keystore "<install_dir>\jre\lib\security\cacerts" Windows WAR/EAR "%JAVA_HOME%\bin\keytool" -import -alias tomcat -file file.cer -keystore "%JAVA_HOME%\jre\lib\security\cacerts" Unix/Linux
$JAVA_HOME/bin/keytool -import -alias tomcat -file file.cer -keystore $JAVA_HOME/jre/lib/security/cacerts Next, proceed to the step on redirecting certain pages to HTTPS. Redirecting certain pages to HTTPSAlthough HTTPS is now activated and available, the old HTTP URLs (http://localhost:8080) are still available. In most situations one wants these URLs to continue working, but for some to redirect to their https equivalent. This is done by editing WEB-INF/web.xml, and adding the following section at the end of the file, before the closing </web-app>: <security-constraint> <web-resource-collection> <web-resource-name>all-except-attachments</web-resource-name> <url-pattern>*.js</url-pattern> <url-pattern>*.jsp</url-pattern> <url-pattern>*.jspa</url-pattern> <url-pattern>*.css</url-pattern> <url-pattern>/browse/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> This means that all URLs except attachments are redirected from HTTP to HTTPS. IE has a bug which prevents attachments like .doc files being viewed via HTTPS if SSL protection is forced in web.xml. Once this change is made, restart JIRA and access http://localhost:8080. You should be redirected to https://localhost:8443/secure/Dashboard.jspa. The port it redirects to is determined by the redirectPort value you specify in the server.xml file in the HTTP Connector stanza.
TroubleshootingHere are some troubleshooting tips if you are using a self-signed key created by keytool, as described above. When you enter "https://localhost:8443" in your browser, if you get a message such as "Cannot establish a connection to the server at localhost:8443", look for error messages in your logs/catalina.out log file. Here are some possible errors with explanations: SSL + Apache + IE problemsSome people have reported errors when uploading attachments over SSL using IE. This is due to an IE bug, and can be fixed in Apache by setting: BrowserMatch ".MSIE." \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 Google has plenty more on this. Can't find the keystorejava.io.FileNotFoundException: /home/user/.keystore (No such file or directory) This indicates that Tomcat cannot find the keystore. The keytool utility creates the keystore as a file called .keystore in the current user's home directory. For Unix/Linux the home directory is likely to be /home/<username>. For Windows it is likely to be C:\Documents And Settings\<UserName>. Make sure you are running JIRA as the same user who created the keystore. If this is not the case, or if you are running JIRA on Windows as a service, you will need to specify where the keystore file is in conf/server.xml. Add the following attribute to the connector tag you uncommented: keystoreFile="<location of keystore file>" Incorrect passwordjava.io.IOException: Keystore was tampered with, or password was incorrect You used a different password than "changeit". You must either use "changeit" for both the keystore password and for the key password for Tomcat, or if you want to use a different password, you must specify it using the keystorePass attribute of the Connector tag, as described above. Passwords don't matchjava.io.IOException: Cannot recover key You specified a different value for the keystore password and the key password for Tomcat. Both passwords must be the same. Wrong certificatejavax.net.ssl.SSLException: No available certificate corresponds to the SSL cipher suites which are enabled. If the Keystore has more than one certificate, Tomcat will use the first returned unless otherwise specified in the SSL Connector in conf/server.xml. Add the keyAlias attribute to the Connector tag you uncommented, with the relevant alias, for example: <Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" useBodyEncodingForURI="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="/opt/local/.keystore" keystorePass="removed" keyAlias="tomcat"/> |
![]() |
Document generated by Confluence on Mar 27, 2011 18:37 |