我有一个奇怪的问题。将我的LAMP开发机(Debian)更新为PHP7。之后,我无法再通过Curl连接到特定的TLS加密API。
有问题的SSL证书由thawte签名。
curl https://example.com
给我
curl: (60) SSL certificate problem: unable to get local issuer certificate
而
curl https://thawte.com
当然,这也是Thawte作品签名的。
我可以在其他计算机上通过HTTPS访问API站点,例如通过curl和浏览器在我的桌面上。因此该证书绝对有效。SSL Labs评级为A。
从我的开发机到其他SSL加密站点的任何其他Curl请求都可以工作。我的根证书是最新的。为了验证,我跑了update-ca-certificates
。我什至将http://curl.haxx.se/ca/cacert.pem下载到/ etc / ssl / certs并运行c_rehash
。
还是一样的错误。
有什么方法可以调试验证过程并查看正在寻找但找不到的本地颁发者证书curl(或openssl),即文件名?
更新
curl -vs https://example.com
告诉我(IP +域名已匿名)
* Hostname was NOT found in DNS cache
* Trying 192.0.2.1...
* Connected to example.com (192.0.2.1) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem: unable to get local issuer certificate
* Closing connection 0
和
echo | openssl s_client -connect example.com:443
给
CONNECTED(00000003)
depth=2 C = US, O = "thawte, Inc.", OU = Certification Services Division, OU = "(c) 2006 thawte, Inc. - For authorized use only", CN = thawte Primary Root CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=DE/ST=XYZ/CN=*.example.com
i:/C=US/O=thawte, Inc./CN=thawte SSL CA - G2
1 s:/C=US/O=thawte, Inc./CN=thawte SSL CA - G2
i:/C=US/O=thawte, Inc./OU=Certification Services Division/OU=(c) 2006 thawte, Inc. - For authorized use only/CN=thawte Primary Root CA
2 s:/C=US/O=thawte, Inc./OU=Certification Services Division/OU=(c) 2006 thawte, Inc. - For authorized use only/CN=thawte Primary Root CA
i:/C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com
---
Server certificate
-----BEGIN CERTIFICATE-----
[...]
-----END CERTIFICATE-----
subject=/C=DE/ST=XYZ/CN=*.example.com
issuer=/C=US/O=thawte, Inc./CN=thawte SSL CA - G2
---
No client certificate CA names sent
---
SSL handshake has read 4214 bytes and written 421 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: [...]
Session-ID-ctx:
Master-Key: [...]
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - 5a 95 df 40 2c c9 6b d5-4a 50 75 c5 a3 80 0a 2d Z..@,.k.JPu....-
[...]
00b0 - d5 b9 e8 25 00 c5 c7 da-ce 73 fb f2 c5 46 c4 24 ...%.....s...F.$
Start Time: 1455111516
Timeout : 300 (sec)
Verify return code: 20 (unable to get local issuer certificate)
---
DONE
curl -vs https://example.com echo | openssl s_client -connect example.com:443