MITM proxy on Ubuntu Startup?


Ok, I got mitmproxy working correctly. What an awesome tool it is, thank you so much. I need one more thing though, I want it to automatically start when I boot up Ubuntu server 16.04.4. What’s the best way to accomplish that? I am looking for a startup script of some sort.

I tried this already:

sudo nano /etc/rc.local

/usr/local/bin/mitmproxy --showhost --ssl-insecure --set upstream_cert=false &

exit 0

I got the following error:

Error: mitmproxy’s console interface requires a TTY. Please run mitmproxy in an interactive shell environment.


Clearly I’m not doing something right. I did see this script but it seems huge and I’m not sure it is what I am looking for.

What do you recommend? thanks


I don’t know any suggested way but I can explain what I did by myself in Debian.

  1. Create file /home/user/ and make it executable

/usr/local/bin/mitmdump --showhost --ssl-insecure --set upstream_cert=false &>> /var/log/mitmdump.log

  1. Create file /lib/systemd/system/mitmdump.service

Description=mitmdump service



  1. Reload system services

systemctl daemon-reload

  1. Enable service at startup

systemctl enable mitmdump.service

  1. Start service

systemctl start mitmdump.service

Use mitmdump instead of mitmproxy.