Hi everyone, I’ve been trying to understand how MiTM setups like a transparent proxy work.

Obviously, the use-case here is in a personal scope: I’d like to inspect the traffic of some of my machines. I am aware that Squid can be a transparent proxy, and some might use the Burp Suite to analyse network traffic.

Could someone explain the basic networking and the concept of certificates in this scenario? I feel like I don’t understand how certificates are used well enough.


For example: I realise that if someone inserts a root certificate in the certificate store of an OS, the machine trusts said CA, thus allowing encrypted traffic from the machine to be decrypted. However, say the machine was trying to access Amazon; won’t Amazon have its own certificate? I don’t know how I’m confused about such a simple matter. Would really appreciate your help!

  • MigratingtoLemmy@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    8 months ago

    Basically, if I were to run a CA locally (on my network) and use that certificate in some OS, I should be able to set up a MiTM setup easily. Except that applications like web browsers don’t care and will utilise certificate pinning anyway, regardless of which certificates I keep in my certificate store in the OS.

    Also, let’s say I’m running HAProxy/Caddy/NGINX at home which acts as my SSL-termination point for my network. In this case, if a service wants to access the internet, do these reverse proxies encrypt the outbound traffic with a different certificate?

    • canni@lemmy.one
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 months ago

      If I understand the question, the traffic in your local intranet will basically always be encrypted with your root cert. So client -> proxy with your cert, then normal internet encryption from proxy -> internet.

      For the apps, it depends on the app, but you can usually insert your cert into their store, it might just be different than the systems store. This could be hard to do on an non-rooted iPhone, idk. My experience is with Linux desktops. For example, in chromium based apps, there is a database in ~/.pki/nssdb that you can insert your cert into. Again, this is something I do at work where we have a very tightly controlled network and application stack. I would not recommend a MiTM proxy for your home environment, it will only cause headaches.

      • MigratingtoLemmy@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        8 months ago

        Ah, I see. I suppose I got a bit confused, and wanted to confirm how encryption would work for outbound traffic. Just to be sure: when an application wants to send encrypted data to a website/service on the Internet, it will use the respective certificate for said website. However, if one runs a transparent proxy in the middle and inserts a root certificate in the certificate store of the application, said certificate becomes valid (and the de-facto pick) for all websites, and this is what the client begins to use for everything.

        Is that how it works?