我向我的 Teamcity BuildServer 添加了一个自签名证书以引入 https 支持,以便现在可以在
https://ServerUrl:8443
(更多详情 here )
结果是我能够通过 https 访问服务器,但我的构建代理现在已断开连接。如何解决这个问题?
最佳答案
构建代理作为构建服务器的客户端工作,并使用 http/https 与其通信,事实证明,当您添加自签名证书时,构建代理不接受它。
我需要
要更改路径,我执行了以下操作(请参阅 this post 了解更多详细信息)
Locate the file:
$TEAMCITY_HOME/buildAgent/conf/buildAgent.properties
Change the property
serverUrl=http:\://localhost\:8080 to your new url
为了让构建代理知道它可以信任新证书,我必须将其导入构建代理的 keystore 。这是使用 keytool 完成的:
keytool -importcert -file <cert file>
-keystore <agent installation path>/jre/lib/security/cacerts
(除非您已更改,否则 keystore 受密码保护:changeit)
TeamCity 团队更详细地描述了这个过程here
注意
如果您需要从 TeamCity buildserver keystore 中检索您的证书,您也可以使用 keytool 来执行此操作:
keytool -export -alias <alias name>
-file <certificate file name>
-keystore <Teamcity keystore path>
关于security - 将自签名 https 证书添加到 teamcity 后,TeamCity 构建代理断开连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14980207/