Hidden service crash course I2P edition <3
Note: My setup runs off a raspberry pi (debian bookworm) so most
of the installation commands only apply to debian based distros. Otherwise, setup and configuration should
be the same across different distros.
ALSO this only covers the setup of a webserver, so if you want to learn
about I2P itself and how it works I would recommend the [ official site ]
I'm not a professional, never type commands that a stranger tells you to if you don't know what they are,
etc etc
I2P Setup:
1) First you need to install i2p on your server machine. There are a couple different implementations, but I chose i2pd, which is a C++
implementation of the i2p client. The below commands were pulled directly from the
i2pd docs, which also has instructions for different distros
sudo apt install -y apt-transport-https
wget -qO - https://repo.i2pd.xyz/.help/add_repo | bash -s -
sudo apt-get update
sudo apt-get install i2pd
2) Next to create a website, you have to create a config file under `/etc/i2pd/tunnels.conf.d/your_choice.conf`
.
Inside the configuration file you created goes basic info about your site
[anon-website]
type = http
host = 127.0.0.1
port = 7474
keys = your_choice.dat
Note: I'm not sure if the conf name and keys HAVE to match but it's easier to remember sooo I'd recommend keeping them the same. (also
if it's not obvious you can replace your_choice with wtv you want)
3) Restart i2pd with `sudo systemctl restart i2pd`
. Your site keys should be generated in `/var/lib/i2pd/your_choice.dat`
and your site address is under `/var/lib/i2pd/destinations`
(replace the `.0.dat` or `.4.dat` with `.b32.i2p`)
4) Now that i2pd is installed, we need a webserver to deploy our site. I decided to go with caddy
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
5) Next we modify the caddy config to point to the directory that hosts our site files, which is located at
`/etc/caddy/Caddyfile`
http://your_site.b32.i2p:7474 {
bind 127.0.0.1
root * /var/www/your_dir
file_server
}
6) Restart caddy and you should be able to access your site! I check mine on my personal machine with basic i2p (not i2pd)
installed. It's pretty easy to get the browser set up if you follow the instructions on the official site
I use firefox for regular browsing and librewolf
specifically for i2p so I don't have to modify my proxy settings constantly, but they provide browser bundles so this isn't really necessary
Optional - Caddy Logs:
If you want site logs like you'd get by default on nginx or other popular webservers you can enable them by editing
your Caddyfile (shown above). Inside your site's curly braces, add:
log {
output file /var/log/caddy/access.log {
roll_size 100mb
roll_keep 10
}
format json
}
If you want to play around with log formatting, I'd recommend looking at caddy's
logging documentation!
Troubleshooting:
When I (inevitably) run into problems, I'll update this <3
Questions/ concerns/ thoughts/ objections? contact me!
november 2024