Flu*_*ffy 8 openssl certificate
我遇到问题curl并将openssl客户端证书报告为已过期,即使它不是未来的日期:
# echo | openssl s_client -showcerts -connect example.com:443 2>&1 | grep Verify
Verify return code: 10 (certificate has expired)
Run Code Online (Sandbox Code Playgroud)
但
# echo | openssl s_client -showcerts -connect example.com:443 2>&1 | openssl x509 -noout -dates
notBefore=Oct 17 00:00:00 2011 GMT
notAfter=Oct 21 12:00:00 2014 GMT
Run Code Online (Sandbox Code Playgroud)
系统日期是正确的.Firefox也没有显示该网站证书的任何错误.我试过的Openssl版本是OpenSSL 1.0.1e-fips 11 Feb 2013和OpenSSL 1.0.1f 6 Jan 2014.我在这里找到了一个类似的问题,其中作者声称openssl 0.9.8中缺少该问题,但在1.0.1中存在.
为什么会这样?
Flu*_*ffy 12
我的问题是证书确实过期了,但不是这个特定的,而是签名链中的一个。
例如,对于谷歌这个命令openssl s_client -showcerts -connect google.com:443 </dev/null | openssl x509 -noout -dates显示:
notBefore=Oct 6 12:37:54 2016 GMT
notAfter=Dec 29 12:28:00 2016 GMT
Run Code Online (Sandbox Code Playgroud)
但是只openssl s_client -showcerts -connect google.com:443 </dev/null显示了不是 1,而是 3 个证书(附在---BEGIN/END CERTIFICATE---部分中),第一个是 google 的,它是实际检查的那个。为了验证这一点,我已经复制了(可能应该有更少的手动方式)第一个 to/tmp/google和最后一个 to /tmp/geotrust,现在运行openssl x509 -noout -dates < /tmp/google给了我:
notBefore=Oct 6 12:37:54 2016 GMT
notAfter=Dec 29 12:28:00 2016 GMT
Run Code Online (Sandbox Code Playgroud)
与第一个命令的输出匹配,并且openssl x509 -noout -dates < /tmp/geotrust:
notBefore=May 21 04:00:00 2002 GMT
notAfter=Aug 21 04:00:00 2018 GMT
Run Code Online (Sandbox Code Playgroud)
这是不同的,以前没有显示过。所以最后我的问题是,其中一个更高权限的证书确实已经过时了。
顺便说一句,问题的评论建议升级操作系统来解决这个问题——我想原因是一样的。操作系统带有一堆根证书,所以如果你有疯狂的旧操作系统,其中一些可能会过期,你可以升级这些根证书,或者整个操作系统来解决这个问题。
也很方便地知道,在没有的情况下运行可以showcerts让您很好地了解证书链 - openssl s_client -connect google.com:443 </dev/null:
---
Certificate chain
0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.google.com
i:/C=US/O=Google Inc/CN=Google Internet Authority G2
1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---
Run Code Online (Sandbox Code Playgroud)
所有这些都不需要过期。
我今天也遇到了类似的问题,特意来这里寻找答案。幸运的是,我自己得到了答案。这是我得到它的方法:
话虽如此,请检查本地信任存储中是否有任何已过期的中间/根证书(对于 openssl 可能是 /usr/lib/ssl/certs/ ),这会“毒害” openssl 客户端命令或curl 的验证命令。
| 归档时间: |
|
| 查看次数: |
6058 次 |
| 最近记录: |