From 6a514eef9eb008d1b8ab6fae3423c4aa6afa21e2 Mon Sep 17 00:00:00 2001
From: David Uhden Collado <149145202+daviduhden@users.noreply.github.com>
Date: Thu, 4 Jul 2024 05:43:13 +0200
Subject: Update i2p.md
There is no need to create a new user for this service, the system automatically creates a new user that will be used to run the service when installing the package. On the other hand, i2pd does not look for the configuration files by default in the home directory of the i2pd user but rather in /etc/i2pd/.
---
content/i2p.md | 43 +++++++++++++++++++------------------------
1 file changed, 19 insertions(+), 24 deletions(-)
(limited to 'content')
diff --git a/content/i2p.md b/content/i2p.md
index b4bd664..40ac79d 100644
--- a/content/i2p.md
+++ b/content/i2p.md
@@ -11,7 +11,7 @@ Now you have a website, why not offer it in a private alternative such as the In
## Setting up I2P
-There are 2 main I2P implementations, I2P and i2pd, we are using i2pd in this guide because it\'s easier to use in servers.
+There are 2 main I2P implementations, I2P and i2pd, we are using i2pd in this guide because it's easier to use on servers.
### Installing I2P
@@ -38,16 +38,9 @@ apt install i2pd
### Enabling I2P
-We are going to create a user for i2pd, because i2pd finds the configuration files in its home directory. And it\'s easier (and more tidy) to have it in a separate user:
+Next we have to configure the i2pd daemon, the configuration is located at `/etc/i2pd/`.
-```sh
-useradd -m i2p -s /bin/bash
-su -l i2p
-mkdir ~/.i2pd
-cd ~/.i2pd
-```
-
-Now that you\'re in \~/.i2pd, you have to create a file named \"tunnels.conf\". Which is the config file for every hidden service you\'re offering over I2P, the content should be like this:
+Edit the `tunnels.conf` file and add the following configuration to the file:
```systemd
[example]
@@ -57,13 +50,15 @@ port = 8080
keys = example.dat
```
+You can comment or remove the tunnels that are added by default in the configuration file.
+
#### Optional: Generating a Vanity Address
-If you run `i2pd` with the configuration above, it will generate a random private key (`example.dat`) for your website in `example.dat` with a matching address made up of 52 random characters, derived from this same key.
+If you run `i2pd` with the configuration above, it will generate a random private key (`example.dat`) for your website at `/var/lib/i2pd/` with a matching address made up of 52 random characters, derived from this same key.
If you instead pre-generate a private key for your website, you can use brute-force computation to make a "vanity" address, such as the following:
```
-{{}}chad{{}}aor3jc08ht340c30mg5cf340j395gj095kuazj5tokipr34f.32.i2p
+chadaor3jc08ht340c30mg5cf340j395gj095kuazj5tokipr34f.32.i2p
```
To accomplish this, a set of tools named `i2pd-tools` can be installed.
@@ -86,12 +81,12 @@ make -j$(nproc)
This will build a variety of useful tools for i2p, with `vain` being the command of interest to generate an address:
```sh
-./vain {{}}chad{{}}
+./vain chad
```
This command will begin running and output a new set of private keys named `private.dat` to the same directory it's ran from. Copy this file to your i2p configuration and you'll have your vanity address:
```sh
-cp private.dat /home/i2p/.i2pd/example.dat
+cp private.dat /var/lib/i2pd/example.dat
```
#### Optional: Authentication Strings for Registrars
@@ -99,14 +94,14 @@ cp private.dat /home/i2p/.i2pd/example.dat
I2P has various **registrars** that let users link their long I2P addresses to shorter, more memorable ones, like `example.i2p`. To actually register your site on one of these registrars, you will need an **authentication string.** Luckily, `i2pd-tools` includes such a tool in their repository:
```sh
-./regaddr private.dat {{}}example.2ip{{}} > {{}}auth_string.txt{{}}
+./regaddr private.dat example.2ip > auth_string.txt
```
The command above will save the string to a file named `auth_string.txt`. You will have to place the text contained in that file on a registration page like [http://reg.i2p/add](http://reg.i2p/add) or [http://stats.i2p/i2p/addkey.html](http://stats.i2p/i2p/addkey.html).
### Getting your I2P Hostname
-Then, run `/usr/sbin/i2pd --daemon` to start i2pd and we can retreive our I2P hostname.
+Then, run the command `systemctl start i2pd` to start i2pd and `systemctl enable i2pd` to enable i2pd at startup, this will automatically generate our I2P hostname which we will now see.
This can be done in lynx or a command-line browser by going to `http://127.0.0.1:7070/?page=i2p_tunnels` to get your I2P hostname.
@@ -114,28 +109,26 @@ You can also run these commands to find your hostname:
```sh
printf "%s.b32.i2p
-" $(head -c 391 /home/i2p/.i2pd/example.dat |sha256sum|xxd -r -p | base32 |sed s/=//g | tr A-Z a-z)
+" $(head -c 391 /var/lib/i2pd/example.dat | sha256sum | xxd -r -p | base32 | sed s/=//g | tr A-Z a-z)
```
*(If you've generated your own keys to obtain a vanity address, now's a good time to make sure i2pd is properly reading those keys by verifying the address is the same as the one generated with the `vain` command.)*
## Adding the Nginx Config
-From here, the steps are almost identical to setting up a normal websitenconfiguration file. Follow the steps as if you were making a new website on the webserver [tutorial](/basic/nginx) up until the server block of code. Instead, paste this:
+From here, the steps are almost identical to setting up a normal website configuration file. Follow the steps as if you were making a new website on the webserver [tutorial](/basic/nginx) up until the server block of code. Instead, paste this:
```nginx
server {
listen 127.0.0.1:8080 ;
- root /var/www/{{}}example{{}} ;
+ root /var/www/example ;
index index.html ;
}
```
#### Clarifications
-####
-
-Nginx will listen in port 8080, but i2pd will forward your port 8080 to the i2p site port 80. This way you don\'t have to deal with server names or anything like that.
+Nginx will listen on port 8080, but i2pd will forward your port 8080 to the i2p site port 80. This way you don't have to deal with server names or anything like that.
From here we are almost done, all we have to do is enable the site and reload nginx which is also covered in [the webserver tutorial](nginx.html#enable).
@@ -144,7 +137,9 @@ From here we are almost done, all we have to do is enable the site and reload ng
Make sure to update I2P on a regular basis by running:
```sh
-apt update && apt install i2pd
+apt update && apt upgrade
```
-**Contributor** - [qorg11](https://qorg11.net)
+**Contributors**
+- [qorg11](https://qorg11.net)
+- [David Uhden](https://github.com/daviduhden)
--
cgit v1.2.3