9

Here's my issue: I'm using the university internet connection quite often. The network has a firewall which blocks the connection of some programs like IRC (Xchat, Irssi), sometimes even the Software Updater and some other applications.

I've surfed on the web and found out that I can "overtake" the firewall using a Tor proxy. But the instructions on how configure it are confused and often incorrect. Can you please help me in find out how to do that?

Thank you in advance!

  • 1
    I would recommend just using a VPN instead of a Tor proxy. Any particular reason why you don't want to use one? – TheOdd Oct 6 '16 at 23:30
14

Install the official Tor proxy

Tor and its official SOCKS 5 proxy are pretty quick to get running on Ubuntu. Going off of the Tor Project website's installation instructions, do the following:

  1. Open a terminal by pressing Ctrl+Alt+T
  2. Run the following (replace xenial with the release you're running if you're not on 16.04 Xenial Xerus):

    sudo -i
    echo deb http://deb.torproject.org/torproject.org xenial main > /etc/apt/sources.list.d/tor.list
    echo deb-src http://deb.torproject.org/torproject.org xenial main >> /etc/apt/sources.list.d/tor.list
    gpg --keyserver keys.gnupg.net --recv 886DDD89
    gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
    apt update
    apt install tor deb.torproject.org-keyring
    exit
    

Now the Tor SOCKS 5 proxy will be running on your machine, 127.0.0.1, on port 9050. Remember that this is a SOCKS 5 proxy, not an HTTP proxy.

Your Tor proxy will automatically start when your machine boots. You can run sudo service tor restart or other actions like start, stop, and status to control the Tor proxy on your machine.

Apt through Tor

Going off of the apt-transport-tor Github README, to get apt to work through Tor:

  1. Back up /etc/apt/sources.list and all .list files in /etc/apt/sources.list.d
  2. Open a terminal by pressing Ctrl+Alt+T
  3. Run the following:

    sudo -i
    apt update
    apt install apt-transport-tor
    sed -i 's/ http/ tor+http/g' /etc/apt/sources.list /etc/apt/sources.list.d/*.list
    apt update
    exit
    
  4. Make sure to fix any error messages that appear (if needed, restore the files you backed up)

Note: Be aware that some programs, like Google Chrome, will modify their .list file, so those programs may automatically switch back to trying to connect directly when checking for updates instead of going through Tor.

In-program proxy settings

A lot of programs connect just fine through Tor if you edit the proxy settings to:

  • Host: 127.0.0.1
  • Port: 9050
  • Proxy type (if it asks): SOCKS5
  • Username/Password (if it asks): both set to the name of the program

Proxy wrapper

Other programs, like irssi, need to use torsocks. There are two ways of doing this:

  1. torsocks gives error messages:

    torsocks -i command arguments
    
  2. torsocks is quiet (useful for programs like irssi that assume they fully control what's shown on the terminal):

    TORSOCKS_LOG_LEVEL=1 torsocks -i command arguments
    
  • Well, the firewall didn't allowed me to generate the key. Now I've manage to do it and I'll test it on Monday. Thanks for now anyway. Oh, and if I go on Settings -> Network -> Network Proxy and I set Socks Host on 127.0.0.1:9050 all the traffic is going through there, right? – West Oct 8 '16 at 14:03
  • It should be going through Tor, assuming the program isn't badly written. You can gain more confidence by connecting to a .onion address suitable for the program (such as https://3g2upl4pq6kufc4m.onion for a browser). – Olathe Oct 8 '16 at 16:42
  • So, the test was a failure. The firewall doesn't allow me to connect through Tor protocol, everything keeps loading (browsers, irssi, etc...), but never connects. As soon as I turn off the proxy the browser start to work again. Any suggestion? – West Oct 10 '16 at 14:21
  • One thing to check is whether Tor is running when you try to connect using it. You can run sudo netstat -plnt | fgrep :9050 and see if you get a line saying tor is running. If it is, but you can't get through, take a look at Tor bridges, which use unpublished addresses. You may even need to use obfuscated bridges (also described in the previous link), which hides not only what you're doing through Tor from your ISP, it hides that you're using Tor in the first place. – Olathe Oct 12 '16 at 22:58
  • 1
    gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 gpg: WARNING: nothing exported – Eugene Gr. Philippov Feb 9 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.