How can i configure Tor with bridge and privoxy to proxy entire system

Accessing to some repository and website for sanctioned countries always is a big challenge for developers. I try to find the best and easiest way to proxy entire system in Ubuntu with Tor, privoxy and bridge.


Solution 1:

First of all you need to open terminal and install Tor:

sudo apt-get install tor

Then check that the tor is install successfully or not by:

service tor status

If the server was not run then run by:

service tor start

After runing tor you can see the log of the tor by

journalctl -exft Tor

Then you must search for below line in log

Bootstrapped 100%: Done

If you can not find this line in you log, then its means that your tor doesn't run and you should configure Bridge for your tor. for configure tor bridge at first install obfs4proxy by:

sudo apt install obfs4proxy

then you should get the bridge line. for get the bridge line go to https://bridges.torproject.org/ and get your bridge line. getting bridge lines for configure tor bridge

After getting your bridge line you should open torrc with command:

sudo vim  /etc/tor/torrc

then add the following code to end of torrc file

UseBridges 1 
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy 
Bridge obfs4 89.163.181.170:443 A0D27B876F1DD14A15C223F48BD9CD4A6BC4517E cert=nOm4+38yOIZ+91ux/vMUOZjUv6pocGtPkZ1QUXumE03Y8akJmrdCwXzxvQVqVPLMlwQrXA iat-mode=0
Bridge obfs4 50.39.226.171:47368 93BBD8F80D5F5A8A55829A3168278327BABC14D7 cert=e7kfc/GAUTzv6OEu/a9zQnzGQu9dzhs4jZSmKCXYCaOVZUf5vci2KKilPzR6pUKiiO9hNA iat-mode=0
Bridge obfs4 79.199.47.29:9002 6BF05636116C654B65C3F546414739D164D857F1 cert=KmcvY9E6kf6P9ve9gZl0dg0s4bPV4Ik8u25wuJM0p9XXwC+cCxvI8/2jQhjL1qDFFqt9VQ iat-mode=0

Make sure that you used your own bridges. after setting your bridge restart your tor service and check the log by:

sudo service tor restart

journalctl -exft Tor

If you want to proxy entire system such as browser, http, https and etc then privoxy done it for you. install privoxy

sudo apt-get install privoxy

go to privoxy configuration file

sudo vim /etc/privoxy/config

remove the comment of line

forward-socks5t / 127.0.0.1:9050 .

save the file and restart privoxy.

service privoxy restart.

for proxy http or https traffics in terminal use these command.

export http_proxy="http://127.0.0.1:8118"
export https_proxy="https://127.0.0.1:8118"

or if you use the desktop version of ubuntu you can set the proxy in Network configuration like the image below.

Network proxy in desktop version of Ubuntu