Ssl – iptables https transparent proxy with privoxy

httpsiptablesport-forwardingssl

So I have a privoxy running (on port 8080) on a box acting as a router. My goal is to route all HTTP & HTTPS traffic through privoxy on there. HTTP works with the following command

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

However, it doesn't work for port 443.

To get HTTP to work, I had to set privoxy's config for "accept-intercepted-requests" to be 1. Is there a similar option to intercept HTTPS requests?

I know setting the proxy settings on Firefox works, but it would be easier if the proxy is transparent. Thanks.

Best Answer

A primary purpose of HTTPS is to prevent "man-in-the-middle", which is exactly what a transparent proxy like this is trying to do. To do so, you'd need to have a certificate valid for everything or a system to generate certificates on the fly. In either case you're going to need an internal CA (no already-trusted external one will give you a cert for anything you don't control) and to install that root as trusted in all systems behind the proxy.

Configuration of the browser proxy option will likely be a more reasonable task. It may be possible to do this through some sort of proxy auto-configuration, but I wouldn't be surprised if it's not possible for security reasons (I've never really investigated proxy autoconfig before).