在进行证书故障排查的时候,难免要查看证书信息。不过目前的浏览器在设计上,查看证书详情变得困难很多,因此,你可以借助 CURL 来查看证书信息。
具体的命令
curl --insecure -v https://域名 2>&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }'
Code language: JavaScript (javascript)
返回结果如下,其中包含了域名证书当中的过期时间、申请者等核心信息,方便你进行排查。
➜ ~ curl --insecure -v https://www.ixiqin.com 2>&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }'
* SSL connection using TLSv1.2 / ECDHE-RSA-CHACHA20-POLY1305
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=www.ixiqin.com
* start date: Aug 15 00:00:00 2021 GMT
* expire date: Nov 13 23:59:59 2021 GMT
* issuer: C=AT; O=ZeroSSL; CN=ZeroSSL RSA Domain Secure Site CA
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fe096810a00)
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
* Connection #0 to host www.ixiqin.com left intact
* Closing connection 0
Code language: PHP (php)