New event after `clientconnect` as soon as TLS is established
See original GitHub issueIs your feature request related to a problem? Please describe.
layer.client_conn.timestamp_tls_setup
is None
in clientconnect
. I’m storing all mitmproxy data in SQLite and there is no event I can hook into to easily get timestamp_tls_setup
. I could wait for clientdisconnect
but I want to have the data as soon as it is available. Same for cert
inside serverconnect
.
Describe the solution you’d like
An event, maybe we can call it clientconvert
analogous to convert_to_tls
method. The event is triggered once a client connection is converted. So obviously not all client connections will be converted to TLS, it will never fire for them.
I’d also need a symmetrical event like serverconvert
so that I can process conn.cert
only once and not for every single request
. Right now inside serverconnect
the cert
is None
. My current workaround is to process the cert
for every request
but have a UNIQUE constraint on the cert sha256 and effectively only storing it once.
Describe alternatives you’ve considered
For HTTP data I can use the first request
event for any given client_conn
and process it as needed. But that requires additional logic or it will process stuff multiple times if a connection is shared.
Additional context
There’s also next_layer
. Could I use that? I’m not familiar enough with what a layer is and how that works. Even if I could use it I guess two new events would be user friendly and explicit.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Correct me if I’m wrong, this is now
tls_established_client
andtls_established_server
? They give me tls info for every connection as soon as possible?Yes.
Maybe it is because of the Jedi tricks I’ve been using, but you have in fact already helped me in the past few months without realizing 😉
I will share more details some time in the future and check out Slack as well!