GRPC_TLS_CERT_EXPIRED grpc auth_error ai_generated true

不可用:gRPC TLS 握手失败:证书已过期

UNAVAILABLE: grpc: TLS handshake failed: certificate has expired

ID: grpc/tls-certificate-expiration

其他格式: JSON · Markdown 中文 · English
96%修复率
92%置信度
1证据数
2024-08-12首次发现

版本兼容性

版本状态引入弃用备注
gRPC v1.48.x active
gRPC v1.58.x active
gRPC v1.64.x active

根因分析

gRPC 服务器(或双向 TLS 中的客户端)使用的 TLS 证书已过有效期,导致握手失败。

English

The TLS certificate used by the gRPC server (or client in mutual TLS) has passed its expiry date, causing the handshake to fail.

generic

官方文档

https://grpc.io/docs/guides/auth/#tls

解决方案

  1. 续期 TLS 证书:使用 `openssl req -x509 -newkey rsa:4096 -keyout server_key.pem -out server_cert.pem -days 365 -nodes` 生成新证书,然后重启 gRPC 服务器。
  2. 如果使用 Let's Encrypt,运行 `certbot renew` 自动续期证书,然后重新加载 gRPC 服务器(如 `kill -HUP <pid>` 或重启进程)。
  3. 作为临时紧急修复,将系统时钟调回证书有效期范围内(不推荐用于生产),然后重启服务器。

无效尝试

常见但无效的做法:

  1. 80% 失败

    This bypasses hostname verification but not certificate expiration; the handshake still fails because the certificate itself is invalid.

  2. 50% 失败

    SSL session caching affects performance, not certificate validation; expiration is checked during full handshake.

  3. 90% 失败

    The expired certificate remains the same; restarting does not fix the expiration date.