certificate-expired

TLS 证书过期的定位与修复

现象

浏览器提示证书已过期,客户端报 certificate has expired or is not yet valid。openssl 查看 notAfter 已经早于当前时间。

快速定位

openssl x509 -in cert.pem -noout -subject -issuer -dates
openssl s_client -connect <host>:443 -servername <host> 2>/dev/null \
  | openssl x509 -noout -dates
curl -v https://<host>/
date -u
certbot certificates
certbot renew --dry-run

常见根因

  1. 忘记续期,或自动续期任务没有运行。
  2. ACME 验证失败:DNS、80/443 端口、防火墙或限流。
  3. 服务器时间错误,导致证书被判断为未生效或已过期。
  4. 更新了证书文件但没有重载服务。
  5. 多台机器/多个副本中只更新了一部分。

修复

相关命令

读完自测

合上页面,先回答,再展开对照。

  1. 客户端报证书过期时,先确认哪两件事?
  2. 自动续期失败的常见原因有哪些?
  3. 续期成功后为什么仍可能报过期,如何验证?
答案
  1. 用 openssl 查看 notAfter,并用 date -u 核对服务器时间,排除证书确已过期或时钟错误。
  2. ACME 验证失败(DNS、80/443 端口、防火墙或限流),或自动续期任务根本没有运行。
  3. 可能没有重载服务,或只更新了部分副本/CDN;需重载 Nginx/Apache/网关,并用 openssl s_client 或 curl -v 验证线上证书。