Configuring HTTPS on Tomcat

本文介绍如何为JIRA配置SSL,包括使用自签名证书和第三方证书颁发机构的证书。此外还详细说明了如何设置Tomcat来支持HTTPS,并通过重定向特定页面确保数据安全。

Reference from http://confluence.atlassian.com/display/JIRA/Running+JIRA+over+SSL+or+HTTPS#RunningJIRAoverSSLorHTTPS-ImportCertificateIntoTheTruststore

Running JIRA over SSL or HTTPS

<!-- wiki content -->

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.

Please note that Atlassian Support will refer SSL support to the institution that issues the Certificate. We provide this documentation for reference.

The process of enabling SSL access is specific to each application server, but the process for specifying which pages require protection is generic.

This procedure is a general guide for the way to configure Tomcat with HTTPS and only covers the common installation types of JIRA. It is by no means a definitive or comprehensive guide to configuring HTTPS and may not be applicable to your specific integration.
For JIRA Windows Standalone installations
  • Since JIRA 3.8, Java comes bundled with JIRA Windows Standalone. It is this bundled JRE (Java Runtime Environment) that is used to run Tomcat by default, and which must be updated with the SSL certificates.
  • The term <install-dir> is used frequently in this document which refers the the installation directory of JIRA. The JIRA Installation Directory KB shows you how to determine this for your particular installation.

On this page:

Running JIRA over HTTPS

The 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 Tomcat

Edit conf/server.xml , and at the bottom before the </Service> tag, add this section (or uncomment it where you find it) in Tomcat 6:

<script> window.SyntaxHighlighter.config.clipboardSwf = '/s/1814/13/2/_/download/resources/com.atlassian.confluence.ext.newcode-macro-plugin:clipboard/clipboard.swf'; </script>
1. < Connector port = "8443" maxHttpHeaderSize = "8192" SSLEnabled = "true"
2. maxThreads = "150" minSpareThreads = "25" maxSpareThreads = "75"
3. enableLookups = "false" disableUploadTimeout = "true" useBodyEncodingForURI = "true"
4. acceptCount = "100" scheme = "https" secure = "true"
5. 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).

JIRA 4.1 Standalone comes with Tomcat 6 which requires SSLEnabled="true" to be added to the Connector tag above. We will include this by default soon- http://jira.atlassian.com/browse/JRA-20963

^Back to the flowchart

Generate Self-Signed Certificate

Self-signed certificates are useful in cases where you require encryption but do not need to verify the website identity.
They are commonly used for testing and on internal corporate networks (intranets).

Due to the certificate not being signed by a Certification Authority (CA), users may get prompted that the site is untrusted 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.

The following approach to create the certificate uses Java's keytool , and has been formatted for use with Java 1.6.
There are other tools for generating certificates such as openSSL which are not discussed in this procedure.

When running the following keytool command you will be prompted with:

What is your first and last name?

Instead of entering your first and last name as specified, you must enter the fully qualified hostname of the server running JIRA. This is the same as the name you would type in your web browser after the http:// section to access your JIRA installation. When the client web browser examines the certificate, it checks this field, and makes sure that it matches the hostname. If it doesn't, it may prevent access to the site, and at the very least will generate pop-up messages saying that there is a mismatch. An example of a qualified hostname is: support.atlassian.com

The keytool utility will also prompt you for two passwords: the keystore password and the key password for Tomcat. You must use the same value for both passwords, and the value must be either:

  1. "changeit" (this is the default value Tomcat expects), or
  2. if you use a value other than "changeit", you must also specify it in conf/server.xml . You must add the following attribute to the Connector tag described above:

    keystorePass="<password value>"
    

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 .

^Back to the flowchart

Obtain CA Certificate

Digital 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 .
Some of the most well known CAs are:

Next, import the certificate into the Trust-store .

^Back to the flowchart

Import Certificate into the Trust-store

Your SSL Vendor may have different instructions, please refer to them for proper certificate installation. Examples include GoDaddy and VeriSign

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

This step must be performed as the root user, or with the use of sudo
$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 .

^Back to the flowchart

Redirecting certain pages to HTTPS

Although 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> :

