Nathaniel Smith <n...@pobox.com> added the comment:

I didn't know this, but apparently the SSLKEYLOGFILE envvar is a de-facto 
standard: chrome, firefox, and libcurl all check for this envvar, and if found 
they log TLS secrets to the file in a specific format.

Reports of projects supporting this:

- https://www.imperialviolet.org/2012/06/25/wireshark.html
- 
https://jimshaver.net/2015/02/11/decrypting-tls-browser-traffic-with-wireshark-the-easy-way/
- https://ec.haxx.se/tls-sslkeylogfile.html

Also, people are using gross ctypes hacks to convince Python to do this too: 
https://github.com/joernheissler/SslMasterKey

Also, now that I know this exists I kind of wish it was supported because I've 
been frustrated by this problem before myself :-).

My first thought was that the ssl module should provide methods to extract the 
various secret values (e.g., wrappers for SSL_SESSION_get_master_key and 
SSL_get_client_random), and leave the environment variable checking to user 
code. But... looking at the file format docs:

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format

...it appears that TLS 1.3 has more and different secrets than previous 
versions, and trying to expose all these different pieces seems pretty messy. 
If we simply implement SSLKEYLOGFILE, that would give people what they want, 
and since we would be writing it out ourselves we could make it handle 
different TLS versions internally without exposing that complexity as part of 
the API.

We would of course have to disable this if -E was passed on the command line.

As an FYI to anyone looking at this bug, Christian (the main ssl module 
maintainer) is generally *very* overloaded, so I would say that the chances of 
this actually being implemented go *way* up if someone puts together a PR.

----------
nosy: +njs

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34271>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to