How to setup & use mitmproxy
on Linux + Firefox / iOS
-
Install it
apt (Ubuntu / Debian / Mint)
sudo apt update -y sudo apt upgrade -y sudo apt install mitmproxy -y
dnf (Fedora / CentOS / Red Hat Enterprise Linux)
sudo dnf check-update sudo dnf upgrade -y sudo dnf install python3-pip -y pip install mitmproxy
*Couldn't find a way to install it with
dnf
pacman (Arch)
yes | sudo pacman -Syu mitmproxy
*Alternatively you can use a Docker image or
pip
2. Configure it in the network settings
This example shows how it's done on GNOME (in this case Ubuntu):
- Open your network settings window
- Open the
Network Proxy
settings window - Click
Manual
- Remove the value from
Ignore Hosts
- Input the address and port of
mitmproxy
-
mitmproxy
: Nvim / Vim like TUI (Terminal User Interface)mitmweb
: WUI (Web User Interface)mitmdump
: a non interactive dump (liketcpdump
)
-
Setup the TSL certificate
Firefox
- Click the hamburger menu in the top right corner.
- Click
Settings
->Privacy & Security
- Scroll down to the bottom and click:
View Certificates
- Make sure you're in the
Authorities
tab and click:Import
- In the file selector window, first make sure you have
Show Hidden Files
turned on and than select:~/.mitmproxy/mitmproxy-ca-cert.cer
- Check the
Trust this CA to identify websites
checkbox and clickOk
- Click
Ok
again
*If some pages sill have issues you have to clear Firefox's cache (to remove the HTTP Strict Transport Security (HSTS) pinned certificates) *For instructions on how to install certificates on other OSs, visit <mitm.it> (you need to have
mitmproxy
setup and running for this to work though)iOS
- Make sure you're on the same network as the machine that is running
mitmproxy
- Open the
Settings
app - Tap
Wi-Fi
-> The bluei
icon next to the name of the Wi-Fi network you'r connected to - Tap
Configure Proxy
->Manual
- Input the address (that's the IP address of the computer that's running
mitmproxy
) and port ofmitmproxy
- Open
Safari
(other browsers may not open the proper certificate installation prompt) - Go to <mitm.it>
- Press the green
Get mitmproxy-ca-cert.pem
button belowiOS - please read the instructions!
- On the download configuration dialog tap
Allow
- Go back to the
Settings
app - Move back to it's main page
- Tap
Profile downloaded
(which should be at the top) - On the install profile dialog tap
Install
and verify it with your passcode - Move back to it's main page again
- Tap
General
->About
->Certificate Trust Settings
(which should be at the bottom) - Tap the switch next to
mitmproxy
*If this does not work right away, double check your settings and/or try switching your iOS device to airplane mode and back. Note that some apps are using certificate pinning and will not work if traffic is being intercepted like this.