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.

serverconnect - cert is alway None

See original GitHub issue

Problem Description

I’ve configured an mitmProxy in upstream mode, and trying to intercept the certificate it (Fiddler) presents to mitmProxy using an add-on.

cert field frommitmproxy.connections.ServerConnection object is always None

Maybe I’m doing something wrong…

Steps to reproduce the behavior:

import mitmproxy
from mitmproxy import ctx


class MyAddon:

    def serverconnect(self, conn: mitmproxy.connections.ServerConnection):
        ctx.log.info("serverconnect: %s" % vars(conn))

addons = [
    MyAddon()
]

System Information

5.0.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Prinzhorncommented, Apr 8, 2020

I’m trying to create a custom “trust manager” by inspecting cert.x509._subject_invalidator and if it’s created by a specific issuer, pass-trough the request, otherwise block it.

In this case you can work around by using the request event and flow.kill() if your check fails.

Pseudocode:

request(flow):
    if(flow.server_conn.cert......):
        flow.kill()
0reactions
mhilscommented, Apr 9, 2020

I think @Prinzhorn’s previous comment achieves just that. We will eventually expose the relevant OpenSSL bits in an addon, but for now @Prinzhorn’s approach is probably the best way to go next to monkeypatching the core.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid CA certificate with self signed certificate chain
A CA root certificate has to be marked as belonging to a CA: A CA certificate must include the basicConstraints value with the...
Read more >
ServerConnection Class (Microsoft.SqlServer.Management ...
Returns true if the SqlConnection object is connected with the server. This can only return true for non pooled connections as pooled connections...
Read more >
Sonar-scanner fails with self-signed certificate
I have imported the crt file into the JVM Cacerts and also created a jks file containing the certificate. No matter how I...
Read more >
Configure the SEG V2 - VMware Docs
Configure the SEG V2 ; Ignore SSL Errors between SEG and AirWatch server, Select Enable to ignore Secure Socket Layer (SSL) certificate errors ......
Read more >
records.config — Apache Traffic Server 9.1.4 documentation
Check that the certificate file name used for the server session matches the ... Always read while writing, but allow non-cached Range requests...
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