The easiest way to create a trasnparent proxy on a single PC which is browser and proxy at the same time is to use squid3 and iptables.
I found the solution here:
http://blog.bodhizazen.net/linux/how-to-transparent-proxy/
In squid.conf I needed to make the following changes:
Code:
# uncomment
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
# add
http_access allow localnet
# add "intercept"
http_port 3128 intercept
Next step is to created two rules with iptables:
Code:
iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner --uid-owner root -j ACCEPT
iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner ! --uid-owner proxy -j REDIRECT --to-port 3128
Make sure to have "iptables-persistent" installed and save the settings:
Code:
iptables-save > /etc/iptables/rules.v4
This is all. The proxy is now transparent without touching the applications. Each request for port 80 is run throught the proxy.
Matthias |