且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将自签名https证书添加到teamcity后,TeamCity构建代理将断开连接

更新时间:2022-02-05 08:04:10

构建代理作为构建服务器的客户端,并使用http / https与之通信,事实证明,当您添加自签名证书时,构建代理不接受它。

The build agent works as a client to the build server and communicates with it using http/https, and it turns out that when you add a self-signed certificate the build agent does not accept it.

我需要


  1. 让构建代理知道与服务器通信的新路径

  2. 让构建代理知道它可以信任自签名证书

要更改路径,我执行了以下操作(请参阅这篇文章了解更多详情)

To change the path I did the following (see this post for more details )


找到文件:

$ TEAMCITY_HOME / buildAgent / conf / buildAgent.properties


更改房产

serverUrl = http: \:// localhost \:8080 到您的新网址

让构建代理知道它可以信任新证书我必须将其导入构建代理的密钥存储区。这是使用keytool完成的:

To let the build agent know that it could trust the new certificate I had to import it into the build agent's key store.This was done using keytool:

keytool -importcert -file <cert file>  
        -keystore <agent installation path>/jre/lib/security/cacerts

除非您已更改密钥,否则密钥库受密码保护:更改

TeamCity团队更详细地描述了此过程这里

The TeamCity team describes this process in slightly more details here

注意

如果您需要从TeamCity构建服务器密钥库中检索证书,还可以使用keytool执行此操作

NOTE
If you need to retrieve your certificate from the TeamCity buildserver keystore, you can also use keytool to do this :

keytool -export -alias <alias name>  
        -file <certificate file name> 
        -keystore <Teamcity keystore path>