FAQ 3.13, but on the same box
I understand how to set up a transparent proxy. However, it is possible to run a transparent proxy and web browser on the same box?
What if I put the proxy on a loopback interface and REDIRECT port 80 to port 3128 the loopback? Would that work?
Signature · 1 line
A new cognitive theory of emotion, http://openheartlogic.org
Quoted 2 lines · Joshua N Pritikin
I understand how to set up a transparent proxy. However, it is possible to run a transparent proxy and web browser on the same box?
Yes.
Quoted 2 lines
What if I put the proxy on a loopback interface and REDIRECT port 80 to port 3128 the loopback? Would that work?
Sounds good to me.
http://www.squid-cache.org/Doc/FAQ/FAQ-17.html#ss17.4
Regards,
Antony.
Signature · 6 lines
The first fifty percent of an engineering project takes ninety percent of the
time, and the remaining fifty percent takes another ninety percent of the
time.
Please reply to the list;
please don't CC me.Quoted 4 lines · Antony Stone
Quoted 2 lines · Joshua N Pritikin
I understand how to set up a transparent proxy. However, it is possible to run a transparent proxy and web browser on the same box?
Quoted 8 lines
Yes.
Quoted 2 lines
What if I put the proxy on a loopback interface and REDIRECT port 80 to port 3128 the loopback? Would that work?
Sounds good to me.
This FAQ doesn't address my question. I also looked at "Transparent Proxy with Linux and Squid mini-HOWTO" by Daniel Kiracofe.
So far, all docs assume that the squid-box and the browser box are different machines.
Hrm, I think I need to add an OUTPUT rule that matches on the owner. If --uid-owner=proxy then the packet should not REDIRECT back to port 3128. Something like that?
Signature · 1 line
A new cognitive theory of emotion, http://openheartlogic.org
Quoted 9 lines · Joshua N Pritikin
Quoted 2 lines · Antony Stone
This FAQ doesn't address my question. I also looked at "Transparent Proxy with Linux and Squid mini-HOWTO" by Daniel Kiracofe.
So far, all docs assume that the squid-box and the browser box are different machines.
No, the link I posted is specifically for Squid + Netfilter on the same machine - you can tell this by the fact it uses REDIRECT, not DNAT.
Regards,
Antony.
Signature · 4 lines
Ramdisk is not an installation procedure.
Please reply to the list;
please don't CC me.Quoted 4 lines · Antony Stone
Quoted 3 lines · Joshua N Pritikin
Quoted 1 line · Antony Stone
Quoted 8 lines
Quoted 5 lines
This FAQ doesn't address my question. I also looked at "Transparent Proxy with Linux and Squid mini-HOWTO" by Daniel Kiracofe.
So far, all docs assume that the squid-box and the browser box are different machines.
No, the link I posted is specifically for Squid + Netfilter on the same machine - you can tell this by the fact it uses REDIRECT, not DNAT.
I tried that rule already. It only works for other machines on my network which are using the proxy as a gateway.
I am trying to do Squid + Netfilter + BROWSER on the same machine.
Signature · 1 line
A new cognitive theory of emotion, http://openheartlogic.org
Quoted 11 lines · Joshua N Pritikin
Quoted 10 lines · Antony Stone
Quoted 8 lines · Joshua N Pritikin
Quoted 1 line · Antony Stone
This FAQ doesn't address my question. I also looked at "Transparent Proxy with Linux and Squid mini-HOWTO" by Daniel Kiracofe.
So far, all docs assume that the squid-box and the browser box are different machines.
Quoted 7 lines
Quoted 2 lines
No, the link I posted is specifically for Squid + Netfilter on the same machine - you can tell this by the fact it uses REDIRECT, not DNAT.
I tried that rule already. It only works for other machines on my network which are using the proxy as a gateway.
I am trying to do Squid + Netfilter + BROWSER on the same machine.
Oh, right - I hadn't appreciated that part before. I thought you just meant
transparent proxying to a proxy on the gateway instead of to a proxy somewhere else.
In that case you either need to DNAT your OUTPUT packets, as per your previous posting, or else just tell the local browser to use the local proxy (which I suspect is much the simplest solution in terms of understanding when something odd happens in the future).
Regards,
Antony.
Signature · 7 lines
Success is a lousy teacher. It seduces smart people into thinking they can't
lose.
- William H Gates III
Please reply to the list;
please don't CC me.Quoted 9 lines · Antony Stone
Quoted 1 line · Joshua N Pritikin
I am trying to do Squid + Netfilter + BROWSER on the same machine.
Oh, right - I hadn't appreciated that part before. I thought you just meant
transparent proxying to a proxy on the gateway instead of to a proxy somewhere else.In that case you either need to DNAT your OUTPUT packets, as per your previous posting,
This solution seems to work (below). I wonder if this should be added to the various FAQs? ;-)
#!/bin/sh
iptables -t nat -F # clear table
# normal transparent proxy iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j REDIRECT --to-port 8080
# handle connections on the same box (192.168.0.2 is a loopback instance) gid=`id -g proxy` iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner --gid-owner $gid -j ACCEPT iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination 192.168.0.2:8080
Signature · 1 line
A new cognitive theory of emotion, http://openheartlogic.org
Quoted 2 lines · Joshua N Pritikin
This solution seems to work (below). I wonder if this should be added to the various FAQs? ;-)
That's a good idea. The reason it's not in the FAQs already is probably
because there was no owner match in netfilter when the FAQs were written...
Regards,
Antony.
Signature · 7 lines
Your work is both good and original. Unfortunately the parts that are good
aren't original, and the parts that are original aren't good.
- Samuel Johnson
Please reply to the list;
please don't CC me.