Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm using Tor Browser bundle 3.5.3 and squid3 (version 3.3.8) on Ubuntu 13.10 as transparent HTTP proxy on the same machine (i.e. not usual setup on gateway). I redirect HTTP request through squid with the following iptables rules added in /etc/rc.local

sudo iptables -t nat -A OUTPUT -m owner --uid-owner `id -u proxy` -j ACCEPT
sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 3128
sudo iptables -t filter -A OUTPUT -m owner --uid-owner `id -u proxy` -j ACCEPT
sudo iptables -t nat -A PREROUTING -i bond0 -p tcp --dport 80 -j REDIRECT --to-ports 3128 

How can I use squid in the same way for by Tor Browser?

My /etc/squid3/squid.conf looks like this:

http_port 3128 transparent

hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY

always_direct allow all

acl all src all
acl localhost src
acl localhost src
acl localnet src
acl to_localhost dst
acl SSL_ports port 443 563
acl SSL_ports port 873
acl Safe_ports port 80
acl Safe_ports port 21
acl Safe_ports port 443 563
acl Safe_ports port 70
acl Safe_ports port 210
acl Safe_ports port 1025-65535
acl Safe_ports port 9050
acl Safe_ports port 9051
acl Safe_ports port 8118
acl Safe_ports port 8080
acl Safe_ports port 280
acl Safe_ports port 488
acl Safe_ports port 591
acl Safe_ports port 777
acl Safe_ports port 631
acl Safe_ports port 873
acl Safe_ports port 901
acl purge method PURGE
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access allow purge localnet
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny to_localhost
http_access allow localhost
http_access allow localnet
http_access deny all

http_reply_access allow all

access_log /var/log/squid/access.log squid

icp_access allow all

forwarded_for off
coredump_dir /var/spool/squid

and works for HTTP requests. Adding Tor Browser's ports 9050 and 9051 (see config file) didn't help.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.