Azure Pipelines 本地代理无法连接 SSL 错误

Azure Pipelines local agent failing to connect with SSL error

我们有一个本地服务器 (Windows Server 2012 R2),上面有一个 Azure Pipelines 代理 运行。今天(2022 年 1 月 31 日)此代理无法再连接到我们的 Azure DevOps 组织。

根据日志文件判断,我认为这是因为它正在尝试连接较旧的 TLS 版本,该版本截至今天已不再可用 - https://devblogs.microsoft.com/devops/azure-devops-services-to-require-tls-1-2/

所以我按照有关如何确保启用 TLS 1.2 的说明进行操作,并在注册表编辑器中确认了我的设置,并通过 运行 这里建议的 PowerShell 脚本 - https://docs.microsoft.com/en-us/security/engineering/solving-tls1-problem#update-windows-powershell-scripts-or-related-registry-settings

一切正常,但仍然无法连接同一个问题。机器也已重新启动。如果我尝试 URL 它在内置的 Internet Explorer 浏览器中请求,它会失败,但是 Chrome 它会成功,所以它一定仍在尝试连接 TLS 1.2,但我没有知道为什么。我也尝试过重新安装代理(使用最新版本),但它因同样的错误而失败。有什么建议吗?

在服务器上使用 IISCrypto 启用以下 Cyphers 帮助我们解决了这个问题

密码套件

TLS 1.2(server-preferred 顺序的套件)

  • TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (0x9f) DH 2048 位 FS 256
  • TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (0x9e) DH 2048 位 FS 128

这个来自Vijay's solution

由于 TLS 1.2 mandate. We have self-hosted agents, and despite the boxes showing having .NET 4.8 installed, we ran the below registry edits in an elevated command prompt per this doc 恢复了连接,我们遇到了 Azure DevOps 无法发布到 Azure 应用服务的问题:

reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:64

reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:32

在受影响的计算机上,您可以尝试 运行 使用 AzDO TLS 1.2 转换就绪检查器进行分析:https://github.com/microsoft/azure-devops-tls12/blob/main/AzureDevOpsTls12Analysis.ps1

该脚本检查客户端是否启用了 TLS 1.2,检查密码套件问题并检查是否存在使旧版 .NET Framework 应用支持 TLS 1.2 所需的开关。根据发现,它会打印缓解建议或生成定制的缓解脚本 (ps1)。

模拟题中描述的问题,脚本给出建议:

MITIGATION 'gpeditREM': via Local Group Policy setting
    Run gpedit.msc:
    - Navigate to "Computer Config/Administrative Templates/Network/SSL Config Settings"
    - Choose setting "SSL Cipher Suite Order" -> Edit
    - If 'Enabled' is not checked, then continue to the next mitigation below.
    - If 'Enabled' is checked:
      - *either* change to 'Not configured' (resets to OS-default setting)"
      - *or* keep 'Enabled' and in field 'SSL Cipher Suites' add at least one of the following items to comma-separated list:
        TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
        TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
    - Press 'OK' button
    Restart the computer

MITIGATION 'regFunctionsDEL': deletion of cipher suite list in registry
    Mitigation script generated at .\Mitigation-regFunctionsDEL.ps1
    Run the mitigation script as Administrator:
    - If 'Done!' is printed, then operation was successfull.
    - If 'Mitigation was not effective!' is printed, then cipher suites are enforced via domain GPO - talk to your domain administrator.

Screenshot: TLS 1.2-transition readiness checker on WS 2012 R2

Windows Server 2012 R2(及更早版本)容易受到密码套件问题的影响,因为它仅支持 AzDevOps 当前所需的四个 TLS 1.2 密码套件中的两个(即使只有 [=13 才支持这两个) =] 已应用)。

请记住 Azure DevOps rolled-back 其 1 月 31 日的 TLS 1.0/1.1 弃用(IPv6 端点除外)。全面弃用目前计划不早于 2022 年 3 月 31 日 (announcement)

更新(2022 年 5 月):Azure DevOps 团队已在 dev.azure.com 域上完成 TLS 1.0/1.1 弃用。子域 *.visualstudio.com 将紧随其后。