Skip to content

Instantly share code, notes, and snippets.

@franciscocpg
Last active May 13, 2024 08:48
Show Gist options
  • Save franciscocpg/a4f52afcc00d472a9d7c407db16a92ee to your computer and use it in GitHub Desktop.
Save franciscocpg/a4f52afcc00d472a9d7c407db16a92ee to your computer and use it in GitHub Desktop.
Import mitm certificate to CA in arch linux
  1. After installing mitmproxy run it (just type mitmproxy) in a terminal session and quit. This will create the necessaries certificates files at ~/.mitmproxy.

  2. Extract the certificate to .crt format:
    openssl x509 -in ~/.mitmproxy/mitmproxy-ca.pem -inform PEM -out ca.crt

  3. Trust the certificate into CA:
    sudo trust anchor ca.crt

  4. Run the mitmproxy again

  5. Open another terminal session and set the proxy:

export http_proxy='http://localhost:8080'
export https_proxy='http://localhost:8080'
  1. Run a curl to an https site and it should work:
    curl https://www.google.com
@Gictorbit
Copy link

very helpful

@tomay3000
Copy link

Thank you ;)

@iuriatan
Copy link

Very helpful indeed! That should go to mitmproxy's docs 🙇‍♂️

@azkadev
Copy link

azkadev commented Aug 26, 2023

I tried on linux but this error appears

p11-kit: no configured writable location to store anchors
how to solve it

@assapir
Copy link

assapir commented Sep 28, 2023

Thanks!

@Espacio-root
Copy link

curl --cacert ca.crt https://www.google.com works fine but without --cacert argument, it throws a tsl error. Help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment