Skip to content

Instantly share code, notes, and snippets.

@elvisoliveira
Forked from franciscocpg/README.md
Last active September 30, 2020 14:00
Show Gist options
  • Select an option

  • Save elvisoliveira/408b9fbc81e0515308eec0a7592c41ff to your computer and use it in GitHub Desktop.

Select an option

Save elvisoliveira/408b9fbc81e0515308eec0a7592c41ff 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. Import certificate into Java KeyStore using the keytool

sudo $JAVA_HOME/bin/keytool -import -trustcacerts \
-file /path/to/mitmproxy-ca-cert.pem \  
-alias mitmproxycert \
-keystore $JAVA_HOME/jre/lib/security/cacerts

The default password for the Java keystore is: changeit

  1. Run the mitmproxy again

  2. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment