Jenkins和SSL证书 [英] Jenkins and SSL certificates

查看:1091
本文介绍了Jenkins和SSL证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我对证书的曝光和经验有限,因此我试图将其作为学习体验,并获得答案。



使用Jenkins我想能够作为我的构建的一部分使用证书(.p12)进行身份验证的卷曲请求。



示例

  curl --cert / Users / Jenkins /。 jenkins / workspace / develop-pipeline /../ certificates / dev_cert.p12:password https://jira.dev.organisation.co.uk:443/rest/api/2/issue/MYSTATS-1234 

所以我有一个桌面证书(私钥),我保存在Jenkins运行的机器上,但我也明白我需要一个CA证书来授权这个私钥(希望到目前为止这是正确的)。



当我从终端上运行curl命令在Jenkins机器,我有一个弹出窗口,问我是否要使用钥匙扣内的证书授权,我点击总是允许,所以命令行curl请求总是工作。



这是作为Jenkins构建的一部分我获得

 (58)SSL:无法加载证书/ Users / Jenkins / .jenkins / workspace / develop-pipeline /../ certificates / dev_cert.p12及其私钥:OSStatus -25308 

证书的路径是正确的,因为目录结构是

  develop-pipeline 
证书
dev_cert.p12

我不明白的是,如果我不提供密码

  curl --cert /Users/Jenkins/.jenkins/workspace/develop-pipeline/../certificates/dev_cert.p12 https: /jira.dev.organisation.co.uk:443/rest/api/2/issue/MYSTATS-1234 

我收到此讯息

  SSL证书/Users/Jenkins/.jenkins/workspace/develop-pipeline/dev_cert .p12需要密码

所以它找到了证书?



还提供了不正确的密码。

  SSL:证书密码不正确/ Users / Jenkins / .jenkins / workspace / develop-pipeline / dev_cert.p12及其私钥。 

我需要做什么才能使这项工作?

解决方案

a href =https://github.com/boot2docker/boot2docker/issues/573#issuecomment-254436739 =nofollow noreferrer>这个Github评论帮助我整理出OSX的curl问题。所以在我的case安装curl通过Homebrew与OpenSSL标志做的伎俩。


Firstly my exposure and experience with certificates is limited so I am trying to use this as a learning experience aswell as obtaining an answer.

Using Jenkins I would like to be able to make a curl request as part of my build that uses a certificate (.p12) to authenticate.

Example

curl --cert /Users/Jenkins/.jenkins/workspace/develop-pipeline/../certificates/dev_cert.p12:password https://jira.dev.organisation.co.uk:443/rest/api/2/issue/MYSTATS-1234

So i have a Desktop certificate (private key) which i have saved onto the machine where Jenkins runs, but I also understand that i need a CA certificate to authorise this private key (hope this is correct so far).

When i have run the curl command from the terminal on the Jenkins machine i had a popup that asked me did i want to use the cert within the keychain to authorise and i clicked always allow, so command line curl requests always work.

However when i run this as part of a Jenkins build i get

(58) SSL: Can't load the certificate "/Users/Jenkins/.jenkins/workspace/develop-pipeline/../certificates/dev_cert.p12" and its private key: OSStatus -25308

The path to the cert is correct as the directory structure is

develop-pipeline
certificates
  dev_cert.p12

What i dont understand is that if i dont provide a password

curl --cert /Users/Jenkins/.jenkins/workspace/develop-pipeline/../certificates/dev_cert.p12 https://jira.dev.organisation.co.uk:443/rest/api/2/issue/MYSTATS-1234

i get the message

SSL The certificate "/Users/Jenkins/.jenkins/workspace/develop-pipeline/dev_cert.p12" requires a password

So it has found the certificate ?

Also providing an incorrect password yields

 SSL: Incorrect password for the certificate "/Users/Jenkins/.jenkins/workspace/develop-pipeline/dev_cert.p12" and its private key.

What do i need to do to get this working? Any links to things that will help me

Thanks

解决方案

This Github comment helped me sorting out the curl issue on OSX. So in my case installing curl via Homebrew with OpenSSL flags did the trick.

这篇关于Jenkins和SSL证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