Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: Getting Tor working (not tor browser) [SOLVED] (Read 1467 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Getting Tor working (not tor browser) [SOLVED]

Hello
I use OpenRC.
I wanted to have my Laptop use tor. I added it as a sercive:
1. Changed the torrc file
Code: [Select]
## Uncomment this to start the process in the background... or use
## --runasdaemon 1 on the command line.
## see the FAQ entry if you want Tor to run as an NT service.
RunAsDaemon 1
and did
Code: [Select]
sudo rc-update add tor 
succesfully. Proof:
Code: [Select]
[SkvShkr% sudo rc-update show              
       NetworkManager |      default                          
                acpid |      default                          
          agetty.tty1 |      default                          
          agetty.tty2 |      default                          
          agetty.tty3 |      default                          
          agetty.tty4 |      default                          
               binfmt | boot                                  
             bootmisc | boot                                  
              cgroups |                                 sysinit
          consolefont | boot                                  
               cronie |      default                          
                 dbus |      default                          
                devfs |                                 sysinit
                dmesg |                                 sysinit
              elogind | boot                                  
                 fsck | boot                                  
             hostname | boot                                  
              hwclock | boot                                  
              keymaps | boot                                  
            killprocs |                        shutdown       
    kmod-static-nodes |                                 sysinit
                local |      default nonetwork                
           localmount | boot                                  
             loopback | boot                                  
              modules | boot                                  
             mount-ro |                        shutdown       
                 mtab | boot                                  
               net.lo | boot                                  
             netmount |      default                          
         opensysusers | boot                                  
     opentmpfiles-dev |                                 sysinit
   opentmpfiles-setup | boot                                  
               procfs | boot                                  
                 root | boot                                  
         save-keymaps | boot                                  
    save-termencoding | boot                                  
            savecache |                        shutdown       
                 sddm |      default                          
              seedrng | boot                                  
                 swap | boot                                  
               sysctl | boot                                  
                sysfs |                                 sysinit
            syslog-ng |      default                          
         termencoding | boot                                  
                  tor |      default                          
                 udev |                                 sysinit
         udev-trigger |                                 sysinit
I do not know where to look for the info that might help me. I checked a lot of guides including the offial arch one, but still I do not know what to do next.

I know, that it is indeed rinning:
Code: [Select]
[SkvShkr% tor  
Aug 16 13:19:01.177 [notice] Tor 0.4.7.10 running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1q, Zlib 1.2.12, Liblzma 5.2.6, Libzstd 1.5.2 and Glibc 2.36 as libc.
Aug 16 13:19:01.177 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
Aug 16 13:19:01.177 [notice] Read configuration file "/etc/tor/torrc".
Aug 16 13:19:01.178 [notice] Opening Socks listener on 127.0.0.1:9050
Aug 16 13:19:01.178 [warn] Could not bind to 127.0.0.1:9050: Address already in use. Is Tor already running?
Aug 16 13:19:01.178 [warn] Failed to parse/validate config: Failed to bind one of the listener ports.
Aug 16 13:19:01.178 [err] Reading config failed--see warnings above.
What do i do now?

Ps. I am still new to linux, be charitable please

Re: Getting Tor working (not tor browser)

Reply #1
Give us the output of:
Code: [Select]
lsof -i4 -P -n | grep -F LISTEN

Re: Getting Tor working (not tor browser)

Reply #2
Here it is
Code: [Select]
SkvShkr% lsof -i4 -P -n | grep -F LISTEN
SkvShkr% lsof -i4 -P -n                
COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
firefox   4018 egycobra  150u  IPv4  27006      0t0  TCP 192.168.1.118:44900->65.9.86.77:443 (ESTABLISHED)
firefox   4018 egycobra  158u  IPv4  16315      0t0  TCP 192.168.1.118:37090->151.101.190.208:443 (ESTABLISHED)
firefox   4018 egycobra  160u  IPv4  30836      0t0  TCP 192.168.1.118:33988->65.9.86.127:443 (ESTABLISHED)
firefox   4018 egycobra  161u  IPv4  30848      0t0  TCP 192.168.1.118:36168->35.186.227.140:443 (ESTABLISHED)
firefox   4018 egycobra  162u  IPv4  30838      0t0  TCP 192.168.1.118:40834->52.222.149.75:443 (ESTABLISHED)
firefox   4018 egycobra  172u  IPv4  29975      0t0  TCP 192.168.1.118:53000->34.213.92.18:443 (ESTABLISHED)
firefox   4018 egycobra  173u  IPv4  22242      0t0  TCP 192.168.1.118:51252->185.199.109.153:443 (ESTABLISHED)
firefox   4018 egycobra  176u  IPv4  16317      0t0  TCP 192.168.1.118:44962->65.9.86.75:443 (ESTABLISHED)
firefox   4018 egycobra  185u  IPv4  16323      0t0  TCP 192.168.1.118:41484->2.16.172.43:80 (ESTABLISHED)
plasma-br 4731 egycobra  150u  IPv4  27006      0t0  TCP 192.168.1.118:44900->65.9.86.77:443 (ESTABLISHED)
plasma-br 4731 egycobra  157u  IPv4  30837      0t0  TCP 192.168.1.118:46174->44.241.28.160:443 (CLOSE_WAIT)
plasma-br 4731 egycobra  160u  IPv4  30836      0t0  TCP 192.168.1.118:33988->65.9.86.127:443 (ESTABLISHED)
plasma-br 4731 egycobra  162u  IPv4  30838      0t0  TCP 192.168.1.118:40834->52.222.149.75:443 (ESTABLISHED)
plasma-br 4731 egycobra  165u  IPv4  26320      0t0  TCP 192.168.1.118:48088->34.214.139.174:443 (CLOSE_WAIT)
plasma-br 4731 egycobra  172u  IPv4  29975      0t0  TCP 192.168.1.118:53000->34.213.92.18:443 (ESTABLISHED)
keepassxc 4738 egycobra  150u  IPv4  27006      0t0  TCP 192.168.1.118:44900->65.9.86.77:443 (ESTABLISHED)
keepassxc 4738 egycobra  157u  IPv4  30837      0t0  TCP 192.168.1.118:46174->44.241.28.160:443 (CLOSE_WAIT)
keepassxc 4738 egycobra  158u  IPv4  16315      0t0  TCP 192.168.1.118:37090->151.101.190.208:443 (ESTABLISHED)
keepassxc 4738 egycobra  159u  IPv4  16314      0t0  TCP 192.168.1.118:46696->34.209.16.253:443 (CLOSE_WAIT)
keepassxc 4738 egycobra  160u  IPv4  30836      0t0  TCP 192.168.1.118:33988->65.9.86.127:443 (ESTABLISHED)
keepassxc 4738 egycobra  161u  IPv4  16316      0t0  TCP 192.168.1.118:37104->151.101.190.208:443 (ESTABLISHED)
keepassxc 4738 egycobra  162u  IPv4  30838      0t0  TCP 192.168.1.118:40834->52.222.149.75:443 (ESTABLISHED)
keepassxc 4738 egycobra  165u  IPv4  26320      0t0  TCP 192.168.1.118:48088->34.214.139.174:443 (CLOSE_WAIT)
keepassxc 4738 egycobra  172u  IPv4  29975      0t0  TCP 192.168.1.118:53000->34.213.92.18:443 (ESTABLISHED)
keepassxc 4738 egycobra  173u  IPv4  22242      0t0  TCP 192.168.1.118:51252->185.199.109.153:443 (ESTABLISHED)
keepassxc 4738 egycobra  176u  IPv4  16317      0t0  TCP 192.168.1.118:44962->65.9.86.75:443 (ESTABLISHED)
thunderbi 6180 egycobra   46u  IPv4  28451      0t0  TCP 192.168.1.118:55472->64.233.162.109:993 (ESTABLISHED)
thunderbi 6180 egycobra   98u  IPv4  28377      0t0  TCP 192.168.1.118:55456->142.250.203.131:80 (ESTABLISHED)
thunderbi 6180 egycobra  100u  IPv4  31120      0t0  TCP 192.168.1.118:52024->64.233.162.109:993 (ESTABLISHED)
thunderbi 6180 egycobra  101u  IPv4  31121      0t0  TCP 192.168.1.118:52034->64.233.162.109:993 (ESTABLISHED)
thunderbi 6180 egycobra  102u  IPv4  31122      0t0  TCP 192.168.1.118:52048->64.233.162.109:993 (ESTABLISHED)
thunderbi 6180 egycobra  103u  IPv4  31123      0t0  TCP 192.168.1.118:52058->64.233.162.109:993 (ESTABLISHED)
thunderbi 6180 egycobra  105u  IPv4  28378      0t0  TCP 192.168.1.118:55458->142.250.203.131:80 (ESTABLISHED)
thunderbi 6180 egycobra  106u  IPv4  28379      0t0  TCP 192.168.1.118:55466->142.250.203.131:80 (ESTABLISHED)
thunderbi 6180 egycobra  107u  IPv4  28380      0t0  TCP 192.168.1.118:55468->142.250.203.131:80 (ESTABLISHED)
thunderbi 6180 egycobra  110u  IPv4  27300      0t0  TCP 192.168.1.118:40312->216.58.215.97:443 (ESTABLISHED)
As you can see, it greps nothing. I included the result withoutt the grep though.

Re: Getting Tor working (not tor browser)

Reply #3
I think I got your problem:

1- You should not run tor manually through your terminal, start it through openrc

2- if you really want to run tor manually, use sudo tor

Re: Getting Tor working (not tor browser)

Reply #4
RunAsDaemon seems redundant since you're already starting tor with openRC.
The message is pretty clear. Tor appears to be running, as it should since you enabled it as a service.
Do this:
Code: [Select]
pkillall tor
Then try running it again. If it show no errors this time then tor was running form the beginning.
Now you can use it as a socks proxy for any program that support it. Also you may want to install torsocks, it let you use tor as a proxy in case you don't find a way to configure a program to do so.
Another handy program is privoxy if you use a browser like qutebrowser since it can only use one proxy at a time.

Re: Getting Tor working (not tor browser)

Reply #5
RunAsDaemon seems redundant since you're already starting tor with openRC.
The message is pretty clear. Tor appears to be running, as it should since you enabled it as a service.
Do this:
Code: [Select]
pkillall tor
Then try running it again. If it show no errors this time then tor was running form the beginning.
Now you can use it as a socks proxy for any program that support it. Also you may want to install torsocks, it let you use tor as a proxy in case you don't find a way to configure a program to do so.
Another handy program is privoxy if you use a browser like qutebrowser since it can only use one proxy at a time.
Could not have said it better myself!

Re: Getting Tor working (not tor browser)

Reply #6
Though a warning, torsocks can only torify programs that use libc library functions, not syscalls, from torsocks( 8 ) man-page:
Quote
Torsocks uses ELF dynamic loader features to intercept dynamic function calls from programs in which it is embedded. As a result, non-ELF executables, or executables that make system calls directly with the system call trap (int 0x80) are not supported.

Re: Getting Tor working (not tor browser)

Reply #7
I wanted to have my Laptop use tor.
I didn't realize that you actually wanted to route all your traffic through tor.
Anyway, here's the how-to.
Although, I wouldn't recommend you to do that 'cause:
  • It'll reduce your internet speed.
  • Some programs and web sites may outright deny access to you.
  • AFAIK there isn't a single mirror of the artix repos that's a onion service, so they may not be inclined to accept traffic coming from tor.

Though a warning, torsocks can only torify programs that use libc library functions, not syscalls, from torsocks( 8 ) man-page:
Thanks for clarifying this, I did not know about it.

Re: Getting Tor working (not tor browser)

Reply #8
  • AFAIK there isn't a single mirror of the artix repos that's a onion service, so they may not be inclined to accept traffic coming from tor.
http://dotsrccccbidkzg7oc7oj4ugxrlfbt64qebyunxbrgqhxiwj3nl6vcad.onion/artix-linux/ (repos and ISOs)
http://uuktajb4xq3ykpayyawfhpuadoqsq7g5g4kks33cwhvx7due7ymuryqd.onion/artixlinux/ (repos)

https://wiki.artixlinux.org/Main/Mirrors#Onion_Mirrors

Re: Getting Tor working (not tor browser)

Reply #9
RunAsDaemon seems redundant since you're already starting tor with openRC.
Okay, I disabled it in torrc.
The message is pretty clear. Tor appears to be running, as it should since you enabled it as a service.
Do this:
Code: [Select]
pkillall tor
Then try running it again. If it show no errors this time then tor was running form the beginning.

Here's what i got:
First the pkillall:
Code: [Select]
SkvShkr% sudo pkillall tor
[sudo] password for egycobra:
sudo: pkillall: command not found
So I corrected it to killall and rerun it
Code: [Select]
[SkvShkr% sudo tor
Aug 17 11:06:41.678 [notice] Tor 0.4.7.10 running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1q, Zlib 1.2.12, Liblzma 5.2.6, Libzstd 1.5.2 and Glibc 2.36 as libc.
Aug 17 11:06:41.678 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
Aug 17 11:06:41.678 [notice] Read configuration file "/etc/tor/torrc".
Aug 17 11:06:41.680 [notice] Opening Socks listener on 127.0.0.1:9050
Aug 17 11:06:41.680 [warn] Could not bind to 127.0.0.1:9050: Address already in use. Is Tor already running?
Aug 17 11:06:41.680 [warn] Failed to parse/validate config: Failed to bind one of the listener ports.
Aug 17 11:06:41.680 [err] Reading config failed--see warnings above.
SkvShkr% sudo killall tor
SkvShkr% sudo tor
Aug 17 11:06:53.948 [notice] Tor 0.4.7.10 running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1q, Zlib 1.2.12, Liblzma 5.2.6, Libzstd 1.5.2 and Glibc 2.36 as libc.
Aug 17 11:06:53.948 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
Aug 17 11:06:53.948 [notice] Read configuration file "/etc/tor/torrc".
Aug 17 11:06:53.949 [notice] Opening Socks listener on 127.0.0.1:9050
Aug 17 11:06:53.949 [warn] Could not bind to 127.0.0.1:9050: Address already in use. Is Tor already running?
Aug 17 11:06:53.949 [warn] Failed to parse/validate config: Failed to bind one of the listener ports.
Aug 17 11:06:53.949 [err] Reading config failed--see warnings above.
As you can see, that did nothing.

Anyway I also disabled it by using
Code: [Select]
SkvShkr% sudo rc-update delete tor
 * service tor removed from runlevel default
And for the recap: I want to run it manually for my whole system. I'm aware of the consequences.
ps. Thanks for the .onion mirrors garza!

Re: Getting Tor working (not tor browser)

Reply #10
Okay. I will need you modify the /etc/tor/torrc file, you may need to use sudo since that file should be owned by tor.
Look for the section of the config that explain the use of SOCKSPort, once you are there on a new line write this:
Code: [Select]
SOCKSPort 127.0.0.1:9090
Please note that the port 9090 can be changed to whatever other port that you want, as long as is not being use. Also, instead of writing 127.0.0.1 you can just do localhost:[Any_Available_Port].
Try running tor again, this time it should try to use port 9090.
If this work and you choose to use it like that you will need to adjust every other program that wants to use tor to look up port 9090 (or any other port you choose).

For example: torsocks.
Torsocks by the default is going to check port 9050. So you will need to configure it to use 9090 instead.
  • Create a .config/torsocks directory.
  • Copy the example config (etc/tor/torsocks.conf) to the created directory and verify that's owned by your user.
  • Edit the file so the option TorPort look up for the port 9090 instead of 9050.
  • On your .bash_profile/.profile set the environment variable TORSOCKS_CONF_FILE to the location of the torsocks.conf file.

Re: Getting Tor working (not tor browser)

Reply #11
I did just that:
Code: [Select]
SkvShkr% sudo tor
Aug 17 17:10:09.932 [notice] Tor 0.4.7.10 running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1q, Zlib 1.2.12, Liblzma 5.2.6, Libzstd 1.5.2 and Glibc 2.36 as libc.
Aug 17 17:10:09.932 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
Aug 17 17:10:09.932 [notice] Read configuration file "/etc/tor/torrc".
Aug 17 17:10:09.933 [notice] Opening Socks listener on 127.0.0.1:9090
Aug 17 17:10:09.933 [notice] Opened Socks listener connection (ready) on 127.0.0.1:9090

Out of curiosity i commented my line to check if 9050 still wouldn't work and it somehow works?
Code: [Select]
^C%                                                                                                                                SkvShkr% sudo tor
Aug 17 17:11:19.262 [notice] Tor 0.4.7.10 running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1q, Zlib 1.2.12, Liblzma 5.2.6, Libzstd 1.5.2 and Glibc 2.36 as libc.
Aug 17 17:11:19.262 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
Aug 17 17:11:19.262 [notice] Read configuration file "/etc/tor/torrc".
Aug 17 17:11:19.264 [notice] Opening Socks listener on 127.0.0.1:9050
Aug 17 17:11:19.264 [notice] Opened Socks listener connection (ready) on 127.0.0.1:9050

In both cases after opened socks listener port it won't do more

 

Re: Getting Tor working (not tor browser)

Reply #12
Okay guys I think i fixed it.
Tor service was already running.
What commands do i recommend to check that (for the people from the future):
Code: [Select]
rc-status
Here you can see if you even have the tor service.
If you don't:
Code: [Select]
rc-update add tor
This adds tor as a service to your default runlevel. You can turn it on/off (choose one)
Code: [Select]
rc-service tor start/stop

How to check if you are connected to tor?
With one simple command
Code: [Select]
curl --socks5 localhost:9050 --socks5-hostname localhost:9050 https://check.torproject.org/api/ip
Explanation
* curl - checks url
* --socks5 - Uses specified SOCKS5 proxy - In this case tor, which by default is configured to be at port 9050.
* ----socks5-hostname - Uses the specified SOCKS5 proxy (and let the proxy resolve the host name)

I hope that helps. I'm going to make another post asking how to route pacman traffic through tor