Can someone tell me if the following scenario is possible using mitmproxy?
I have a LAN with a few devices on it and a
dnsmasq running on the gateway to provide DHCP and DNS services. This
dnsmasq is configured with a large domains list to perform ad blocking (by returning NXDOMAIN or an invalid ip address).
I want to take things a step further and instead of blocking the traffic, I want to redirect it to a small web server running on the same gateway, which will log the requests and return dummy data, like 1x1 px gif/png for images, empty html/js, etc. For this, I’ll configure
dnsmasq to return a specific IP address for all blocked domains (e.g.
22.214.171.124) and use
iptables to redirect the traffic received from the LAN to
126.96.36.199, to my web server.
The problem will be the HTTPS traffic, as my web server isn’t capable of spoofing SSL certificates for the requested hosts.
So, would it be possible to redirect traffic to mitmproxy, spoof the certificate from the real host and then forward the connection to my web server (via HTTP) instead ?