crypto/tls: EncryptedClientHelloKeys can't be safely rotated when GetConfigForClient is used #71920
Labels
BugReport
Issues describing a possible bug in the Go implementation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Go version
go version go1.24.0 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I'm attempting to implement the ECH spec with regards to key rotation. It states in 10.10.5:
The application (Caddy in this case) requires use of
GetConfigForClient
.What did you see happen?
The problem is,
tls.Config.EncryptedClientHelloKeys
is a static field, not a callback likeGetCertificate
.This means we have to start a new TLS server with the updated ECH keys, which is complex and can be tricky to do without downtime.
I also realized that
GetConfigForClient
is not recursive... at first I tried usingGetConfigForClient
to return a tls.Config populated especially for ECH:But this results in "no certificates configured", because the returned Config's
GetConfigForClient
isn't called, and sure enough it has no certs. Relevant code:https://cs.opensource.google/go/go/+/master:src/crypto/tls/handshake_server.go;l=148-168?q=GetConfigForClient&ss=go%2Fgo&start=11
But we can't return the final tls.Config yet (the one with certificates) because we don't have the inner SNI yet.
What did you expect to see?
I was hoping that GetConfigForClient + EncryptedClientHelloKeys could play well together... in the case of ECH, maybe allow GetConfigForClient to be used to unwrap the outer Hello, and also be used for the inner. (i.e. allow calling it twice, once before once after processing ECH) Or, make a new field,
GetEncryptedClientHelloKeys
callback function, much likeGetCertificate
.Rotating keys is beneficial for security and encouraged by the spec.
Do you have any other suggestions for making this work as-is? Or is this something that can be enhanced?
Thanks again for server-side ECH 💯
The text was updated successfully, but these errors were encountered: