Wget、自签名证书和 --no-check-certificate 不起作用

Wget、自签名证书和 --no-check-certificate 不起作用

我最近在我们的一个 nginx 网络服务器上安装了一个自签名 SSL 证书。如果我尝试使用 wget 获取文件,--no-check-certificate则会收到以下错误。您可以使用浏览器访问该网站,浏览器将识别出它是自签名的,并且证书会显示所有正确的信息。根据消息,我似乎应该找到一种在本地信任证书的方法,但这是否违背了 --no-check-certificate 的目的?

$ wget https://www.example.com/index.html --no-check-certificate
--2015-02-20 14:13:58--  https://www.example.com/index.html
Resolving example.com... 192.0.2.1
Connecting to example.com|192.0.2.1|:443... connected.
WARNING: cannot verify example.com’s certificate, issued by “/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Domain Validation Secure Server CA”:
  Unable to locally verify the issuer’s authority.
WARNING: no certificate subject alternative name matches
    requested host name “example.com”.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

任何想法都将不胜感激。

答案1

看看获得的错误输出和命令行,这里的问题不是客户端证书验证。似乎服务器机器拒绝连接。这可能是由于获得未向服务器提供所需的客户端证书(请检查您的其他浏览器是否有该证书)、此特定的用户代理被拒绝等。

我宁愿检查服务器的日志。

答案2

您可以尝试添加一些调试:-S 和 -d 用于服务器和客户端标头。

tcpdump 更好一些,能提供完整的故事,但其次最好的是没有完整数据包负载的报头。

http://www.gnu.org/software/wget/manual/wget.html

相关内容