curl检测https证书有效期命令
curl -vvI https://域名
例如:
[root@st-01 cert]# curl -vvI https://www.baidu.com * About to connect() to www.baidu.com port 443 (#0) * Trying 110.242.68.4... * Connected to www.baidu.com (110.242.68.4) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 * Server certificate: * subject: CN=baidu.com,O="Beijing Baidu Netcom Science Technology Co., Ltd",OU=service operation department,L=beijing,ST=beijing,C=CN * start date: Jul 01 01:16:03 2021 GMT * expire date: Aug 02 01:16:03 2022 GMT * common name: baidu.com * issuer: CN=GlobalSign Organization Validation CA - SHA256 - G2,O=GlobalSign nv-sa,C=BE > HEAD / HTTP/1.1 > User-Agent: curl/7.29.0 > Host: www.baidu.com > Accept: */* > < HTTP/1.1 200 OK HTTP/1.1 200 OK < Accept-Ranges: bytes Accept-Ranges: bytes < Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform < Connection: keep-alive Connection: keep-alive < Content-Length: 277 Content-Length: 277 < Content-Type: text/html Content-Type: text/html < Date: Fri, 10 Dec 2021 05:00:22 GMT Date: Fri, 10 Dec 2021 05:00:22 GMT < Etag: "575e1f59-115" Etag: "575e1f59-115" < Last-Modified: Mon, 13 Jun 2016 02:50:01 GMT Last-Modified: Mon, 13 Jun 2016 02:50:01 GMT < Pragma: no-cache Pragma: no-cache < Server: bfe/1.0.8.18 Server: bfe/1.0.8.18 < * Connection #0 to host www.baidu.com left intact
这样就可以 使用curl的命令直接查看证书信息了