Tag: tor

  • Setup Tor Hidden Service on CentOS 7

    Tor is provided by EPEL repository on CentOS 7. Install EPEL repo with command

    yum install epel-release
    

    Install tor

    yum install tor
    

    Edit tor config file

    vi /etc/tor/torrc
    

    Uncomment or add following lines

    HiddenServiceDir /var/lib/tor/hidden_service/
    HiddenServicePort 80 127.0.0.1:80
    

    Restart tor with command

    systemctl restart tor
    

    Now your tor hidden service is ready to use. You need to run your web application on 127.0.0.1:80

    To see URL of your tor hidden service, run

    cat /var/lib/tor/hidden_service/hostname
    

    Make sure to make a backup of folder “/var/lib/tor/hidden_service/” as it comtains keys for this .onion domain. If you lost it, you will lose your domain name. So it is very important you keep the files safe.

    To stop/start tor, run

    systemctl stop tor
    systemctl start tor
    

    See tor

  • Tor Hidden Service in Ubuntu/Debian

    Tor Hidden Service in Ubuntu/Debian

    tor browser

    To install tor on Ubuntu/Debian, run

    apt install tor
    

    Default configuration file for tor is /etc/tor/torrc

    To enable hidden service, edit /etc/tor/torrc

    vi /etc/tor/torrc
    

    uncomment lines

    HiddenServiceDir /var/lib/tor/hidden_service/
    HiddenServicePort 80 127.0.0.1:80
    

    Create folder for your hidden service

    mkdir /var/lib/tor/hidden_service/
    chmod 700 /var/lib/tor/hidden_service/
    chown -R debian-tor:debian-tor /var/lib/tor/hidden_service/
    

    You need to install Apache/Nginx etc.. to serve your web application. Make sure to configure web application listen on 127.0.0.0:80

    Now restart tor with command

    systemctl start tor@default
    

    Ubuntu/Debian support multiple instances of tor. You can use command “/usr/sbin/tor-instance-create” to create new tor instance. Configuration for instanced tor available at /etc/tor/instances/INSTANCE_NAME/torrc

    To see URL for your Hidden service, run

    cat /var/lib/tor/hidden_service/hostname
    

    Example

    root@lab:~# cat /var/lib/tor/hidden_service/hostname 
    3w2pkr2qcusd6rx7zq4rulq7kt4xjpsgv7nxubcy2bdbgipy4wto4aid.onion
    root@lab:~# 
    

    You should be able to visit the application using .onion link in Tor Browser.

    You need to take backup of tor folder (/var/lib/tor/hidden_service) as it contains your secret keys, this is needed to use the .onion domain name. If you lose this, you will lose the .onion url.

    To start the service on boot, run

    systemctl enable tor@default
    

    See Tor

  • Install Tor on Ubuntu

    Tor is a highly anonymous proxy network. Tor is used by sites in dark web as it is almost impossible to find who owns a web site when it is hidden using tor.

    https://www.torproject.org

    To install tor on Ubuntu/Debian, run

    apt install -y tor
    

    This will start a sock5 proxy server on your PC on port 9050.

    tor proxy

    To check if proxy is working, run

    root@ok-vm:~# curl --socks5 127.0.0.1:9050 http://checkip.amazonaws.com
    185.220.101.44
    root@ok-vm:~# 
    

    You can also use “torify”, that work like proxychains.

    root@ok-vm:~# torify curl http://checkip.amazonaws.com
    185.220.101.46
    root@ok-vm:~# 
    

    You can configure your browser to use sock5 proxy server running on 127.0.0.1 on port 9050.

    If you are using applications that do not support proxy, then you can use torify or proxychains, for example.

    torify google-chrome
    
  • Block Tor IP Addresses with CSF Firewall

    To block traffic from TOR using CSF firewall, edit

    vi /etc/csf/csf.blocklists
    

    Add following to end of the file

    TOR|86400|0|https://www.dan.me.uk/torlist/
    

    86400 = Tor IP list updated every 86400 seconds (12 hours), you can change this if required, but updating every 12 hours is fine for such a large list.

    Now restart CSF and LFD

    csf -r
    systemctl restart lfd
    

    You can verify IPs get added to firewall by running

    iptables -L -n
    

    You wills see DROP lines for each of the TOR IP address.

    # iptables -L -n | grep DROP | wc -l
    5955
    # 
    

    You will be able to see the downloaded TOR IP list at

    /var/lib/csf/csf.block.TOR
    

    csf

    Block Tor IP Addresses