【问题标题】:Wget and Curl stopped working with HTTPS. Wrongly complain about an expired certificateWget 和 Curl 停止使用 HTTPS。错误地抱怨证书过期
【发布时间】:2020-09-18 07:09:49
【问题描述】:

我有一个每天在 Ubuntu 14.04 服务器上运行的脚本。该脚本是一个简单的 wget 命令,它从远程服务器下载文件并将其保存到本地文件系统:

wget https://example.com/resources/scripts/myfile.php -O myfile.php

它已经运行了几个月,直到今天早上,当我突然运行它时,我得到:

--2020-05-30 11:57:16--  https://example.com/resources/scripts/myfile.php
Resolving example.com (example.com)... xx.xx.xx.xx
Connecting to example.com (example.com)|xx.xx.xx.xx|:443... connected.
ERROR: cannot verify example.com's certificate, issued by ‘/C=GB/ST=Greater Manchester/L=Salford/O=Sectigo Limited/CN=Sectigo RSA Domain Validation Secure Server CA’:
  Issued certificate has expired.
To connect to example.com insecurely, use `--no-check-certificate'.

该域的 SSL 有效,将于 2022 年 1 月到期。这方面没有任何变化。然而不知何故 wget 不再看到这一点。

这是另一个有趣的事实。如果我在 Ubuntu 18 机器上运行相同的命令,它就像一个魅力,没有任何抱怨。这告诉我我的 Ubuntu 14.04 机器出了点问题。

Curl 产生同样的错误:

curl https://example.com
curl: (60) SSL certificate problem: certificate has expired

This post 提示证书包已过期。我已经下载了建议的 PEM 文件并尝试通过指定 --ca-certificate=cacert.pem 选项来运行 wget,但无济于事。

我也尝试过运行:apt install ca-certificatesupdate-ca-certificates,但这也没有用。

同样,在 Ubuntu 18 机器上一切正常,但在 Ubuntu 14 或 16 上却不行。另外,为什么直到今天早上我知道没有人碰过机器时它才能正常工作?显然有些东西已经过时了,但我似乎不知道如何修复它。

有人有什么建议吗?

【问题讨论】:

标签: ssl curl wget


【解决方案1】:

两天前,我在 Comodo 证书和 ubuntu 16.04 上遇到了同样的错误。 问题就像是说 mrmuggles 这个https://support.sectigo.com/Com_KnowledgeDetailPage?Id=kA03l00000117LT

我用这个步骤修复了:

  • vi /etc/ca-certificates.conf
  • 删除行(或注释) 指定 AddTrust_External_Root.crt
  • apt update && apt install ca-certificates
  • update-ca-certificates -f -v

【讨论】:

  • 这并没有解决我的 Ubuntu 14 上的问题。也许这适用于 Ubuntu 16。我想解决问题的正确方法是在带有 SSLed 站点的服务器上。这篇文章展示了如何:stackoverflow.com/a/62115626/1927991
  • 就我而言,apt update && apt install ca-certificates 修复了所有问题。
【解决方案2】:

https://askubuntu.com/questions/440580/how-does-one-remove-a-certificate-authoritys-certificate-from-a-system

与原始海报一样,编辑 ca-certificates.conf 的方法在 Ubuntu 14.04 上对我不起作用。 什么有效:

  1. 运行 sudo dpkg-reconfigure ca-certificates

  2. 取消选择问题 CA:AddTrust_External_Root

  3. 按确定

我的理解是删除AddTrust_External_Root的过期CA,改用较新的CAUSERTrust_RSA_Certification_Authority

【讨论】:

    猜你喜欢
    • 2022-01-18
    • 2015-12-11
    • 2021-11-26
    • 2021-12-12
    • 2020-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-17
    相关资源
    最近更新 更多