linux系统下JIRA 配置https
首先需要安装jdk,MySQL,其次安装JIRA。
一,配置证书
1, 使用 keytool($JAVA_HOME/bin/keytool)生成本地秘钥库文件(*.jks):
$JAVA_HOME/bin/keytool -genkeypair -keysize 2048 -alias jira -keyalg RSA -sigalg SHA256withRSA -keystore /opt/atlassian/ca/jira.jks
注:
1)*.jks文件不要放在安装目录,以免后续升级时被冲掉;
2)执行时要输入 firt and last name 时。要写域名或者IP,比如: 192.168.100.101,jira.company.com;
3)执行时要输入密码,只能是字母和数字组合,记住了,后续要用到。
2, 生成证书签名请求(*.csr):
$JAVA_HOME/bin/keytool -certreq -keyalg RSA -alias jira -file jira.csr -keystore /opt/atlassian/ca/jira.jks
注:执行时要输入上一步设置的密码。
3, 签名(*.crt):(有俩种方式获取)
1)CA机构签名:
将生成的 jira.csr 提交给CA机构签名,CA会给你签名后的证书 jira.crt 以及根证书或者中间证书:root.crt
2)自签名:
生成密钥和根证书:
openssl req -newkey rsa:2048 -nodes -keyout ca.key -x509 -days 365 -out ca.crt
自签名:
openssl x509 -req -CA ca.crt -CAkey ca.key -in jira.csr -out jira.crt -days 365 -CAcreateserial
检查签名:
openssl verify -verbose -CAfile ca.crt jira.crt
4, 导入根证书、签名的证书至本地秘钥库:
$JAVA_HOME/bin/keytool -importcert -alias rootCA -keystore /opt/atlassian/ca/jira.jks -trustcacerts -file ca.crt
$JAVA_HOME/bin/keytool -importcert -alias jira -keystore /opt/atlassian/ca/jira.jks -file jira.crt
检查导入证书:
$JAVA_HOME/bin/keytool -list -alias jira -keystore /opt/atlassian/ca/jira.jks
二、配置JIRA服务
1,备份<Jira_INSTALL>/conf/server.xml
2,配置https连接选项:
编辑<Jira_INSTALL>/conf/server.xml,增加如下:
<Connector port="8443" maxHttpHeaderSize="8192" relaxedPathChars="[]|" relaxedQueryChars="[]|{}^\`"<>"
maxThreads="150" minSpareThreads="25"
protocol="org.apache.coyote.http11.Http11NioProtocol"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" useBodyEncodingForURI="true" URIEncoding="UTF-8"
sslProtocol="TLSv1.2" sslEnabledProtocols="TLSv1.2,TLSv1.3" SSLEnabled="true"
keyAlias="jira" keystoreFile="/opt/atlassian/ca/jira.jks" keystorePass="xxx" keystoreType="JKS"/>
注:
1)如果JIRA是老版本升级的,那没有这个参数会启动不起来,一定要加上:relaxedQueryChars="[]|{}^\`"<>"
2)如果https端口不是8443,修改了端口,http里的对应也要改:
3,配置http自动重定向https页面:
编辑<Jira_INSTALL>/atlassian-jira/WEB-INF/web.xml,在前增加如下:
<security-constraint>
<web-resource-collection>
<web-resource-name>all-except-attachments</web-resource-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspa</url-pattern>
<url-pattern>/browse/*</url-pattern>
<url-pattern>/issues/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
三、重启JIRA
使用原来的地址访问,会自动跳到https的8443端口,或者使用https://ip地址:8443。