1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<!DOCTYPE html><head><meta charset="utf-8" /><meta name="description" content="C.C.M. personal website" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>π½ Torsite β C.C.M. Homepage</title><link rel="stylesheet" href="/css/default.css" /></head><body><header><div id="block"><p>+>---------------------------<+</p><p>[<a href="/about.html">About</a>]--[<a href="/research.html">Research</a>]--[<a href="/projects.html">Projects</a>]</p><p>+>---------------------------<+</p><br /></div></header><div id="block"><h1>π½ Torsite</h1><div>February 24, 2024</div><div><h2>Create your website on TOR</h2><p><div style="text-align: center"><img src="/images/torsite.png" /></div></p><h2>[1] Installing and Configuring Tor</h2><p>Tor comes in two components: the Tor browser, and the Tor server. The Tor browser is used to access either websites on the Clearnet while maintaining your anonymity, or websites hidden on the Tor network itself. In both cases, you remain anonymous to the website. However, if you want to hide your own website, you will need the Tor server. To install those two components on your Kali Linux system, you will need to issue the following commands:</p><div id="code"><pre style="overflow: auto"><code> apt update
apt install tor torbrowser-launcher torsocks apache2 -y</code></pre></div><h2>[2] Setting up an HTTP Server</h2><p>It is time now to configure your web server. You can use any webserver you like. For the sake of this tutorial, however, we will use Apache server on Kali Linux. One important consideration you should be aware of is the fact that your web server must run on localhost only; that is, it must be listening only on 127.0.0.1. The reason this is important is that it guarantees the anonymity we are after. The default behavior of Apache server β once you start it β is to listen on all available interfaces. If you do not change that, your web server may become accessible from Clearnet in addition to the Tor network, and you do not want that. You want your website to be accessible only from Tor. To change this behavior, we will edit the file /etc/apache2/ports.conf:</p><div id="code"><pre style="overflow: auto"><code> edit /etc/apache2/ports.conf</code></pre></div><p>Then, change the IP address 0.0.0.0 to 127.0.0.1 for port 80 and 443 (SSL/TLS) as follows:</p><p>Then, save the file ports.conf.</p><p>Add the files of your website to the director /var/www/html. For the sake of this tutorial, we will create the file oursite.html which will include the following HTML code:</p><p>Now, we will save the file oursite.html in /var/www/html. It is time to start Apache:</p><div id="code"><pre style="overflow: auto"><code> /etc/init.d/apache2 restart</code></pre></div><p>We can now verify that our website is accessible on the locahost by accessing it through a normal web browser, e.g., Firefox, with the address</p><div id="code"><pre style="overflow: auto"><code> http://localhost/torsite.html</code></pre></div><h2>[3] Add the Website to Tor</h2><p>Now that we have our web server listening on localhost, we can configure our Tor program to designate this server as a Tor hidden service.
We do this by editing Tor configuration file /etc/tor/torrc as follows:</p><div id="code"><pre style="overflow: auto"><code>HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80
HiddenServiceDir /var/lib/tor/hidden_service1/
HiddenService1Port 81 127.0.0.1:81</code></pre></div><p>We need to uncomment the line starting with HiddenServiceDir.
We can add as many HiddenServiceDir as we want depending on the number of hidden services we want to host.
And then, we need to uncomment the line with the HiddenServicePort directive.</p><h2>[4] Run Tor Service</h2><p>After editing the configuration file, we need to run the actual Tor service.
It will perform all necessary work to register your website in the Tor network.
It will also create private and public keys for encryption and will create an onion address which people are going to use to access your website.</p><div id="code"><pre style="overflow: auto"><code> torNov 13 17:18:09.832 [notice] Tor 0.3.4.8 (git-5da0e95e4871a0a1) running on Linux</code></pre></div><p>Nov 13 17:18:09.851 [notice] Tor canβt help you if you use it wrong!
Nov 13 17:18:09.947 [notice] Read configuration file β/etc/tor/torrcβ.
Nov 13 17:18:36.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Nov 13 17:18:37.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Nov 13 17:18:37.000 [notice] Bootstrapped 100%: Done</p><p>Once it is done, leave the terminal window open. The Tor program will create two files under the directory /var/lib/tor/hidden_services/ and those files are:</p><blockquote><p>hostname: this file contains the Onion address of your website.
private_key: this file contains the private key. It should be completely secure.</p></blockquote><p>One important note here is that the private_key file must be kept confidential and secure.
Tor generates for your website two keys: public and private.
The public key is sent to the actual Tor network and gets stored in a directory database along with many other public keys of other websites.
Users wishing to access your website use that public key to make the connection.
However, your local Tor service uses the private key to decrypt the traffic.</p><h2>[5] Accessing the Hidden Website</h2><p>If you have done everything correctly up to now,
you should have your onion address in the file /var/lib/tor/hidden_service/hostname.
In our example, we have the following address:</p><div id="code"><pre style="overflow: auto"><code> cd /var/lib/tor/hidden_service/
cat hostname</code></pre></div><p>http://idtirp7vx6rcpxgkmm3t6ungbuq6wcsinjggfhmppuv2e2prux4gc6qd.onion</p><p>All you need to do now is to open a Tor Browser β from any system on the Internet β and type the above address in the URL bar:</p><div id="code"><pre style="overflow: auto"><code> torbrowser-launcher &</code></pre></div><p>Notice that we also need to enter the html file name β we created earlier β after the address. Thus, our address looks exactly like this:
idtirp7vx6rcpxgkmm3t6ungbuq6wcsinjggfhmppuv2e2prux4gc6qd.onion/torsite.html</p></div></div><footer><div id="block"><br /><p>+>---------------------------<+</p><div>[<a href="https://codeberg.org/berkeley">Codeberg</a>]--[<a href="https://os.securityos.co/">SecurityOS</a>]</div><div>[<a href="https://github.com/cristiancmoises">GitHub</a>]--[<a href="https://www.linkedin.com/in/cristiancezarmoises">LinkedIn</a>]</div><div>[<a href="https://www.researchgate.net/profile/Cristian-Moises/research">Research</a>]--[<a href="http://secopscj53y6qltbysxt2bhnr2ohwzi6bh6wbxonycgc6tdemj4xkmyd.onion/">TOR</a>]--[<a href="https://youtube.com/@securityops">Youtube</a>]</div><p>Β© 2024 Cristian Cezar Moises</p><p>[<a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>]</p><p>Built with [<a href="http://haunt.dthompson.us">Haunt</a>] in [<a href="https://www.gnu.org/software/guile/guile.html">Scheme</a>]</p><p>+>---------------------------<+</p></div></footer></body>
|