question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New event after `clientconnect` as soon as TLS is established

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Prinzhorncommented, Feb 4, 2022

Correct me if I’m wrong, this is now tls_established_client and tls_established_server? They give me tls info for every connection as soon as possible?

def client_connected(client):
    print('client_connected')
    print(client.timestamp_tls_setup)


def tls_established_client(data):
    print('tls_established_client')
    print(data.conn.timestamp_tls_setup)


def server_connected(data):
    print('server_connected')
    print(data.server.timestamp_tls_setup)


def tls_established_server(data):
    print('tls_established_server')
    print(data.conn.timestamp_tls_setup)

0reactions
Prinzhorncommented, Apr 3, 2020

You are either very pessimistic regarding your work or very optimistic regarding our progress. smile

Yes.

Anyways, we’d of course be very interested to hear what you are building and if there’s anything we can help with. On that note, feel free to join us on Slack!

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

SecureBlackbox 16: Why doesn't SSL/TLS (HTTPS, FTPS etc ...
Short answer. First of all, newer versions of servers expect the client to have enabled either new (TLS 1.1, TLS 1.2) or old...
Read more >
Transport options to ensure net/http client connect via TLS 1.2
At the time of writing, Go will speak TLS 1.2 automatically if the server supports it. tls.ConnectionState reports various negotiated TLS ...
Read more >
TLS event 'secureConnect' not fired on cleartextstream when ...
No, when you have a client connect, both a 'secureConnection' on the server and a 'secureConnect' on the cleartextstream should occur. As it ......
Read more >
Transport Layer Security (TLS) connections might fail or ...
When attempting to connect, Transport Layer Security (TLS) might fail or timeout. ... An error logged in the System Event Log for SCHANNEL...
Read more >
Client - websockets 10.4 documentation
When connecting to a wss:// URI, if ssl isn't provided, a TLS context is created with create_default_context() . You can set host and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found