Tor install and usage (Arch based distro)

Install and configuration

$ yay -S tor nyx torsocks torbrowser-launcher

Sync Explicit (4): tor-0.4.8.7-1, nyx-2.1.0-7, torsocks-2.4.0-1, torbrowser-launcher-0.3.6-2  
resolviendo dependencias...  
buscando conflictos entre paquetes...  
  
Paquete (5)             Versión nueva  Diferencia neta  Tamaño de la descarga  
core/python-gpgme       1.22.0-1              1,66 MiB               0,25 MiB  
extra/nyx               2.1.0-7               1,04 MiB               0,19 MiB  
extra/tor               0.4.8.7-1            15,62 MiB               2,79 MiB  
extra/torbrowser-launcher 0.3.6-2             0,26 MiB               0,07 MiB  
extra/torsocks          2.4.0-1               0,13 MiB               0,05 MiB  

Tamaño total de la descarga:      3,35 MiB  
Tamaño total de la instalación:  18,72 MiB  

:: ¿Continuar con la instalación? [S/n]    
:: Obteniendo los paquetes...  
torbrowser-launcher-0.3.6-2-any   69,4 KiB   380 KiB/s 00:00 [---------] 100%  
torsocks-2.4.0-1-x86_64           51,8 KiB   256 KiB/s 00:00 [---------] 100%  
nyx-2.1.0-7-any                  194,0 KiB   683 KiB/s 00:00 [---------] 100%  
tor-0.4.8.7-1-x86_64               2,8 MiB  4,76 MiB/s 00:01 [---------] 100%  
python-gpgme-1.22.0-1-x86_64     257,1 KiB   424 KiB/s 00:01 [---------] 100%  
Total (5/5)                        3,4 MiB  5,25 MiB/s 00:01 [---------] 100%  
(5/5) comprobando las claves del depósito                    [---------] 100%  
(5/5) verificando la integridad de los paquetes              [---------] 100%  
(5/5) cargando los archivos de los paquetes                  [---------] 100%  
(5/5) comprobando conflictos entre archivos                  [---------] 100%  
:: Procesando los cambios de los paquetes...  
(1/5) instalando python-gpgme                                [---------] 100%  
(2/5) instalando tor                                         [---------] 100%  
Dependencias opcionales para tor  
   torsocks: for torify [pendiente]  
(3/5) instalando torbrowser-launcher                         [---------] 100%  
Dependencias opcionales para torbrowser-launcher  
   apparmor: support for apparmor profiles  
(4/5) instalando nyx                                         [---------] 100%  
Dependencias opcionales para nyx  
   tor: tor-server to talk to [instalado]  
(5/5) instalando torsocks                                    [---------] 100%  
:: Ejecutando los «hooks» de posinstalación...  
(1/6) Creating system user accounts...  
Creating group 'tor' with GID 43.  
Creating user 'tor' (n/a) with UID 43 and GID 43.  
(2/6) Reloading system manager configuration...  
(3/6) Creating temporary files...  
(4/6) Arming ConditionNeedsUpdate...  
(5/6) Updating icon theme caches...  
(6/6) Updating the desktop file MIME type cache...

$ sudo systemctl status tor

○ tor.service - Anonymizing overlay network for TCP  
    Loaded: loaded (/usr/lib/systemd/system/tor.service; disabled; preset: disabled)  
    Active: inactive (dead)  
