diff options
Diffstat (limited to 'doc/old/handbook/chapters/installation.texi')
-rw-r--r-- | doc/old/handbook/chapters/installation.texi | 2497 |
1 files changed, 2497 insertions, 0 deletions
diff --git a/doc/old/handbook/chapters/installation.texi b/doc/old/handbook/chapters/installation.texi new file mode 100644 index 000000000..f93645114 --- /dev/null +++ b/doc/old/handbook/chapters/installation.texi | |||
@@ -0,0 +1,2497 @@ | |||
1 | @node Installing GNUnet | ||
2 | @chapter Installing GNUnet | ||
3 | |||
4 | This guide is intended for those who want to install Gnunet from | ||
5 | source. For instructions on how to install GNUnet as a binary package | ||
6 | please refer to the official documentation of your operating system or | ||
7 | package manager. | ||
8 | |||
9 | For understanding this guide properly it is important to know that | ||
10 | there are two different ways of running GNUnet: | ||
11 | |||
12 | @itemize @bullet | ||
13 | @item the @emph{single-user setup} | ||
14 | @item the @emph{multi-user setup} | ||
15 | @end itemize | ||
16 | |||
17 | The latter variant has a better security model and requires extra | ||
18 | preparation before running @code{make install} and a different | ||
19 | configuration. Beginners who want to quickly try out GNUnet can | ||
20 | use the @emph{single-user setup}. | ||
21 | |||
22 | @menu | ||
23 | * Installing dependencies:: | ||
24 | * Getting the Source Code:: | ||
25 | * Create user and groups for the system services:: | ||
26 | * Preparing and Compiling the Source Code:: | ||
27 | * Installation:: | ||
28 | * Minimal configuration:: | ||
29 | * Checking the Installation:: | ||
30 | * The graphical configuration interface:: | ||
31 | * Config Leftovers:: | ||
32 | @end menu | ||
33 | |||
34 | @c ----------------------------------------------------------------------- | ||
35 | @node Installing dependencies | ||
36 | @section Installing dependencies | ||
37 | |||
38 | GNUnet needs few libraries and applications for being able to run and | ||
39 | another few optional ones for using certain features. Preferably they | ||
40 | should be installed with a package manager. | ||
41 | |||
42 | The mandatory libraries and applications are | ||
43 | @itemize @bullet | ||
44 | @item autoconf 2.59 or above (when building from git) | ||
45 | @item automake 1.11.1 or above (when building from git) | ||
46 | @item recutils 1.0 or above (when building from git) | ||
47 | @item gettext | ||
48 | @item glibc (read below, other libcs work) | ||
49 | @item GnuTLS 3.2.12 or above, recommended to be linked against libunbound | ||
50 | @item GNU make 4.0 or higher (other make implementations do work) | ||
51 | @item iptables (on Linux systems) | ||
52 | @item libtool 2.2 or above | ||
53 | @item libltdl (part of libtool) | ||
54 | @item libgcrypt 1.6 or above | ||
55 | @item libidn2 or libidn | ||
56 | @item libmicrohttpd 0.9.63 or above | ||
57 | @item libunistring | ||
58 | @item libjansson | ||
59 | @item libgmp | ||
60 | @item libgnurl or libcurl (libcurl has to be linked to GnuTLS) 7.35.0 or above | ||
61 | @item Texinfo 5.2 or above (for building the documentation) | ||
62 | @item Texlive 2012 or above (for building the documentation, and for gnunet-bcd) | ||
63 | @item makeinfo 4.8 or above | ||
64 | @item pkgconf (or pkg-config) | ||
65 | @item zlib | ||
66 | @end itemize | ||
67 | |||
68 | Glibc is required for certain NSS features: | ||
69 | |||
70 | @example | ||
71 | One mechanism of integrating GNS with legacy applications via NSS is | ||
72 | not available if this is disabled. But applications that don't use the | ||
73 | glibc for NS resolution won't work anyway with this, so little is lost | ||
74 | on *BSD systems. | ||
75 | GNS via direct use or via the HTTP or DNS proxies is unaffected. | ||
76 | @end example | ||
77 | |||
78 | Other libcs should work, the resulting builds just don't include the | ||
79 | glibc NSS specific code. One example is the build against NetBSD's libc | ||
80 | as detailed in @uref{https://bugs.gnunet.org/view.php?id=5605}. | ||
81 | |||
82 | In addition GNUnet needs at least one of these three databases | ||
83 | (at the minimum sqlite3) | ||
84 | @itemize @bullet | ||
85 | @item sqlite + libsqlite 3.8 or above (the default, requires no further configuration) | ||
86 | @item postgres + libpq | ||
87 | @item mysql + libmysqlclient | ||
88 | @end itemize | ||
89 | |||
90 | These are the dependencies only required for certain features | ||
91 | @itemize @bullet | ||
92 | @item miniupnpc (for traversing NAT boxes more reliably) | ||
93 | @item libnss | ||
94 | @item libopus (for running the GNUnet conversation telephony application) | ||
95 | @item libogg (for running the GNUnet conversation telephony application) | ||
96 | @item gstreamer OR libpulse (for running the GNUnet conversation telephony application) | ||
97 | @item bluez (for bluetooth support) | ||
98 | @item libextractor (optional but highly recommended, read below) | ||
99 | @item libpbc | ||
100 | (for attribute-based encryption and the identity provider subsystem) | ||
101 | @item libgabe | ||
102 | (for attribute-based encryption and the identity provider subsystem) | ||
103 | @item texi2mdoc (for automatic mdoc generation) | ||
104 | @item perl5 for some utilities (which are not installed) | ||
105 | @end itemize | ||
106 | |||
107 | About libextractor being optional: | ||
108 | @example | ||
109 | While libextractor ("LE") is optional, it is recommended to build gnunet | ||
110 | against it. If you install it later, you won't benefit from libextractor. | ||
111 | If you are a distributor, we recommend to split LE into basis + plugins | ||
112 | rather than making LE an option as an afterthought by the user. LE | ||
113 | itself is very small, but its dependency chain on first, second, third | ||
114 | etc level can be big. There is a small effect on privacy if your LE | ||
115 | build differs from one which includes all plugins (plugins are build as | ||
116 | shared objects): if users publish a directory with a mixture of file | ||
117 | types (for example mpeg, jpeg, png, gif) the configuration of LE could | ||
118 | leak which plugins are installed for which filetypes are not providing | ||
119 | more details. However, this leak is just a minor concern. | ||
120 | @end example | ||
121 | |||
122 | These are the test-suite requirements: | ||
123 | @itemize @bullet | ||
124 | @item python3.6 or higher | ||
125 | @item gnunet (installation first) | ||
126 | @item some core-utils: which(1), bc(1), curl(1), sed(1), awk(1), etc. | ||
127 | @item a shell (very few Bash scripts, the majority are POSIX sh scripts) | ||
128 | @end itemize | ||
129 | |||
130 | These are runtime requirements: | ||
131 | @itemize @bullet | ||
132 | @item nss (the certutil binary, for gnunet-gns-proxy-setup-ca) | ||
133 | @item openssl (openssl binary, for gnunet-gns-proxy-setup-ca) | ||
134 | @end itemize | ||
135 | |||
136 | @c ----------------------------------------------------------------------- | ||
137 | @node Getting the Source Code | ||
138 | @section Getting the Source Code | ||
139 | You can either download the source code using git (you obviously need | ||
140 | git installed) or as an archive. | ||
141 | |||
142 | Using git type | ||
143 | @example | ||
144 | git clone https://git.gnunet.org/gnunet.git | ||
145 | @end example | ||
146 | |||
147 | The archive can be found at | ||
148 | @uref{https://ftpmirror.gnu.org/gnu/gnunet/}. Extract it using a graphical | ||
149 | archive tool or @code{tar}: | ||
150 | @example | ||
151 | tar xzvf gnunet-@value{VERSION}.tar.gz | ||
152 | @end example | ||
153 | |||
154 | In the next chapter we will assume that the source code is available | ||
155 | in the home directory at @code{~/gnunet}. | ||
156 | |||
157 | @c ----------------------------------------------------------------------- | ||
158 | @node Create user and groups for the system services | ||
159 | @section Create user and groups for the system services | ||
160 | |||
161 | @cartouche | ||
162 | For the single-user setup this section can be skipped. | ||
163 | @end cartouche | ||
164 | |||
165 | The multi-user setup means that there are @emph{system services}, which are | ||
166 | run once per machine as a dedicated system user (called @code{gnunet}) and | ||
167 | @emph{user services} which can be started by every user who wants to use | ||
168 | GNUnet applications. The user services communicate with the system services | ||
169 | over unix domain sockets. To gain permissions to read and write those sockets | ||
170 | the users running GNUnet applications will need to be in the @code{gnunet} | ||
171 | group. In addition the group @code{gnunetdns} may be needed (see below). | ||
172 | |||
173 | Create user @code{gnunet} who is member of the group @code{gnunet} | ||
174 | (automatically created) and specify a home directory where the GNUnet | ||
175 | services will store persistent data such as information about peers. | ||
176 | @example | ||
177 | $ sudo useradd --system --home-dir /var/lib/gnunet --create-home gnunet | ||
178 | @end example | ||
179 | |||
180 | Now add your own user to the @code{gnunet} group. | ||
181 | |||
182 | @example | ||
183 | $ sudo usermod -aG gnunet alice | ||
184 | @end example | ||
185 | |||
186 | Create a group @code{gnunetdns}. This allows using @code{setgid} in a way | ||
187 | that only the DNS service can run the @code{gnunet-helper-dns} binary. This | ||
188 | is only needed if @emph{system-wide DNS interception} will be used. For more | ||
189 | information see @xref{Configuring system-wide DNS interception}. | ||
190 | |||
191 | @example | ||
192 | $ sudo groupadd gnunetdns | ||
193 | @end example | ||
194 | |||
195 | @c ----------------------------------------------------------------------- | ||
196 | @node Preparing and Compiling the Source Code | ||
197 | @section Preparing and Compiling the Source Code | ||
198 | For preparing the source code for compilation a bootstrap script and | ||
199 | @code{configure} has to be run from the source code directory. When | ||
200 | running @code{configure} the following options can be specified to | ||
201 | customize the compilation and installation process: | ||
202 | |||
203 | @itemize @bullet | ||
204 | @item @code{--disable-documentation} - don't build the documentation | ||
205 | @item @code{--enable-logging=[LOGLEVEL]} - choose a loglevel (@code{debug}, @code{info}, @code{warning} or @code{error}) | ||
206 | @item @code{--prefix=[PATH]} - the directory where the GNUnet libraries and binaries will be installed | ||
207 | @item @code{--with-extractor=[PATH]} - the path to libextractor | ||
208 | @item @code{--with-libidn=[PATH]} - the path to libidn | ||
209 | @item @code{--with-libidn2=[PATH]} - the path to libidn2 (takes priority over libidn if both are found) | ||
210 | @item @code{--with-microhttpd=[PATH]} - the path to libmicrohttpd | ||
211 | @item @code{--with-sqlite=[PATH]} - the path to libsqlite | ||
212 | @item @code{--with-zlib=[PATH]} - the path to zlib | ||
213 | @end itemize | ||
214 | |||
215 | Note that the list above is not always up to date and you | ||
216 | should check the output of @code{./configure --help}, read | ||
217 | the @file{configure.ac} or send an email asking for assistance | ||
218 | if you are in doubt of any configure options or require fixes | ||
219 | for your operating system. | ||
220 | |||
221 | The following example configures the installation prefix | ||
222 | @code{/usr/local} and disables building the documentation | ||
223 | @example | ||
224 | $ cd ~/gnunet | ||
225 | $ ./bootstrap | ||
226 | $ configure --prefix=/usr/local --disable-documentation | ||
227 | @end example | ||
228 | |||
229 | After running the bootstrap script and @code{configure} successfully | ||
230 | the source code can be compiled with make. Here @code{-j5} specifies | ||
231 | that 5 threads should be used. | ||
232 | @example | ||
233 | $ make -j5 | ||
234 | @end example | ||
235 | |||
236 | @c ----------------------------------------------------------------------- | ||
237 | @node Installation | ||
238 | @section Installation | ||
239 | The compiled binaries can be installed using @code{make install}. It | ||
240 | needs to be run as root (or with sudo) because some binaries need the | ||
241 | @code{suid} bit set. Without that some features (e.g. the VPN service, | ||
242 | system-wide DNS interception, NAT traversal using ICMP) will not work. | ||
243 | |||
244 | @example | ||
245 | $ sudo make install | ||
246 | @end example | ||
247 | |||
248 | @menu | ||
249 | * NSS plugin (Optional):: | ||
250 | * Installing the GNS Certificate Authority (Optional):: | ||
251 | @end menu | ||
252 | |||
253 | @node NSS plugin (Optional) | ||
254 | @subsection NSS plugin (Optional) | ||
255 | |||
256 | @cartouche | ||
257 | The installation of the NSS plugin is only necessary if GNS | ||
258 | resolution shall be used with legacy applications (that only | ||
259 | support DNS). | ||
260 | @end cartouche | ||
261 | |||
262 | One important library is the GNS plugin for NSS (the name services | ||
263 | switch) which allows using GNS (the GNU name system) in the normal DNS | ||
264 | resolution process. Unfortunately NSS expects it in a specific | ||
265 | location (probably @code{/lib}) which may differ from the installation | ||
266 | prefix (see @code{--prefix} option in the previous section). This is | ||
267 | why the plugin has to be installed manually. | ||
268 | |||
269 | Find the directory where nss plugins are installed on your system, e.g. | ||
270 | |||
271 | @example | ||
272 | $ ls -l /lib/libnss_* | ||
273 | /lib/libnss_mymachines.so.2 | ||
274 | /lib/libnss_resolve.so.2 | ||
275 | /lib/libnss_myhostname.so.2 | ||
276 | /lib/libnss_systemd.so.2 | ||
277 | @end example | ||
278 | |||
279 | Copy the GNS NSS plugin to that directory: | ||
280 | |||
281 | @example | ||
282 | cp ~/gnunet/src/gns/nss/.libs/libnss_gns.so.2 /lib | ||
283 | @end example | ||
284 | |||
285 | Now, to activate the plugin, you need to edit your | ||
286 | @code{/etc/nsswitch.conf} where you should find a line like this: | ||
287 | |||
288 | @example | ||
289 | hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 | ||
290 | @end example | ||
291 | |||
292 | The exact details may differ a bit, which is fine. Add the text | ||
293 | @code{"gns [NOTFOUND=return]"} after @code{"files"}. | ||
294 | |||
295 | @example | ||
296 | hosts: files gns [NOTFOUND=return] mdns4_minimal [NOTFOUND=return] dns mdns4 | ||
297 | @end example | ||
298 | |||
299 | @node Installing the GNS Certificate Authority (Optional) | ||
300 | @subsection Installing the GNS Certificate Authority (Optional) | ||
301 | |||
302 | @cartouche | ||
303 | Installing the GNS certificate authority is only necessary if GNS shall | ||
304 | be used in a browser. | ||
305 | @end cartouche | ||
306 | |||
307 | The GNS Certificate authority can provide TLS certificates for GNS names while | ||
308 | downloading webpages from legacy webservers. This allows browsers to use HTTPS | ||
309 | in combinations with GNS name resolution. | ||
310 | |||
311 | To install it execute the GNS CA-setup script. So far Firefox and Chromium are | ||
312 | supported. | ||
313 | |||
314 | @example | ||
315 | $ gnunet-gns-proxy-setup-ca | ||
316 | @end example | ||
317 | |||
318 | A local proxy server, that takes care of the name resolution and provides | ||
319 | certificates on-the-fly needs to be started: | ||
320 | |||
321 | @example | ||
322 | $ /usr/lib/gnunet/libexec/gnunet-gns-proxy | ||
323 | @end example | ||
324 | |||
325 | Now GNS should work in browsers that are configured to use a SOCKS proxy on | ||
326 | @code{localhost:7777}. | ||
327 | |||
328 | |||
329 | @node Minimal configuration | ||
330 | @section Minimal configuration | ||
331 | GNUnet needs a configuration file to start (@pxref{Config file format}). | ||
332 | For the @emph{single-user setup} an empty file is sufficient: | ||
333 | |||
334 | @example | ||
335 | $ touch ~/.config/gnunet.conf | ||
336 | @end example | ||
337 | |||
338 | For the @emph{multi-user setup} we need an extra config file for the system | ||
339 | services. The default location is @code{/etc/gnunet.conf}. The minimal | ||
340 | content of that file which activates the system services roll is: | ||
341 | |||
342 | @example | ||
343 | [arm] | ||
344 | START_SYSTEM_SERVICES = YES | ||
345 | START_USER_SERVICES = NO | ||
346 | @end example | ||
347 | |||
348 | The config file for the user services (@code{~/.config/gnunet.conf}) needs | ||
349 | the opposite configuration to activate the user services roll: | ||
350 | |||
351 | @example | ||
352 | [arm] | ||
353 | START_SYSTEM_SERVICES = NO | ||
354 | START_USER_SERVICES = YES | ||
355 | @end example | ||
356 | |||
357 | |||
358 | @node Checking the Installation | ||
359 | @section Checking the Installation | ||
360 | |||
361 | |||
362 | This section describes a quick, casual way to check if your GNUnet | ||
363 | installation works. However, if it does not, we do not cover | ||
364 | steps for recovery --- for this, please study the instructions | ||
365 | provided in the developer handbook as well as the system-specific | ||
366 | instruction in the source code repository. | ||
367 | Please note that the system specific instructions are not provided | ||
368 | as part of this handbook! | ||
369 | |||
370 | |||
371 | @menu | ||
372 | * Starting GNUnet:: | ||
373 | * gnunet-gtk:: | ||
374 | * Statistics:: | ||
375 | * Peer Information:: | ||
376 | @end menu | ||
377 | |||
378 | @cindex Starting GNUnet | ||
379 | @cindex GNUnet GTK | ||
380 | @cindex GTK | ||
381 | @cindex GTK user interface | ||
382 | |||
383 | @node Starting GNUnet | ||
384 | @subsection Starting GNUnet | ||
385 | The GNUnet services are started and stopped by the ARM service (Automatic | ||
386 | Restart Manager). For the @emph{single-user setup} a simple | ||
387 | |||
388 | @example | ||
389 | $ gnunet-arm -s | ||
390 | @end example | ||
391 | |||
392 | starts a default set of services. Later GNUnet applications can request more | ||
393 | services to start without additional user interaction. GNUnet can be stopped | ||
394 | again using the @code{-e} option: | ||
395 | |||
396 | @example | ||
397 | $ gnunet-arm -e | ||
398 | @end example | ||
399 | |||
400 | The list of running services can be displayed using the @code{-I} option. | ||
401 | It should look similar to this example: | ||
402 | |||
403 | @example | ||
404 | $ gnunet-arm -I | ||
405 | Running services: | ||
406 | topology (gnunet-daemon-topology) | ||
407 | nat (gnunet-service-nat) | ||
408 | vpn (gnunet-service-vpn) | ||
409 | gns (gnunet-service-gns) | ||
410 | cadet (gnunet-service-cadet) | ||
411 | namecache (gnunet-service-namecache) | ||
412 | hostlist (gnunet-daemon-hostlist) | ||
413 | revocation (gnunet-service-revocation) | ||
414 | ats (gnunet-service-ats) | ||
415 | peerinfo (gnunet-service-peerinfo) | ||
416 | zonemaster (gnunet-service-zonemaster) | ||
417 | zonemaster-monitor (gnunet-service-zonemaster-monitor) | ||
418 | dht (gnunet-service-dht) | ||
419 | namestore (gnunet-service-namestore) | ||
420 | set (gnunet-service-set) | ||
421 | statistics (gnunet-service-statistics) | ||
422 | nse (gnunet-service-nse) | ||
423 | fs (gnunet-service-fs) | ||
424 | peerstore (gnunet-service-peerstore) | ||
425 | core (gnunet-service-core) | ||
426 | rest (gnunet-rest-server) | ||
427 | transport (gnunet-service-transport) | ||
428 | datastore (gnunet-service-datastore) | ||
429 | @end example | ||
430 | |||
431 | For the @emph{multi-user setup} first the system services need to be started | ||
432 | as the system user, i.e. the user @code{gnunet} needs to execute | ||
433 | @code{gnunet-arm -s}. This should be done by the system's init system. | ||
434 | Then the user who wants to start GNUnet applications has to run | ||
435 | @code{gnunet-arm -s} too. It is recommended to automate this, e.g. using | ||
436 | the user's crontab. | ||
437 | |||
438 | @node gnunet-gtk | ||
439 | @subsection gnunet-gtk | ||
440 | |||
441 | |||
442 | The @command{gnunet-gtk} package contains several graphical | ||
443 | user interfaces for the respective GNUnet applications. | ||
444 | Currently these interfaces cover: | ||
445 | |||
446 | @itemize @bullet | ||
447 | @item Statistics | ||
448 | @item Peer Information | ||
449 | @item GNU Name System | ||
450 | @item File Sharing | ||
451 | @item Conversation | ||
452 | @item Setup | ||
453 | @end itemize | ||
454 | |||
455 | Previously, many of these interfaces were combined into one application | ||
456 | called @command{gnunet-gtk}, with different tabs for each interface. This | ||
457 | combined application has been removed in version 0.11.0, but each of the | ||
458 | interfaces is still available as a standalone application | ||
459 | (@command{gnunet-statistics-gtk} for statistics, @command{gnunet-fs-gtk} | ||
460 | for filesharing, etc). | ||
461 | |||
462 | @node Statistics | ||
463 | @subsection Statistics | ||
464 | |||
465 | |||
466 | We assume that you have started gnunet via @code{gnunet-arm} or via your | ||
467 | system-provided method for starting services. | ||
468 | First, you should launch GNUnet's graphical statistics interface. | ||
469 | You can do this from the command-line by typing | ||
470 | |||
471 | @example | ||
472 | gnunet-statistics-gtk | ||
473 | @end example | ||
474 | |||
475 | If your peer is running correctly, you should see a bunch | ||
476 | of lines, all of which should be ``significantly'' above zero (at | ||
477 | least if your peer has been running for more than a few seconds). The | ||
478 | lines indicate how many other peers your peer is connected to (via | ||
479 | different mechanisms) and how large the entire overlay network is | ||
480 | currently estimated to be. The X-axis represents time (in seconds | ||
481 | since the start of @command{gnunet-statistics-gtk}). | ||
482 | |||
483 | You can click on "Traffic" to see information about the amount of | ||
484 | bandwidth your peer has consumed, and on "Storage" to check the amount | ||
485 | of storage available and used by your peer. Note that "Traffic" is | ||
486 | plotted cumulatively, so you should see a strict upwards trend in the | ||
487 | traffic. | ||
488 | |||
489 | The term ``peer'' is a common word used in | ||
490 | federated and distributed networks to describe a participating device | ||
491 | which is connected to the network. Thus, your Personal Computer or | ||
492 | whatever it is you are looking at the Gtk+ interface describes a | ||
493 | ``Peer'' or a ``Node''. | ||
494 | |||
495 | @node Peer Information | ||
496 | @subsection Peer Information | ||
497 | |||
498 | |||
499 | First, you should launch the peer information graphical user interface. | ||
500 | You can do this from the command-line by typing | ||
501 | |||
502 | @example | ||
503 | $ gnunet-peerinfo-gtk | ||
504 | @end example | ||
505 | |||
506 | Once you have done this, you will see a list of known peers (by the | ||
507 | first four characters of their public key), their friend status (all | ||
508 | should be marked as not-friends initially), their connectivity (green | ||
509 | is connected, red is disconnected), assigned bandwidth, country of | ||
510 | origin (if determined) and address information. If hardly any peers | ||
511 | are listed and/or if there are very few peers with a green light for | ||
512 | connectivity, there is likely a problem with your network | ||
513 | configuration. | ||
514 | |||
515 | @c NOTE: Inserted from Installation Handbook in original ``order'': | ||
516 | @c FIXME: Move this to User Handbook. | ||
517 | @node The graphical configuration interface | ||
518 | @section The graphical configuration interface | ||
519 | |||
520 | If you also would like to use @command{gnunet-gtk} and | ||
521 | @command{gnunet-setup} (highly recommended for beginners), do: | ||
522 | |||
523 | @menu | ||
524 | * Configuring your peer:: | ||
525 | * Configuring the Friend-to-Friend (F2F) mode:: | ||
526 | * Configuring the hostlist to bootstrap:: | ||
527 | * Configuration of the HOSTLIST proxy settings:: | ||
528 | * Configuring your peer to provide a hostlist :: | ||
529 | * Configuring the datastore:: | ||
530 | * Configuring the MySQL database:: | ||
531 | * Reasons for using MySQL:: | ||
532 | * Reasons for not using MySQL:: | ||
533 | * Setup Instructions:: | ||
534 | * Testing:: | ||
535 | * Performance Tuning:: | ||
536 | * Setup for running Testcases:: | ||
537 | * Configuring the Postgres database:: | ||
538 | * Reasons to use Postgres:: | ||
539 | * Reasons not to use Postgres:: | ||
540 | * Manual setup instructions:: | ||
541 | * Testing the setup manually:: | ||
542 | * Configuring the datacache:: | ||
543 | * Configuring the file-sharing service:: | ||
544 | * Configuring logging:: | ||
545 | * Configuring the transport service and plugins:: | ||
546 | * Configuring the WLAN transport plugin:: | ||
547 | * Configuring HTTP(S) reverse proxy functionality using Apache or nginx:: | ||
548 | * Blacklisting peers:: | ||
549 | * Configuration of the HTTP and HTTPS transport plugins:: | ||
550 | * Configuring the GNU Name System:: | ||
551 | * Configuring the GNUnet VPN:: | ||
552 | * Bandwidth Configuration:: | ||
553 | * Configuring NAT:: | ||
554 | * Peer configuration for distributors (e.g. Operating Systems):: | ||
555 | @end menu | ||
556 | |||
557 | @node Configuring your peer | ||
558 | @subsection Configuring your peer | ||
559 | |||
560 | This chapter will describe the various configuration options in GNUnet. | ||
561 | |||
562 | The easiest way to configure your peer is to use the | ||
563 | @command{gnunet-setup} tool. | ||
564 | @command{gnunet-setup} is part of the @command{gnunet-gtk} | ||
565 | package. You might have to install it separately. | ||
566 | |||
567 | Many of the specific sections from this chapter actually are linked from | ||
568 | within @command{gnunet-setup} to help you while using the setup tool. | ||
569 | |||
570 | While you can also configure your peer by editing the configuration | ||
571 | file by hand, this is not recommended for anyone except for developers | ||
572 | as it requires a more in-depth understanding of the configuration files | ||
573 | and internal dependencies of GNUnet. | ||
574 | |||
575 | @node Configuring the Friend-to-Friend (F2F) mode | ||
576 | @subsection Configuring the Friend-to-Friend (F2F) mode | ||
577 | |||
578 | GNUnet knows three basic modes of operation: | ||
579 | @itemize @bullet | ||
580 | @item In standard "peer-to-peer" mode, | ||
581 | your peer will connect to any peer. | ||
582 | @item In the pure "friend-to-friend" | ||
583 | mode, your peer will ONLY connect to peers from a list of friends | ||
584 | specified in the configuration. | ||
585 | @item Finally, in mixed mode, | ||
586 | GNUnet will only connect to arbitrary peers if it | ||
587 | has at least a specified number of connections to friends. | ||
588 | @end itemize | ||
589 | |||
590 | When configuring any of the F2F ("friend-to-friend") modes, | ||
591 | you first need to create a file with the peer identities | ||
592 | of your friends. Ask your friends to run | ||
593 | |||
594 | @example | ||
595 | $ gnunet-peerinfo -sq | ||
596 | @end example | ||
597 | |||
598 | @noindent | ||
599 | The resulting output of this command needs to be added to your | ||
600 | @file{friends} file, which is simply a plain text file with one line | ||
601 | per friend with the output from the above command. | ||
602 | |||
603 | You then specify the location of your @file{friends} file in the | ||
604 | @code{FRIENDS} option of the "topology" section. | ||
605 | |||
606 | Once you have created the @file{friends} file, you can tell GNUnet to only | ||
607 | connect to your friends by setting the @code{FRIENDS-ONLY} option | ||
608 | (again in the "topology" section) to YES. | ||
609 | |||
610 | If you want to run in mixed-mode, set "FRIENDS-ONLY" to NO and configure a | ||
611 | minimum number of friends to have (before connecting to arbitrary peers) | ||
612 | under the "MINIMUM-FRIENDS" option. | ||
613 | |||
614 | If you want to operate in normal P2P-only mode, simply set | ||
615 | @code{MINIMUM-FRIENDS} to zero and @code{FRIENDS_ONLY} to NO. | ||
616 | This is the default. | ||
617 | |||
618 | @node Configuring the hostlist to bootstrap | ||
619 | @subsection Configuring the hostlist to bootstrap | ||
620 | |||
621 | After installing the software you need to get connected to the GNUnet | ||
622 | network. The configuration file included in your download is already | ||
623 | configured to connect you to the GNUnet network. | ||
624 | In this section the relevant configuration settings are explained. | ||
625 | |||
626 | To get an initial connection to the GNUnet network and to get to know | ||
627 | peers already connected to the network you can use the so called | ||
628 | "bootstrap servers". | ||
629 | These servers can give you a list of peers connected to the network. | ||
630 | To use these bootstrap servers you have to configure the hostlist daemon | ||
631 | to activate bootstrapping. | ||
632 | |||
633 | To activate bootstrapping, edit the @code{[hostlist]}-section in your | ||
634 | configuration file. You have to set the argument @command{-b} in the | ||
635 | options line: | ||
636 | |||
637 | @example | ||
638 | [hostlist] | ||
639 | OPTIONS = -b | ||
640 | @end example | ||
641 | |||
642 | Additionally you have to specify which server you want to use. | ||
643 | The default bootstrapping server is | ||
644 | "@uref{http://v10.gnunet.org/hostlist, http://v10.gnunet.org/hostlist}". | ||
645 | [^] To set the server you have to edit the line "SERVERS" in the hostlist | ||
646 | section. To use the default server you should set the lines to | ||
647 | |||
648 | @example | ||
649 | SERVERS = http://v10.gnunet.org/hostlist [^] | ||
650 | @end example | ||
651 | |||
652 | @noindent | ||
653 | To use bootstrapping your configuration file should include these lines: | ||
654 | |||
655 | @example | ||
656 | [hostlist] | ||
657 | OPTIONS = -b | ||
658 | SERVERS = http://v10.gnunet.org/hostlist [^] | ||
659 | @end example | ||
660 | |||
661 | @noindent | ||
662 | Besides using bootstrap servers you can configure your GNUnet peer to | ||
663 | receive hostlist advertisements. | ||
664 | Peers offering hostlists to other peers can send advertisement messages | ||
665 | to peers that connect to them. If you configure your peer to receive these | ||
666 | messages, your peer can download these lists and connect to the peers | ||
667 | included. These lists are persistent, which means that they are saved to | ||
668 | your hard disk regularly and are loaded during startup. | ||
669 | |||
670 | To activate hostlist learning you have to add the @command{-e} | ||
671 | switch to the @code{OPTIONS} line in the hostlist section: | ||
672 | |||
673 | @example | ||
674 | [hostlist] | ||
675 | OPTIONS = -b -e | ||
676 | @end example | ||
677 | |||
678 | @noindent | ||
679 | Furthermore you can specify in which file the lists are saved. | ||
680 | To save the lists in the file @file{hostlists.file} just add the line: | ||
681 | |||
682 | @example | ||
683 | HOSTLISTFILE = hostlists.file | ||
684 | @end example | ||
685 | |||
686 | @noindent | ||
687 | Best practice is to activate both bootstrapping and hostlist learning. | ||
688 | So your configuration file should include these lines: | ||
689 | |||
690 | @example | ||
691 | [hostlist] | ||
692 | OPTIONS = -b -e | ||
693 | HTTPPORT = 8080 | ||
694 | SERVERS = http://v10.gnunet.org/hostlist [^] | ||
695 | HOSTLISTFILE = $SERVICEHOME/hostlists.file | ||
696 | @end example | ||
697 | |||
698 | @node Configuration of the HOSTLIST proxy settings | ||
699 | @subsection Configuration of the HOSTLIST proxy settings | ||
700 | |||
701 | The hostlist client can be configured to use a proxy to connect to the | ||
702 | hostlist server. | ||
703 | This functionality can be configured in the configuration file directly | ||
704 | or using the @command{gnunet-setup} tool. | ||
705 | |||
706 | The hostlist client supports the following proxy types at the moment: | ||
707 | |||
708 | @itemize @bullet | ||
709 | @item HTTP and HTTP 1.0 only proxy | ||
710 | @item SOCKS 4/4a/5/5 with hostname | ||
711 | @end itemize | ||
712 | |||
713 | In addition authentication at the proxy with username and password can be | ||
714 | configured. | ||
715 | |||
716 | To configure proxy support for the hostlist client in the | ||
717 | @command{gnunet-setup} tool, select the "hostlist" tab and select | ||
718 | the appropriate proxy type. | ||
719 | The hostname or IP address (including port if required) has to be entered | ||
720 | in the "Proxy hostname" textbox. If required, enter username and password | ||
721 | in the "Proxy username" and "Proxy password" boxes. | ||
722 | Be aware that this information will be stored in the configuration in | ||
723 | plain text (TODO: Add explanation and generalize the part in Chapter 3.6 | ||
724 | about the encrypted home). | ||
725 | |||
726 | To provide these options directly in the configuration, you can | ||
727 | enter the following settings in the @code{[hostlist]} section of | ||
728 | the configuration: | ||
729 | |||
730 | @example | ||
731 | # Type of proxy server, | ||
732 | # Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME | ||
733 | # Default: HTTP | ||
734 | # PROXY_TYPE = HTTP | ||
735 | |||
736 | # Hostname or IP of proxy server | ||
737 | # PROXY = | ||
738 | # User name for proxy server | ||
739 | # PROXY_USERNAME = | ||
740 | # User password for proxy server | ||
741 | # PROXY_PASSWORD = | ||
742 | @end example | ||
743 | |||
744 | @node Configuring your peer to provide a hostlist | ||
745 | @subsection Configuring your peer to provide a hostlist | ||
746 | |||
747 | If you operate a peer permanently connected to GNUnet you can configure | ||
748 | your peer to act as a hostlist server, providing other peers the list of | ||
749 | peers known to him. | ||
750 | |||
751 | Your server can act as a bootstrap server and peers needing to obtain a | ||
752 | list of peers can contact it to download this list. | ||
753 | To download this hostlist the peer uses HTTP. | ||
754 | For this reason you have to build your peer with libgnurl (or libcurl) | ||
755 | and microhttpd support. | ||
756 | |||
757 | To configure your peer to act as a bootstrap server you have to add the | ||
758 | @command{-p} option to @code{OPTIONS} in the @code{[hostlist]} section | ||
759 | of your configuration file. | ||
760 | Besides that you have to specify a port number for the http server. | ||
761 | In conclusion you have to add the following lines: | ||
762 | |||
763 | @example | ||
764 | [hostlist] | ||
765 | HTTPPORT = 12980 | ||
766 | OPTIONS = -p | ||
767 | @end example | ||
768 | |||
769 | @noindent | ||
770 | If your peer acts as a bootstrap server other peers should know about | ||
771 | that. You can advertise the hostlist your are providing to other peers. | ||
772 | Peers connecting to your peer will get a message containing an | ||
773 | advertisement for your hostlist and the URL where it can be downloaded. | ||
774 | If this peer is in learning mode, it will test the hostlist and, in the | ||
775 | case it can obtain the list successfully, it will save it for | ||
776 | bootstrapping. | ||
777 | |||
778 | To activate hostlist advertisement on your peer, you have to set the | ||
779 | following lines in your configuration file: | ||
780 | |||
781 | @example | ||
782 | [hostlist] | ||
783 | EXTERNAL_DNS_NAME = example.org | ||
784 | HTTPPORT = 12981 | ||
785 | OPTIONS = -p -a | ||
786 | @end example | ||
787 | |||
788 | @noindent | ||
789 | With this configuration your peer will a act as a bootstrap server and | ||
790 | advertise this hostlist to other peers connecting to it. | ||
791 | The URL used to download the list will be | ||
792 | @code{@uref{http://example.org:12981/, http://example.org:12981/}}. | ||
793 | |||
794 | Please notice: | ||
795 | |||
796 | @itemize @bullet | ||
797 | @item The hostlist is @b{not} human readable, so you should not try to | ||
798 | download it using your webbrowser. Just point your GNUnet peer to the | ||
799 | address! | ||
800 | @item Advertising without providing a hostlist does not make sense and | ||
801 | will not work. | ||
802 | @end itemize | ||
803 | |||
804 | @node Configuring the datastore | ||
805 | @subsection Configuring the datastore | ||
806 | |||
807 | The datastore is what GNUnet uses for long-term storage of file-sharing | ||
808 | data. Note that long-term does not mean 'forever' since content does have | ||
809 | an expiration date, and of course storage space is finite (and hence | ||
810 | sometimes content may have to be discarded). | ||
811 | |||
812 | Use the @code{QUOTA} option to specify how many bytes of storage space | ||
813 | you are willing to dedicate to GNUnet. | ||
814 | |||
815 | In addition to specifying the maximum space GNUnet is allowed to use for | ||
816 | the datastore, you need to specify which database GNUnet should use to do | ||
817 | so. Currently, you have the choice between sqLite, MySQL and Postgres. | ||
818 | |||
819 | @node Configuring the MySQL database | ||
820 | @subsection Configuring the MySQL database | ||
821 | |||
822 | This section describes how to setup the MySQL database for GNUnet. | ||
823 | |||
824 | Note that the mysql plugin does NOT work with mysql before 4.1 since we | ||
825 | need prepared statements. | ||
826 | We are generally testing the code against MySQL 5.1 at this point. | ||
827 | |||
828 | @node Reasons for using MySQL | ||
829 | @subsection Reasons for using MySQL | ||
830 | |||
831 | @itemize @bullet | ||
832 | |||
833 | @item On up-to-date hardware where | ||
834 | mysql can be used comfortably, this module | ||
835 | will have better performance than the other database choices (according | ||
836 | to our tests). | ||
837 | |||
838 | @item Its often possible to recover the mysql database from internal | ||
839 | inconsistencies. Some of the other databases do not support repair. | ||
840 | @end itemize | ||
841 | |||
842 | @node Reasons for not using MySQL | ||
843 | @subsection Reasons for not using MySQL | ||
844 | |||
845 | @itemize @bullet | ||
846 | @item Memory usage (likely not an issue if you have more than 1 GB) | ||
847 | @item Complex manual setup | ||
848 | @end itemize | ||
849 | |||
850 | @node Setup Instructions | ||
851 | @subsection Setup Instructions | ||
852 | |||
853 | @itemize @bullet | ||
854 | |||
855 | @item In @file{gnunet.conf} set in section @code{DATASTORE} the value for | ||
856 | @code{DATABASE} to @code{mysql}. | ||
857 | |||
858 | @item Access mysql as root: | ||
859 | |||
860 | @example | ||
861 | $ mysql -u root -p | ||
862 | @end example | ||
863 | |||
864 | @noindent | ||
865 | and issue the following commands, replacing $USER with the username | ||
866 | that will be running @command{gnunet-arm} (so typically "gnunet"): | ||
867 | |||
868 | @example | ||
869 | CREATE DATABASE gnunet; | ||
870 | GRANT select,insert,update,delete,create,alter,drop,create \ | ||
871 | temporary tables ON gnunet.* TO $USER@@localhost; | ||
872 | SET PASSWORD FOR $USER@@localhost=PASSWORD('$the_password_you_like'); | ||
873 | FLUSH PRIVILEGES; | ||
874 | @end example | ||
875 | |||
876 | @item | ||
877 | In the $HOME directory of $USER, create a @file{.my.cnf} file with the | ||
878 | following lines | ||
879 | |||
880 | @example | ||
881 | [client] | ||
882 | user=$USER | ||
883 | password=$the_password_you_like | ||
884 | @end example | ||
885 | |||
886 | @end itemize | ||
887 | |||
888 | That's it. Note that @file{.my.cnf} file is a slight security risk unless | ||
889 | its on a safe partition. The @file{$HOME/.my.cnf} can of course be | ||
890 | a symbolic link. | ||
891 | Luckily $USER has only privileges to mess up GNUnet's tables, | ||
892 | which should be pretty harmless. | ||
893 | |||
894 | @node Testing | ||
895 | @subsection Testing | ||
896 | |||
897 | You should briefly try if the database connection works. First, login | ||
898 | as $USER. Then use: | ||
899 | |||
900 | @example | ||
901 | $ mysql -u $USER | ||
902 | mysql> use gnunet; | ||
903 | @end example | ||
904 | |||
905 | @noindent | ||
906 | If you get the message | ||
907 | |||
908 | @example | ||
909 | Database changed | ||
910 | @end example | ||
911 | |||
912 | @noindent | ||
913 | it probably works. | ||
914 | |||
915 | If you get | ||
916 | |||
917 | @example | ||
918 | ERROR 2002: Can't connect to local MySQL server | ||
919 | through socket '/tmp/mysql.sock' (2) | ||
920 | @end example | ||
921 | |||
922 | @noindent | ||
923 | it may be resolvable by | ||
924 | |||
925 | @example | ||
926 | ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock | ||
927 | @end example | ||
928 | |||
929 | @noindent | ||
930 | so there may be some additional trouble depending on your mysql setup. | ||
931 | |||
932 | @node Performance Tuning | ||
933 | @subsection Performance Tuning | ||
934 | |||
935 | For GNUnet, you probably want to set the option | ||
936 | |||
937 | @example | ||
938 | innodb_flush_log_at_trx_commit = 0 | ||
939 | @end example | ||
940 | |||
941 | @noindent | ||
942 | for a rather dramatic boost in MySQL performance. However, this reduces | ||
943 | the "safety" of your database as with this options you may loose | ||
944 | transactions during a power outage. | ||
945 | While this is totally harmless for GNUnet, the option applies to all | ||
946 | applications using MySQL. So you should set it if (and only if) GNUnet is | ||
947 | the only application on your system using MySQL. | ||
948 | |||
949 | @node Setup for running Testcases | ||
950 | @subsection Setup for running Testcases | ||
951 | |||
952 | If you want to run the testcases, you must create a second database | ||
953 | "gnunetcheck" with the same username and password. This database will | ||
954 | then be used for testing (@command{make check}). | ||
955 | |||
956 | @node Configuring the Postgres database | ||
957 | @subsection Configuring the Postgres database | ||
958 | |||
959 | This text describes how to setup the Postgres database for GNUnet. | ||
960 | |||
961 | This Postgres plugin was developed for Postgres 8.3 but might work for | ||
962 | earlier versions as well. | ||
963 | |||
964 | @node Reasons to use Postgres | ||
965 | @subsection Reasons to use Postgres | ||
966 | |||
967 | @itemize @bullet | ||
968 | @item Easier to setup than MySQL | ||
969 | @item Real database | ||
970 | @end itemize | ||
971 | |||
972 | @node Reasons not to use Postgres | ||
973 | @subsection Reasons not to use Postgres | ||
974 | |||
975 | @itemize @bullet | ||
976 | @item Quite slow | ||
977 | @item Still some manual setup required | ||
978 | @end itemize | ||
979 | |||
980 | @node Manual setup instructions | ||
981 | @subsection Manual setup instructions | ||
982 | |||
983 | @itemize @bullet | ||
984 | @item In @file{gnunet.conf} set in section @code{DATASTORE} the value for | ||
985 | @code{DATABASE} to @code{postgres}. | ||
986 | @item Access Postgres to create a user: | ||
987 | |||
988 | @table @asis | ||
989 | @item with Postgres 8.x, use: | ||
990 | |||
991 | @example | ||
992 | # su - postgres | ||
993 | $ createuser | ||
994 | @end example | ||
995 | |||
996 | @noindent | ||
997 | and enter the name of the user running GNUnet for the role interactively. | ||
998 | Then, when prompted, do not set it to superuser, allow the creation of | ||
999 | databases, and do not allow the creation of new roles. | ||
1000 | |||
1001 | @item with Postgres 9.x, use: | ||
1002 | |||
1003 | @example | ||
1004 | # su - postgres | ||
1005 | $ createuser -d $GNUNET_USER | ||
1006 | @end example | ||
1007 | |||
1008 | @noindent | ||
1009 | where $GNUNET_USER is the name of the user running GNUnet. | ||
1010 | |||
1011 | @end table | ||
1012 | |||
1013 | |||
1014 | @item | ||
1015 | As that user (so typically as user "gnunet"), create a database (or two): | ||
1016 | |||
1017 | @example | ||
1018 | $ createdb gnunet | ||
1019 | # this way you can run "make check" | ||
1020 | $ createdb gnunetcheck | ||
1021 | @end example | ||
1022 | |||
1023 | @end itemize | ||
1024 | |||
1025 | Now you should be able to start @code{gnunet-arm}. | ||
1026 | |||
1027 | @node Testing the setup manually | ||
1028 | @subsection Testing the setup manually | ||
1029 | |||
1030 | You may want to try if the database connection works. First, again login | ||
1031 | as the user who will run @command{gnunet-arm}. Then use: | ||
1032 | |||
1033 | @example | ||
1034 | $ psql gnunet # or gnunetcheck | ||
1035 | gnunet=> \dt | ||
1036 | @end example | ||
1037 | |||
1038 | @noindent | ||
1039 | If, after you have started @command{gnunet-arm} at least once, you get | ||
1040 | a @code{gn090} table here, it probably works. | ||
1041 | |||
1042 | @node Configuring the datacache | ||
1043 | @subsection Configuring the datacache | ||
1044 | |||
1045 | |||
1046 | The datacache is what GNUnet uses for storing temporary data. This data is | ||
1047 | expected to be wiped completely each time GNUnet is restarted (or the | ||
1048 | system is rebooted). | ||
1049 | |||
1050 | You need to specify how many bytes GNUnet is allowed to use for the | ||
1051 | datacache using the @code{QUOTA} option in the section @code{[dhtcache]}. | ||
1052 | Furthermore, you need to specify which database backend should be used to | ||
1053 | store the data. Currently, you have the choice between | ||
1054 | sqLite, MySQL and Postgres. | ||
1055 | |||
1056 | @node Configuring the file-sharing service | ||
1057 | @subsection Configuring the file-sharing service | ||
1058 | |||
1059 | In order to use GNUnet for file-sharing, you first need to make sure | ||
1060 | that the file-sharing service is loaded. | ||
1061 | This is done by setting the @code{START_ON_DEMAND} option in | ||
1062 | section @code{[fs]} to "YES". Alternatively, you can run | ||
1063 | |||
1064 | @example | ||
1065 | $ gnunet-arm -i fs | ||
1066 | @end example | ||
1067 | |||
1068 | @noindent | ||
1069 | to start the file-sharing service by hand. | ||
1070 | |||
1071 | Except for configuring the database and the datacache the only important | ||
1072 | option for file-sharing is content migration. | ||
1073 | |||
1074 | Content migration allows your peer to cache content from other peers as | ||
1075 | well as send out content stored on your system without explicit requests. | ||
1076 | This content replication has positive and negative impacts on both system | ||
1077 | performance and privacy. | ||
1078 | |||
1079 | FIXME: discuss the trade-offs. Here is some older text about it... | ||
1080 | |||
1081 | Setting this option to YES allows gnunetd to migrate data to the local | ||
1082 | machine. Setting this option to YES is highly recommended for efficiency. | ||
1083 | Its also the default. If you set this value to YES, GNUnet will store | ||
1084 | content on your machine that you cannot decrypt. | ||
1085 | While this may protect you from liability if the judge is sane, it may | ||
1086 | not (IANAL). If you put illegal content on your machine yourself, setting | ||
1087 | this option to YES will probably increase your chances to get away with it | ||
1088 | since you can plausibly deny that you inserted the content. | ||
1089 | Note that in either case, your anonymity would have to be broken first | ||
1090 | (which may be possible depending on the size of the GNUnet network and the | ||
1091 | strength of the adversary). | ||
1092 | |||
1093 | @node Configuring logging | ||
1094 | @subsection Configuring logging | ||
1095 | |||
1096 | Since version 0.9.0, logging in GNUnet is controlled via the | ||
1097 | @code{-L} and @code{-l} options. | ||
1098 | Using @code{-L}, a log level can be specified. With log level | ||
1099 | @code{ERROR} only serious errors are logged. | ||
1100 | The default log level is @code{WARNING} which causes anything of | ||
1101 | concern to be logged. | ||
1102 | Log level @code{INFO} can be used to log anything that might be | ||
1103 | interesting information whereas | ||
1104 | @code{DEBUG} can be used by developers to log debugging messages | ||
1105 | (but you need to run @code{./configure} with | ||
1106 | @code{--enable-logging=verbose} to get them compiled). | ||
1107 | The @code{-l} option is used to specify the log file. | ||
1108 | |||
1109 | Since most GNUnet services are managed by @code{gnunet-arm}, using the | ||
1110 | @code{-l} or @code{-L} options directly is not possible. | ||
1111 | Instead, they can be specified using the @code{OPTIONS} configuration | ||
1112 | value in the respective section for the respective service. | ||
1113 | In order to enable logging globally without editing the @code{OPTIONS} | ||
1114 | values for each service, @command{gnunet-arm} supports a | ||
1115 | @code{GLOBAL_POSTFIX} option. | ||
1116 | The value specified here is given as an extra option to all services for | ||
1117 | which the configuration does contain a service-specific @code{OPTIONS} | ||
1118 | field. | ||
1119 | |||
1120 | @code{GLOBAL_POSTFIX} can contain the special sequence "@{@}" which | ||
1121 | is replaced by the name of the service that is being started. | ||
1122 | Furthermore, @code{GLOBAL_POSTFIX} is special in that sequences | ||
1123 | starting with "$" anywhere in the string are expanded (according | ||
1124 | to options in @code{PATHS}); this expansion otherwise is | ||
1125 | only happening for filenames and then the "$" must be the | ||
1126 | first character in the option. Both of these restrictions do | ||
1127 | not apply to @code{GLOBAL_POSTFIX}. | ||
1128 | Note that specifying @code{%} anywhere in the @code{GLOBAL_POSTFIX} | ||
1129 | disables both of these features. | ||
1130 | |||
1131 | In summary, in order to get all services to log at level | ||
1132 | @code{INFO} to log-files called @code{SERVICENAME-logs}, the | ||
1133 | following global prefix should be used: | ||
1134 | |||
1135 | @example | ||
1136 | GLOBAL_POSTFIX = -l $SERVICEHOME/@{@}-logs -L INFO | ||
1137 | @end example | ||
1138 | |||
1139 | @node Configuring the transport service and plugins | ||
1140 | @subsection Configuring the transport service and plugins | ||
1141 | |||
1142 | The transport service in GNUnet is responsible to maintain basic | ||
1143 | connectivity to other peers. | ||
1144 | Besides initiating and keeping connections alive it is also responsible | ||
1145 | for address validation. | ||
1146 | |||
1147 | The GNUnet transport supports more than one transport protocol. | ||
1148 | These protocols are configured together with the transport service. | ||
1149 | |||
1150 | The configuration section for the transport service itself is quite | ||
1151 | similar to all the other services | ||
1152 | |||
1153 | @example | ||
1154 | START_ON_DEMAND = YES | ||
1155 | @@UNIXONLY@@ PORT = 2091 | ||
1156 | HOSTNAME = localhost | ||
1157 | HOME = $SERVICEHOME | ||
1158 | CONFIG = $DEFAULTCONFIG | ||
1159 | BINARY = gnunet-service-transport | ||
1160 | #PREFIX = valgrind | ||
1161 | NEIGHBOUR_LIMIT = 50 | ||
1162 | ACCEPT_FROM = 127.0.0.1; | ||
1163 | ACCEPT_FROM6 = ::1; | ||
1164 | PLUGINS = tcp udp | ||
1165 | UNIXPATH = /tmp/gnunet-service-transport.sock | ||
1166 | @end example | ||
1167 | |||
1168 | Different are the settings for the plugins to load @code{PLUGINS}. | ||
1169 | The first setting specifies which transport plugins to load. | ||
1170 | |||
1171 | @itemize @bullet | ||
1172 | @item transport-unix | ||
1173 | A plugin for local only communication with UNIX domain sockets. Used for | ||
1174 | testing and available on unix systems only. Just set the port | ||
1175 | |||
1176 | @example | ||
1177 | [transport-unix] | ||
1178 | PORT = 22086 | ||
1179 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
1180 | @end example | ||
1181 | |||
1182 | @item transport-tcp | ||
1183 | A plugin for communication with TCP. Set port to 0 for client mode with | ||
1184 | outbound only connections | ||
1185 | |||
1186 | @example | ||
1187 | [transport-tcp] | ||
1188 | # Use 0 to ONLY advertise as a peer behind NAT (no port binding) | ||
1189 | PORT = 2086 | ||
1190 | ADVERTISED_PORT = 2086 | ||
1191 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
1192 | # Maximum number of open TCP connections allowed | ||
1193 | MAX_CONNECTIONS = 128 | ||
1194 | @end example | ||
1195 | |||
1196 | @item transport-udp | ||
1197 | A plugin for communication with UDP. Supports peer discovery using | ||
1198 | broadcasts. | ||
1199 | |||
1200 | @example | ||
1201 | [transport-udp] | ||
1202 | PORT = 2086 | ||
1203 | BROADCAST = YES | ||
1204 | BROADCAST_INTERVAL = 30 s | ||
1205 | MAX_BPS = 1000000 | ||
1206 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
1207 | @end example | ||
1208 | |||
1209 | @item transport-http | ||
1210 | HTTP and HTTPS support is split in two part: a client plugin initiating | ||
1211 | outbound connections and a server part accepting connections from the | ||
1212 | client. The client plugin just takes the maximum number of connections as | ||
1213 | an argument. | ||
1214 | |||
1215 | @example | ||
1216 | [transport-http_client] | ||
1217 | MAX_CONNECTIONS = 128 | ||
1218 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
1219 | @end example | ||
1220 | |||
1221 | @example | ||
1222 | [transport-https_client] | ||
1223 | MAX_CONNECTIONS = 128 | ||
1224 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
1225 | @end example | ||
1226 | |||
1227 | @noindent | ||
1228 | The server has a port configured and the maximum number of connections. | ||
1229 | The HTTPS part has two files with the certificate key and the certificate | ||
1230 | file. | ||
1231 | |||
1232 | The server plugin supports reverse proxies, so a external hostname can be | ||
1233 | set using the @code{EXTERNAL_HOSTNAME} setting. | ||
1234 | The webserver under this address should forward the request to the peer | ||
1235 | and the configure port. | ||
1236 | |||
1237 | @example | ||
1238 | [transport-http_server] | ||
1239 | EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de/gnunet | ||
1240 | PORT = 1080 | ||
1241 | MAX_CONNECTIONS = 128 | ||
1242 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
1243 | @end example | ||
1244 | |||
1245 | @example | ||
1246 | [transport-https_server] | ||
1247 | PORT = 4433 | ||
1248 | CRYPTO_INIT = NORMAL | ||
1249 | KEY_FILE = https.key | ||
1250 | CERT_FILE = https.cert | ||
1251 | MAX_CONNECTIONS = 128 | ||
1252 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
1253 | @end example | ||
1254 | |||
1255 | @item transport-wlan | ||
1256 | |||
1257 | The next section describes how to setup the WLAN plugin, | ||
1258 | so here only the settings. Just specify the interface to use: | ||
1259 | |||
1260 | @example | ||
1261 | [transport-wlan] | ||
1262 | # Name of the interface in monitor mode (typically monX) | ||
1263 | INTERFACE = mon0 | ||
1264 | # Real hardware, no testing | ||
1265 | TESTMODE = 0 | ||
1266 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
1267 | @end example | ||
1268 | @end itemize | ||
1269 | |||
1270 | @node Configuring the WLAN transport plugin | ||
1271 | @subsection Configuring the WLAN transport plugin | ||
1272 | |||
1273 | The wlan transport plugin enables GNUnet to send and to receive data on a | ||
1274 | wlan interface. | ||
1275 | It has not to be connected to a wlan network as long as sender and | ||
1276 | receiver are on the same channel. This enables you to get connection to | ||
1277 | GNUnet where no internet access is possible, for example during | ||
1278 | catastrophes or when censorship cuts you off from the internet. | ||
1279 | |||
1280 | |||
1281 | @menu | ||
1282 | * Requirements for the WLAN plugin:: | ||
1283 | * Configuration:: | ||
1284 | * Before starting GNUnet:: | ||
1285 | * Limitations and known bugs:: | ||
1286 | @end menu | ||
1287 | |||
1288 | |||
1289 | @node Requirements for the WLAN plugin | ||
1290 | @subsubsection Requirements for the WLAN plugin | ||
1291 | |||
1292 | @itemize @bullet | ||
1293 | |||
1294 | @item wlan network card with monitor support and packet injection | ||
1295 | (see @uref{http://www.aircrack-ng.org/, aircrack-ng.org}) | ||
1296 | |||
1297 | @item Linux kernel with mac80211 stack, introduced in 2.6.22, tested with | ||
1298 | 2.6.35 and 2.6.38 | ||
1299 | |||
1300 | @item Wlantools to create the a monitor interface, tested with airmon-ng | ||
1301 | of the aircrack-ng package | ||
1302 | @end itemize | ||
1303 | |||
1304 | @node Configuration | ||
1305 | @subsubsection Configuration | ||
1306 | |||
1307 | There are the following options for the wlan plugin (they should be like | ||
1308 | this in your default config file, you only need to adjust them if the | ||
1309 | values are incorrect for your system) | ||
1310 | |||
1311 | @example | ||
1312 | # section for the wlan transport plugin | ||
1313 | [transport-wlan] | ||
1314 | # interface to use, more information in the | ||
1315 | # "Before starting GNUnet" section of the handbook. | ||
1316 | INTERFACE = mon0 | ||
1317 | # testmode for developers: | ||
1318 | # 0 use wlan interface, | ||
1319 | #1 or 2 use loopback driver for tests 1 = server, 2 = client | ||
1320 | TESTMODE = 0 | ||
1321 | @end example | ||
1322 | |||
1323 | @node Before starting GNUnet | ||
1324 | @subsubsection Before starting GNUnet | ||
1325 | |||
1326 | Before starting GNUnet, you have to make sure that your wlan interface is | ||
1327 | in monitor mode. | ||
1328 | One way to put the wlan interface into monitor mode (if your interface | ||
1329 | name is wlan0) is by executing: | ||
1330 | |||
1331 | @example | ||
1332 | sudo airmon-ng start wlan0 | ||
1333 | @end example | ||
1334 | |||
1335 | @noindent | ||
1336 | Here is an example what the result should look like: | ||
1337 | |||
1338 | @example | ||
1339 | Interface Chipset Driver | ||
1340 | wlan0 Intel 4965 a/b/g/n iwl4965 - [phy0] | ||
1341 | (monitor mode enabled on mon0) | ||
1342 | @end example | ||
1343 | |||
1344 | @noindent | ||
1345 | The monitor interface is mon0 is the one that you have to put into the | ||
1346 | configuration file. | ||
1347 | |||
1348 | @node Limitations and known bugs | ||
1349 | @subsubsection Limitations and known bugs | ||
1350 | |||
1351 | Wlan speed is at the maximum of 1 Mbit/s because support for choosing the | ||
1352 | wlan speed with packet injection was removed in newer kernels. | ||
1353 | Please pester the kernel developers about fixing this. | ||
1354 | |||
1355 | The interface channel depends on the wlan network that the card is | ||
1356 | connected to. If no connection has been made since the start of the | ||
1357 | computer, it is usually the first channel of the card. | ||
1358 | Peers will only find each other and communicate if they are on the same | ||
1359 | channel. Channels must be set manually, e.g. by using: | ||
1360 | |||
1361 | @example | ||
1362 | iwconfig wlan0 channel 1 | ||
1363 | @end example | ||
1364 | |||
1365 | @node Configuring HTTP(S) reverse proxy functionality using Apache or nginx | ||
1366 | @subsection Configuring HTTP(S) reverse proxy functionality using Apache or nginx | ||
1367 | |||
1368 | The HTTP plugin supports data transfer using reverse proxies. A reverse | ||
1369 | proxy forwards the HTTP request he receives with a certain URL to another | ||
1370 | webserver, here a GNUnet peer. | ||
1371 | |||
1372 | So if you have a running Apache or nginx webserver you can configure it to | ||
1373 | be a GNUnet reverse proxy. Especially if you have a well-known website | ||
1374 | this improves censorship resistance since it looks as normal surfing | ||
1375 | behaviour. | ||
1376 | |||
1377 | To do so, you have to do two things: | ||
1378 | |||
1379 | @itemize @bullet | ||
1380 | @item Configure your webserver to forward the GNUnet HTTP traffic | ||
1381 | @item Configure your GNUnet peer to announce the respective address | ||
1382 | @end itemize | ||
1383 | |||
1384 | As an example we want to use GNUnet peer running: | ||
1385 | |||
1386 | @itemize @bullet | ||
1387 | |||
1388 | @item HTTP server plugin on @code{gnunet.foo.org:1080} | ||
1389 | |||
1390 | @item HTTPS server plugin on @code{gnunet.foo.org:4433} | ||
1391 | |||
1392 | @item A apache or nginx webserver on | ||
1393 | @uref{http://www.foo.org/, http://www.foo.org:80/} | ||
1394 | |||
1395 | @item A apache or nginx webserver on https://www.foo.org:443/ | ||
1396 | @end itemize | ||
1397 | |||
1398 | And we want the webserver to accept GNUnet traffic under | ||
1399 | @code{http://www.foo.org/bar/}. The required steps are described here: | ||
1400 | |||
1401 | @menu | ||
1402 | * Reverse Proxy - Configure your Apache2 HTTP webserver:: | ||
1403 | * Reverse Proxy - Configure your Apache2 HTTPS webserver:: | ||
1404 | * Reverse Proxy - Configure your nginx HTTPS webserver:: | ||
1405 | * Reverse Proxy - Configure your nginx HTTP webserver:: | ||
1406 | * Reverse Proxy - Configure your GNUnet peer:: | ||
1407 | @end menu | ||
1408 | |||
1409 | @node Reverse Proxy - Configure your Apache2 HTTP webserver | ||
1410 | @subsubsection Reverse Proxy - Configure your Apache2 HTTP webserver | ||
1411 | |||
1412 | First of all you need mod_proxy installed. | ||
1413 | |||
1414 | Edit your webserver configuration. Edit | ||
1415 | @code{/etc/apache2/apache2.conf} or the site-specific configuration file. | ||
1416 | |||
1417 | In the respective @code{server config},@code{virtual host} or | ||
1418 | @code{directory} section add the following lines: | ||
1419 | |||
1420 | @example | ||
1421 | ProxyTimeout 300 | ||
1422 | ProxyRequests Off | ||
1423 | <Location /bar/ > | ||
1424 | ProxyPass http://gnunet.foo.org:1080/ | ||
1425 | ProxyPassReverse http://gnunet.foo.org:1080/ | ||
1426 | </Location> | ||
1427 | @end example | ||
1428 | |||
1429 | @node Reverse Proxy - Configure your Apache2 HTTPS webserver | ||
1430 | @subsubsection Reverse Proxy - Configure your Apache2 HTTPS webserver | ||
1431 | |||
1432 | We assume that you already have an HTTPS server running, if not please | ||
1433 | check how to configure a HTTPS host. An uncomplicated to use example | ||
1434 | is the example configuration file for Apache2/HTTPD provided in | ||
1435 | @file{apache2/sites-available/default-ssl}. | ||
1436 | |||
1437 | In the respective HTTPS @code{server config},@code{virtual host} or | ||
1438 | @code{directory} section add the following lines: | ||
1439 | |||
1440 | @example | ||
1441 | SSLProxyEngine On | ||
1442 | ProxyTimeout 300 | ||
1443 | ProxyRequests Off | ||
1444 | <Location /bar/ > | ||
1445 | ProxyPass https://gnunet.foo.org:4433/ | ||
1446 | ProxyPassReverse https://gnunet.foo.org:4433/ | ||
1447 | </Location> | ||
1448 | @end example | ||
1449 | |||
1450 | @noindent | ||
1451 | More information about the apache mod_proxy configuration can be found | ||
1452 | in the | ||
1453 | @uref{http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass, Apache documentation}. | ||
1454 | |||
1455 | @node Reverse Proxy - Configure your nginx HTTPS webserver | ||
1456 | @subsubsection Reverse Proxy - Configure your nginx HTTPS webserver | ||
1457 | |||
1458 | Since nginx does not support chunked encoding, you first of all have to | ||
1459 | install the @code{chunkin} | ||
1460 | @uref{http://wiki.nginx.org/HttpChunkinModule, module}. | ||
1461 | |||
1462 | To enable chunkin add: | ||
1463 | |||
1464 | @example | ||
1465 | chunkin on; | ||
1466 | error_page 411 = @@my_411_error; | ||
1467 | location @@my_411_error @{ | ||
1468 | chunkin_resume; | ||
1469 | @} | ||
1470 | @end example | ||
1471 | |||
1472 | @noindent | ||
1473 | Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or | ||
1474 | the site-specific configuration file. | ||
1475 | |||
1476 | In the @code{server} section add: | ||
1477 | |||
1478 | @example | ||
1479 | location /bar/ @{ | ||
1480 | proxy_pass http://gnunet.foo.org:1080/; | ||
1481 | proxy_buffering off; | ||
1482 | proxy_connect_timeout 5; # more than http_server | ||
1483 | proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout | ||
1484 | proxy_http_version 1.1; # 1.0 default | ||
1485 | proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504; | ||
1486 | @} | ||
1487 | @end example | ||
1488 | |||
1489 | @node Reverse Proxy - Configure your nginx HTTP webserver | ||
1490 | @subsubsection Reverse Proxy - Configure your nginx HTTP webserver | ||
1491 | |||
1492 | Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or | ||
1493 | the site-specific configuration file. | ||
1494 | |||
1495 | In the @code{server} section add: | ||
1496 | |||
1497 | @example | ||
1498 | ssl_session_timeout 6m; | ||
1499 | location /bar/ | ||
1500 | @{ | ||
1501 | proxy_pass https://gnunet.foo.org:4433/; | ||
1502 | proxy_buffering off; | ||
1503 | proxy_connect_timeout 5; # more than http_server | ||
1504 | proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout | ||
1505 | proxy_http_version 1.1; # 1.0 default | ||
1506 | proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504; | ||
1507 | @} | ||
1508 | @end example | ||
1509 | |||
1510 | @node Reverse Proxy - Configure your GNUnet peer | ||
1511 | @subsubsection Reverse Proxy - Configure your GNUnet peer | ||
1512 | |||
1513 | To have your GNUnet peer announce the address, you have to specify the | ||
1514 | @code{EXTERNAL_HOSTNAME} option in the @code{[transport-http_server]} | ||
1515 | section: | ||
1516 | |||
1517 | @example | ||
1518 | [transport-http_server] | ||
1519 | EXTERNAL_HOSTNAME = http://www.foo.org/bar/ | ||
1520 | @end example | ||
1521 | |||
1522 | @noindent | ||
1523 | and/or @code{[transport-https_server]} section: | ||
1524 | |||
1525 | @example | ||
1526 | [transport-https_server] | ||
1527 | EXTERNAL_HOSTNAME = https://www.foo.org/bar/ | ||
1528 | @end example | ||
1529 | |||
1530 | @noindent | ||
1531 | Now restart your webserver and your peer... | ||
1532 | |||
1533 | @node Blacklisting peers | ||
1534 | @subsection Blacklisting peers | ||
1535 | |||
1536 | Transport service supports to deny connecting to a specific peer of to a | ||
1537 | specific peer with a specific transport plugin using the blacklisting | ||
1538 | component of transport service. With@ blacklisting it is possible to deny | ||
1539 | connections to specific peers of@ to use a specific plugin to a specific | ||
1540 | peer. Peers can be blacklisted using@ the configuration or a blacklist | ||
1541 | client can be asked. | ||
1542 | |||
1543 | To blacklist peers using the configuration you have to add a section to | ||
1544 | your configuration containing the peer id of the peer to blacklist and | ||
1545 | the plugin@ if required. | ||
1546 | |||
1547 | Examples: | ||
1548 | |||
1549 | To blacklist connections to P565... on peer AG2P... using tcp add: | ||
1550 | |||
1551 | @c FIXME: This is too long and produces errors in the pdf. | ||
1552 | @example | ||
1553 | [transport-blacklist AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520] | ||
1554 | P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = tcp | ||
1555 | @end example | ||
1556 | |||
1557 | To blacklist connections to P565... on peer AG2P... using all plugins add: | ||
1558 | |||
1559 | @example | ||
1560 | [transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520] | ||
1561 | P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = | ||
1562 | @end example | ||
1563 | |||
1564 | You can also add a blacklist client using the blacklist API. On a | ||
1565 | blacklist check, blacklisting first checks internally if the peer is | ||
1566 | blacklisted and if not, it asks the blacklisting clients. Clients are | ||
1567 | asked if it is OK to connect to a peer ID, the plugin is omitted. | ||
1568 | |||
1569 | On blacklist check for (peer, plugin) | ||
1570 | |||
1571 | @itemize @bullet | ||
1572 | @item Do we have a local blacklist entry for this peer and this plugin? | ||
1573 | @item YES: disallow connection | ||
1574 | @item Do we have a local blacklist entry for this peer and all plugins? | ||
1575 | @item YES: disallow connection | ||
1576 | @item Does one of the clients disallow? | ||
1577 | @item YES: disallow connection | ||
1578 | @end itemize | ||
1579 | |||
1580 | @node Configuration of the HTTP and HTTPS transport plugins | ||
1581 | @subsection Configuration of the HTTP and HTTPS transport plugins | ||
1582 | |||
1583 | The client parts of the http and https transport plugins can be configured | ||
1584 | to use a proxy to connect to the hostlist server. This functionality can | ||
1585 | be configured in the configuration file directly or using the | ||
1586 | gnunet-setup tool. | ||
1587 | |||
1588 | Both the HTTP and HTTPS clients support the following proxy types at | ||
1589 | the moment: | ||
1590 | |||
1591 | @itemize @bullet | ||
1592 | @item HTTP 1.1 proxy | ||
1593 | @item SOCKS 4/4a/5/5 with hostname | ||
1594 | @end itemize | ||
1595 | |||
1596 | In addition authentication at the proxy with username and password can be | ||
1597 | configured. | ||
1598 | |||
1599 | To configure proxy support for the clients in the gnunet-setup tool, | ||
1600 | select the "transport" tab and activate the respective plugin. Now you | ||
1601 | can select the appropriate proxy type. The hostname or IP address | ||
1602 | (including port if required) has to be entered in the "Proxy hostname" | ||
1603 | textbox. If required, enter username and password in the "Proxy username" | ||
1604 | and "Proxy password" boxes. Be aware that these information will be stored | ||
1605 | in the configuration in plain text. | ||
1606 | |||
1607 | To configure these options directly in the configuration, you can | ||
1608 | configure the following settings in the @code{[transport-http_client]} | ||
1609 | and @code{[transport-https_client]} section of the configuration: | ||
1610 | |||
1611 | @example | ||
1612 | # Type of proxy server, | ||
1613 | # Valid values: HTTP, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME | ||
1614 | # Default: HTTP | ||
1615 | # PROXY_TYPE = HTTP | ||
1616 | |||
1617 | # Hostname or IP of proxy server | ||
1618 | # PROXY = | ||
1619 | # User name for proxy server | ||
1620 | # PROXY_USERNAME = | ||
1621 | # User password for proxy server | ||
1622 | # PROXY_PASSWORD = | ||
1623 | @end example | ||
1624 | |||
1625 | @node Configuring the GNU Name System | ||
1626 | @subsection Configuring the GNU Name System | ||
1627 | |||
1628 | @menu | ||
1629 | * Configuring system-wide DNS interception:: | ||
1630 | * Configuring the GNS nsswitch plugin:: | ||
1631 | @c * Configuring GNS on W32:: | ||
1632 | * GNS Proxy Setup:: | ||
1633 | * Setup of the GNS CA:: | ||
1634 | * Testing the GNS setup:: | ||
1635 | * Migrating existing DNS zones into GNS:: | ||
1636 | @end menu | ||
1637 | |||
1638 | |||
1639 | @node Configuring system-wide DNS interception | ||
1640 | @subsubsection Configuring system-wide DNS interception | ||
1641 | |||
1642 | Before you install GNUnet, make sure you have a user and group 'gnunet' | ||
1643 | as well as an empty group 'gnunetdns'. | ||
1644 | |||
1645 | When using GNUnet with system-wide DNS interception, it is absolutely | ||
1646 | necessary for all GNUnet service processes to be started by | ||
1647 | @code{gnunet-service-arm} as user and group 'gnunet'. You also need to be | ||
1648 | sure to run @code{make install} as root (or use the @code{sudo} option to | ||
1649 | configure) to grant GNUnet sufficient privileges. | ||
1650 | |||
1651 | With this setup, all that is required for enabling system-wide DNS | ||
1652 | interception is for some GNUnet component (VPN or GNS) to request it. | ||
1653 | The @code{gnunet-service-dns} will then start helper programs that will | ||
1654 | make the necessary changes to your firewall (@code{iptables}) rules. | ||
1655 | |||
1656 | Note that this will NOT work if your system sends out DNS traffic to a | ||
1657 | link-local IPv6 address, as in this case GNUnet can intercept the traffic, | ||
1658 | but not inject the responses from the link-local IPv6 address. Hence you | ||
1659 | cannot use system-wide DNS interception in conjunction with link-local | ||
1660 | IPv6-based DNS servers. If such a DNS server is used, it will bypass | ||
1661 | GNUnet's DNS traffic interception. | ||
1662 | |||
1663 | Using the GNU Name System (GNS) requires two different configuration | ||
1664 | steps. | ||
1665 | First of all, GNS needs to be integrated with the operating system. Most | ||
1666 | of this section is about the operating system level integration. | ||
1667 | |||
1668 | The remainder of this chapter will detail the various methods for | ||
1669 | configuring the use of GNS with your operating system. | ||
1670 | |||
1671 | At this point in time you have different options depending on your OS: | ||
1672 | |||
1673 | @itemize @bullet | ||
1674 | @item Use the gnunet-gns-proxy@* | ||
1675 | This approach works for all operating systems and is likely the | ||
1676 | easiest. However, it enables GNS only for browsers, not for other | ||
1677 | applications that might be using DNS, such as SSH. Still, using the | ||
1678 | proxy is required for using HTTP with GNS and is thus recommended for | ||
1679 | all users. To do this, you simply have to run the | ||
1680 | @code{gnunet-gns-proxy-setup-ca} script as the user who will run the | ||
1681 | browser (this will create a GNS certificate authority (CA) on your | ||
1682 | system and import its key into your browser), then start | ||
1683 | @code{gnunet-gns-proxy} and inform your browser to use the Socks5 | ||
1684 | proxy which @code{gnunet-gns-proxy} makes available by default on port | ||
1685 | 7777. | ||
1686 | @item Use a nsswitch plugin (recommended on GNU systems)@* | ||
1687 | This approach has the advantage of offering fully personalized | ||
1688 | resolution even on multi-user systems. A potential disadvantage is | ||
1689 | that some applications might be able to bypass GNS. | ||
1690 | @item Use a W32 resolver plugin (recommended on W32)@* | ||
1691 | This is currently the only option on W32 systems. | ||
1692 | @item Use system-wide DNS packet interception@* | ||
1693 | This approach is recommended for the GNUnet VPN. It can be used to | ||
1694 | handle GNS at the same time; however, if you only use this method, you | ||
1695 | will only get one root zone per machine (not so great for multi-user | ||
1696 | systems). | ||
1697 | @end itemize | ||
1698 | |||
1699 | You can combine system-wide DNS packet interception with the nsswitch | ||
1700 | plugin. | ||
1701 | The setup of the system-wide DNS interception is described here. All of | ||
1702 | the other GNS-specific configuration steps are described in the following | ||
1703 | sections. | ||
1704 | |||
1705 | @node Configuring the GNS nsswitch plugin | ||
1706 | @subsubsection Configuring the GNS nsswitch plugin | ||
1707 | |||
1708 | The Name Service Switch (NSS) is a facility in Unix-like operating systems | ||
1709 | (in most cases provided by the GNU C Library) | ||
1710 | that provides a variety of sources for common configuration databases and | ||
1711 | name resolution mechanisms. | ||
1712 | A superuser (system administrator) usually configures the | ||
1713 | operating system's name services using the file | ||
1714 | @file{/etc/nsswitch.conf}. | ||
1715 | |||
1716 | GNS provides a NSS plugin to integrate GNS name resolution with the | ||
1717 | operating system's name resolution process. | ||
1718 | To use the GNS NSS plugin you have to either | ||
1719 | |||
1720 | @itemize @bullet | ||
1721 | @item install GNUnet as root or | ||
1722 | @item compile GNUnet with the @code{--with-sudo=yes} switch. | ||
1723 | @end itemize | ||
1724 | |||
1725 | Name resolution is controlled by the @emph{hosts} section in the NSS | ||
1726 | configuration. By default this section first performs a lookup in the | ||
1727 | @file{/etc/hosts} file and then in DNS. | ||
1728 | The nsswitch file should contain a line similar to: | ||
1729 | |||
1730 | @example | ||
1731 | hosts: files dns [NOTFOUND=return] mdns4_minimal mdns4 | ||
1732 | @end example | ||
1733 | |||
1734 | @noindent | ||
1735 | Here the GNS NSS plugin can be added to perform a GNS lookup before | ||
1736 | performing a DNS lookup. | ||
1737 | The GNS NSS plugin has to be added to the "hosts" section in | ||
1738 | @file{/etc/nsswitch.conf} file before DNS related plugins: | ||
1739 | |||
1740 | @example | ||
1741 | ... | ||
1742 | hosts: files gns [NOTFOUND=return] dns mdns4_minimal mdns4 | ||
1743 | ... | ||
1744 | @end example | ||
1745 | |||
1746 | @noindent | ||
1747 | The @code{NOTFOUND=return} will ensure that if a @code{.gnu} name is not | ||
1748 | found in GNS it will not be queried in DNS. | ||
1749 | |||
1750 | @c @node Configuring GNS on W32 | ||
1751 | @c @subsubsection Configuring GNS on W32 | ||
1752 | |||
1753 | @c This document is a guide to configuring GNU Name System on W32-compatible | ||
1754 | @c platforms. | ||
1755 | |||
1756 | @c After GNUnet is installed, run the w32nsp-install tool: | ||
1757 | |||
1758 | @c @example | ||
1759 | @c w32nsp-install.exe libw32nsp-0.dll | ||
1760 | @c @end example | ||
1761 | |||
1762 | @c @noindent | ||
1763 | @c ('0' is the library version of W32 NSP; it might increase in the future, | ||
1764 | @c change the invocation accordingly). | ||
1765 | |||
1766 | @c This will install GNS namespace provider into the system and allow other | ||
1767 | @c applications to resolve names that end in '@strong{gnu}' | ||
1768 | @c and '@strong{zkey}'. Note that namespace provider requires | ||
1769 | @c gnunet-gns-helper-service-w32 to be running, as well as gns service | ||
1770 | @c itself (and its usual dependencies). | ||
1771 | |||
1772 | @c Namespace provider is hardcoded to connect to @strong{127.0.0.1:5353}, | ||
1773 | @c and this is where gnunet-gns-helper-service-w32 should be listening to | ||
1774 | @c (and is configured to listen to by default). | ||
1775 | |||
1776 | @c To uninstall the provider, run: | ||
1777 | |||
1778 | @c @example | ||
1779 | @c w32nsp-uninstall.exe | ||
1780 | @c @end example | ||
1781 | |||
1782 | @c @noindent | ||
1783 | @c (uses provider GUID to uninstall it, does not need a dll name). | ||
1784 | |||
1785 | @c Note that while MSDN claims that other applications will only be able to | ||
1786 | @c use the new namespace provider after re-starting, in reality they might | ||
1787 | @c stat to use it without that. Conversely, they might stop using the | ||
1788 | @c provider after it's been uninstalled, even if they were not re-started. | ||
1789 | @c W32 will not permit namespace provider library to be deleted or | ||
1790 | @c overwritten while the provider is installed, and while there is at least | ||
1791 | @c one process still using it (even after it was uninstalled). | ||
1792 | |||
1793 | @node GNS Proxy Setup | ||
1794 | @subsubsection GNS Proxy Setup | ||
1795 | |||
1796 | When using the GNU Name System (GNS) to browse the WWW, there are several | ||
1797 | issues that can be solved by adding the GNS Proxy to your setup: | ||
1798 | |||
1799 | @itemize @bullet | ||
1800 | |||
1801 | @item If the target website does not support GNS, it might assume that it | ||
1802 | is operating under some name in the legacy DNS system (such as | ||
1803 | example.com). It may then attempt to set cookies for that domain, and the | ||
1804 | web server might expect a @code{Host: example.com} header in the request | ||
1805 | from your browser. | ||
1806 | However, your browser might be using @code{example.gnu} for the | ||
1807 | @code{Host} header and might only accept (and send) cookies for | ||
1808 | @code{example.gnu}. The GNS Proxy will perform the necessary translations | ||
1809 | of the hostnames for cookies and HTTP headers (using the LEHO record for | ||
1810 | the target domain as the desired substitute). | ||
1811 | |||
1812 | @item If using HTTPS, the target site might include an SSL certificate | ||
1813 | which is either only valid for the LEHO domain or might match a TLSA | ||
1814 | record in GNS. However, your browser would expect a valid certificate for | ||
1815 | @code{example.gnu}, not for some legacy domain name. The proxy will | ||
1816 | validate the certificate (either against LEHO or TLSA) and then | ||
1817 | on-the-fly produce a valid certificate for the exchange, signed by your | ||
1818 | own CA. Assuming you installed the CA of your proxy in your browser's | ||
1819 | certificate authority list, your browser will then trust the | ||
1820 | HTTPS/SSL/TLS connection, as the hostname mismatch is hidden by the proxy. | ||
1821 | |||
1822 | @item Finally, the proxy will in the future indicate to the server that it | ||
1823 | speaks GNS, which will enable server operators to deliver GNS-enabled web | ||
1824 | sites to your browser (and continue to deliver legacy links to legacy | ||
1825 | browsers) | ||
1826 | @end itemize | ||
1827 | |||
1828 | @node Setup of the GNS CA | ||
1829 | @subsubsection Setup of the GNS CA | ||
1830 | |||
1831 | First you need to create a CA certificate that the proxy can use. | ||
1832 | To do so use the provided script gnunet-gns-proxy-ca: | ||
1833 | |||
1834 | @example | ||
1835 | $ gnunet-gns-proxy-setup-ca | ||
1836 | @end example | ||
1837 | |||
1838 | @noindent | ||
1839 | This will create a personal certification authority for you and add this | ||
1840 | authority to the firefox and chrome database. The proxy will use the this | ||
1841 | CA certificate to generate @code{*.gnu} client certificates on the fly. | ||
1842 | |||
1843 | Note that the proxy uses libcurl. Make sure your version of libcurl uses | ||
1844 | GnuTLS and NOT OpenSSL. The proxy will @b{not} work with libcurl compiled | ||
1845 | against OpenSSL. | ||
1846 | |||
1847 | You can check the configuration your libcurl was build with by | ||
1848 | running: | ||
1849 | |||
1850 | @example | ||
1851 | curl --version | ||
1852 | @end example | ||
1853 | |||
1854 | the output will look like this (without the linebreaks): | ||
1855 | |||
1856 | @example | ||
1857 | gnurl --version | ||
1858 | curl 7.56.0 (x86_64-unknown-linux-gnu) libcurl/7.56.0 \ | ||
1859 | GnuTLS/3.5.13 zlib/1.2.11 libidn2/2.0.4 | ||
1860 | Release-Date: 2017-10-08 | ||
1861 | Protocols: http https | ||
1862 | Features: AsynchDNS IDN IPv6 Largefile NTLM SSL libz \ | ||
1863 | TLS-SRP UnixSockets HTTPS-proxy | ||
1864 | @end example | ||
1865 | |||
1866 | @node Testing the GNS setup | ||
1867 | @subsubsection Testing the GNS setup | ||
1868 | |||
1869 | Now for testing purposes we can create some records in our zone to test | ||
1870 | the SSL functionality of the proxy: | ||
1871 | |||
1872 | @example | ||
1873 | $ gnunet-identity -C test | ||
1874 | $ gnunet-namestore -a -e "1 d" -n "homepage" \ | ||
1875 | -t A -V 131.159.74.67 -z test | ||
1876 | $ gnunet-namestore -a -e "1 d" -n "homepage" \ | ||
1877 | -t LEHO -V "gnunet.org" -z test | ||
1878 | @end example | ||
1879 | |||
1880 | @noindent | ||
1881 | At this point we can start the proxy. Simply execute | ||
1882 | |||
1883 | @example | ||
1884 | $ gnunet-arm -i gns-proxy | ||
1885 | @end example | ||
1886 | |||
1887 | To run the proxy at all times in the future, you should | ||
1888 | change your configuration as follows: | ||
1889 | |||
1890 | @example | ||
1891 | $ gnunet-config -s gns-proxy -o AUTOSTART -V YES | ||
1892 | @end example | ||
1893 | |||
1894 | @noindent | ||
1895 | Configure your browser to use this SOCKSv5 proxy using | ||
1896 | @code{localhost} on port 7777. | ||
1897 | If you use @command{Firefox} (or one of its derivatives/forks such as | ||
1898 | Icecat) you also have to go to @code{about:config} and set the key | ||
1899 | @code{network.proxy.socks_remote_dns} to @code{true}. | ||
1900 | |||
1901 | When you visit @code{https://homepage.test/}, you should get to the | ||
1902 | @code{https://gnunet.org/} frontpage and the browser (with the correctly | ||
1903 | configured proxy) should give you a valid SSL certificate for | ||
1904 | @code{homepage.gnu} and no warnings. It should look like this: | ||
1905 | |||
1906 | @c FIXME: Image does not exist, create it or save it from Drupal? | ||
1907 | @c @image{images/gnunethpgns.png,5in,, picture of homepage.gnu in Webbrowser} | ||
1908 | |||
1909 | @node Migrating existing DNS zones into GNS | ||
1910 | @subsubsection Migrating existing DNS zones into GNS | ||
1911 | |||
1912 | To migrate an existing zone into GNS use the Ascension tool. | ||
1913 | |||
1914 | Ascension transfers entire zones into GNS by doing incremental zone transfers | ||
1915 | and then adding the records to GNS. | ||
1916 | |||
1917 | Compared to the gnunet-zoneimport tool it strictly uses AXFR or IXFR depending | ||
1918 | on whether or not there exists a SOA record for the zone. If that is the case it | ||
1919 | will take the serial as a reference point and request the zone. The server will | ||
1920 | either answer the IXFR request with a correct incremental zone or with the | ||
1921 | entire zone, which depends on the server configuration. | ||
1922 | |||
1923 | You can find the source code here: @code{https://git.gnunet.org/ascension.git/} | ||
1924 | |||
1925 | The software can be installed into a Python virtual environment like this: | ||
1926 | @example | ||
1927 | $ python3 -m venv .venv | ||
1928 | $ source .venv/bin/activate | ||
1929 | $ python3 setup.py install | ||
1930 | @end example | ||
1931 | |||
1932 | Or installed globally like this: | ||
1933 | @example | ||
1934 | $ sudo python3 setup.py install | ||
1935 | @end example | ||
1936 | |||
1937 | Pip will then install all the necessary requirements that are needed to run | ||
1938 | Ascension. For development purposes a virtual environment should suffice. | ||
1939 | Keeping a virtual environment helps with keeping things tidy and prevents | ||
1940 | breaking of Ascension through a future Python update. | ||
1941 | |||
1942 | The advantage of using a virtual environment is, that all the dependencies can | ||
1943 | be installed separately in different versions without touching your systems | ||
1944 | Python installation and its dependencies. | ||
1945 | |||
1946 | Another way to install Ascension on Debian is to install the python3-ascension | ||
1947 | package. It can be found within the above mentioned Ascension git repository. | ||
1948 | This also adds a system user called ascension and runs a GNUnet peer in the | ||
1949 | background. Please note: This only works if a recent version of GNUnet is | ||
1950 | installed on your system. The version number of Ascension is chosen according | ||
1951 | to the required feature level of GNUnet: Ascension 0.11.5 is only | ||
1952 | compatible with GNUnet 0.11.5 or later and so on. | ||
1953 | As Debian's packages for GNUnet are outdated even in experimental, | ||
1954 | you will need to install GNUnet manually | ||
1955 | @xref{Installing GNUnet}. | ||
1956 | |||
1957 | Please check @xref{Migrating an existing DNS zone into GNS}, for usage manual | ||
1958 | of the tool. | ||
1959 | |||
1960 | @node Configuring the GNUnet VPN | ||
1961 | @subsection Configuring the GNUnet VPN | ||
1962 | |||
1963 | @menu | ||
1964 | * IPv4 address for interface:: | ||
1965 | * IPv6 address for interface:: | ||
1966 | * Configuring the GNUnet VPN DNS:: | ||
1967 | * Configuring the GNUnet VPN Exit Service:: | ||
1968 | * IP Address of external DNS resolver:: | ||
1969 | * IPv4 address for Exit interface:: | ||
1970 | * IPv6 address for Exit interface:: | ||
1971 | @end menu | ||
1972 | |||
1973 | Before configuring the GNUnet VPN, please make sure that system-wide DNS | ||
1974 | interception is configured properly as described in the section on the | ||
1975 | GNUnet DNS setup. @pxref{Configuring the GNU Name System}, | ||
1976 | if you haven't done so already. | ||
1977 | |||
1978 | The default options for the GNUnet VPN are usually sufficient to use | ||
1979 | GNUnet as a Layer 2 for your Internet connection. | ||
1980 | However, what you always have to specify is which IP protocol you want | ||
1981 | to tunnel: IPv4, IPv6 or both. | ||
1982 | Furthermore, if you tunnel both, you most likely should also tunnel | ||
1983 | all of your DNS requests. | ||
1984 | You theoretically can tunnel "only" your DNS traffic, but that usually | ||
1985 | makes little sense. | ||
1986 | |||
1987 | The other options as shown on the gnunet-setup tool are: | ||
1988 | |||
1989 | @node IPv4 address for interface | ||
1990 | @subsubsection IPv4 address for interface | ||
1991 | |||
1992 | This is the IPv4 address the VPN interface will get. You should pick a | ||
1993 | 'private' IPv4 network that is not yet in use for you system. For example, | ||
1994 | if you use @code{10.0.0.1/255.255.0.0} already, you might use | ||
1995 | @code{10.1.0.1/255.255.0.0}. | ||
1996 | If you use @code{10.0.0.1/255.0.0.0} already, then you might use | ||
1997 | @code{192.168.0.1/255.255.0.0}. | ||
1998 | If your system is not in a private IP-network, using any of the above will | ||
1999 | work fine. | ||
2000 | You should try to make the mask of the address big enough | ||
2001 | (@code{255.255.0.0} or, even better, @code{255.0.0.0}) to allow more | ||
2002 | mappings of remote IP Addresses into this range. | ||
2003 | However, even a @code{255.255.255.0} mask will suffice for most users. | ||
2004 | |||
2005 | @node IPv6 address for interface | ||
2006 | @subsubsection IPv6 address for interface | ||
2007 | |||
2008 | The IPv6 address the VPN interface will get. Here you can specify any | ||
2009 | non-link-local address (the address should not begin with @code{fe80:}). | ||
2010 | A subnet Unique Local Unicast (@code{fd00::/8} prefix) that you are | ||
2011 | currently not using would be a good choice. | ||
2012 | |||
2013 | @node Configuring the GNUnet VPN DNS | ||
2014 | @subsubsection Configuring the GNUnet VPN DNS | ||
2015 | |||
2016 | To resolve names for remote nodes, activate the DNS exit option. | ||
2017 | |||
2018 | @node Configuring the GNUnet VPN Exit Service | ||
2019 | @subsubsection Configuring the GNUnet VPN Exit Service | ||
2020 | |||
2021 | If you want to allow other users to share your Internet connection (yes, | ||
2022 | this may be dangerous, just as running a Tor exit node) or want to | ||
2023 | provide access to services on your host (this should be less dangerous, | ||
2024 | as long as those services are secure), you have to enable the GNUnet exit | ||
2025 | daemon. | ||
2026 | |||
2027 | You then get to specify which exit functions you want to provide. By | ||
2028 | enabling the exit daemon, you will always automatically provide exit | ||
2029 | functions for manually configured local services (this component of the | ||
2030 | system is under | ||
2031 | development and not documented further at this time). As for those | ||
2032 | services you explicitly specify the target IP address and port, there is | ||
2033 | no significant security risk in doing so. | ||
2034 | |||
2035 | Furthermore, you can serve as a DNS, IPv4 or IPv6 exit to the Internet. | ||
2036 | Being a DNS exit is usually pretty harmless. However, enabling IPv4 or | ||
2037 | IPv6-exit without further precautions may enable adversaries to access | ||
2038 | your local network, send spam, attack other systems from your Internet | ||
2039 | connection and do other mischiefs that will appear to come from your | ||
2040 | machine. This may or may not get you into legal trouble. | ||
2041 | If you want to allow IPv4 or IPv6-exit functionality, you should strongly | ||
2042 | consider adding additional firewall rules manually to protect your local | ||
2043 | network and to restrict outgoing TCP traffic (e.g. by not allowing access | ||
2044 | to port 25). While we plan to improve exit-filtering in the future, | ||
2045 | you're currently on your own here. | ||
2046 | Essentially, be prepared for any kind of IP-traffic to exit the respective | ||
2047 | TUN interface (and GNUnet will enable IP-forwarding and NAT for the | ||
2048 | interface automatically). | ||
2049 | |||
2050 | Additional configuration options of the exit as shown by the gnunet-setup | ||
2051 | tool are: | ||
2052 | |||
2053 | @node IP Address of external DNS resolver | ||
2054 | @subsubsection IP Address of external DNS resolver | ||
2055 | |||
2056 | If DNS traffic is to exit your machine, it will be send to this DNS | ||
2057 | resolver. You can specify an IPv4 or IPv6 address. | ||
2058 | |||
2059 | @node IPv4 address for Exit interface | ||
2060 | @subsubsection IPv4 address for Exit interface | ||
2061 | |||
2062 | This is the IPv4 address the Interface will get. Make the mask of the | ||
2063 | address big enough (255.255.0.0 or, even better, 255.0.0.0) to allow more | ||
2064 | mappings of IP addresses into this range. As for the VPN interface, any | ||
2065 | unused, private IPv4 address range will do. | ||
2066 | |||
2067 | @node IPv6 address for Exit interface | ||
2068 | @subsubsection IPv6 address for Exit interface | ||
2069 | |||
2070 | The public IPv6 address the interface will get. If your kernel is not a | ||
2071 | very recent kernel and you are willing to manually enable IPv6-NAT, the | ||
2072 | IPv6 address you specify here must be a globally routed IPv6 address of | ||
2073 | your host. | ||
2074 | |||
2075 | Suppose your host has the address @code{2001:4ca0::1234/64}, then | ||
2076 | using @code{2001:4ca0::1:0/112} would be fine (keep the first 64 bits, | ||
2077 | then change at least one bit in the range before the bitmask, in the | ||
2078 | example above we changed bit 111 from 0 to 1). | ||
2079 | |||
2080 | You may also have to configure your router to route traffic for the entire | ||
2081 | subnet (@code{2001:4ca0::1:0/112} for example) through your computer (this | ||
2082 | should be automatic with IPv6, but obviously anything can be | ||
2083 | disabled). | ||
2084 | |||
2085 | @node Bandwidth Configuration | ||
2086 | @subsection Bandwidth Configuration | ||
2087 | |||
2088 | You can specify how many bandwidth GNUnet is allowed to use to receive | ||
2089 | and send data. This is important for users with limited bandwidth or | ||
2090 | traffic volume. | ||
2091 | |||
2092 | @node Configuring NAT | ||
2093 | @subsection Configuring NAT | ||
2094 | |||
2095 | Most hosts today do not have a normal global IP address but instead are | ||
2096 | behind a router performing Network Address Translation (NAT) which assigns | ||
2097 | each host in the local network a private IP address. | ||
2098 | As a result, these machines cannot trivially receive inbound connections | ||
2099 | from the Internet. GNUnet supports NAT traversal to enable these machines | ||
2100 | to receive incoming connections from other peers despite their | ||
2101 | limitations. | ||
2102 | |||
2103 | In an ideal world, you can press the "Attempt automatic configuration" | ||
2104 | button in gnunet-setup to automatically configure your peer correctly. | ||
2105 | Alternatively, your distribution might have already triggered this | ||
2106 | automatic configuration during the installation process. | ||
2107 | However, automatic configuration can fail to determine the optimal | ||
2108 | settings, resulting in your peer either not receiving as many connections | ||
2109 | as possible, or in the worst case it not connecting to the network at all. | ||
2110 | |||
2111 | To manually configure the peer, you need to know a few things about your | ||
2112 | network setup. First, determine if you are behind a NAT in the first | ||
2113 | place. | ||
2114 | This is always the case if your IP address starts with "10.*" or | ||
2115 | "192.168.*". Next, if you have control over your NAT router, you may | ||
2116 | choose to manually configure it to allow GNUnet traffic to your host. | ||
2117 | If you have configured your NAT to forward traffic on ports 2086 (and | ||
2118 | possibly 1080) to your host, you can check the "NAT ports have been opened | ||
2119 | manually" option, which corresponds to the "PUNCHED_NAT" option in the | ||
2120 | configuration file. If you did not punch your NAT box, it may still be | ||
2121 | configured to support UPnP, which allows GNUnet to automatically | ||
2122 | configure it. In that case, you need to install the "upnpc" command, | ||
2123 | enable UPnP (or PMP) on your NAT box and set the "Enable NAT traversal | ||
2124 | via UPnP or PMP" option (corresponding to "ENABLE_UPNP" in the | ||
2125 | configuration file). | ||
2126 | |||
2127 | Some NAT boxes can be traversed using the autonomous NAT traversal method. | ||
2128 | This requires certain GNUnet components to be installed with "SUID" | ||
2129 | privileges on your system (so if you're installing on a system you do | ||
2130 | not have administrative rights to, this will not work). | ||
2131 | If you installed as 'root', you can enable autonomous NAT traversal by | ||
2132 | checking the "Enable NAT traversal using ICMP method". | ||
2133 | The ICMP method requires a way to determine your NAT's external (global) | ||
2134 | IP address. This can be done using either UPnP, DynDNS, or by manual | ||
2135 | configuration. If you have a DynDNS name or know your external IP address, | ||
2136 | you should enter that name under "External (public) IPv4 address" (which | ||
2137 | corresponds to the "EXTERNAL_ADDRESS" option in the configuration file). | ||
2138 | If you leave the option empty, GNUnet will try to determine your external | ||
2139 | IP address automatically (which may fail, in which case autonomous | ||
2140 | NAT traversal will then not work). | ||
2141 | |||
2142 | Finally, if you yourself are not behind NAT but want to be able to | ||
2143 | connect to NATed peers using autonomous NAT traversal, you need to check | ||
2144 | the "Enable connecting to NATed peers using ICMP method" box. | ||
2145 | |||
2146 | |||
2147 | @node Peer configuration for distributors (e.g. Operating Systems) | ||
2148 | @subsection Peer configuration for distributors (e.g. Operating Systems) | ||
2149 | |||
2150 | The "GNUNET_DATA_HOME" in "[PATHS]" in @file{/etc/gnunet.conf} should be | ||
2151 | manually set to "/var/lib/gnunet/data/" as the default | ||
2152 | "~/.local/share/gnunet/" is probably not that appropriate in this case. | ||
2153 | Similarly, distributors may consider pointing "GNUNET_RUNTIME_DIR" to | ||
2154 | "/var/run/gnunet/" and "GNUNET_HOME" to "/var/lib/gnunet/". Also, should a | ||
2155 | distributor decide to override system defaults, all of these changes | ||
2156 | should be done in a custom @file{/etc/gnunet.conf} and not in the files | ||
2157 | in the @file{config.d/} directory. | ||
2158 | |||
2159 | Given the proposed access permissions, the "gnunet-setup" tool must be | ||
2160 | run as use "gnunet" (and with option "-c /etc/gnunet.conf" so that it | ||
2161 | modifies the system configuration). As always, gnunet-setup should be run | ||
2162 | after the GNUnet peer was stopped using "gnunet-arm -e". Distributors | ||
2163 | might want to include a wrapper for gnunet-setup that allows the | ||
2164 | desktop-user to "sudo" (e.g. using gtksudo) to the "gnunet" user account | ||
2165 | and then runs "gnunet-arm -e", "gnunet-setup" and "gnunet-arm -s" in | ||
2166 | sequence. | ||
2167 | |||
2168 | @node Config Leftovers | ||
2169 | @section Config Leftovers | ||
2170 | |||
2171 | This section describes how to start a GNUnet peer. It assumes that you | ||
2172 | have already compiled and installed GNUnet and its' dependencies. | ||
2173 | Before you start a GNUnet peer, you may want to create a configuration | ||
2174 | file using gnunet-setup (but you do not have to). | ||
2175 | Sane defaults should exist in your | ||
2176 | @file{$GNUNET_PREFIX/share/gnunet/config.d/} directory, so in practice | ||
2177 | you could simply start without any configuration. If you want to | ||
2178 | configure your peer later, you need to stop it before invoking the | ||
2179 | @code{gnunet-setup} tool to customize further and to test your | ||
2180 | configuration (@code{gnunet-setup} has built-in test functions). | ||
2181 | |||
2182 | The most important option you might have to still set by hand is in | ||
2183 | [PATHS]. Here, you use the option "GNUNET_HOME" to specify the path where | ||
2184 | GNUnet should store its data. | ||
2185 | It defaults to @code{$HOME/}, which again should work for most users. | ||
2186 | Make sure that the directory specified as GNUNET_HOME is writable to | ||
2187 | the user that you will use to run GNUnet (note that you can run frontends | ||
2188 | using other users, GNUNET_HOME must only be accessible to the user used to | ||
2189 | run the background processes). | ||
2190 | |||
2191 | You will also need to make one central decision: should all of GNUnet be | ||
2192 | run under your normal UID, or do you want distinguish between system-wide | ||
2193 | (user-independent) GNUnet services and personal GNUnet services. The | ||
2194 | multi-user setup is slightly more complicated, but also more secure and | ||
2195 | generally recommended. | ||
2196 | |||
2197 | @menu | ||
2198 | * The Single-User Setup:: | ||
2199 | * The Multi-User Setup:: | ||
2200 | * Killing GNUnet services:: | ||
2201 | * Access Control for GNUnet:: | ||
2202 | @end menu | ||
2203 | |||
2204 | @node The Single-User Setup | ||
2205 | @subsection The Single-User Setup | ||
2206 | |||
2207 | For the single-user setup, you do not need to do anything special and can | ||
2208 | just start the GNUnet background processes using @code{gnunet-arm}. | ||
2209 | By default, GNUnet looks in @file{~/.config/gnunet.conf} for a | ||
2210 | configuration (or @code{$XDG_CONFIG_HOME/gnunet.conf} if@ | ||
2211 | @code{$XDG_CONFIG_HOME} is defined). If your configuration lives | ||
2212 | elsewhere, you need to pass the @code{-c FILENAME} option to all GNUnet | ||
2213 | commands. | ||
2214 | |||
2215 | Assuming the configuration file is called @file{~/.config/gnunet.conf}, | ||
2216 | you start your peer using the @code{gnunet-arm} command (say as user | ||
2217 | @code{gnunet}) using: | ||
2218 | |||
2219 | @example | ||
2220 | gnunet-arm -c ~/.config/gnunet.conf -s | ||
2221 | @end example | ||
2222 | |||
2223 | @noindent | ||
2224 | The "-s" option here is for "start". The command should return almost | ||
2225 | instantly. If you want to stop GNUnet, you can use: | ||
2226 | |||
2227 | @example | ||
2228 | gnunet-arm -c ~/.config/gnunet.conf -e | ||
2229 | @end example | ||
2230 | |||
2231 | @noindent | ||
2232 | The "-e" option here is for "end". | ||
2233 | |||
2234 | Note that this will only start the basic peer, no actual applications | ||
2235 | will be available. | ||
2236 | If you want to start the file-sharing service, use (after starting | ||
2237 | GNUnet): | ||
2238 | |||
2239 | @example | ||
2240 | gnunet-arm -c ~/.config/gnunet.conf -i fs | ||
2241 | @end example | ||
2242 | |||
2243 | @noindent | ||
2244 | The "-i fs" option here is for "initialize" the "fs" (file-sharing) | ||
2245 | application. You can also selectively kill only file-sharing support using | ||
2246 | |||
2247 | @example | ||
2248 | gnunet-arm -c ~/.config/gnunet.conf -k fs | ||
2249 | @end example | ||
2250 | |||
2251 | @noindent | ||
2252 | Assuming that you want certain services (like file-sharing) to be always | ||
2253 | automatically started whenever you start GNUnet, you can activate them by | ||
2254 | setting "IMMEDIATE_START=YES" in the respective section of the configuration | ||
2255 | file (for example, "[fs]"). Then GNUnet with file-sharing support would | ||
2256 | be started whenever you@ enter: | ||
2257 | |||
2258 | @example | ||
2259 | gnunet-arm -c ~/.config/gnunet.conf -s | ||
2260 | @end example | ||
2261 | |||
2262 | @noindent | ||
2263 | Alternatively, you can combine the two options: | ||
2264 | |||
2265 | @example | ||
2266 | gnunet-arm -c ~/.config/gnunet.conf -s -i fs | ||
2267 | @end example | ||
2268 | |||
2269 | @noindent | ||
2270 | Using @code{gnunet-arm} is also the preferred method for initializing | ||
2271 | GNUnet from @code{init}. | ||
2272 | |||
2273 | Finally, you should edit your @code{crontab} (using the @code{crontab} | ||
2274 | command) and insert a line@ | ||
2275 | |||
2276 | @example | ||
2277 | @@reboot gnunet-arm -c ~/.config/gnunet.conf -s | ||
2278 | @end example | ||
2279 | |||
2280 | to automatically start your peer whenever your system boots. | ||
2281 | |||
2282 | @node The Multi-User Setup | ||
2283 | @subsection The Multi-User Setup | ||
2284 | |||
2285 | This requires you to create a user @code{gnunet} and an additional group | ||
2286 | @code{gnunetdns}, prior to running @code{make install} during | ||
2287 | installation. | ||
2288 | Then, you create a configuration file @file{/etc/gnunet.conf} which should | ||
2289 | contain the lines:@ | ||
2290 | |||
2291 | @example | ||
2292 | [arm] | ||
2293 | START_SYSTEM_SERVICES = YES | ||
2294 | START_USER_SERVICES = NO | ||
2295 | @end example | ||
2296 | |||
2297 | @noindent | ||
2298 | Then, perform the same steps to run GNUnet as in the per-user | ||
2299 | configuration, except as user @code{gnunet} (including the | ||
2300 | @code{crontab} installation). | ||
2301 | You may also want to run @code{gnunet-setup} to configure your peer | ||
2302 | (databases, etc.). | ||
2303 | Make sure to pass @code{-c /etc/gnunet.conf} to all commands. If you | ||
2304 | run @code{gnunet-setup} as user @code{gnunet}, you might need to change | ||
2305 | permissions on @file{/etc/gnunet.conf} so that the @code{gnunet} user can | ||
2306 | write to the file (during setup). | ||
2307 | |||
2308 | Afterwards, you need to perform another setup step for each normal user | ||
2309 | account from which you want to access GNUnet. First, grant the normal user | ||
2310 | (@code{$USER}) permission to the group gnunet: | ||
2311 | |||
2312 | @example | ||
2313 | # adduser $USER gnunet | ||
2314 | @end example | ||
2315 | |||
2316 | @noindent | ||
2317 | Then, create a configuration file in @file{~/.config/gnunet.conf} for the | ||
2318 | $USER with the lines: | ||
2319 | |||
2320 | @example | ||
2321 | [arm] | ||
2322 | START_SYSTEM_SERVICES = NO | ||
2323 | START_USER_SERVICES = YES | ||
2324 | @end example | ||
2325 | |||
2326 | @noindent | ||
2327 | This will ensure that @code{gnunet-arm} when started by the normal user | ||
2328 | will only run services that are per-user, and otherwise rely on the | ||
2329 | system-wide services. | ||
2330 | Note that the normal user may run gnunet-setup, but the | ||
2331 | configuration would be ineffective as the system-wide services will use | ||
2332 | @file{/etc/gnunet.conf} and ignore options set by individual users. | ||
2333 | |||
2334 | Again, each user should then start the peer using | ||
2335 | @file{gnunet-arm -s} --- and strongly consider adding logic to start | ||
2336 | the peer automatically to their crontab. | ||
2337 | |||
2338 | Afterwards, you should see two (or more, if you have more than one USER) | ||
2339 | @code{gnunet-service-arm} processes running in your system. | ||
2340 | |||
2341 | @node Killing GNUnet services | ||
2342 | @subsection Killing GNUnet services | ||
2343 | |||
2344 | It is not necessary to stop GNUnet services explicitly when shutting | ||
2345 | down your computer. | ||
2346 | |||
2347 | It should be noted that manually killing "most" of the | ||
2348 | @code{gnunet-service} processes is generally not a successful method for | ||
2349 | stopping a peer (since @code{gnunet-service-arm} will instantly restart | ||
2350 | them). The best way to explicitly stop a peer is using | ||
2351 | @code{gnunet-arm -e}; note that the per-user services may need to be | ||
2352 | terminated before the system-wide services will terminate normally. | ||
2353 | |||
2354 | @node Access Control for GNUnet | ||
2355 | @subsection Access Control for GNUnet | ||
2356 | |||
2357 | This chapter documents how we plan to make access control work within the | ||
2358 | GNUnet system for a typical peer. It should be read as a best-practice | ||
2359 | installation guide for advanced users and builders of binary | ||
2360 | distributions. The recommendations in this guide apply to POSIX-systems | ||
2361 | with full support for UNIX domain sockets only. | ||
2362 | |||
2363 | Note that this is an advanced topic. The discussion presumes a very good | ||
2364 | understanding of users, groups and file permissions. Normal users on | ||
2365 | hosts with just a single user can just install GNUnet under their own | ||
2366 | account (and possibly allow the installer to use SUDO to grant additional | ||
2367 | permissions for special GNUnet tools that need additional rights). | ||
2368 | The discussion below largely applies to installations where multiple users | ||
2369 | share a system and to installations where the best possible security is | ||
2370 | paramount. | ||
2371 | |||
2372 | A typical GNUnet system consists of components that fall into four | ||
2373 | categories: | ||
2374 | |||
2375 | @table @asis | ||
2376 | |||
2377 | @item User interfaces | ||
2378 | User interfaces are not security sensitive and are supposed to be run and | ||
2379 | used by normal system users. | ||
2380 | The GTK GUIs and most command-line programs fall into this category. | ||
2381 | Some command-line tools (like gnunet-transport) should be excluded as they | ||
2382 | offer low-level access that normal users should not need. | ||
2383 | @item System services and support tools | ||
2384 | System services should always run and offer services that can then be | ||
2385 | accessed by the normal users. | ||
2386 | System services do not require special permissions, but as they are not | ||
2387 | specific to a particular user, they probably should not run as a | ||
2388 | particular user. Also, there should typically only be one GNUnet peer per | ||
2389 | host. System services include the gnunet-service and gnunet-daemon | ||
2390 | programs; support tools include command-line programs such as gnunet-arm. | ||
2391 | @item Privileged helpers | ||
2392 | Some GNUnet components require root rights to open raw sockets or perform | ||
2393 | other special operations. These gnunet-helper binaries are typically | ||
2394 | installed SUID and run from services or daemons. | ||
2395 | @item Critical services | ||
2396 | Some GNUnet services (such as the DNS service) can manipulate the service | ||
2397 | in deep and possibly highly security sensitive ways. For example, the DNS | ||
2398 | service can be used to intercept and alter any DNS query originating from | ||
2399 | the local machine. Access to the APIs of these critical services and their | ||
2400 | privileged helpers must be tightly controlled. | ||
2401 | @end table | ||
2402 | |||
2403 | @c FIXME: The titles of these chapters are too long in the index. | ||
2404 | |||
2405 | @menu | ||
2406 | * Recommendation - Disable access to services via TCP:: | ||
2407 | * Recommendation - Run most services as system user "gnunet":: | ||
2408 | * Recommendation - Control access to services using group "gnunet":: | ||
2409 | * Recommendation - Limit access to certain SUID binaries by group "gnunet":: | ||
2410 | * Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns":: | ||
2411 | * Differences between "make install" and these recommendations:: | ||
2412 | @end menu | ||
2413 | |||
2414 | @node Recommendation - Disable access to services via TCP | ||
2415 | @subsubsection Recommendation - Disable access to services via TCP | ||
2416 | |||
2417 | GNUnet services allow two types of access: via TCP socket or via UNIX | ||
2418 | domain socket. | ||
2419 | If the service is available via TCP, access control can only be | ||
2420 | implemented by restricting connections to a particular range of IP | ||
2421 | addresses. | ||
2422 | This is acceptable for non-critical services that are supposed to be | ||
2423 | available to all users on the local system or local network. | ||
2424 | However, as TCP is generally less efficient and it is rarely the case | ||
2425 | that a single GNUnet peer is supposed to serve an entire local network, | ||
2426 | the default configuration should disable TCP access to all GNUnet | ||
2427 | services on systems with support for UNIX domain sockets. | ||
2428 | Since GNUnet 0.9.2, configuration files with TCP access disabled should be | ||
2429 | generated by default. Users can re-enable TCP access to particular | ||
2430 | services simply by specifying a non-zero port number in the section of | ||
2431 | the respective service. | ||
2432 | |||
2433 | |||
2434 | @node Recommendation - Run most services as system user "gnunet" | ||
2435 | @subsubsection Recommendation - Run most services as system user "gnunet" | ||
2436 | |||
2437 | GNUnet's main services should be run as a separate user "gnunet" in a | ||
2438 | special group "gnunet". | ||
2439 | The user "gnunet" should start the peer using "gnunet-arm -s" during | ||
2440 | system startup. The home directory for this user should be | ||
2441 | @file{/var/lib/gnunet} and the configuration file should be | ||
2442 | @file{/etc/gnunet.conf}. | ||
2443 | Only the @code{gnunet} user should have the right to access | ||
2444 | @file{/var/lib/gnunet} (@emph{mode: 700}). | ||
2445 | |||
2446 | @node Recommendation - Control access to services using group "gnunet" | ||
2447 | @subsubsection Recommendation - Control access to services using group "gnunet" | ||
2448 | |||
2449 | Users that should be allowed to use the GNUnet peer should be added to the | ||
2450 | group "gnunet". Using GNUnet's access control mechanism for UNIX domain | ||
2451 | sockets, those services that are considered useful to ordinary users | ||
2452 | should be made available by setting "UNIX_MATCH_GID=YES" for those | ||
2453 | services. | ||
2454 | Again, as shipped, GNUnet provides reasonable defaults. | ||
2455 | Permissions to access the transport and core subsystems might additionally | ||
2456 | be granted without necessarily causing security concerns. | ||
2457 | Some services, such as DNS, must NOT be made accessible to the "gnunet" | ||
2458 | group (and should thus only be accessible to the "gnunet" user and | ||
2459 | services running with this UID). | ||
2460 | |||
2461 | @node Recommendation - Limit access to certain SUID binaries by group "gnunet" | ||
2462 | @subsubsection Recommendation - Limit access to certain SUID binaries by group "gnunet" | ||
2463 | |||
2464 | Most of GNUnet's SUID binaries should be safe even if executed by normal | ||
2465 | users. However, it is possible to reduce the risk a little bit more by | ||
2466 | making these binaries owned by the group "gnunet" and restricting their | ||
2467 | execution to user of the group "gnunet" as well (4750). | ||
2468 | |||
2469 | @node Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns" | ||
2470 | @subsubsection Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns" | ||
2471 | |||
2472 | A special group "gnunetdns" should be created for controlling access to | ||
2473 | the "gnunet-helper-dns". | ||
2474 | The binary should then be owned by root and be in group "gnunetdns" and | ||
2475 | be installed SUID and only be group-executable (2750). | ||
2476 | @b{Note that the group "gnunetdns" should have no users in it at all, | ||
2477 | ever.} | ||
2478 | The "gnunet-service-dns" program should be executed by user "gnunet" (via | ||
2479 | gnunet-service-arm) with the binary owned by the user "root" and the group | ||
2480 | "gnunetdns" and be SGID (2700). This way, @strong{only} | ||
2481 | "gnunet-service-dns" can change its group to "gnunetdns" and execute the | ||
2482 | helper, and the helper can then run as root (as per SUID). | ||
2483 | Access to the API offered by "gnunet-service-dns" is in turn restricted | ||
2484 | to the user "gnunet" (not the group!), which means that only | ||
2485 | "benign" services can manipulate DNS queries using "gnunet-service-dns". | ||
2486 | |||
2487 | @node Differences between "make install" and these recommendations | ||
2488 | @subsubsection Differences between "make install" and these recommendations | ||
2489 | |||
2490 | The current build system does not set all permissions automatically based | ||
2491 | on the recommendations above. In particular, it does not use the group | ||
2492 | "gnunet" at all (so setting gnunet-helpers other than the | ||
2493 | gnunet-helper-dns to be owned by group "gnunet" must be done manually). | ||
2494 | Furthermore, 'make install' will silently fail to set the DNS binaries to | ||
2495 | be owned by group "gnunetdns" unless that group already exists (!). | ||
2496 | An alternative name for the "gnunetdns" group can be specified using the | ||
2497 | @code{--with-gnunetdns=GRPNAME} configure option. | ||