Setting up your own darknet site

Note: This guide assumes that you have at least two functioning brain cells and basic knowledge of Linux. We're going to use Debian 11 in this guide. If you're using a different distro or operating system, you're on your own.

All terminal commands should be run as root. If you're not root, execute sudo -i and input your password and you should be there. Again, if you're using doas instead, you're on your own (and probably already know what you're doing).

 

What darknet do you want to use?

Tor   Yggdrasil I2P

 

Setting up the darknet itself

Tor

Install Tor.

apt install tor

Edit /etc/tor/torrc to allow connections to and from the hidden service.

nano -$ /etc/tor/torrc

Go to the lines that say:

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

Uncomment them by deleting the # mark in front of each line.

If you want, you can change the HiddenServiceDir directory, but you will need to remember it for later. (You will need to do this if you want multiple Tor hidden services.) For security purposes, keep the new directory inside of /var/lib/tor/.

Save and exit the text editor, then restart the Tor process.

systemctl restart tor@default

Now get the address of your new service. (If you picked a different HiddenServiceDir, now is the time to remember it.)

cat /var/lib/tor/hidden_service/hostname

Whatever comes up is your address for when you set up your web server.


Which web server do you want to use?

[Caddy]

 

Yggdrasil

Install Yggdrasil.

apt install dirmngr -y

gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt

gpg --export 569130E8CA20FBC4CB3FDE555898470A764B32C9 | sudo apt-key add -

echo 'deb https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil' | sudo tee /etc/apt/sources.list.d/yggdrasil.list

apt update; apt install yggdrasil -y

Now start Yggdrasil to get its IP address.

systemctl start yggdrasil; systemctl enable yggdrasil

journalctl -xe -u yggdrasil

There will be a line near the bottom that says "Your IPv6 address is". This is your address for when you set up your web server.

Press Control and C together to exit journalctl.

Configure some peers.

Open this page in a new tab in your browser, and open your Yggdrasil configuration on your server:

nano -$ /etc/yggdrasil.conf

At the top of the configuration file will be a section that looks like this:

Peers: []

Pick some peers from the list and add them to that section of the file (one per line) so it now looks something like this:

Peers:
[
	t*****://50.236.201.218:56088
	t*****://lancis.iscute.moe:49273
	t*****://45.77.107.150:34660
	tls://longseason.1200bps.xyz:13122
	tls://107.189.4.167:42024
]
			

Save and exit the text editor, then restart the Yggdrasil process.

systemctl restart yggdrasil


Which web server do you want to use?

[Caddy]

 

I2P

Install I2Pd.

apt install i2pd lynx -y

Edit I2Pd's configuration file to allow connections to and from the hidden service.

nano -$ /var/lib/i2pd/tunnels.conf

Go to the end of the file and add:

[mycooleepsite]
type = http
host = 127.0.0.1
port = 80
keys = mycooleepsite.dat
			

Restart I2Pd.

systemctl restart i2pd

Find out your new eepsite's hash.

lynx https://127.0.0.1:7070

Go to the "I2P Tunnels" page. (In Lynx, press the down arrow until "I2P Tunnels" is highlighted, and then press the enter key.)

In the "Server Tunnels" section, there should be a string that looks something like VERYLONGHASH.b32.i2p. The whole thing (including the .b32.i2p) is your address for when you set up your web server.


Which web server do you want to use?

[Caddy]

 

IPFS

This section has been moved to its own page due to its complexity.

 

Setting up the web server

Caddy

Install Caddy.

echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" | tee -a /etc/apt/sources.list.d/caddy-fury.list

apt update; apt install caddy -y

Edit the Caddyfile to serve the site.

nano -$ /etc/caddy/Caddyfile

Paste the following in:

https://address {
	root * /your/website/file/path/here
	file_server
	encode gzip
	bind 127.0.0.1
}
			

"address" should be the, well, address of your new site, given in the last step of its section. (Yggdrasil IPv6 addresses should be enclosed in brackets.)

/your/website/file/path/here should be the actual path to your website's files.

bind 127.0.0.1 will (hopefully) prevent the easiest of deanonymization attacks. (Delete this line for Yggdrasil services.) Let's Decentralize is not responsible for your personal safety, and it is up to you to harden your server's security further.

Now restart Caddy to apply your changes.

systemctl restart caddy


made with <3 by your friends at Dead End Shrine Online
CC BY-NC-SA 4.0 © Lethe Beltane