[ruben@prox ~]$ sudo systemctl start tor  
[ruben@prox ~]$ sudo systemctl status tor  
● tor.service - Anonymizing overlay network for TCP  
    Loaded: loaded (/usr/lib/systemd/system/tor.service; disabled; preset: disabled)  
    Active: active (running) since Sat 2023-10-21 17:59:15 CEST; 1s ago  
   Process: 65971 ExecStartPre=/usr/bin/tor -f /etc/tor/torrc --verify-config (code=exited, status=0/>  
  Main PID: 65972 (tor)  
     Tasks: 13 (limit: 38172)  
    Memory: 20.3M  
       CPU: 219ms  
    CGroup: /system.slice/tor.service  
            └─65972 /usr/bin/tor -f /etc/tor/torrc  
  
oct 21 17:59:15 prox Tor[65972]: Opening Socks listener on 127.0.0.1:9050  
oct 21 17:59:15 prox Tor[65972]: Opened Socks listener connection (ready) on 127.0.0.1:9050  
oct 21 17:59:15 prox Tor[65972]: Parsing GEOIP IPv4 file /usr/share/tor/geoip.  
oct 21 17:59:15 prox Tor[65972]: Parsing GEOIP IPv6 file /usr/share/tor/geoip6.  
oct 21 17:59:15 prox Tor[65972]: Bootstrapped 0% (starting): Starting  
oct 21 17:59:15 prox Tor[65972]: Starting with guard context "default"  
oct 21 17:59:15 prox Tor[65972]: Signaled readiness to systemd  
oct 21 17:59:15 prox systemd[1]: Started Anonymizing overlay network for TCP.  
oct 21 17:59:16 prox Tor[65972]: Bootstrapped 5% (conn): Connecting to a relay  
oct 21 17:59:16 prox Tor[65972]: Bootstrapped 10% (conn_done): Connected to a relay

$ ss -nlt

State   Recv-Q  Send-Q  Local Address:Port Peer   Address:Port     Process        
LISTEN     0     4096        0.0.0.0:8000          0.0.0.0:*                     
LISTEN     0     4096        127.0.0.1:40543       0.0.0.0:*                     
LISTEN     0     4096        0.0.0.0:8082          0.0.0.0:*                     
LISTEN     0     5           127.0.0.1:5054        0.0.0.0:*                     
LISTEN     0     4096        127.0.0.1:1143        0.0.0.0:*                     
LISTEN     0     4096        127.0.0.1:1025        0.0.0.0:*                     
LISTEN     0     4096        0.0.0.0:443           0.0.0.0:*                     
LISTEN     0     4096        127.0.0.1:33537       0.0.0.0:*                     
LISTEN     0     4096        127.0.0.1:631         0.0.0.0:*                  
LISTEN     0     10          0.0.0.0:27500         0.0.0.0:*                     
LISTEN     0     4096        127.0.0.1:9050        0.0.0.0:*                     
LISTEN     0     4096        [::1]:631             [::]:*                      
LISTEN     0     4096        [::]:8000             [::]:*                      
LISTEN     0     4096        [::]:8082             [::]:*                     
LISTEN     0     50          *:1716                *:*                       
LISTEN     0     4096        [::]:443              [::]:*                     
LISTEN     0     10          [::]:27500            [::]:*      

Usage

Torify a command

$ wget -qO - https://api.ipify.org; echo

x1x1.y1y1.z1z1.t1t1

$ torsocks wget -qO - https://api.ipify.org; echo

x2x2.y2y2.z2z2.t2.t2

$ sudo systemctl stop tor
$ torsocks wget -qO - https://api.ipify.org; echo

1697904509 PERROR torsocks[67004]: socks5 libc connect: Conexión rehusada (in socks5_connect() at socks  
5.c:202)

Torify a shell

$ source torsocks on

Tor mode activated. Every command will be torified for this shell.

$ wget -qO - https://api.ipify.org; echo

xxx.yyy.zzz.ttt

$ source torsocks off  

Tor mode deactivated. Command will NOT go through Tor anymore.

Tor browser

$ torbrowser-launcher  

Tor Browser Launcher  
By Micah Lee, licensed under MIT  
version 0.3.6  
https://github.com/micahflee/torbrowser-launcher  
Launching Tor Browser.  
Running /home/ruben/.local/share/torbrowser/tbb/x86_64/tor-browser/start-tor-browser.desktop  
Launching './Browser/start-tor-browser --detach'...