参考:https://www.cnblogs.com/dingkailinux/p/8408929.html
一、通过域名查询:
以淘宝京东为例
root@server01:~/scripts# echo | openssl s_client -servername taobao.com -connect taobao.com:443 2>/dev/null | openssl x509 -noout -dates
notBefore=Nov 12 08:07:05 2018 GMT
notAfter=Nov 13 07:36:08 2019 GMT
root@server01:~/scripts# echo | openssl s_client -servername jd.com -connect jd.com:443 2>/dev/null | openssl x509 -noout -dates
notBefore=Jul 31 06:21:07 2018 GMT
notAfter=Sep 28 09:42:54 2019 GMT
root@server01:~/scripts#
二、通过证书查询
这个输出内容还是挺多的,建议简单过滤下,另外fullchain.pem是我的证书我是用let's bot生成的,key文件名字是privkey.pem
root@server01:~/scripts# openssl x509 -in fullchain.pem -noout -text | grep "Not"
Not Before: Sep 27 09:54:00 2018 GMT
Not After : Dec 26 09:54:00 2018 GMT
User Notice: