Skip to content

Certificate Expired

错误信息

                x509: certificate 有 expired or 是不 yet 有效
              

快速摘要

TLS certificate used 通过 service 有通过它的 expiration date, and 客户端 refuse 到连接.

为什么发生

  • TLS certificate 是不 renewed 之前它的 expiration date

  • 系统 clock 是不正确, 制作有效 certificate appear expired

  • certificate 是安装使用错误 validity period

  • Automated certificate renewal (e.g., cert-manager) 是不 工作

最小示例

✗ 错误代码
# Certificate expired, HTTPS connections fail
curl https://api.example.com
# Error: x509: certificate has expired
✓ 修复代码
# Renew with certbot (Let's Encrypt)
certbot renew
# Or with cert-manager in K8s
kubectl delete certificate api-cert  # cert-manager will recreate

certificate expired. fix renews 它 using certbot (for Let's Encrypt) or cert-manager (for Kubernetes).

如何诊断

  • 检查 certificate expiration: openssl s_client -连接 <host>:443

  • 验证系统 clock: date — ensure 它是 正确

  • 检查 cert-manager 状态如果 using 它: kubectl 获取 certificates -

  • View certificate details: echo | openssl s_client -连接 <host>:443 2>/dev/空 | openssl x509 -noout -dates

如何修复

  • Renew certificate 使用你的 Certificate Authority (e.g., Let's Encrypt)

  • Fix 系统 clock 如果它 是不正确: ntpdate or chrony

  • 重启 cert-manager 如果它 是不 renewing certificates automatically

  • 安装 renewed certificate in 你的 web 服务器 or Ingress

如何预防

  • Use cert-manager for automatic certificate renewal in Kubernetes

  • 设置 alerts for certificates expiring 在内 30 days

  • Monitor certificate expiration dates regularly

相关资源

相关术语

← 返回语言