1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
{% extends "common/base.j2" %}
{% block body_content %}
<div class="container">
<h2>{{ _("Tutorial: GNUnet on Debian 9") }}</h2>
<h3>{{ _("Introduction") }}</h3>
<p>Welcome to the hopefully painless GNUnet tutorial for Debian 9! It provides
very concrete instructions on how to compile, install and configure a current
version of GNUnet. The goal is to support newcomers, either end users or
developers, who want to get in touch with GNUnet for the first time. After
installing GNUnet we will make sure that out new GNUnet installation is working
correctly.</p>
<p><b>Attention: If you came across the official gnunet package for Debian 9,
ignore it! It is ancient and not compatible with current GNUnet
installations.</b></p>
<p>Now let's start!</p>
<h3>{{ _("Requirements") }}</h3>
<p>First let's install the following Debian 9 packages to use GNUnet
painlessly. Optional dependencies are listed in Appendix A. They are required
for some experimental GNUnet features.</p>
<p><code>
$ 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
</code></p>
<h3>{{ _("Make an installatino directory") }}</h3>
<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>
<p><code>
$ mkdir ~/gnunet_installation
</code></p>
<h3>{{ _("Get the source code") }}</h3>
<p>We download the GNUnet source code using git. On Debian 9 we need the
sources of another library (libmicrohttpd). There exists a Debian 9 package for
libmicrohttpd too, but it is too old.</p>
<p><code>
$ cd ~/gnunet_installation<br>
$ git clone --depth 1 https://gnunet.org/git/gnunet.git<br>
$ git clone --depth 1 https://gnunet.org/git/libmicrohttpd.git
</code></p>
<h3>{{ _("Compile and Install") }}</h3>
<p>Installing GNUnet is not hard, it only requires one little nasty step which
involves modifying an important config file of the operating system. So we'll
pay extra attention while doing this.</p>
<p>Before we can compile GNUnet, we compile and install libmicrohttpd.</p>
<p><code>
$ cd ~/gnunet_installation/libmicrohttpd<br>
$ autoreconf -fi<br>
$ sudo apt install libgnutls28-dev<br>
$ ./configure --disable-doc --prefix=/opt/libmicrohttpd<br>
$ make -j$(nproc || echo -n 1)<br>
$ sudo make install<br>
</code></p>
<p>Now it's finally time to compile and install GNUnet. We have two options:
installing a *production version* and installing a *development version*. If
you want to start writing GNUnet applications or join the GNUnet development
choose the development version (it will print more debug output and contains
debug symbols that can be displayed with a debugger). Otherwise choose the
production version.</p>
<h4>{{ _("Option 1: GNUnet for production / usage") }}</h4>
<p><code>
$ cd ~/gnunet_installation/gnunet<br>
$ ./bootstrap<br>
$ export GNUNET_PREFIX=/usr<br>
$ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --with-microhttpd=/opt/libmicrohttpd<br>
$ sudo addgroup gnunetdns<br>
$ sudo adduser --system --group --disabled-login --home /var/lib/gnunet gnunet<br>
$ make -j$(nproc || echo -n 1)<br>
$ sudo make install<br>
</code></p>
<h4>{{ _("Option 2: GNUnet for development") }}</h4>
<p><code>
$ cd ~/gnunet_installation/gnunet<br>
$ ./bootstrap<br>
$ export GNUNET_PREFIX=/usr<br>
$ export CFLAGS="-g -Wall -O0"<br>
$ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --enable-logging=verbose --with-microhttpd=/opt/libmicrohttpd<br>
$ make -j$(nproc || echo -n 1)<br>
$ sudo make install<br>
</p></code>
<h4>{{ _("Install GNUnet plugin for name resolution") }}</h4>
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 Debian 9 we have to do
<p><code>
$ sudo cp /usr/lib/gnunet/nss/libnss_gns.so.2 /lib/$(uname -m)-linux-gnu/
</p></code>
<p>The next step is activating the GNUnet plugin we just copied in the NSS
config. It is located in `/etc/nsswitch.conf`. It should contain a line
starting with "hosts" similar to this (at least "files" and "dns" should be
there):</p>
<p><code>
$ cat /etc/nsswitch.conf<br>
hosts: files mdns4_minimal [NOTFOUND=return] dns
</p></code>
<p><b>Attention: Once we modified `etc/nsswitch.conf` DNS resolution will only
be possible as long as is GNUnet is running. We can leave the next step out,
but then we will not be able to use GNUnet's name resolution in external
applications.</b></p>
<p>We save a copy of the original file and then modify the line using sed:</p>
<p><code>
$ sudo cp /etc/nsswitch.conf /etc/nsswitch.conf.original<br>
$ sudo sed -i -E 's/^(hosts:.*) dns/\1 gns [NOTFOUND=return] dns/' /etc/nsswitch.conf
</p></code>
<p>Now in the line starting with "hosts" should contain an entry "gns [NOTFOUND=return]" before the "dns" entry like this:</p>
<p><code>
hosts: files mdns4_minimal [NOTFOUND=return] gns [NOTFOUND=return] dns
</p></code>
<p>That's it. It wasn't that nasty, was it?</p>
<h3>{{ _("Configuration") }}</h3>
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:
<p><code>
$ touch ~/.config/gnunet.conf
</p></code>
<p>Now we can start it with the command line tool `gnunet-arm` (Automatic Restart Manager).</p>
<p><code>
$ gnunet-arm -s
</p></code>
<p>It starts the default GNUnet services. We can list them with the `-I` option:</p>
<p><code>
$ gnunet-arm -I<br>
Running services:<br>
ats (gnunet-service-ats)<br>
revocation (gnunet-service-revocation)<br>
set (gnunet-service-set)<br>
nat (gnunet-service-nat)<br>
transport (gnunet-service-transport)<br>
peerstore (gnunet-service-peerstore)<br>
hostlist (gnunet-daemon-hostlist)<br>
identity (gnunet-service-identity)<br>
namecache (gnunet-service-namecache)<br>
peerinfo (gnunet-service-peerinfo)<br>
datastore (gnunet-service-datastore)<br>
zonemaster (gnunet-service-zonemaster)<br>
zonemaster-monitor (gnunet-service-zonemaster-monitor)<br>
nse (gnunet-service-nse)<br>
cadet (gnunet-service-cadet)<br>
dht (gnunet-service-dht)<br>
core (gnunet-service-core)<br>
gns (gnunet-service-gns)<br>
statistics (gnunet-service-statistics)<br>
topology (gnunet-daemon-topology)<br>
fs (gnunet-service-fs)<br>
namestore (gnunet-service-namestore)<br>
vpn (gnunet-service-vpn)
</p></code>
<p>For stopping GNUnet again we can use the `-e` option.</p>
<p><code>
$ gnunet-arm -e
</p></code>
<h3>{{ _("Make sure it works") }}</h3>
<p>Let's try some of GNUnet's components: gns, filesharing, CADET and VPN.</p>
<h4>{{ _("GNS") }}</h4>
<p>First let's try out GNS, the GNU name service. We'll publish an IP address
in a GNS record and try to resolve it using our browser. First we need an
identity which is the equivalent to a zone in DNS. We'll call it "myself" and
create it using the `gnunet-identity` command line tool.
Instead of "myself" you can surely use your nick or any other name. </p>
<p><code>
$ gnunet-identity -C myself
</p></code>
<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>
<p><code>
$ gnunet-identity -d<br>
myself - HWTYD3P5D77JVFNVMZ1M5T10V4SZYNMY3PCGQCSVENKD6ZCRKPMG
</p></code>
<p>Now we add a public `A` record to our zone. It has the name "ccc", a value
of "195.54.164.39" and it never expires.</p>
<p><code>
$ gnunet-namestore -z myself -a -e never -p -t A -n ccc -V 195.54.164.39
</p></code>
<p>Now we can query that record using the command line tool `gnunet-gns`.</p>
<p><code>
$ gnunet-gns -u ccc.myself<br>
ccc.myself:<br>
Got `A' record: 195.54.164.39
</p></code>
<p>So it worked! Now you can try to type "ccc.myself" into your browser and see
what website is behind the IP address. (If it doesnt work use the IP directly
;p)</p>
<h4>{{ _("filesharing") }}</h4>
<p>Let's publish a file in the GNUnet filesharing network. We use tow keywords
("commons" and "state") so other people will be able to search for the file.
</p>
<p>We can choose any file and describe it with meaningful keywords (using the
`-k` command line option).</p>
<p><code>
$ gnunet-publish -k commons -k state ostrom.pdf<br>
Publishing `/home/myself/ostrom.pdf' done.<br>
URI is `gnunet://fs/chk/M57SXDJ72EWS25CT6307KKJ8K0GCNSPTAZ649NA1NS10MJB4A1GZ9EN4Y02KST9VA5BHE8B335RPXQVBWVZ587Y83WQ7J3DHMBX30Q8.DHNGBN4CB2DBX1QRZ1R0B1Q18WTEAK4R94S9D57C9JMJJ3H7SSQDCV4D1218C4S2VP085AMQQSMG18FCP6NQMZQZJ91XR5NBX7YF0V0.42197237'.
</p></code>
<p>Finding the file by keyword works with `gnunet-search`.</p>
<p><code>
$ gnunet-search commons<br>
#1:<br>
gnunet-download -o "ostrom.pdf" gnunet://fs/chk/M57SXDJ72EWS25CT6307KKJ8K0GCNSPTAZ649NA1NS10MJB4A1GZ9EN4Y02KST9VA5BHE8B335RPXQVBWVZ587Y83WQ7J3DHMBX30Q8.DHNGBN4CB2DBX1QRZ1R0B1Q18WTEAK4R94S9D57C9JMJJ3H7SSQDCV4D1218C4S2VP085AMQQSMG18FCP6NQMZQZJ91XR5NBX7YF0V0.42197237
</p></code>
<p>It gives us the command line call to download the file (and store it as
ostrom.pdf)!</p>
<h4>{{ _("CADET (and Chat)") }}</h4>
<p>We can use the `gnunet-cadet` command line tool to open a port and from
another machine connect to this port and chat or transfer data. First we need
our *peer ID* of the GNUnet peer opening the port.</p>
<p><code>
$ gnunet-peerinfo -s<br>
I am peer `P4T5GHS1PCZ06R82D3KW8Z8J1113BQZWAWGYHTZ8G1ZXMWXQGAVG'.
</p></code>
<p>Now we open the port (it can be any string!):</p>
<p><code>
$ gnunet-cadet -o my-secret-port
</p></code>
<p>On the other machine we can connect using the peer ID and the port and start chatting!</p>
<p><code>
$ gnunet-cadet P4T5GHS1PCZ06R82D3KW8Z8J1113BQZWAWGYHTZ8G1ZXMWXQGAVG my-secret-port
</p></code>
<h4>{{ _("VPN") }}</h4>
<p>TBD</p>
<h3>{{ _("Uninstall GNUnet and its dependencies") }}</h3>
<p><code>
$ cd ~/gnunet_installation/gnunet<br>
$ sudo make uninstall<br>
$ cd ~/gnunet_installation/libmicrohttpd<br>
$ sudo make uninstall<br>
$ 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>
$ sudo apt autoremove<br>
$ sudo userdel -r gnunet<br>
$ sudo groupdel gnunet<br>
$ sudo groupdel gnunetdns<br>
$ sudo mv /etc/nsswitch.conf.original /etc/nsswitch.conf<br>
$ sudo rm /lib/$(uname -m)-linux-gnu/libnss_gns.so.2<br>
</p></code>
<h3>{{ _("Appendix A: Optional GNUnet features") }}</h3>
<p>TBD</p>
<h3>{{ _("Troubleshooting") }}</h3>
<h4>{{ _("You can't reach other people's nodes") }}</h4>
<p>Should our computer not have reached the open GNUnet network automatically,
we can manually instruct our node how to reach the nodes of our friends. This
works by exchanging HELLO strings. This is how we get a hello string for our
computer.</p>
<p><code>
$ gnunet-peerinfo -gn
</p></code>
<p>We can now pass this string to our friends "out of band" (using whatever
existing chat or messaging technology). If the string contains some private IP
networks we don't want to share, we can carefully edit them out.</p>
<p>Once we receive such strings from our friends, we can add them like
this:</p>
<p><code>
gnunet-peerinfo -p <string>
</p></code>
<p>Now our GNUnet nodes can attempt reaching each other directly. This may
still fail due to NAT traversal issues.</p>
<h4>{{ _("OMG you guys broke my internet") }}</h4>
<p>We can replace `/etc/nsswitch.conf` with the backup we made earlier
(`/etc/nsswitch.conf.original`). Now DNS resolution should work again without a
running GNUnet.</p>
<p><code>
$ cp /etc/nsswitch.conf.original /etc/nsswitch.conf
</p></code>
</div>
{% endblock body_content %}
|