| 场景 | 批量证书到期检查 |
|---|---|
| 组合 | openssl s_client + x509 + 循环 |
单域名检查
单域名检查
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
| openssl x509 -noout -subject -issuer -enddate -checkend 2592000 # 30 天内到期则退出码非 0批量巡检
批量巡检
for d in qiqicto.com api.example.com static.example.com; do
end=$(echo | openssl s_client -connect $d:443 -servername $d 2>/dev/null | openssl x509 -noout -enddate)
echo "$d $end"
done链不全(缺中间证书)表现为浏览器/curl 报错但 openssl 能握手:加 -showcerts 对照链完整性。