How to install a certificate, enable it ‐ mitmproxy - kdaisho/Blog GitHub Wiki

Prerequisite

  • Machine: Linux Kali (Debian)
  • mitmproxy must be installed

Steps

Run mitmproxy

mitmproxy

Visit http://mitm.it/*1

  • Download the cert
  • Run the following command. (assuming you're in the directory of the downloaded file)
sudo mv mitmproxy-ca-cert.pem /usr/local/share/ca-certificates/mitmproxy.crt
sudo update-ca-trust

The instruction from mitm.it ends there, but if you want to browse HTTPS sites with mitmproxy, you need one more step. Because the browser won't trust the cert from mitmproxy at this point yet.

  • Go to Firefox, Settings
  • Go to Privacy & Security
  • Find Certificates in the Security section
  • Click 'View Certificates...' button
  • Click 'Import'
  • Find the cert downloaded from mitm.it, select it to import
  • Click the cert from the list, and click 'Edit Trust...' button
  • Check 'This certificate can identify websites.' option, then click 'OK'
  • Close the Settings. Done.

Now you should be able to visit HTTPS sites without warnings.


*1 If you are not able to access that page, you don't have a right proxy settings on your browser.

E.g., Firefox

  • Open Settings
  • Go to General
  • Locate Network Setting, click 'Settings...' button
  • Select 'Manual proxy configuration'
    • HTTP Proxy to 127.0.0.1, port 8080
    • Apply the same to HTTPS
  • Click 'OK'