Wget 因证书错误而失败

问题描述 投票:0回答:3

作为自动化构建的一部分,我们从 github 下载一些代码。最小的例子:

wget github.com

最近,该命令开始失败并出现证书错误:

URL transformed to HTTPS due to an HSTS policy
--2017-10-05 11:43:45--  https://github.com/
Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
Connecting to github.com (github.com)|192.30.253.112|:443... connected.

ERROR: cannot verify github.com's certificate, issued by 'CN=DigiCert SHA2 Extended Validation Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US':
  Unable to locally verify the issuer's authority.

我尝试更新证书存储和 wget 本身:

update-ca-certificates
apt-get install wget

错误还是一样。 我的wget版本是GNU Wget 1.17.1,操作系统是Ubuntu 16.04.3。

ssl wget ubuntu-16.04
3个回答
0
投票

您可以在 wget 命令行上添加

--no-check-certificate
选项来避免检查证书的有效性。


0
投票

答案就在数据包配置中的某个地方。不幸的是,我无法确切地说出原因。怀疑是从 ppa 安装的某些

mono
版本扰乱了我们的证书存储。


0
投票

我们之前启用 HSTS 策略的网站之一也出现类似错误。即使我们禁用 HSTS 后,该错误仍然存在。

经过一番挖掘,我发现 wget 将有关站点的 HSTS 信息保留在本地缓存文件中。删除文件即可解决问题。

rm ~/.wget-hsts
© www.soinside.com 2019 - 2024. All rights reserved.