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