【问题标题】:Docker Windows Composer ZScaler SSL Certificate Verify FailedDocker Windows Composer ZScaler SSL 证书验证失败
【发布时间】:2023-03-14 21:49:02
【问题描述】:

我在 Windows 10 企业版机器上运行 Docker Windows(Linux 容器)。我正在使用基于 Debian 的 Docker 映像,并且我的 Windows 桌面正在运行 ZScaler。

我获得了两个证书文件(一个根证书和一个中间证书),我通过将它们放入 /usr/local/share/ca-certificates 目录并运行出现的“update-ca-certificates”来安装它们安装证书。

当我尝试运行 composer diag 时,我得到以下输出:

composer diag
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: [Composer\Downloader\TransportException] The "https://repo.packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: <Omitted
Dev Public Key Fingerprint: <Omitted
OK
Checking composer version:

  [Composer\Downloader\TransportException]
  The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
  error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
  Failed to enable crypto
  failed to open stream: operation failed


diagnose

有人可以帮我弄清楚如何让它工作吗?

【问题讨论】:

  • 为什么要使用自己的证书? getcomposer.org 绝不会使用您的任何个人证书
  • zscaler 充当 SSL 代理,企业要求...它直接将自己置于您和外部世界之间——解密任何出站 SSL 流量并使用自签名证书重新加密它——或至少一份由不受信任的 CA 签署。因此,入站返回 SSL 连接似乎正在使用来自无效 CA 的证书,因此出现错误(这是我的理解)...... getcomposer 文档说它使用 PHP 设置...... PHP 说它使用操作系统设置,还说你应该'不必设置这个......在这里查看相关链接:getcomposer.org/doc/06-config.md#cafile

标签: docker openssl composer-php debian zscaler


【解决方案1】:

在我的情况下,根证书没有正确安装......企业提供的证书的名称为 .crt 用于中间证书,.cer 用于根证书。 update-ca-certificates 没有获取名为 .cer 的证书。重命名根证书并重新运行 update-ca-certificates 安装了根证书并修复了问题。

运行以下命令有助于找出问题:

CONNECTED(00000003)
depth=2 DC = com, DC = my-enterprise, DC = ent, CN = ca-intermediate
verify error:num=2:unable to get issuer certificate
issuer= DC = pvt, DC = my-enterprise, CN = ca-rootauth
verify return:1
depth=1 C = US, ST = US, L = US, O = "my-enterprise ", OU = CTE, CN = my-enterprise.com
issuer= DC = com, DC = my-enterprise, DC = ent, CN = ca-intermediate
verify return:1
depth=0 C = US, ST = California, L = San Francisco, O = "GitHub, Inc.", CN = *.github.com
issuer= C = US, ST = US, L = US, O = "my-enterprise ", OU = CTE, CN = my-enterprise.com
verify return:1
---
Certificate chain
0 s:C = US, ST = California, L = San Francisco, O = "GitHub, Inc.", CN = *.github.com
   i:C = US, ST = US, L = US, O = "my-enterprise ", OU = CTE, CN = my-enterprise.com

这表明根证书未被识别为有效 CA,并导致我列出了 openssl 识别的证书。我在这里找到了答案: https://unix.stackexchange.com/questions/97244/list-all-available-ssl-ca-certificates

一旦我列出并验证 CA 受信任列表中不存在 ca-rootauth,那么只需弄清楚为什么两者(根和中间)工作方式不同......

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-30
    • 1970-01-01
    • 2019-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-28
    • 2021-10-08
    相关资源
    最近更新 更多