【问题标题】:Apply CA root certificates inside Dockerfile在 Dockerfile 中应用 CA 根证书
【发布时间】:2021-01-16 22:13:01
【问题描述】:

如何在 Docker 容器中下载证书(并自动更新)?

在基于 Alpine 的 Docker 容器中,我执行以下操作:

curl -I https://gtp.nlgworldwide.com

但我收到此错误:

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

我想我需要在我的Dockerfile 中做这样的事情:

RUN curl -s -O https://curl.haxx.se/ca/cacert.pem && mv cacert.pem /usr/local/share/ca-certificates && update-ca-certificates

但我仍然无法连接到上述网站,如何确保获得该网站的正确 CA 根证书?

【问题讨论】:

  • 我的意思是https://curl.haxx.se/ca/cacert.pem - 我已经更新了
  • 再次更新以将 wget 调用替换为 curl,但问题似乎与未将 COMODO TLS CA 根证书之一添加到证书存储区有关。

标签: docker ssl curl


【解决方案1】:

那个 HTTPS 站点也给我带来了问题,使用的是最新的 CA 存储。

问题是服务器未提供中间 COMODO 证书,这是服务器配置错误。

如果您愿意,可以通过手动下载丢失的证书并将其添加到您的 CA 存储来解决此问题。

The SSL Labs test verifies this.

【讨论】:

  • 感谢 Daniel,我可以确认从 support.comodo.com/index.php?/Knowledgebase/Article/View/970/… 下载证书并将文件移动到 /usr/local/share/ca-certificates/。然后运行的目录:“update-ca-certificates”对我有用。
  • 我还通知网站的开发人员与他们的服务器管理员核实以修复他们的 SSL 设置的配置,但由于我不确定这需要多长时间,我的 Dockerfile RUN/COPY 命令应该同时工作。再次感谢!
猜你喜欢
  • 1970-01-01
  • 2019-11-15
  • 2021-01-17
  • 1970-01-01
  • 2020-06-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-27
相关资源
最近更新 更多