diff options
Diffstat (limited to 'tutorial-ubuntu1804.html.j2')
-rw-r--r-- | tutorial-ubuntu1804.html.j2 | 391 |
1 files changed, 391 insertions, 0 deletions
diff --git a/tutorial-ubuntu1804.html.j2 b/tutorial-ubuntu1804.html.j2 new file mode 100644 index 00000000..32a8a326 --- /dev/null +++ b/tutorial-ubuntu1804.html.j2 | |||
@@ -0,0 +1,391 @@ | |||
1 | {% extends "common/base.j2" %} | ||
2 | {% block body_content %} | ||
3 | <div class="container"> | ||
4 | |||
5 | <h2>{{ _("Tutorial: GNUnet on Ubuntu 18.04") }}</h2> | ||
6 | |||
7 | <h3>{{ _("Introduction") }}</h3> | ||
8 | |||
9 | <p>Welcome to the hopefully painless GNUnet tutorial for Ubuntu 18.04! It provides | ||
10 | very concrete instructions on how to compile, install and configure a current | ||
11 | version of GNUnet. The goal is to support newcomers, either end users or | ||
12 | developers, who want to get in touch with GNUnet for the first time. After | ||
13 | installing GNUnet we will make sure that out new GNUnet installation is working | ||
14 | correctly.</p> | ||
15 | |||
16 | <p><b>Attention: If you came across the official gnunet package for Ubuntu 18.04, | ||
17 | ignore it! It is ancient and not compatible with current GNUnet | ||
18 | installations.</b></p> | ||
19 | |||
20 | <p>Now let's start!</p> | ||
21 | |||
22 | <h3>{{ _("Requirements") }}</h3> | ||
23 | |||
24 | <p>First let's install the following Ubuntu 18.04 packages to use GNUnet | ||
25 | painlessly. Optional dependencies are listed in Appendix A. They are required | ||
26 | for some experimental GNUnet features.</p> | ||
27 | |||
28 | <p><code> | ||
29 | $ sudo apt install git libtool autoconf autopoint build-essential libgcrypt-dev libidn11-dev zlib1g-dev libunistring-dev libglpk-dev miniupnpc libextractor-dev libjansson-dev libcurl4-gnutls-dev libsqlite3-dev openssl libnss3-tools libmicrohttpd | ||
30 | </code></p> | ||
31 | |||
32 | <h3>{{ _("Make an installation directory") }}</h3> | ||
33 | |||
34 | <p>Next we create a directory in our home directory where we store the source code later. We should keep this directory after installation because it contains Makefiles that can be used for uninstalling GNUnet again (see chapter *Uninstall GNUnet and its dependencies*).</p> | ||
35 | |||
36 | <p><code> | ||
37 | $ mkdir ~/gnunet_installation | ||
38 | </code></p> | ||
39 | |||
40 | <h3>{{ _("Get the source code") }}</h3> | ||
41 | |||
42 | <p>We download the GNUnet source code using git.</p> | ||
43 | |||
44 | <p><code> | ||
45 | $ cd ~/gnunet_installation<br> | ||
46 | $ git clone --depth 1 https://gnunet.org/git/gnunet.git<br> | ||
47 | </code></p> | ||
48 | |||
49 | <h3>{{ _("Compile and Install") }}</h3> | ||
50 | |||
51 | <p>Installing GNUnet is not hard. We have two options: | ||
52 | installing a *production version* and installing a *development version*. If | ||
53 | you want to start writing GNUnet applications or join the GNUnet development | ||
54 | choose the development version (it will print more debug output and contains | ||
55 | debug symbols that can be displayed with a debugger). Otherwise choose the | ||
56 | production version.</p> | ||
57 | |||
58 | <h4>{{ _("Option 1: GNUnet for production / usage") }}</h4> | ||
59 | <p><code> | ||
60 | $ cd ~/gnunet_installation/gnunet<br> | ||
61 | $ ./bootstrap<br> | ||
62 | $ export GNUNET_PREFIX=/usr<br> | ||
63 | $ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --with-microhttpd=/opt/libmicrohttpd<br> | ||
64 | $ sudo addgroup gnunetdns<br> | ||
65 | $ sudo adduser --system --group --disabled-login --home /var/lib/gnunet gnunet<br> | ||
66 | $ make -j$(nproc || echo -n 1)<br> | ||
67 | $ sudo make install | ||
68 | </code></p> | ||
69 | |||
70 | <h4>{{ _("Option 2: GNUnet for development") }}</h4> | ||
71 | <p><code> | ||
72 | $ cd ~/gnunet_installation/gnunet<br> | ||
73 | $ ./bootstrap<br> | ||
74 | $ export GNUNET_PREFIX=/usr<br> | ||
75 | $ export CFLAGS="-g -Wall -O0"<br> | ||
76 | $ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --enable-logging=verbose <br> | ||
77 | $ make -j$(nproc || echo -n 1)<br> | ||
78 | $ sudo make install | ||
79 | </p></code> | ||
80 | |||
81 | <!--<h4>{{ _("Install GNUnet plugin for name resolution") }}</h4> | ||
82 | So now it gets a bit nasty. It's not so bad. All we have to do is copy a file and edit another one. The file we need to copy is GNUnet's plugin for the Name Service Switch (NSS) in unix systems. Different unixes expect it in different locations and GNUnet's build system does not try to guess. On Ubuntu 18.04 we have to do | ||
83 | |||
84 | <p><code> | ||
85 | $ sudo cp /usr/lib/gnunet/nss/libnss_gns.so.2 /lib/$(uname -m)-linux-gnu/ | ||
86 | </p></code> | ||
87 | |||
88 | <p>The next step is activating the GNUnet plugin we just copied in the NSS | ||
89 | config. It is located in `/etc/nsswitch.conf`. It should contain a line | ||
90 | starting with "hosts" similar to this (at least "files" and "dns" should be | ||
91 | there):</p> | ||
92 | |||
93 | <p><code> | ||
94 | $ cat /etc/nsswitch.conf<br> | ||
95 | hosts: files mdns4_minimal [NOTFOUND=return] dns | ||
96 | </p></code> | ||
97 | |||
98 | <p><b>Attention: Once we modified `etc/nsswitch.conf` DNS resolution will only | ||
99 | be possible as long as is GNUnet is running. We can leave the next step out, | ||
100 | but then we will not be able to use GNUnet's name resolution in external | ||
101 | applications.</b></p> | ||
102 | |||
103 | <p>We save a copy of the original file and then modify the line using sed:</p> | ||
104 | |||
105 | <p><code> | ||
106 | $ sudo cp /etc/nsswitch.conf /etc/nsswitch.conf.original<br> | ||
107 | $ sudo sed -i -E 's/^(hosts:.*) dns/\1 gns [NOTFOUND=return] dns/' /etc/nsswitch.conf | ||
108 | </p></code> | ||
109 | |||
110 | <p>Now in the line starting with "hosts" should contain an entry "gns [NOTFOUND=return]" before the "dns" entry like this:</p> | ||
111 | |||
112 | <p><code> | ||
113 | hosts: files mdns4_minimal [NOTFOUND=return] gns [NOTFOUND=return] dns | ||
114 | </p></code> | ||
115 | |||
116 | <p>That's it. It wasn't that nasty, was it?</p>--> | ||
117 | |||
118 | <h3>{{ _("Configuration") }}</h3> | ||
119 | Congratulations! GNUnet is now installed! Before we start it we need to create a configuration file. By default GNUnet looks in our home directory for the file `~/.gnunet/gnunet.conf`. We can start with an empty file for now: | ||
120 | |||
121 | <p><code> | ||
122 | $ touch ~/.config/gnunet.conf | ||
123 | </p></code> | ||
124 | |||
125 | <p>Now we can start it with the command line tool `gnunet-arm` (Automatic Restart Manager).</p> | ||
126 | |||
127 | <p><code> | ||
128 | $ gnunet-arm -s | ||
129 | </p></code> | ||
130 | |||
131 | <p>It starts the default GNUnet services. We can list them with the `-I` option:</p> | ||
132 | |||
133 | <p><code> | ||
134 | $ gnunet-arm -I<br> | ||
135 | Running services:<br> | ||
136 | ats (gnunet-service-ats)<br> | ||
137 | revocation (gnunet-service-revocation)<br> | ||
138 | set (gnunet-service-set)<br> | ||
139 | nat (gnunet-service-nat)<br> | ||
140 | transport (gnunet-service-transport)<br> | ||
141 | peerstore (gnunet-service-peerstore)<br> | ||
142 | hostlist (gnunet-daemon-hostlist)<br> | ||
143 | identity (gnunet-service-identity)<br> | ||
144 | namecache (gnunet-service-namecache)<br> | ||
145 | peerinfo (gnunet-service-peerinfo)<br> | ||
146 | datastore (gnunet-service-datastore)<br> | ||
147 | zonemaster (gnunet-service-zonemaster)<br> | ||
148 | zonemaster-monitor (gnunet-service-zonemaster-monitor)<br> | ||
149 | nse (gnunet-service-nse)<br> | ||
150 | cadet (gnunet-service-cadet)<br> | ||
151 | dht (gnunet-service-dht)<br> | ||
152 | core (gnunet-service-core)<br> | ||
153 | gns (gnunet-service-gns)<br> | ||
154 | statistics (gnunet-service-statistics)<br> | ||
155 | topology (gnunet-daemon-topology)<br> | ||
156 | fs (gnunet-service-fs)<br> | ||
157 | namestore (gnunet-service-namestore)<br> | ||
158 | vpn (gnunet-service-vpn) | ||
159 | </p></code> | ||
160 | |||
161 | <p>For stopping GNUnet again we can use the `-e` option.</p> | ||
162 | |||
163 | <p><code> | ||
164 | $ gnunet-arm -e | ||
165 | </p></code> | ||
166 | |||
167 | <h3>{{ _("Make sure it works") }}</h3> | ||
168 | |||
169 | <p>Let's try out some of GNUnet's use cases. Some should be done before others: | ||
170 | |||
171 | <ul> | ||
172 | <li>filesharing</li> | ||
173 | <li>A simple chat using CADET</li> | ||
174 | <li>Name resolution using GNS on the command line</li> | ||
175 | <li>Name resolution using GNS with a browser (do it on the command line first)</li> | ||
176 | <li>Serving a website using VPN (do name resolution with a browser first)</li> | ||
177 | </ul> | ||
178 | |||
179 | </p> | ||
180 | |||
181 | |||
182 | <h4>{{ _("filesharing") }}</h4> | ||
183 | |||
184 | <p>Let's publish a file in the GNUnet filesharing network. We use the keywords | ||
185 | ("commons" and "state") so other people will be able to search for the file. | ||
186 | </p> | ||
187 | |||
188 | <p>We can choose any file and describe it with meaningful keywords (using the | ||
189 | `-k` command line option).</p> | ||
190 | |||
191 | <p><code> | ||
192 | $ gnunet-publish -k commons -k state ostrom.pdf<br> | ||
193 | Publishing `/home/myself/ostrom.pdf' done.<br> | ||
194 | URI is `gnunet://fs/chk/M57SXDJ72EWS25CT6307KKJ8K0GCNSPTAZ649NA1NS10MJB4A1GZ9EN4Y02KST9VA5BHE8B335RPXQVBWVZ587Y83WQ7J3DHMBX30Q8.DHNGBN4CB2DBX1QRZ1R0B1Q18WTEAK4R94S9D57C9JMJJ3H7SSQDCV4D1218C4S2VP085AMQQSMG18FCP6NQMZQZJ91XR5NBX7YF0V0.42197237'. | ||
195 | </p></code> | ||
196 | |||
197 | <p>Finding the file by keyword works with `gnunet-search`.</p> | ||
198 | |||
199 | <p><code> | ||
200 | $ gnunet-search commons<br> | ||
201 | #1:<br> | ||
202 | gnunet-download -o "ostrom.pdf" gnunet://fs/chk/M57SXDJ72EWS25CT6307KKJ8K0GCNSPTAZ649NA1NS10MJB4A1GZ9EN4Y02KST9VA5BHE8B335RPXQVBWVZ587Y83WQ7J3DHMBX30Q8.DHNGBN4CB2DBX1QRZ1R0B1Q18WTEAK4R94S9D57C9JMJJ3H7SSQDCV4D1218C4S2VP085AMQQSMG18FCP6NQMZQZJ91XR5NBX7YF0V0.42197237 | ||
203 | </p></code> | ||
204 | |||
205 | <p>It gives us the command line call to download the file (and store it as | ||
206 | ostrom.pdf)!</p> | ||
207 | |||
208 | |||
209 | <h4>{{ _("CADET (and Chat)") }}</h4> | ||
210 | |||
211 | <p>We can use the `gnunet-cadet` command line tool to open a port and from | ||
212 | another machine connect to this port and chat or transfer data. First we need | ||
213 | our *peer ID* of the GNUnet peer opening the port.</p> | ||
214 | |||
215 | <p><code> | ||
216 | $ gnunet-peerinfo -s<br> | ||
217 | I am peer `P4T5GHS1PCZ06R82D3KW8Z8J1113BQZWAWGYHTZ8G1ZXMWXQGAVG'. | ||
218 | </p></code> | ||
219 | |||
220 | <p>Now we open the port (it can be any string!):</p> | ||
221 | |||
222 | <p><code> | ||
223 | $ gnunet-cadet -o my-secret-port | ||
224 | </p></code> | ||
225 | |||
226 | <p>On the other machine we can connect using the peer ID and the port and start chatting!</p> | ||
227 | |||
228 | <p><code> | ||
229 | $ gnunet-cadet P4T5GHS1PCZ06R82D3KW8Z8J1113BQZWAWGYHTZ8G1ZXMWXQGAVG my-secret-port | ||
230 | </p></code> | ||
231 | |||
232 | |||
233 | <h4>{{ _("Name resolution using GNS on the command line") }}</h4> | ||
234 | |||
235 | <p>GNS is the GNU name service, a fully decentralized alternatice to DNS. We'll publish an IP address in a GNS record try to resolve it on the command line. First we need an identity which is the | ||
236 | equivalent to a zone in DNS. We'll call it "myself" and create it using the | ||
237 | `gnunet-identity` command line tool. Instead of "myself" you can surely use your | ||
238 | nick or any other name. </p> | ||
239 | |||
240 | <p><code> | ||
241 | $ gnunet-identity -C myself | ||
242 | </code></p> | ||
243 | |||
244 | <p>We can check if it worked using the same tool. We expect the name of our identity and the corresponding public key to be displayed.</p> | ||
245 | |||
246 | <p><code> | ||
247 | $ gnunet-identity -d<br> | ||
248 | myself - HWTYD3P5D77JVFNVMZ1M5T10V4SZYNMY3PCGQCSVENKD6ZCRKPMG | ||
249 | </code></p> | ||
250 | |||
251 | <p>Now we add a public `A` record to our zone. It has the name "ccc", a value | ||
252 | of "195.54.164.39" and it expires after one day.</p> | ||
253 | <p><code> | ||
254 | $ gnunet-namestore -z myself -a -e "1 d" -p -t A -n ccc -V 195.54.164.39 | ||
255 | </code></p> | ||
256 | |||
257 | <p>Now we can query that record using the command line tool `gnunet-gns`.</p> | ||
258 | |||
259 | <p><code> | ||
260 | $ gnunet-gns -u ccc.myself<br> | ||
261 | ccc.myself:<br> | ||
262 | Got `A' record: 195.54.164.39 | ||
263 | </code></p> | ||
264 | |||
265 | <p>So it worked! But only resolving our own records is boring. So we can give our | ||
266 | identity (the public key of it to be precise) to someone else so they can try to | ||
267 | resolve our records, too. The other person (Bob) has to add it to his namestore like | ||
268 | this:<p> | ||
269 | |||
270 | <p><code> | ||
271 | $ gnunet-namestore -z myself -a -e never -p -t PKEY -n alice -V HWTYD3P5D77JVFNVMZ1M5T10V4SZYNMY3PCGQCSVENKD6ZCRKPMG | ||
272 | </code></p> | ||
273 | |||
274 | <p>Our identity in Bobs namestore is a public record (-p) and never expires (-e never). Now Bob (let's assume he has called his identity myself, too) should be able to resolve our "ccc" record, too!</p> | ||
275 | |||
276 | <p><code> | ||
277 | $ gnunet-gns -u ccc.alice.myself<br> | ||
278 | ccc.alice.myself:<br> | ||
279 | Got `A' record: 195.54.164.39 | ||
280 | </code></p> | ||
281 | |||
282 | <p>It can continue like this. A friend of Bob would be able to resolve our records too because Bob published our identity in a public record. Bobs friend would simply use "ccc.alice.bob.myself" to resolve our "ccc" record. | ||
283 | |||
284 | |||
285 | <h4>{{ _("Name resolution using GNS with a browser") }}</h4> | ||
286 | |||
287 | <p>In the previous use case "Name resolution using GNS on the command line" we got an idea | ||
288 | about what GNS is about, but now let's use it with a browser, to make it actually useful. Currently Firefox and Chromium are known to work.</p> | ||
289 | |||
290 | <p>Many websites enforce HTTPS and thus provide certificates for their hostnames (and not our GNS names). Browsers don't like wrong hostnames in certificates and will present error messages. So GNUnet has to trick them by generating own certificates for our GNS names. This means we need to create our own certificate authority and tell our browser about it. Luckily there's a script for it:</p> | ||
291 | |||
292 | <p><code> | ||
293 | $ gnunet-gns-proxy-setup-ca | ||
294 | </code></p> | ||
295 | |||
296 | <p>After executing this script the Browser has to be restarted.</p> | ||
297 | |||
298 | <p>GNUnet provides a proxy service (gnunet-gns-proxy) that the browser can send DNS and HTTP traffic to. It will try to resolve names with GNS first and forward the rest of the DNS traffic to the system's DNS resolver. It will also take care of the HTTP traffic, so the browser gets valid certificates and the web server will not be confused by our GNS hostnames. Our GNS namestore doesn't know about any DNS hostnames yet, so we have to store them, too. For our "ccc" A record, we have to store a LEHO (legacy hostname) record, too. It must contain the website's original DNS hostname:</p> | ||
299 | |||
300 | <p><code> | ||
301 | $ gnunet-namestore -z myself -a -e "1 d" -p -t LEHO -n ccc -V www.ccc.de | ||
302 | </code></p> | ||
303 | |||
304 | <p>Now let's start gnunet-gns-proxy.</p> | ||
305 | |||
306 | <p><code> | ||
307 | $ /usr/lib/gnunet/libexec/gnunet-gns-proxy | ||
308 | </code></p> | ||
309 | |||
310 | <p>Our browser has to be configured so it uses our proxy. In Firefox we have to set these options under "about:config":</p> | ||
311 | |||
312 | <p><code> | ||
313 | network.proxy.socks: localhost<br> | ||
314 | network.proxy.socks_port: 7777<br> | ||
315 | network.proxy.socks_remote_dns true<br> | ||
316 | network.proxy.type: 1 | ||
317 | </code></p> | ||
318 | |||
319 | <p>To tell Chromium to use the proxy, it has to be started with the "--proxy-server" command line option:</p> | ||
320 | |||
321 | <p><code> | ||
322 | $ chromium --proxy-server="socks5://127.0.0.1:7777" | ||
323 | </code></p> | ||
324 | |||
325 | <p>Now we should be able to resolve our GNS names in the browser! We just have to type "https://ccc.myself" into the address bar. If our friend Bob prepared his system, too, he can resolve our record by typing "ccc.alice.myself".</p> | ||
326 | |||
327 | |||
328 | <h4>{{ _("VPN") }}</h4> | ||
329 | |||
330 | <p>TBD</p> | ||
331 | |||
332 | <h3>{{ _("Uninstall GNUnet and its dependencies") }}</h3> | ||
333 | |||
334 | <p><code> | ||
335 | $ cd ~/gnunet_installation/gnunet<br> | ||
336 | $ sudo make uninstall<br> | ||
337 | $ cd ~/gnunet_installation/libmicrohttpd<br> | ||
338 | $ sudo make uninstall<br> | ||
339 | $ sudo apt remove git libtool autoconf autopoint build-essential libgcrypt-dev libidn11-dev zlib1g-dev libunistring-dev libglpk-dev miniupnpc libextractor-dev libjansson-dev libcurl4-gnutls-dev libsqlite3-dev<br> | ||
340 | $ sudo apt autoremove<br> | ||
341 | $ sudo userdel -r gnunet<br> | ||
342 | $ sudo groupdel gnunet<br> | ||
343 | $ sudo groupdel gnunetdns<br> | ||
344 | $ sudo mv /etc/nsswitch.conf.original /etc/nsswitch.conf<br> | ||
345 | $ sudo rm /lib/$(uname -m)-linux-gnu/libnss_gns.so.2 | ||
346 | </p></code> | ||
347 | |||
348 | |||
349 | <h3>{{ _("Appendix A: Optional GNUnet features") }}</h3> | ||
350 | |||
351 | <p>TBD</p> | ||
352 | |||
353 | <h3>{{ _("Troubleshooting") }}</h3> | ||
354 | |||
355 | <h4>{{ _("You can't reach other people's nodes") }}</h4> | ||
356 | |||
357 | <p>Should our computer not have reached the open GNUnet network automatically, | ||
358 | we can manually instruct our node how to reach the nodes of our friends. This | ||
359 | works by exchanging HELLO strings. This is how we get a hello string for our | ||
360 | computer.</p> | ||
361 | |||
362 | <p><code> | ||
363 | $ gnunet-peerinfo -gn | ||
364 | </p></code> | ||
365 | |||
366 | <p>We can now pass this string to our friends "out of band" (using whatever | ||
367 | existing chat or messaging technology). If the string contains some private IP | ||
368 | networks we don't want to share, we can carefully edit them out.</p> | ||
369 | |||
370 | <p>Once we receive such strings from our friends, we can add them like | ||
371 | this:</p> | ||
372 | |||
373 | <p><code> | ||
374 | gnunet-peerinfo -p <string> | ||
375 | </p></code> | ||
376 | |||
377 | <p>Now our GNUnet nodes can attempt reaching each other directly. This may | ||
378 | still fail due to NAT traversal issues.</p> | ||
379 | |||
380 | <!--<h4>{{ _("OMG you guys broke my internet") }}</h4> | ||
381 | |||
382 | <p>We can replace `/etc/nsswitch.conf` with the backup we made earlier | ||
383 | (`/etc/nsswitch.conf.original`). Now DNS resolution should work again without a | ||
384 | running GNUnet.</p> | ||
385 | |||
386 | <p><code> | ||
387 | $ cp /etc/nsswitch.conf.original /etc/nsswitch.conf | ||
388 | </p></code>--> | ||
389 | |||
390 | </div> | ||
391 | {% endblock body_content %} | ||