LOGBOOK

HELP

Quiz Entry - updated: 2026.10.20

Why does the browser show a big certificate warning when traffic first runs through mitmproxy, and how does making mitmproxy a subordinate CA of the company PKI remove it?

At first mitmproxy signs its fake site certificates with its own self-made CA, which the client does not trust; once mitmproxy's CA is a sub-CA chaining to the company root, the fakes validate and the warning disappears.

To read HTTPS, mitmproxy must terminate TLS itself: it presents a certificate for, say, meteo.ch to the browser. It cannot have the real one (that private key is on the real server), so it generates a certificate on the fly for each requested host name, signed by its CA. Out of the box that CA is self-generated, unknown to every trust store, so the browser rightly raises NET::ERR_CERT_AUTHORITY_INVALID and HSTS-protected sites cannot be opened at all.

The lab then has the proxy request a certificate from the company CA using the Subordinate Certification Authority template:

  1. openssl req -new -newkey rsa:4096 -keyout mitmproxyca-private.key -out subca.csr
  2. Submit the CSR on /certsrv with the Subordinate CA template, download the chain.
  3. Convert the .p7b to PEM into ~/.mitmproxy/mitmproxy-ca.pem and append the private key to the same file, since mitmproxy needs the key to sign the certificates it generates.
  4. Start with --set cert_passphrase=… to unlock the key.

Now every certificate mitmproxy generates chains: fake leaf, then mitmproxy sub-CA, then CKTECK CA, then the root, which domain clients trust. The padlock reappears. This is exactly how corporate TLS-inspection firewalls work, and why a sub-CA certificate must never be issued lightly: it is a licence to impersonate any website.

SSL interception: two separate TLS sessions with a forged leaf certificate signed by the proxy's sub-CA

* Two TLS sessions; the browser trusts the forged certificate through the company root. *

Go deeper:

From Quiz: ISLAB / Public Key Infrastructure | Updated: Oct 20, 2026