<script> window.SyntaxHighlighter.config.clipboardSwf = '/s/1814/13/2/_/download/resources/com.atlassian.confluence.ext.newcode-macro-plugin:clipboard/clipboard.swf'; </script>
01. < security-constraint >
02. < web-resource-collection >
03. < web-resource-name >all-except-attachments</ web-resource-name >
04. < url-pattern >*.js</ url-pattern >
05. < url-pattern >*.jsp</ url-pattern >
06. < url-pattern >*.jspa</ url-pattern >
07. < url-pattern >*.css</ url-pattern >
08. < url-pattern >/browse/*</ url-pattern >
09. </ web-resource-collection >
10. < user-data-constraint >
11. < transport-guarantee >CONFIDENTIAL</ transport-guarantee >
12. </ user-data-constraint >
13. </ 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.

There does not seem to be an easy way to make subsequent pages revert to HTTP after logging in via HTTPS - see JRA-7250

Troubleshooting

Here 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 problems

Some 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:

<script> window.SyntaxHighlighter.config.clipboardSwf = '/s/1814/13/2/_/download/resources/com.atlassian.confluence.ext.newcode-macro-plugin:clipboard/clipboard.swf'; </script>
1. BrowserMatch ".MSIE." \
2. nokeepalive ssl-unclean-shutdown \
3. downgrade- 1.0 force-response- 1.0

Google has plenty more on this.

Can't find the keystore

java.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 password

java.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 match

java.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 certificate

javax.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"/>
<!-- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"> <rdf:Description rdf:about="http://confluence.atlassian.com/display/JIRA/Running+JIRA+over+SSL+or+HTTPS" dc:identifier="http://confluence.atlassian.com/display/JIRA/Running+JIRA+over+SSL+or+HTTPS" dc:title="Running JIRA over SSL or HTTPS" trackback:ping="http://confluence.atlassian.com/rpc/trackback/124008"/> </rdf:RDF> --> Labels parameters
【评估多目标跟踪方法】9个高度敏捷目标在编队中的轨迹和测量研究(Matlab代码实现)内容概要:本文围绕“评估多目标跟踪方法”,重点研究9个高度敏捷目标在编队飞行中的轨迹生成与测量过程,并提供完整的Matlab代码实现。文中详细模拟了目标的动态行为、运动约束及编队结构,通过仿真获取目标的状态信息与观测数据,用于验证和比较不同多目标跟踪算法的性能。研究内容涵盖轨迹建模、噪声处理、传感器测量模拟以及数据可视化等关键技术环节,旨在为雷达、无人机编队、自动驾驶等领域的多目标跟踪系统提供可复现的测试基准。; 适合人群:具备一定Matlab编程基础,从事控制工程、自动化、航空航天、智能交通或人工智能等相关领域的研究生、科研人员及工程技术人员。; 使用场景及目标:①用于多目标跟踪算法(如卡尔曼滤波、粒子滤波、GM-CPHD等)的性能评估与对比实验;②作为无人机编队、空中交通监控等应用场景下的轨迹仿真与传感器数据分析的教学与研究平台;③支持对高度机动目标在复杂编队下的可观测性与跟踪精度进行深入分析。; 阅读建议:建议读者结合提供的Matlab代码进行实践操作,重点关注轨迹生成逻辑与测量模型构建部分,可通过修改目标数量、运动参数或噪声水平来拓展实验场景,进一步提升对多目标跟踪系统设计与评估的理解。
本软件实现了一种基于时域有限差分法结合时间反转算法的微波成像技术,旨在应用于乳腺癌的早期筛查。其核心流程分为三个主要步骤:数据采集、信号处理与三维可视化。 首先,用户需分别执行“WithTumor.m”与“WithoutTumor.m”两个脚本。这两个程序将在模拟生成的三维生物组织环境中进行电磁仿真,分别采集包含肿瘤模型与不包含肿瘤模型的场景下的原始场数据。所获取的数据将自动存储为“withtumor.mat”与“withouttumor.mat”两个数据文件。 随后,运行主算法脚本“TR.m”。该程序将加载上述两组数据,并实施时间反转算法。算法的具体过程是:提取两组仿真信号之间的差异成分,通过一组专门设计的数字滤波器对差异信号进行增强与净化处理,随后在数值模拟的同一组织环境中进行时间反向的电磁波传播计算。 在算法迭代计算过程中,系统会按预设的周期(每n次迭代)自动生成并显示三维模拟空间内特定二维切面的电场强度分布图。通过对比观察这些动态更新的二维场分布图像,用户有望直观地识别出由肿瘤组织引起的异常电磁散射特征,从而实现病灶的视觉定位。 关于软件的具体配置要求、参数设置方法以及更深入的技术细节,请参阅软件包内附的说明文档。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值