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