Back to index

Intro to Tor

February 3, 2022

Club Announcement 🔗

Please meet with us for our first meeting of Winter Quarter 2022, hosted by our new Workshop Coordinator, Nate! We will be learning about Tor, a network built to help people communicate anonymously.

We will have an intro to Tor’s history and technology, how to host an Onion Site with a vanity URL, and learn how to use protocols like SSH over Tor.

For this workshop, please have Kali Linux installed. It would also be beneficial to run the following commands before the workshop:

sudo apt update
sudo apt upgrade
sudo apt install nginx tor torbrowser-launcher
note: mkp224o requires the libsodium-dev and autoconf packages to compile.

Files

Links

Code snippets from the presentation:

ssh over tor:

$ systemctl status tor
$ torsocks ssh \
cowsay@2svffbj7sslh7xbjrtvvr25clreikouznohbtblsttw6yjzripo77zqd.onion
$ sudo systemctl stop tor

example nginx config

server {
    listen localhost:80;
    listen unix:/var/run/cowsay.sock;

    server_name localhost;
    root /var/www/cowsay;
    index index.html;

    add_header Onion-Location http://PLACEHOLDER.onion$request_uri;

    location / {
        try_files $uri.html $uri $uri/ =404;
    }
}

add index, start nginx, test

$ sudo vim /var/www/cowsay/index.html

$ sudo ln -s /etc/nginx/sites-available/cowsay.conf /etc/nginx/sites-enabled/
$ sudo systemctl start nginx
$ curl localhost:80 || firefox localhost:80
your site here
$ curl --unix-socket /var/run/cowsay.sock localhost
your site here (via unix socket!)

mkp224o

$ git clone https://github.com/cathugger/mkp224o.git
$ cd mkp224o
$ ./autogen.sh
$ ./configure  #(we are omitting optimization today)
$ make
$ name=cowsay #pick your own :)
$ ./mkp224o $name -B -d output_dir

install keys

$ sudo cp -r cowsay6v2s....onion /var/lib/tor/cowsay
$ sudo chown -R debian-tor: /var/lib/tor/cowsay
$ sudo chmod -R u+rwX,og-rwx /var/lib/tor/cowsay

/etc/tor/torrc

### This section is just for location-hidden services ###

HiddenServiceDir /var/lib/tor/cowsay
HiddenServicePort 80 unix:/var/run/cowsay.sock
# Unix socket is the best practice. Especially at school.
$ sudo systemctl start tor