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

标签 security https teamcity teamcity-7.0 build-agent

我向我的 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/

    相关文章:

    gradle - 在 Teamcity CI 代理中重用 Gradle 缓存

    c++ - 为进程添加权限

    security - 是否可以拦截纯文本安全请求的有效负载?

    security - Symfony2 扩展 DefaultAuthenticationSuccessHandler

    java - 如何让自签名证书代码只执行一次?

    windows - 如何配置在 Windows 上运行的 node.js 使用多个域名的多个 SSL 证书?

    git - Teamcity 无法自动 merge

    winapi - CI 服务器上的 MSBuild 找不到 AL.exe

    security - OpenID Connect 服务器流中的 "state"参数可以防止什么攻击?

    php - 如何在 laravel 5.4 中保护 .env 文件?