# 错误：SSL 连接错误：SSL 证书已过期

- **ID:** `cloud/gcp-cloud-sql-ssl-expired`
- **领域:** cloud
- **类别:** config_error
- **错误码:** `SSL_ERROR_CERTIFICATE_EXPIRED`
- **验证级别:** ai_generated
- **修复率:** 88%

## 根因

Cloud SQL 的客户端 SSL 证书已过期，导致所有加密连接被服务器拒绝。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Cloud SQL Proxy 2.11.0 | active | — | — |
| MySQL 8.0 | active | — | — |
| PostgreSQL 15 | active | — | — |

## 解决方案

1. ```
   使用 gcloud 生成新的客户端证书：gcloud sql ssl client-certs create client-cert.pem --instance=INSTANCE_NAME && gcloud sql ssl client-certs describe INSTANCE_NAME --cert-file=client-cert.pem
   ```
2. ```
   更新应用程序以使用新证书文件（client-cert.pem、client-key.pem）并重启应用程序。
   ```
3. ```
   通过 cron 作业或 Cloud Scheduler 设置自动证书轮换，每月运行 gcloud sql ssl client-certs create。
   ```

## 无效尝试

- **** — Restarting does not renew expired SSL certificates; they are time-bound and must be regenerated. (95% 失败率)
- **** — Disabling SSL verification bypasses security but does not fix the expired certificate; the server still rejects the connection. (80% 失败率)
- **** — Timeout adjustments do not resolve authentication or certificate validation failures. (90% 失败率)
