1 # I2P Federation and Accessability
3 This guide is going to focus on the Akkoma federation aspect. The actual installation is neatly explained in the official documentation, and more likely to remain up-to-date.
4 It might be added to this guide if there will be a need for that.
6 We're going to use I2PD for its lightweightness over the official client.
7 Follow the documentation according to your distro: https://i2pd.readthedocs.io/en/latest/user-guide/install/#installing
9 How to run it: https://i2pd.readthedocs.io/en/latest/user-guide/run/
13 There are 2 ways to go about this.
14 One using the config, and one using external software (fedproxy). The external software works better so far.
18 **Warning:** So far, everytime I followed this way of federating using I2P, the rest of my federation stopped working. I'm leaving this here in case it will help with making it work.
20 Assuming you're running in prod, cd to your Akkoma folder and append the following to `config/prod.secret.exs`:
22 config :pleroma, :http, proxy_url: {:socks5, :localhost, 4447}
24 And then run the following:
27 MIX_ENV=prod mix deps.get
28 MIX_ENV=prod mix ecto.migrate
31 You can restart I2PD here and finish if you don't wish to make your instance viewable or accessible over I2P.
33 systemctl stop i2pd.service --no-block
34 systemctl start i2pd.service
36 *Notice:* The stop command initiates a graceful shutdown process, i2pd stops after finishing to route transit tunnels (maximum 10 minutes).
38 You can change the socks proxy port in `/etc/i2pd/i2pd.conf`.
42 Fedproxy passes through clearnet requests direct to where they are going. It doesn't force anything over Tor.
44 To use [fedproxy](https://github.com/majestrate/fedproxy) you'll need to install Golang.
48 Use a different user than akkoma or root. Run the following to add the Gopath to your ~/.bashrc.
50 echo "export GOPATH=/home/ren/.go" >> ~/.bashrc
52 Restart that bash session (you can exit and log back in).
53 Run the following to get fedproxy.
55 go get -u github.com/majestrate/fedproxy$
56 cp $(GOPATH)/bin/fedproxy /usr/local/bin/fedproxy
58 And then the following to start it for I2P only.
60 fedproxy 127.0.0.1:2000 127.0.0.1:4447
62 If you want to also use it for Tor, add `127.0.0.1:9050` to that command.
63 You'll also need to modify your Akkoma config.
65 Assuming you're running in prod, cd to your Akkoma folder and append the following to `config/prod.secret.exs`:
67 config :pleroma, :http, proxy_url: {:socks5, :localhost, 2000}
69 And then run the following:
72 MIX_ENV=prod mix deps.get
73 MIX_ENV=prod mix ecto.migrate
76 You can restart I2PD here and finish if you don't wish to make your instance viewable or accessible over I2P.
79 systemctl stop i2pd.service --no-block
80 systemctl start i2pd.service
82 *Notice:* The stop command initiates a graceful shutdown process, i2pd stops after finishing to route transit tunnels (maximum 10 minutes).
84 You can change the socks proxy port in `/etc/i2pd/i2pd.conf`.
86 ## I2P Instance Access
88 Make your instance accessible using I2P.
90 Add the following to your I2PD config `/etc/i2pd/tunnels.conf`:
100 systemctl stop i2pd.service --no-block
101 systemctl start i2pd.service
103 *Notice:* The stop command initiates a graceful shutdown process, i2pd stops after finishing to route transit tunnels (maximum 10 minutes).
105 Now you'll have to find your address.
106 To do that you can download and use I2PD tools.[^1]
107 Or you'll need to access your web-console on localhost:7070.
108 If you don't have a GUI, you'll have to SSH tunnel into it like this:
109 `ssh -L 7070:127.0.0.1:7070 user@ip -p port`.
110 Now you can access it at localhost:7070.
111 Go to I2P tunnels page. Look for Server tunnels and you will see an address that ends with `.b32.i2p` next to "akkoma".
112 This is your site's address.
114 ### I2P-only Instance
116 If creating an I2P-only instance, open `config/prod.secret.exs` and under "config :pleroma, Pleroma.Web.Endpoint," edit "https" and "port: 443" to the following:
118 url: [host: "i2paddress", scheme: "http", port: 80],
120 In addition to that, replace the existing nginx config's contents with the example below.
122 ### Existing Instance (Clearnet Instance)
124 If not an I2P-only instance, add the nginx config below to your existing config at `/etc/nginx/sites-enabled/akkoma.nginx`.
126 And for both cases, disable CSP in Akkoma's config (STS is disabled by default) so you can define those yourself separately from the clearnet (if your instance is also on the clearnet).
127 Copy the following into the `config/prod.secret.exs` in your Akkoma folder (/home/akkoma/akkoma/):
129 config :pleroma, :http_security,
133 Use this as the Nginx config:
135 proxy_cache_path /tmp/akkoma-media-cache levels=1:2 keys_zone=akkoma_media_cache:10m max_size=10g inactive=720m use_temp_path=off;
136 # The above already exists in a clearnet instance's config.
140 listen 127.0.0.1:14447;
141 server_name youri2paddress;
143 # Comment to enable logs
144 access_log /dev/null;
151 gzip_http_version 1.1;
152 gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
154 client_max_body_size 16m;
158 add_header X-XSS-Protection "0";
159 add_header X-Permitted-Cross-Domain-Policies none;
160 add_header X-Frame-Options DENY;
161 add_header X-Content-Type-Options nosniff;
162 add_header Referrer-Policy same-origin;
164 proxy_http_version 1.1;
165 proxy_set_header Upgrade $http_upgrade;
166 proxy_set_header Connection "upgrade";
167 proxy_set_header Host $http_host;
169 proxy_pass http://localhost:4000;
171 client_max_body_size 16m;
175 proxy_cache akkoma_media_cache;
177 proxy_ignore_client_abort on;
178 proxy_pass http://localhost:4000;
184 systemctl stop i2pd.service --no-block
185 systemctl start i2pd.service
187 *Notice:* The stop command initiates a graceful shutdown process, i2pd stops after finishing to route transit tunnels (maximum 10 minutes).
189 You should now be able to both access your instance using I2P and federate with other I2P instances!
191 [^1]: [I2PD tools](https://github.com/purplei2p/i2pd-tools) to print information about a router info file or an I2P private key, generate an I2P private key, and generate vanity addresses.
195 Will be added when encountered.