我们使用 TeamCity 7.1.5,我为新的时间段更新了 TeamCity Server 站点证书(将 server.p12 文件替换为新证书),TeamCity Server 失去了与单个代理的连接。代理状态为已断开连接、已授权、已启用。我使用 WEB 浏览器导航到 TeamCity 站点并确保新证书有效。
进入 teamcity-agent.log 文件,我看到许多类似的消息,例如:
[2014-03-20 16:37:11,694] WARN - jetbrains.buildServer.AGENT - Ping problem: Call https://example.com/RPC2 buildServer.ping: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
如何使用新证书解决此代理连接问题?
使用旧站点证书,TeamCity 可以正常工作。
我看到新旧证书的详细信息有所不同。旧证书签名算法是使用 RSA 加密的 PKCs #1 SHA-1。新的证书签名算法是采用 RSA 加密的 PKCs #1 SHA-256。
最佳答案
我通过将新证书添加到 java 的默认信任库中解决了同样的问题:
并将其导入 java 默认信任库:
keytool -import -trustcacerts -file <ca_file> -alias <CA_ALIAS> -keystore $JAVA_HOME/jre/lib/security/cacerts
- [tmpFile] - 生成文件的名称。
- [servers-keystore] - 已配置的服务器 keystore
- [CA_ALIAS] - 在 keystore 中识别的证书的别名
- [ca_file] - 来自网络的 ca_file(可能通过 chrome expor 获取)
检查 $JAVA_HOME 路径是否正确,也许用绝对路径替换它。 truststore (cacerts) 的默认密码是:changeit
有关 java keytool 的更多信息:here
如果您没有 ca_file,请检查此 post
对于在 Windows 下安装的 TeamCity 代理,使用“agent_installation_path/jre”作为“JAVA_HOME”。 Source
关于java - 更新 TeamCity Server SSL 证书后断开 TeamCity Build Agent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22590248/