为什么 openSSL 无法验证 google 的证书?

为什么 openSSL 无法验证 google 的证书?

当我从 Debian VM 运行命令时openssl -connect www.google.com:443,我在输出中得到以下内容:

验证返回代码:20(无法获取本地颁发者证书)

这是怎么回事?我从未遇到过 Google 的证书问题,所以一定是 Debian 或其 openSSL 库出了问题。当此类工具无法验证我所知道的系统时,调试其他 SSL 系统会变得更加困难!

答案1

在我使用的另一个 Linux 发行版中,naked-connect动词实际上不会导入系统上安装的根 CA 软件包。要实现这一点,您需要添加-CApath /etc/ssl/wherever/,其中路径是根 CA 证书包的位置。

没有 CAPath:

CONNECTED(00000003)
depth=1 C = ZA, O = Thawte Consulting (Pty) Ltd., CN = Thawte SGC CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=mail.google.com
   i:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
 1 s:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
   i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
 ---

使用 CAPath:

CONNECTED(00000003)
depth=2 C = US, O = "VeriSign, Inc.", OU = Class 3 Public Primary Certification     Authority
verify return:1
depth=1 C = ZA, O = Thawte Consulting (Pty) Ltd., CN = Thawte SGC CA
verify return:1
depth=0 C = US, ST = California, L = Mountain View, O = Google Inc, CN = mail.google.com
verify return:1
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=mail.google.com
   i:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
 1 s:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
   i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
---

相关内容