如何设置 Jenkins CI 在 Windows 上使用 https?
我们最近在 Windows 上设置了 Jenkins CI 服务器。现在,为了使用 Active Directory 身份验证,我需要 https (SSL/TLS) 进行访问。鉴于此设置,推荐的方法是什么?
We've recently set up a Jenkins CI server on Windows. Now in order to use Active Directory authentication I'd like to require https (SSL/TLS) for access. Given this setup, what is the recommended way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
转到 %JENKINS_HOME% 并修改 jenkins.xml。在您看到
--httpPort=8080
的地方将其更改为--httpPort=-1 --httpsPort=8080
当然,您可以将端口设置为您想要的任何端口,但在我的测试(不久前,它可能已更改)如果您不保留--httpPort=
那么 Jenkins 将始终使用 8080。因此,如果您只需更改--httpPort =8080
改为--httpsPort=8080
,端口 8080 仍将使用 http。另外,如果您想使用自己的证书,本页底部有一些说明。
http://wiki.jenkins-ci.org/display/JENKINS /启动+和+访问+Jenkins
Go to your %JENKINS_HOME% and modify the jenkins.xml. Where you see
--httpPort=8080
change it to--httpPort=-1 --httpsPort=8080
you can make the ports anything you want of course, but in my testing (a while ago, it may have changed) if you don't keep--httpPort=<something>
then Jenkins will always use 8080. So if you simply change--httpPort=8080
to--httpsPort=8080
, port 8080 will still use http.Also, if you want to use your own certificate, there are some instructions at the bottom of this page.
http://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins
运行:
回答问题,记住
名字和姓氏
是网站 URL,并且应该是小写。示例:州或省
不能缩写。运行:
将
Jenkins.csr
发送到您的证书提供商,并请求具有.p7b
扩展名并以以下内容开头的 PKCS#7 证书:注意:试用证书通常不可用
.p7b
格式,但您也许可以使用此工具合并.cer
文件,该工具报告成功,但对我不起作用。 (https://www.sslshopper.com/ssl-converter.html)运行:
将 Jenkins.xml 中的
arguments
节点更改为以下内容。故障排除:
Jenkins.err.log
中的最后几行。Jenkins.xml
问题而未启动,请将–
(奇怪的 Windows 连字符)字符替换为实际的-
( ASCII 连字符)。[网站名称]
是实际 URL,不带https:
示例:https:// build.jenkins-ci.org
将是build.jenkins-ci.org
。KeyStore Explorer
检查.jks
文件。 “证书层次结构”应显示每个证书嵌套在另一个证书中;这是为了说明证书链。如果它显示彼此相邻的证书,那么它是不正确的。Run:
Answer the questions remembering that
First and last name
is the website URL and should be lowercase. Example:State or province
cannot be abbreviated.Run:
Send
Jenkins.csr
to your cert provider and request a PKCS#7 cert which has a.p7b
extension and starts with:Note: Trial certs are not normally available in
.p7b
format but you may be able to combine the.cer
files using this tool which reported success but didn't work for me. (https://www.sslshopper.com/ssl-converter.html)Run:
Change the
arguments
node in Jenkins.xml to the following prespectivly.Troubleshooting:
Jenkins.err.log
.Jenkins.xml
, replace the–
(weird Windows hyphen) characters with an actual-
(ASCII hyphen).[Name of website]
is the actual URL without thehttps:
example:https://build.jenkins-ci.org
would bebuild.jenkins-ci.org
..jks
file usingKeyStore Explorer
. The "Certificate Hierarchy" should show that each cert is nested in another; This is to illustrate the cert chain. If it shows the certs next to each other then it's not correct.第 1 步:在您的 jenkin 名称上创建公共和私有证书(如果不是,请将它们转换为 keyore 文件)
步骤2:将公共证书导入浏览器证书管理器(导入到所有选项卡)
第三步:使用包含公钥和私钥的 JKS 文件托管 jenkin。
有关步骤,请参阅“在 jenkins 中启用 HTTPS?”
Step1: Create both public and private Certificate on your jenkin name (convert them into keysore file if its not)
Step2: Import the public certificate into your browser certificate mananger (import into all tabs)
Step3: Host your jenkin using JKS file which contain both public and private key.
For steps refer "Enable HTTPS in jenkins?"