jenkins证书制作
程序员文章站
2022-06-05 18:46:31
...
1. 生成服务器证书
keytool -genkey -v -alias tomcat -keyalg RSA -keystore /etc/jenkins/ssl/jenkins.keystore -validity 36500
2. 生成客户端证书
keytool -genkey -v -alias jenkins -keyalg RSA -storetype PKCS12 -keystore /etc/jenkins/ssl/jenkins.p12 -validity 36500
3.把客户端证书导出为一个单独的CER文件
keytool -export -alias jenkins -keystore /etc/jenkins/ssl/jenkins.p12 -storetype PKCS12 -storepass 123456 -rfc -file /etc/jenkins/ssl/jenkins.cer
4. 将生成的CER文件导入到服务器的证书库
keytool -import -v -file /etc/jenkins/ssl/jenkins.cer -keystore /etc/jenkins/ssl/jenkins.keystore
5. 可以查看下
keytool -list -keystore /etc/jenkins/ssl/jenkins.keystore
6. 在{tomcat_home}/conf/server.xml 中配置证书
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150"
scheme="https" secure="true" clientAuth="false" sslProtocol="TLS"
keystoreFile="/etc/jenkins/ssl/jenkins.keystore" keystorePass="123456"
truststoreFile="/etc/jenkins/ssl/jenkins.keystore" truststorePass="123456" />