Open lyuxuan opened 6 years ago
I'll have to check if it would mess with 1.3, and think how to bundle chains, but I can see us adding ConnectionState.LocalCertificates
.
Discussed with @agl and @FiloSottile about potentially adding
LocalCertificate *Certificate // (a *tls.Certificate)
but trying to understand the motivation a bit more. Compelling use cases would help with justification.
We have a specific use case in grpc channelz feature. It presents to users the current state of a connection, including the info about what's the local/remote certificate has been used. Users may use it to figure out what's the identity it presents to the peer, how long local certificate will last before expired, etc. Moreover, channel trace could record local certificates tried and failed before, which may be helpful for diagnosing problematic setup.
Thanks for elaborating.
Is a ConnectionState
field just more convenient, or does saving the result of GetCertificate
/GetClientCertificate
not work at all?
@agl I just saw this in the docs, what am I missing about TLS 1.3 that can lead to multiple client certs?
// GetClientCertificate may be called multiple times for the same // connection if renegotiation occurs or if TLS 1.3 is in use.
Sorry about the delay in response.
GetCertificate
and GetClientCertificate
seems to be only part of the logic to select the local certificate, by reading the implementation of getCertificate
function. If the returned result of GetCertificate
and GetClientCertificate
is nil, nil
, then it will resort to NameToCertificate
to find a certificate.
And yes, collocating local certificate with remote certificate in theConnectionState
struct is convenient for usage.
Thank you.
Pinging this thread again to let y'all know that gRPC-Go is still interested in having this feature.
gRPC is adding support to secure service-to-service communication in our existing proxyless service mesh offering. Currently we use the local/remote certificates used by a connection in our e2e tests to verify that the expected certificates are used. Once this feature is public, this would definitely be helpful for our users in debugging real problems.
Is there any chance of this being prioritized in the near future? gRPC-Go is still interested in having this.
cc @golang/security
Proxyless service mesh is public available now, and we'd like to circle back here and see if this can be prioritized in the near future to help our users in debugging.
While TLS provides ConnectionState() to share some connection security info, like remote certificate (
PeerCertificates
), it lacks the info about local certificate used to set up a connection. And it's not always possible to predict local certificate used as the selection depends on the remote end requirements.Exposing the local certificate would be very helpful for debugging connection issues, for example, user may find certificate getter returns suboptimal certificate, which may be expiring soon or having a long verification chain. Moreover, it will also enable collecting certificate usage statistics, which could be valuable for service owners.
@FiloSottile Thanks!