tonic icon indicating copy to clipboard operation
tonic copied to clipboard

feat: support the SSLKEYLOGFILE environment variable for clients

Open bgeron opened this issue 3 years ago • 4 comments

Nothing changes unless SSLKEYLOGFILE is set in the environment.

If SSLKEYLOGFILE is set, then every time the client connnects, it will append a line to the file designated in SSLKEYLOGFILE with the pre-master secret for that connection.

Point a tool like Wireshark to that file, and suddenly it can decode the TLS conversations.

https://wiki.wireshark.org/TLS#using-the-pre-master-secret

https://docs.rs/rustls/0.20.6/rustls/struct.KeyLogFile.html

https://docs.rs/rustls/0.20.6/rustls/trait.KeyLog.html

bgeron avatar Oct 06 '22 10:10 bgeron

I am leaning to not including this in tonic since its possible to configure this manually via rustls. The support for tls within tonic is quite primitive and will actually be removed in the future. So I recommend moving away from using the transport module in tonic.

LucioFranco avatar Oct 17 '22 19:10 LucioFranco

Short of implementing a TLS connector myself, I think it's not possible to configure this manually. I can specify the tonic::transport::ClientTlsConfig but not the rustls::ClientConfig.

Alternatively I could make this a boolean flag to go into ClientTlsConfig. I guess that would be better. It could be off by default, like it is in rustls.

But if you want to take TLS out of Tonic, I respect that of course. Thank you for making/maintaining Tonic.

bgeron avatar Oct 17 '22 20:10 bgeron

Yes, I would use the hyper-rustls and make sure to only enable http2 then I think it should work. You can either use a customized incoming impl or you can use hyper directly.

LucioFranco avatar Oct 18 '22 16:10 LucioFranco

I would love to have this for local debugging

esemeniuc avatar Jun 14 '23 20:06 esemeniuc