go
auth_error
ai_generated
true
rpc 错误:代码 = Unavailable 描述 = 连接错误:描述 = "传输层:认证握手失败:tls:客户端未提供证书"
rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: tls: client didn't provide a certificate"
ID: go/grpc-missing-client-certificate
80%修复率
88%置信度
0证据数
2024-02-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.x | active | — | — | — |
根因分析
gRPC 服务器要求双向 TLS(mTLS),但客户端在 TLS 握手期间未提供客户端证书。
English
The gRPC server requires mutual TLS (mTLS) but the client did not present a client certificate during the TLS handshake.
解决方案
-
90% 成功率
cert, _ := tls.LoadX509KeyPair("client.crt", "client.key"); creds := credentials.NewTLS(&tls.Config{Certificates: []tls.Certificate{cert}}); conn, _ := grpc.Dial(address, grpc.WithTransportCredentials(creds)) -
85% 成功率
Use a proper CA-signed client certificate and configure the server's CA pool.
无效尝试
常见但无效的做法:
-
60% 失败
This weakens security and may not be possible in production environments.
-
70% 失败
Clients typically need a separate client certificate signed by a CA; using the server cert will still fail.