在訪問https的網站時,報出Peer's Certificate has expired
的錯誤。以下:html
[root@localhost ~]# curl https://www.baidu.com curl: (60) Peer's Certificate has expired. More details here: http://curl.haxx.se/docs/sslcerts.html
搜索了好久,沒有有用的信息。沒能找到已有的解決方法。只能靠本身來分析了。sql
首先根據提示,我判斷是CA證書過時。因而對證書進行了更新curl
update-ca-trust
可是依然沒有解決問題。以後,嘗試了不少方法後,從新回來想一想,爲何不適用curl -v來獲取更多信息呢?因而使用該命令進行再次嘗試。網站
[root@localhost ~]# curl https://www.baidu.com -v * About to connect() to www.baidu.com port 443 (#0) * Trying 180.97.33.107... * Connected to www.baidu.com (180.97.33.107) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * Server certificate: * subject: CN=baidu.com,OU=service operation department,O="Beijing Baidu Netcom Science Technology Co., Ltd.",L=Beijing,ST=Beijing,C=CN * start date: Sep 17 00:00:00 2015 GMT * expire date: Aug 31 23:59:59 2016 GMT * common name: baidu.com * issuer: CN=VeriSign Class 3 International Server CA - G3,OU=Terms of use at https://www.verisign.com/rpa (c)10,OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US * NSS error -8181 (SEC_ERROR_EXPIRED_CERTIFICATE) * Peer's Certificate has expired. * Closing connection 0 curl: (60) Peer's Certificate has expired. More details here: http://curl.haxx.se/docs/sslcerts.html
而後根據SEC_ERROR_EXPIRED_CERTIFICATE
的錯誤說明,進行搜索,發現該命令是因爲本地的時間不正確形成的。進行一次ntp時間同步,問題解決。url
ntpdate pool.ntp.org
https的證書是有開始時間和失效時間的。所以本地時間要在這個證書的有效時間內。不過最好的方式,仍是可以把時間進行同步。code