aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil <phil.buschmann@tum.de>2018-06-13 23:40:25 +0200
committerPhil <phil.buschmann@tum.de>2018-06-13 23:40:25 +0200
commit688bd873c3cb463090039f64b9f13b9a029695dc (patch)
treebc74703d4912da712d82f869237057405ad49060
parenta006f82603921d7b6775c7a7be60c7f388c6a927 (diff)
parentc9b52f6ce67209e000d2f679a34c23bd4724b243 (diff)
downloadgnunet-688bd873c3cb463090039f64b9f13b9a029695dc.tar.gz
gnunet-688bd873c3cb463090039f64b9f13b9a029695dc.zip
-Merge branch 'master' of ssh://gnunet.org/gnunet into gsoc2018/rest_api
-rw-r--r--AUTHORS9
-rw-r--r--README255
-rw-r--r--contrib/Makefile.am2
-rw-r--r--contrib/ci/docker/Dockerfile59
-rw-r--r--contrib/scripts/documentation/gnunet-doc.scm66
-rwxr-xr-xcontrib/scripts/gnunet-bugreport (renamed from contrib/scripts/report.sh)2
-rw-r--r--contrib/services/openrc/gnunet.initd82
-rw-r--r--doc/Makefile.am3
-rw-r--r--doc/documentation/Makefile.am1
-rw-r--r--doc/documentation/chapters/developer.texi384
-rw-r--r--doc/documentation/chapters/installation.texi4149
-rw-r--r--doc/documentation/chapters/user.texi1972
-rw-r--r--doc/documentation/gnunet.texi33
-rw-r--r--doc/system_specific/FROM_SOURCE1423
-rw-r--r--doc/system_specific/outdated-and-old-installation-instructions.txt (renamed from doc/outdated-and-old-installation-instructions.txt)0
-rw-r--r--guix-env.scm3
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/curl/curl.c19
-rw-r--r--src/datacache/plugin_datacache_heap.c3
-rw-r--r--src/datacache/plugin_datacache_postgres.c33
-rw-r--r--src/datacache/test_datacache.c73
-rw-r--r--src/datacache/test_datacache_quota.c31
-rw-r--r--src/dht/gnunet-service-dht_datacache.c5
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c76
-rw-r--r--src/gns/gnunet-service-gns_resolver.c16
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c12
-rw-r--r--src/include/gnunet_curl_lib.h11
-rw-r--r--src/my/my.c26
-rw-r--r--src/my/my_query_helper.c22
-rw-r--r--src/pq/pq_query_helper.c58
-rw-r--r--src/pq/pq_result_helper.c85
-rw-r--r--src/rps/gnunet-rps-profiler.c21
-rw-r--r--src/rps/rps-test_util.c133
-rw-r--r--src/rps/rps-test_util.h8
34 files changed, 4646 insertions, 4430 deletions
diff --git a/AUTHORS b/AUTHORS
index ef7e2eb9d..718038ab8 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -113,12 +113,17 @@ GNU with Net : Christian Muellner <chris@flop.de>
113AFS Face : Alex Jones <alexrjones@ntlworld.com> 113AFS Face : Alex Jones <alexrjones@ntlworld.com>
114new GNU in Net: Nicklas Larsson <whybill@gmail.com> 114new GNU in Net: Nicklas Larsson <whybill@gmail.com>
115 115
116Maintainers: 116Package Maintainers (current and previous):
117FreeBSD : Kirill Ponomarew <ponomarew@oberon.net> 117FreeBSD : Kirill Ponomarew <ponomarew@oberon.net>
118Debian GNU/Linux: Daniel Baumann <daniel.baumann@panthera-systems.net> 118Debian GNU/Linux: Bertrand Marc <bmarc@debian.org>
119 Daniel Baumann <daniel.baumann@panthera-systems.net>
120 Arnaud Kyheng
121 Glenn McGrath <bug1@debian.org>
122Nix: : viric, rahul
119OpenWrt/LEDE : Daniel Golle <daniel@makrotopia.org> 123OpenWrt/LEDE : Daniel Golle <daniel@makrotopia.org>
120OS X : Jussi Eloranta <eloranta@cc.jyu.fi> 124OS X : Jussi Eloranta <eloranta@cc.jyu.fi>
121Gentoo : Carlo von lynX <psyc://loupsycedyglgamf.onion/~lynX> 125Gentoo : Carlo von lynX <psyc://loupsycedyglgamf.onion/~lynX>
126 Nils Gillmann <ng0@n0.is>
122 127
123If you have contributed and are not listed here, please 128If you have contributed and are not listed here, please
124notify one of the maintainers in order to be added. 129notify one of the maintainers in order to be added.
diff --git a/README b/README
index 61c54b4f4..dc0b4b8fb 100644
--- a/README
+++ b/README
@@ -22,7 +22,7 @@ in src/include/gnunet_util_lib.h to point to the source code of your
22fork! 22fork!
23 23
24Additional documentation about GNUnet can be found at 24Additional documentation about GNUnet can be found at
25https://gnunet.org/ and in the doc/ folder. 25https://gnunet.org/ and in the 'doc/' folder.
26 26
27 27
28Dependencies: 28Dependencies:
@@ -30,6 +30,54 @@ Dependencies:
30 30
31These are the direct dependencies for running GNUnet: 31These are the direct dependencies for running GNUnet:
32 32
33- libmicrohttpd >= 0.9.42
34- libgcrypt >= 1.6
35- libgnurl >= 7.35.0 (recommended, available from https://gnunet.org/gnurl)
36- libcurl >= 7.35.0 (alternative to libgnurl)
37- libunistring >= 0.9.2
38- gnutls >= 3.2.12 (highly recommended a gnutls linked against libunbound)
39- libidn >= 1.0
40- libextractor >= 0.6.1 (highly recommended)
41- openssl >= 1.0 (binary, used to generate X.509 certificate)
42- libltdl >= 2.2 (part of GNU libtool)
43- sqlite >= 3.8 (default database, required)
44- mysql >= 5.1 (alternative to sqlite)
45- postgres >= 9.5 (alternative to sqlite)
46- Texinfo >= 5.2 [*1]
47- which (for the bootstrap script)
48- gettext
49- zlib
50- pkg-config
51
52
53These are the dependencies for GNUnet's testsuite:
54
55- Bash (optional (?), for some tests)
56- python >= 2.7 (optional, only python 2.7 is supported)
57- python-future >= 2.7 (optional, only python 2.7 is supported)
58
59
60These are the optional dependencies:
61
62- libopus >= 1.0.1 (optional, for experimental conversation tool)
63- libpulse >= 2.0 (optional, for experimental conversation tool)
64- libogg >= 1.3.0 (optional, for experimental conversation tool)
65- libnss (optional, certtool binary (for convenient installation of GNS proxy))
66- python-future (optional, for some testcases and utilities)
67- python-zbar >= 0.10 (optional, for gnunet-qr)
68- TeX Live >= 2012 (optional, for gnunet-bcd[*])
69- libglpk >= 4.45 (optional, for experimental code)
70- perl5 (optional, for some utilities)
71- python >= 2.7 (optional, for gnunet-qr, only python 2.7 is supported)
72- bluez (optional, for bluetooth support)
73- miniupnpc
74- libpbc >= 0.5.14 (optional, for Attribute-Based Encryption and Identity Provider functionality)
75- libgabe (optional, for Attribute-Based Encryption and Identity Provider functionality,
76 from https://github.com/schanzen/libgabe)
77
78=======
79These are the direct dependencies for running GNUnet:
80
33- libmicrohttpd >= 0.9.52 81- libmicrohttpd >= 0.9.52
34- libgcrypt >= 1.6 82- libgcrypt >= 1.6
35- libgnurl >= 7.35.0 (available from https://gnunet.org/gnurl) 83- libgnurl >= 7.35.0 (available from https://gnunet.org/gnurl)
@@ -51,53 +99,134 @@ These are the direct dependencies for running GNUnet:
51- libglpk >= 4.45 (optional for experimental code) 99- libglpk >= 4.45 (optional for experimental code)
52 100
53Recommended autotools for compiling the git version are: 101Recommended autotools for compiling the git version are:
54- autoconf >= 2.59 102
55- automake >= 1.11.1 103- autoconf >= 2.59
56- libtool >= 2.2 104- automake >= 1.11.1
105- libtool >= 2.2
57 106
58 107
59[*] Mandatory for compiling the info output of the documentation, 108[*] Mandatory for compiling the info output of the documentation,
60a limited subset ('texlive-tiny' in Guix) is enough. 109 a limited subset ('texlive-tiny' in Guix) is enough.
110
111[*1] The default configuration is to build the info output of the
112 documentation, and therefore require texinfo. You can pass
113 '--disable-documentation' to the configure script to change this.
114
115Requirements
116============
61 117
62[*1] The default configuration is to build the info output of the documentation, 118GNUnet's directed acyclic graph (DAG) will require around 0.74 GiB
63and therefore require texinfo. You can pass --disable-documentation to 119Diskspace, with GNUNet itself taking around 9.2 MiB reported by the
64the configure script to change this. 120build on GNU Guix.
65 121
66How to install? 122How to install?
67=============== 123===============
68 124
69The fastest way is to use a binary package if it is available for your 125
70system. For a more detailed description, read the installation 126binary packages
71instructions on the webpage at https://gnunet.org/installation. 127~~~~~~~~~~~~~~~
128
129We recommend to use binary packages provided by your Operating System's
130package manager. GNUnet is reportedly available for at least:
131
132Gentoo (via the 'youbroketheinternet' overlay), GNU Guix, Nix,
133Debian, ALT Linux, Archlinux, Deepin, Devuan, Hyperbola, Kali Linux,
134LEDE/OpenWRT, Manjaro, Parabola, Pardus, Parrot, PureOS, Raspbian,
135Rosa, Trisquel, and Ubuntu.
136
137If GNUnet is available for your Operating System and it is missing,
138send us feedback so that we can add it to this list. Furthermore, if
139you are interested in packaging GNUnet for your Operating System,
140get in touch with us at gnunet-developers@gnu.org if you require
141help with this job.
142
143If you were using an Operating System with the apt package manager,
144GNUnet could be installed as simple as:
145
146$ apt-get install gnunet
147
72Generic installation instructions are in the INSTALL file in this 148Generic installation instructions are in the INSTALL file in this
73directory. 149directory.
74 150
151Scope of Operating System support
152~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153We actively support GNUnet on a broad range of Free Software Operating
154Systems.
155
156For proprietary Operating Systems, like for example Microsoft Windows
157or Apple OS X, we accept patches if they don't break anything for
158other Operating Systems.
159If you are implementing support for a proprietary Operating System,
160you should be aware that progress in our codebase could break
161functionality on your OS and cause unpredicted behavior we can
162not test. However, we do not break support on Operating Systems
163with malicious intent.
164Regressions which do occur on these Operating Systems are 3rd
165class issues and we expect users and developers of these
166Operating Systems to send proposed patches to fix regressions.
167
168For more information about our stand on some of the motivating
169points here, read the 'Philosophy' Chapter of our handbook.
170
171Building GNUnet from source
172~~~~~~~~~~~~~~~~~~~~~~~~~~~
173
174IMPORTANT: You can read further notes about compilation from source in
175the 'doc/FILENAME' document, which includes notes about specific
176requirements for operating systems aswell. If you are a package
177mantainer for an Operating System we invite you to add your notes if
178you feel it is necessary and can not be covered in your Operating
179System's documentation.
180
181
182Some Operating Systems currently require you to build GNUnet from
183source.
184If you are building GNUnet from source you are either interested
185in furthering its development (we have further notes for developer
186builds in our 'GNUnet Developer Handbook') or your Operating System
187simply lacks support for a binary package at the moment.
188Two prominent examples which currently lack cross-compilation
189support in GNUnet (and native binaries) are MS Windows and Apple macOS.
190For macOS we recommend you to do the build process via Homebrew and a
191recent XCode installation.
192Compilation for MS Windows can ...
193
75Note that some functions of GNUnet require "root" access. GNUnet will 194Note that some functions of GNUnet require "root" access. GNUnet will
76install (tiny) SUID binaries for those functions is you run "make 195install (tiny) SUID binaries for those functions is you run "make
77install" as root. If you do not, GNUnet will still work, but some 196install" as root. If you do not, GNUnet will still work, but some
78functionality will not be available (including certain forms of NAT 197functionality will not be available (including certain forms of NAT
79traversal). 198traversal).
80 199
81GNUnet requires the GNU MP library (http://www.gnu.org/software/gmp/) 200GNUnet requires the GNU MP library (https://www.gnu.org/software/gmp/)
82and libgcrypt (http://www.gnupg.org/). You can specify the path to 201and libgcrypt (https://www.gnupg.org/). You can specify the path to
83libgcrypt by passing "--with-gcrypt=PATH" to configure. You will also 202libgcrypt by passing "--with-gcrypt=PATH" to configure. You will also
84need either sqlite (http://www.sqlite.org/), MySQL 203need either sqlite (http://www.sqlite.org/), MySQL
85(http://www.mysql.org/) or PostGres (http://www.postgres.org/). 204(http://www.mysql.org/) or PostGres (http://www.postgres.org/).
86 205
87If you install from source, you need to install GNU libextractor first 206If you install from source, you need to install GNU libextractor first
88(download from http://www.gnu.org/software/libextractor/). We also 207(download from https://www.gnu.org/software/libextractor/). We also
89recommend installing GNU libmicrohttpd (download from 208recommend installing GNU libmicrohttpd (download from
90http://www.gnu.org/software/libmicrohttpd/). Then you can start the 209https://www.gnu.org/software/libmicrohttpd/). Furthermore we recommend
91actual GNUnet compilation and installation process with: 210libgnurl (from https://gnunet.org/gnurl).
211Then you can start the actual GNUnet compilation process with:
212
92 213
93$ export GNUNET_PREFIX=/usr/local/lib # or other directory of your choice 214$ export GNUNET_PREFIX=/usr/local/lib # or other directory of your choice
94# addgroup gnunetdns 215# addgroup gnunetdns
95# adduser --system --home "/var/lib/gnunet" --group gnunet --shell /bin/sh 216# adduser --system --home "/var/lib/gnunet" --group gnunet --shell /bin/sh
96# ./configure --prefix=$GNUNET_PREFIX/.. --with-extractor=$LE_PREFIX 217# ./configure --prefix=$GNUNET_PREFIX/.. --with-extractor=$LE_PREFIX
97$ make 218$ make
219
220And finally install GNUnet with:
221
98# make install 222# make install
223
224Complete the process by either adjusting one of our example service files
225in 'contrib/services' or by running:
226
99# sudo -u gnunet gnunet-arm -s 227# sudo -u gnunet gnunet-arm -s
100 228
229
101Note that running the 'configure' and 'make install' steps as 230Note that running the 'configure' and 'make install' steps as
102root (or with sudo) is required as some parts of the installation 231root (or with sudo) is required as some parts of the installation
103require the creation of SUID binaries. The installation will 232require the creation of SUID binaries. The installation will
@@ -131,7 +260,7 @@ certain binaries that require additional priviledges will not be
131installed properly (and autonomous NAT traversal, WLAN, DNS/GNS and 260installed properly (and autonomous NAT traversal, WLAN, DNS/GNS and
132the VPN will then not work). 261the VPN will then not work).
133 262
134If you run 'configure' and 'make install' as root or use the SUDO 263If you run 'configure' and 'make install' as root or use the '--with-sudo'
135option, GNUnet's build system will install "libnss_gns*" libraries to 264option, GNUnet's build system will install "libnss_gns*" libraries to
136"/lib/" regardless (!) of the $GNUNET_PREFIX you might have specified, 265"/lib/" regardless (!) of the $GNUNET_PREFIX you might have specified,
137as those libraries must be in "/lib/". If you are packaging GNUnet 266as those libraries must be in "/lib/". If you are packaging GNUnet
@@ -139,14 +268,14 @@ for binary distribution, this may cause your packaging script to miss
139those plugins, so you might need to do some additional manual work to 268those plugins, so you might need to do some additional manual work to
140include those libraries in your binary package(s). Similarly, if you 269include those libraries in your binary package(s). Similarly, if you
141want to use the GNUnet naming system and did NOT run GNUnet's 'make 270want to use the GNUnet naming system and did NOT run GNUnet's 'make
142install' process with SUDO rights, the libraries will be installed to 271install' process with sudo rights, the libraries will be installed to
143"$GNUNET_PREFIX" and you will have to move them to "/lib/" 272"$GNUNET_PREFIX" and you will have to move them to "/lib/"
144manually. 273manually.
145 274
146Finally, if you are compiling the code from git, you have to 275Finally, if you are compiling the code from git, you have to
147run ". bootstrap" before ./configure. If you receive an error during 276run "sh ./bootstrap" before running "./configure". If you receive an error during
148the running of ". bootstrap" that looks like "macro `AM_PATH_GTK' not 277the running of "sh ./bootstrap" that looks like "macro `AM_PATH_GTK'
149found in library", you may need to run aclocal by hand with the -I 278not found in library", you may need to run aclocal by hand with the -I
150option, pointing to your aclocal m4 macros, i.e. 279option, pointing to your aclocal m4 macros, i.e.
151 280
152$ aclocal -I /usr/local/share/aclocal 281$ aclocal -I /usr/local/share/aclocal
@@ -165,7 +294,7 @@ configuration for the peer. gnunet-setup can be used to configure and
165test (!) the network settings, choose which applications should be run 294test (!) the network settings, choose which applications should be run
166and configure databases. Other options you might want to control 295and configure databases. Other options you might want to control
167include system limitations (such as disk space consumption, bandwidth, 296include system limitations (such as disk space consumption, bandwidth,
168etc.). The resulting configuration files are human-readable and can 297etc). The resulting configuration files are human-readable and can
169theoretically be created or edited by hand. 298theoretically be created or edited by hand.
170 299
171gnunet-setup is a separate download and requires somewhat recent 300gnunet-setup is a separate download and requires somewhat recent
@@ -181,10 +310,17 @@ configuration file should be located in "~/.config/gnunet.conf" or its
181location can be specified by giving the "-c" option to the respective 310location can be specified by giving the "-c" option to the respective
182GNUnet application. 311GNUnet application.
183 312
313For more information about the configuration (as well as usage) refer
314to the 'GNUnet User Handbook' chapter of the documentation, included
315in this software distribution.
316
184 317
185Usage 318Usage
186===== 319=====
187 320
321For detailed usage notes, instructions and examples, refer to the
322included 'GNUnet User Handbook'.
323
188First, you must obtain an initial list of GNUnet hosts. Knowing a 324First, you must obtain an initial list of GNUnet hosts. Knowing a
189single peer is sufficient since after that GNUnet propagates 325single peer is sufficient since after that GNUnet propagates
190information about other peers. Note that the default configuration 326information about other peers. Note that the default configuration
@@ -210,9 +346,9 @@ UDP or WLAN will discover each other automatically (if they are in the
210vicinity of each other) using broadcasts (IPv4/WLAN) or multicasts 346vicinity of each other) using broadcasts (IPv4/WLAN) or multicasts
211(IPv6). 347(IPv6).
212 348
213The local node is started using "gnunet-arm -s". GNUnet should run 349The local node is started using "gnunet-arm -s". We recommend to run
21424/7 if you want to maximize your anonymity, as this makes partitioning 350GNUnet 24/7 if you want to maximize your anonymity, as this makes
215attacks harder. 351partitioning attacks harder.
216 352
217Once your peer is running, you should then be able to access GNUnet 353Once your peer is running, you should then be able to access GNUnet
218using the shell: 354using the shell:
@@ -229,42 +365,47 @@ together with a description. To publish files on GNUnet, use the
229"gnunet-publish" command. 365"gnunet-publish" command.
230 366
231 367
232The GTK user interface is shipped separately. After downloading and 368The GTK+ (or: Gimp Toolkit) user interface is shipped separately.
233installing gnunet-gtk, you can invoke the setup tool and the 369After installing gnunet-gtk, you can invoke the setup tool and
234file-sharing GUI with: 370the file-sharing GUI with:
235 371
236$ gnunet-setup 372$ gnunet-setup
237$ gnunet-fs-gtk 373$ gnunet-fs-gtk
238 374
239For further documentation, see our webpage. 375For further documentation, see our webpage or the 'GNUnet User Handbook',
376included in this software distribution.
240 377
241 378
242Hacking GNUnet 379Hacking GNUnet
243============== 380==============
244 381
245Contributions are welcome, please submit bugs to 382Contributions are welcome. Please submit bugs you find to
246https://gnunet.org/bugs/. Please make sure to run contrib/report.sh 383https://gnunet.org/bugs/.
384Please make sure to run the script "contrib/scripts/gnunet-bugreport"
247and include the output with your bug reports. More about how to 385and include the output with your bug reports. More about how to
248report bugs can be found in the GNUnet FAQ on the webpage. Submit 386report bugs can be found in the GNUnet FAQ on the webpage. Submit
249patches via E-Mail to gnunet-developers@gnu.org. 387patches via E-Mail to gnunet-developers@gnu.org, formated with
388`git format-patch`.
250 389
251In order to run the unit tests with by hand (instead of using 390In order to run the unit tests by hand (instead of using "make check"),
252"make check"), you need to 391you need to set the environment variable "GNUNET_PREFIX" to the
253set an environment variable ("GNUNET_PREFIX") to the directory 392directory where GNUnet's libraries are installed.
254where GNUnet's libraries are installed. 393Before running any testcases, you must complete the installation.
255Also, before running any testcases, you must 394
256complete the installation first. Quick summary: 395Quick summary:
257 396
258$ ./configure --prefix=$SOMEWHERE 397$ ./configure --prefix=$SOMEWHERE
259$ make 398$ make
260$ make install 399$ make install
400$ export $GNUNET_PREFIX=$SOMEWHERE
261$ make check 401$ make check
262 402
263Some of the testcases require python >= 2.6 (+ the python module "futures") 403Some of the testcases require python >= 2.7, and the python modules
264and pexpect to be installed. If any testcases fail to pass on your system, run 404"python-future" (http://python-future.org/) and "pexpect" to be installed.
265"contrib/scripts/report.sh" (in the repository) or "gnunet-bugreport" 405If any testcases fail to pass on your system, run
266when you already have GNUnet installed and report the output together with 406"contrib/scripts/gnunet-bugreport" (in the repository) or "gnunet-bugreport"
267information about the failing testcase to the Mantis bugtracking 407when you already have GNUnet installed and report its output together with
408information about the failing testcase(s) to the Mantis bugtracking
268system at https://gnunet.org/bugs/. 409system at https://gnunet.org/bugs/.
269 410
270 411
@@ -304,6 +445,34 @@ throttled by ISPs that dislike P2P. Details for configuring the
304reverse proxy are documented on our website. 445reverse proxy are documented on our website.
305 446
306 447
448Further Reading
449===============
450
451* Documentation
452
453 A preliminary rendering of the new GNUnet manual is deployed at
454
455 https://d.n0.is/pub/doc/gnunet/manual/
456
457 we plan to have a complete new gnunet.org up and running in 2019.
458 This website output exists as a convenience solution until then.
459
460* Academia / papers
461
462 In almost 20 years various people in our community have written and
463 collected a good number of papers which have been implemented in
464 GNUnet or projects around GNUnet.
465 There are currently 2 ways to get them:
466
467 * Using git:
468 git clone https://gnunet.org/git/bibliography.git
469 * Using Drupal:
470 https://gnunet.org/bibliography
471
472 The Drupal access will be replaced by a new interface to our
473 bibliography in 2019.
474
475
307Stay tuned 476Stay tuned
308========== 477==========
309 478
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 56fcb9aea..27b1d01bc 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -32,7 +32,6 @@ dist_pkgdata_DATA = \
32 gns/gns-form.xslt \ 32 gns/gns-form.xslt \
33 branding/logo/gnunet-logo.pdf \ 33 branding/logo/gnunet-logo.pdf \
34 branding/logo/gnunet-logo-color.png \ 34 branding/logo/gnunet-logo-color.png \
35 scripts/report.sh \
36 testing_hostkeys.ecc 35 testing_hostkeys.ecc
37 36
38if MINGW 37if MINGW
@@ -126,6 +125,7 @@ install-data-local:
126 $(INSTALL_DATA) $$hello $(DESTDIR)$(pkghellodir)/ ; \ 125 $(INSTALL_DATA) $$hello $(DESTDIR)$(pkghellodir)/ ; \
127 fi \ 126 fi \
128 done 127 done
128 install scripts/gnunet-bugreport $(bindir)/gnunet-bugreport
129 129
130dist-hook: 130dist-hook:
131 if test -d $(srcdir)/hellos; then \ 131 if test -d $(srcdir)/hellos; then \
diff --git a/contrib/ci/docker/Dockerfile b/contrib/ci/docker/Dockerfile
index 974e41a5e..42c64eaf3 100644
--- a/contrib/ci/docker/Dockerfile
+++ b/contrib/ci/docker/Dockerfile
@@ -1,57 +1,32 @@
1from fedora:26 1FROM ubuntu:18.04
2 2
3# Install the required build tools 3# Install the required build tools
4RUN dnf -y update && dnf -y install which git automake texinfo gettext-devel autoconf libtool libtool-ltdl-devel libidn-devel libunistring-devel glpk libextractor-devel libmicrohttpd-devel gnutls libgcrypt-devel jansson-devel sqlite-devel npm 4RUN apt update && apt install -y apt git autopoint automake texinfo gettext autoconf libtool libidn11-dev libunistring-dev gnutls-dev libgcrypt20 libgcrypt20-dev libjansson-dev libsqlite3-dev wget flex bison libglib2.0-dev libgmp3-dev libmicrohttpd-dev libglpk-dev libextractor-dev
5 5
6# Install gnurl from source at version gnurl-7.54.0
6WORKDIR /usr/src 7WORKDIR /usr/src
8RUN git clone https://git.taler.net/gnurl.git --branch gnurl-7.57.0
9RUN cd /usr/src/gnurl && autoreconf -i && ./configure --prefix=/usr --disable-ntlm-wb && make install
7 10
8# Install gnurl 11# Install libpbc
9RUN wget https://ftp.gnu.org/gnu/gnunet/gnurl-7.59.0.tar.gz
10RUN tar xvzpf gnurl-7.59.0.tar.gz
11WORKDIR /usr/src/gnurl-7.59.0
12RUN autoreconf -i
13RUN ./configure --disable-ntlm-wb
14RUN make install
15WORKDIR /usr/src 12WORKDIR /usr/src
13RUN wget https://crypto.stanford.edu/pbc/files/pbc-0.5.14.tar.gz && tar xvzpf pbc-0.5.14.tar.gz && cd /usr/src/pbc-0.5.14 && ./configure --prefix=/usr && make install
16 14
17RUN dnf -y install wget flex bison 15# Install libbswabe
18
19# Install libpbc
20RUN wget https://crypto.stanford.edu/pbc/files/pbc-0.5.14.tar.gz
21RUN tar xvzpf pbc-0.5.14.tar.gz
22WORKDIR /usr/src/pbc-0.5.14
23RUN ./configure --prefix=/usr
24RUN make install
25WORKDIR /usr/src 16WORKDIR /usr/src
17RUN git clone https://github.com/schanzen/libgabe.git && cd /usr/src/libgabe && ./configure --prefix=/usr && make install
26 18
27RUN dnf -y install glib2-devel 19WORKDIR /usr/src
20RUN git clone git://gnunet.org/gnunet.git
21RUN cd /usr/src/gnunet && ./bootstrap && ./configure --enable-experimental --prefix=/usr && make && make install
28 22
29# Install libbswabe 23RUN addgroup gnunetdns && addgroup gnunet && adduser --system --home /var/lib/gnunet gnunet
30RUN git clone https://github.com/schanzen/libgabe.git
31WORKDIR /usr/src/libgabe
32RUN ./configure --prefix=/usr
33RUN make install
34
35# Install WebUI
36WORKDIR /usr/src/
37RUN git clone https://github.com/schanzen/gnunet-webui.git
38WORKDIR /usr/src/gnunet-webui
39RUN git checkout gnuidentity
40
41RUN mkdir /usr/src/gnunet
42WORKDIR /usr/src/gnunet
43ADD . .
44ARG NUM_JOBS
45RUN ./bootstrap
46RUN ./configure --prefix=/usr/local
47RUN make -j$NUM_JOBS
48RUN make install
49
50RUN groupadd gnunetdns
51RUN adduser -S -m -h /var/lib/gnunet gnunet
52RUN chown gnunet:gnunet /var/lib/gnunet 24RUN chown gnunet:gnunet /var/lib/gnunet
53RUN echo '[arm]\nSYSTEM_ONLY = YES\nUSER_ONLY = NO\n' > /etc/gnunet.conf 25RUN echo '[arm]\nSYSTEM_ONLY = YES\nUSER_ONLY = NO\n' > /etc/gnunet.conf
54 26
55ADD docker-entrypoint.sh . 27ADD docker-entrypoint.sh .
56 28
57CMD ["sh", "docker-entrypoint.sh"] 29RUN rm -rf /usr/src/*
30#RUN apt remove gcc
31
32CMD ["sh", "docker-entrypoint.sh"]
diff --git a/contrib/scripts/documentation/gnunet-doc.scm b/contrib/scripts/documentation/gnunet-doc.scm
index 4ae23b298..077efacad 100644
--- a/contrib/scripts/documentation/gnunet-doc.scm
+++ b/contrib/scripts/documentation/gnunet-doc.scm
@@ -76,17 +76,17 @@
76 (string-append (current-source-directory) 76 (string-append (current-source-directory)
77 "/../../../")) 77 "/../../../"))
78 source-file?)))) 78 source-file?))))
79 (package 79 (package
80 (name "gnunet-doc") 80 (name "gnunet-doc")
81 (version (string-append "0.10.1-" revision "." "dev")) 81 (version (string-append "0.10.1-" revision "." "dev"))
82 (source 82 (source
83 (local-file ;;"../../.." 83 (local-file ;;"../../.."
84 ;;%source-dir 84 ;;%source-dir
85 ;;(string-append (getcwd) "/../../../") 85 ;;(string-append (getcwd) "/../../../")
86 (string-append (getcwd)) ;drrty hack and this assumes one static position FIXME! 86 (string-append (getcwd)) ;drrty hack and this assumes one static position FIXME!
87 #:recursive? #t)) 87 #:recursive? #t))
88 ;;#:select? (git-predicate %source-dir))) 88 ;;#:select? (git-predicate %source-dir)))
89 ;;#:select? (force select?))) 89 ;;#:select? (force select?)))
90 (build-system gnu-build-system) 90 (build-system gnu-build-system)
91 (inputs 91 (inputs
92 `(("glpk" ,glpk) 92 `(("glpk" ,glpk)
@@ -105,7 +105,7 @@
105 ("pulseaudio" ,pulseaudio) 105 ("pulseaudio" ,pulseaudio)
106 ("sqlite" ,sqlite) 106 ("sqlite" ,sqlite)
107 ("postgresql" ,postgresql) 107 ("postgresql" ,postgresql)
108 ("mysql" ,mysql) 108 ("mysql" ,mariadb)
109 ("zlib" ,zlib) 109 ("zlib" ,zlib)
110 ("perl" ,perl) 110 ("perl" ,perl)
111 ("python-2" ,python-2) ; tests and gnunet-qr 111 ("python-2" ,python-2) ; tests and gnunet-qr
@@ -145,34 +145,34 @@
145 (chdir "doc/documentation") 145 (chdir "doc/documentation")
146 ;;(zero? (system* "make" "dev-build")))) 146 ;;(zero? (system* "make" "dev-build"))))
147 (zero? (system* "sh" "run-gendocs.sh")))) 147 (zero? (system* "sh" "run-gendocs.sh"))))
148 ;; (zero? (system* "make" "pdf")) 148 ;; (zero? (system* "make" "pdf"))
149 ;; (zero? (system* "make" "html")) 149 ;; (zero? (system* "make" "html"))
150 ;; (zero? (system* "make" "info")))) 150 ;; (zero? (system* "make" "info"))))
151 ;;(zero? (system* "make" "doc-all-give-me-the-noise")))) 151 ;;(zero? (system* "make" "doc-all-give-me-the-noise"))))
152 (replace 'install 152 (replace 'install
153 (lambda _ 153 (lambda _
154 (zero? (system* "make" "doc-gendoc-install"))))))) 154 (zero? (system* "make" "doc-gendoc-install")))))))
155 ;;(lambda* (#:key outputs #:allow-other-keys) 155 ;;(lambda* (#:key outputs #:allow-other-keys)
156 ;; (let* ((out (assoc-ref outputs "out")) 156 ;; (let* ((out (assoc-ref outputs "out"))
157 ;; (doc (string-append out "/share/doc/gnunet"))) 157 ;; (doc (string-append out "/share/doc/gnunet")))
158 ;; (mkdir-p doc) 158 ;; (mkdir-p doc)
159 ;; (copy-recursively "images" 159 ;; (copy-recursively "images"
160 ;; (string-append doc 160 ;; (string-append doc
161 ;; "/images")) 161 ;; "/images"))
162 ;; (mkdir-p (string-append doc "/gnunet")) 162 ;; (mkdir-p (string-append doc "/gnunet"))
163 ;; (install-file "gnunet.pdf" doc) 163 ;; (install-file "gnunet.pdf" doc)
164 ;; (install-file "gnunet.info" doc) 164 ;; (install-file "gnunet.info" doc)
165 ;; (install-file "gnunet.log" doc) ;TODO: Move to 'dev' output? 165 ;; (install-file "gnunet.log" doc) ;TODO: Move to 'dev' output?
166 ;; (copy-recursively "gnunet" 166 ;; (copy-recursively "gnunet"
167 ;; (string-append doc 167 ;; (string-append doc
168 ;; "/gnunet")) 168 ;; "/gnunet"))
169 ;; (install-file "gnunet-c-tutorial.pdf" doc) 169 ;; (install-file "gnunet-c-tutorial.pdf" doc)
170 ;; (install-file "gnunet-c-tutorial.info" doc) 170 ;; (install-file "gnunet-c-tutorial.info" doc)
171 ;; (install-file "gnunet-c-tutorial.log" doc) ;TODO: Move to 'dev' output? 171 ;; (install-file "gnunet-c-tutorial.log" doc) ;TODO: Move to 'dev' output?
172 ;; (copy-recursively "gnunet-c-tutorial" 172 ;; (copy-recursively "gnunet-c-tutorial"
173 ;; (string-append doc 173 ;; (string-append doc
174 ;; "/gnunet-c-tutorial"))) 174 ;; "/gnunet-c-tutorial")))
175 ;; #t))))) 175 ;; #t)))))
176 (synopsis "Documentation of GNUnet") 176 (synopsis "Documentation of GNUnet")
177 (description 177 (description
178 "GNUnet documentation build") 178 "GNUnet documentation build")
diff --git a/contrib/scripts/report.sh b/contrib/scripts/gnunet-bugreport
index 7fbb2f46c..f17cb7636 100755
--- a/contrib/scripts/report.sh
+++ b/contrib/scripts/gnunet-bugreport
@@ -233,7 +233,7 @@ gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
233rm -f $TMPFILE $TMPFILE.bin 233rm -f $TMPFILE $TMPFILE.bin
234 234
235 235
236echo -n "GNUtls : " 236echo -n "GnuTLS : "
237TMPFILE=`mktemp /tmp/gnutls-version-testXXXXXX` 237TMPFILE=`mktemp /tmp/gnutls-version-testXXXXXX`
238cat - >$TMPFILE.c <<EOF 238cat - >$TMPFILE.c <<EOF
239#include <gnutls/gnutls.h> 239#include <gnutls/gnutls.h>
diff --git a/contrib/services/openrc/gnunet.initd b/contrib/services/openrc/gnunet.initd
new file mode 100644
index 000000000..c042e3de1
--- /dev/null
+++ b/contrib/services/openrc/gnunet.initd
@@ -0,0 +1,82 @@
1#!/sbin/openrc-run
2# Copyright 1999-2016 Gentoo Foundation
3# Distributed under the terms of the GNU General Public License v2
4
5if [ -d /run ] ; then
6 PIDFILE=${PIDFILE:-/run/gnunet/arm-service.pid}
7else
8 PIDFILE=${PIDFILE:-/var/run/gnunet/arm-service.pid}
9fi
10
11depend() {
12 # FIXME: refine?
13 need net
14}
15
16GNUNET_PATH="/usr"
17GNUNET_HOME="/var/lib/gnunet"
18SUID_ROOT_HELPERS="exit nat-server nat-client transport-bluetooth transport-wlan vpn"
19
20chmodown_execbin() {
21 if [ -x $1 ]; then
22 if [ "$3" ]; then
23 chown $3 $1 2>/dev/null && chmod $2 $1
24 else
25 chmod $2 $1
26 fi
27 fi
28}
29
30checkconfig() {
31 if [ -n "$(find ${GNUNET_HOME}/.local/share/gnunet -maxdepth 1 -name gnunet.conf -perm +0044)" ] ; then
32 eerror "${conf} must not be world or group readable. Try:"
33 eerror " chmod 600 ${conf}"
34 eerror " chown gnunet:gnunet ${conf}"
35 return 1
36 fi
37 mkdir -p ${GNUNET_HOME}/.cache/gnunet
38
39 # taken from dangole's lede config.. thx!
40 local libexec="${GNUNET_PATH}/lib/gnunet/libexec" # why not /usr/libexec/gnunet ?
41 # not reliable enough:
42 #[ -e ${libexec}/.permfix ] && return
43 for helper in $SUID_ROOT_HELPERS; do
44 chmodown_execbin ${libexec}/gnunet-helper-$helper u+s
45 done
46 chmodown_execbin ${libexec}/gnunet-helper-dns 4750 root:gnunetdns
47 chmodown_execbin ${libexec}/gnunet-service-dns 2750 gnunet:gnunetdns
48 #touch ${libexec}/.permfix
49}
50
51start() {
52 checkconfig || return 1
53
54 local piddir=$(dirname ${PIDFILE})
55 if [ ! -d ${piddir} ] ; then
56 ebegin "Making ${piddir}"
57 mkdir -p ${piddir}
58 eend $?
59 ebegin "Changing permissions of ${piddir}"
60 chown gnunet:gnunet ${piddir}
61 eend $?
62 fi
63
64 ebegin "Starting ${SVCNAME}"
65 # shouldn't be necessary... but
66 start-stop-daemon --start --user gnunet --name gnunet --pidfile ${PIDFILE} \
67 --exec ${GNUNET_PATH}/lib/gnunet/libexec/gnunet-service-arm -- -d
68 # flags to be passed to the process appear after the double-dash
69 eend $?
70}
71
72stop() {
73 ebegin "Stopping ${SVCNAME}"
74 start-stop-daemon --stop --signal QUIT --pidfile ${PIDFILE}
75 sleep 1
76 killall -u gnunet
77 sleep 1
78 rm -rf /tmp/gnunet-gnunet-runtime >/dev/null 2>&1
79 rm -rf /tmp/gnunet-system-runtime >/dev/null 2>&1
80 eend $?
81}
82
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 1070974d1..f60bde084 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -7,4 +7,5 @@ if !DOCUMENTATION
7endif 7endif
8 8
9EXTRA_DIST = \ 9EXTRA_DIST = \
10 outdated-and-old-installation-instructions.txt 10 system_specific/outdated-and-old-installation-instructions.txt \
11 system_specific/FROM_SOURCE
diff --git a/doc/documentation/Makefile.am b/doc/documentation/Makefile.am
index 0781b2fbb..12f40f147 100644
--- a/doc/documentation/Makefile.am
+++ b/doc/documentation/Makefile.am
@@ -113,7 +113,6 @@ info_TEXINFOS = \
113gnunet_TEXINFOS = \ 113gnunet_TEXINFOS = \
114 chapters/developer.texi \ 114 chapters/developer.texi \
115 chapters/preface.texi \ 115 chapters/preface.texi \
116 chapters/installation.texi \
117 chapters/philosophy.texi \ 116 chapters/philosophy.texi \
118 chapters/user.texi \ 117 chapters/user.texi \
119 chapters/vocabulary.texi \ 118 chapters/vocabulary.texi \
diff --git a/doc/documentation/chapters/developer.texi b/doc/documentation/chapters/developer.texi
index 6a895ed11..d33072057 100644
--- a/doc/documentation/chapters/developer.texi
+++ b/doc/documentation/chapters/developer.texi
@@ -2,7 +2,7 @@
2@node GNUnet Developer Handbook 2@node GNUnet Developer Handbook
3@chapter GNUnet Developer Handbook 3@chapter GNUnet Developer Handbook
4 4
5This book is intended to be an introduction for programmers that want to 50This book is intended to be an introduction for programmers that want to
6extend the GNUnet framework. GNUnet is more than a simple peer-to-peer 6extend the GNUnet framework. GNUnet is more than a simple peer-to-peer
7application. 7application.
8 8
@@ -11,7 +11,7 @@ For developers, GNUnet is:
11@itemize @bullet 11@itemize @bullet
12@item developed by a community that believes in the GNU philosophy 12@item developed by a community that believes in the GNU philosophy
13@item Free Software (Free as in Freedom), licensed under the 13@item Free Software (Free as in Freedom), licensed under the
14GNU General Public License@footnote{@uref{https://www.gnu.org/licenses/licenses.html#GPL, https://www.gnu.org/licenses/licenses.html#GPL}} 14GNU Affero General Public License@footnote{@uref{https://www.gnu.org/licenses/licenses.html#AGPL, https://www.gnu.org/licenses/licenses.html#AGPL}}
15@item A set of standards, including coding conventions and 15@item A set of standards, including coding conventions and
16architectural rules 16architectural rules
17@item A set of layered protocols, both specifying the communication 17@item A set of layered protocols, both specifying the communication
@@ -40,6 +40,7 @@ new chapters, sections or insightful comments.
40 40
41@menu 41@menu
42* Developer Introduction:: 42* Developer Introduction::
43* Internal dependencies::
43* Code overview:: 44* Code overview::
44* System Architecture:: 45* System Architecture::
45* Subsystem stability:: 46* Subsystem stability::
@@ -47,6 +48,7 @@ new chapters, sections or insightful comments.
47* Build-system:: 48* Build-system::
48* Developing extensions for GNUnet using the gnunet-ext template:: 49* Developing extensions for GNUnet using the gnunet-ext template::
49* Writing testcases:: 50* Writing testcases::
51* Building GNUnet and its dependencies::
50* TESTING library:: 52* TESTING library::
51* Performance regression analysis with Gauger:: 53* Performance regression analysis with Gauger::
52* TESTBED Subsystem:: 54* TESTBED Subsystem::
@@ -251,6 +253,77 @@ those that have a public website) which build on top of the GNUnet
251framework. 253framework.
252 254
253@c *********************************************************************** 255@c ***********************************************************************
256@node Internal dependencies
257@section Internal dependencies
258
259This section tries to give an overview of what processes a typical GNUnet
260peer running a particular application would consist of. All of the
261processes listed here should be automatically started by
262@command{gnunet-arm -s}.
263The list is given as a rough first guide to users for failure diagnostics.
264Ideally, end-users should never have to worry about these internal
265dependencies.
266
267In terms of internal dependencies, a minimum file-sharing system consists
268of the following GNUnet processes (in order of dependency):
269
270@itemize @bullet
271@item gnunet-service-arm
272@item gnunet-service-resolver (required by all)
273@item gnunet-service-statistics (required by all)
274@item gnunet-service-peerinfo
275@item gnunet-service-transport (requires peerinfo)
276@item gnunet-service-core (requires transport)
277@item gnunet-daemon-hostlist (requires core)
278@item gnunet-daemon-topology (requires hostlist, peerinfo)
279@item gnunet-service-datastore
280@item gnunet-service-dht (requires core)
281@item gnunet-service-identity
282@item gnunet-service-fs (requires identity, mesh, dht, datastore, core)
283@end itemize
284
285@noindent
286A minimum VPN system consists of the following GNUnet processes (in
287order of dependency):
288
289@itemize @bullet
290@item gnunet-service-arm
291@item gnunet-service-resolver (required by all)
292@item gnunet-service-statistics (required by all)
293@item gnunet-service-peerinfo
294@item gnunet-service-transport (requires peerinfo)
295@item gnunet-service-core (requires transport)
296@item gnunet-daemon-hostlist (requires core)
297@item gnunet-service-dht (requires core)
298@item gnunet-service-mesh (requires dht, core)
299@item gnunet-service-dns (requires dht)
300@item gnunet-service-regex (requires dht)
301@item gnunet-service-vpn (requires regex, dns, mesh, dht)
302@end itemize
303
304@noindent
305A minimum GNS system consists of the following GNUnet processes (in
306order of dependency):
307
308@itemize @bullet
309@item gnunet-service-arm
310@item gnunet-service-resolver (required by all)
311@item gnunet-service-statistics (required by all)
312@item gnunet-service-peerinfo
313@item gnunet-service-transport (requires peerinfo)
314@item gnunet-service-core (requires transport)
315@item gnunet-daemon-hostlist (requires core)
316@item gnunet-service-dht (requires core)
317@item gnunet-service-mesh (requires dht, core)
318@item gnunet-service-dns (requires dht)
319@item gnunet-service-regex (requires dht)
320@item gnunet-service-vpn (requires regex, dns, mesh, dht)
321@item gnunet-service-identity
322@item gnunet-service-namestore (requires identity)
323@item gnunet-service-gns (requires vpn, dns, dht, namestore, identity)
324@end itemize
325
326@c ***********************************************************************
254@node Code overview 327@node Code overview
255@section Code overview 328@section Code overview
256 329
@@ -1089,6 +1162,313 @@ typically necessary to run @code{make install} before running any
1089testcases. Thus the canonical command @code{make check install} has to be 1162testcases. Thus the canonical command @code{make check install} has to be
1090changed to @code{make install check} for GNUnet. 1163changed to @code{make install check} for GNUnet.
1091 1164
1165@c ***********************************************************************
1166@cindex Building GNUnet
1167@node Building GNUnet and its dependencies
1168@section Building GNUnet and its dependencies
1169
1170In the following section we will outline how to build GNUnet and
1171some of its dependencies. We will assume a fair amount of knowledge
1172for building applications under UNIX-like systems. Furthermore we
1173assume that the build environment is sane and that you are aware of
1174any implications actions in this process could have.
1175Instructions here can be seen as notes for developers (an extension to
1176the 'HACKING' section in README) as well as package mantainers.
1177@b{Users should rely on the available binary packages.}
1178We will use Debian as an example Operating System environment. Substitute
1179accordingly with your own Ooperating System environment.
1180
1181For the full list of depenendencies, consult the appropriate, up-to-date
1182section in the @file{README} file.
1183
1184First, we need to build or install (depending on your OS) the following
1185packages. If you build them from source, build them in this exact order:
1186
1187@example
1188libgpgerror, libgcrypt, libnettle, libunbound, GnuTLS (with libunbound
1189support)
1190@end example
1191
1192After we have build and installed those packages, we continue with
1193packages closer to GNUnet in this step: libgnurl (our libcurl fork),
1194GNU libmicrohttpd, and GNU libextractor. Again, if your package manager
1195provides one of these packages, use the packages provided from it
1196unless you have good reasons (package version too old, conflicts, etc).
1197We advise against compiling widely used packages such as GnuTLS
1198yourself if your OS provides a variant already unless you take care
1199of maintenance of the packages then.
1200
1201In the optimistic case, this command will give you all the dependencies:
1202
1203@example
1204sudo apt-get install libgnurl libmicrohttpd libextractor
1205@end example
1206
1207From experience we know that at the very least libgnurl is not
1208available in some environments. You could substitute libgnurl
1209with libcurl, but we recommend to install libgnurl, as it gives
1210you a predefined libcurl with the small set GNUnet requires. In
1211the past namespaces of libcurl and libgnurl were shared, which
1212caused problems when you wanted to integrate both of them in one
1213Operating System. This has been resolved, and they can be installed
1214side by side now.
1215
1216@cindex libgnurl
1217@cindex compiling libgnurl
1218GNUnet and some of its function depend on a limited subset of cURL/libcurl.
1219Rather than trying to enforce a certain configuration on the world, we
1220opted to maintain a microfork of it that ensures we can link against the
1221right set of features. We called this specialized set of libcurl
1222``libgnurl''. It is fully ABI compatible with libcurl and currently used
1223by GNUnet and some of its dependencies.
1224
1225We download libgnurl and its digital signature from the GNU fileserver,
1226assuming @env{TMPDIR} exists@footnote{It might be @file{/tmp}, @env{TMPDIR}, @env{TMP} or any other location. For consistency we assume @env{TMPDIR} points to @file{/tmp} for the remainder of this section.}
1227
1228@example
1229cd \$TMPDIR
1230wget https://ftp.gnu.org/gnu/gnunet/gnurl-7.60.0.tar.Z
1231wget https://ftp.gnu.org/gnu/gnunet/gnurl-7.60.0.tar.Z.sig
1232@end example
1233
1234Next, verify the digital signature of the file:
1235
1236@example
1237gpg --verify gnurl-7.60.0.tar.Z.sig
1238@end example
1239
1240If gpg fails, you might try with @command{gpg2} on your OS. If the error
1241states that ``the key can not be found'' or it is unknown, you have to
1242retrieve the key (A88C8ADD129828D7EAC02E52E22F9BBFEE348588) from a
1243keyserver first:
1244
1245@example
1246gpg --keyserver pgp.mit.edu --recv-keys A88C8ADD129828D7EAC02E52E22F9BBFEE348588
1247@end example
1248
1249and rerun the verification command.
1250
1251libgnurl will require the following packages to be present at runtime:
1252gnutls (with DANE support / libunbound), libidn, zlib and at compile time:
1253libtool, groff, perl, pkg-config, and python 2.7.
1254
1255Once you have verified that all the required packages are present on your
1256system, we can proceed to compile libgnurl:
1257
1258@example
1259tar -xvf gnurl-7.60.0.tar.Z
1260cd gnurl-7.60.0
1261sh configure --disable-ntlm-wb
1262make
1263make -C tests test
1264sudo make install
1265@end example
1266
1267After you've compiled and installed libgnurl, we can proceed to building
1268GNUnet.
1269
1270
1271
1272
1273First, in addition to the GNUnet sources you might require downloading the
1274latest version of various dependencies, depending on how recent the
1275software versions in your distribution of GNU/Linux are.
1276Most distributions do not include sufficiently recent versions of these
1277dependencies.
1278Thus, a typically installation on a "modern" GNU/Linux distribution
1279requires you to install the following dependencies (ideally in this
1280order):
1281
1282@itemize @bullet
1283@item libgpgerror and libgcrypt
1284@item libnettle and libunbound (possibly from distribution), GnuTLS
1285@item libgnurl (read the README)
1286@item GNU libmicrohttpd
1287@item GNU libextractor
1288@end itemize
1289
1290Make sure to first install the various mandatory and optional
1291dependencies including development headers from your distribution.
1292
1293Other dependencies that you should strongly consider to install is a
1294database (MySQL, sqlite or Postgres).
1295The following instructions will assume that you installed at least sqlite.
1296For most distributions you should be able to find pre-build packages for
1297the database. Again, make sure to install the client libraries @b{and} the
1298respective development headers (if they are packaged separately) as well.
1299
1300You can find specific, detailed instructions for installing of the
1301dependencies (and possibly the rest of the GNUnet installation) in the
1302platform-specific descriptions, which can be found in the Index.
1303Please consult them now.
1304If your distribution is not listed, please study the build
1305instructions for Debian stable, carefully as you try to install the
1306dependencies for your own distribution.
1307Contributing additional instructions for further platforms is always
1308appreciated.
1309Please take in mind that operating system development tends to move at
1310a rather fast speed. Due to this you should be aware that some of
1311the instructions could be outdated by the time you are reading this.
1312If you find a mistake, please tell us about it (or even better: send
1313a patch to the documentation to fix it!).
1314
1315Before proceeding further, please double-check the dependency list.
1316Note that in addition to satisfying the dependencies, you might have to
1317make sure that development headers for the various libraries are also
1318installed.
1319There maybe files for other distributions, or you might be able to find
1320equivalent packages for your distribution.
1321
1322While it is possible to build and install GNUnet without having root
1323access, we will assume that you have full control over your system in
1324these instructions.
1325First, you should create a system user @emph{gnunet} and an additional
1326group @emph{gnunetdns}. On the GNU/Linux distributions Debian and Ubuntu,
1327type:
1328
1329@example
1330sudo adduser --system --home /var/lib/gnunet --group \
1331--disabled-password gnunet
1332sudo addgroup --system gnunetdns
1333@end example
1334
1335@noindent
1336On other Unixes and GNU systems, this should have the same effect:
1337
1338@example
1339sudo useradd --system --groups gnunet --home-dir /var/lib/gnunet
1340sudo addgroup --system gnunetdns
1341@end example
1342
1343Now compile and install GNUnet using:
1344
1345@example
1346tar xvf gnunet-@value{VERSION}.tar.gz
1347cd gnunet-@value{VERSION}
1348./configure --with-sudo=sudo --with-nssdir=/lib
1349make
1350sudo make install
1351@end example
1352
1353If you want to be able to enable DEBUG-level log messages, add
1354@code{--enable-logging=verbose} to the end of the
1355@command{./configure} command.
1356@code{DEBUG}-level log messages are in English only and
1357should only be useful for developers (or for filing
1358really detailed bug reports).
1359
1360@noindent
1361Next, edit the file @file{/etc/gnunet.conf} to contain the following:
1362
1363@example
1364[arm]
1365SYSTEM_ONLY = YES
1366USER_ONLY = NO
1367@end example
1368
1369@noindent
1370You may need to update your @code{ld.so} cache to include
1371files installed in @file{/usr/local/lib}:
1372
1373@example
1374# ldconfig
1375@end example
1376
1377@noindent
1378Then, switch from user @code{root} to user @code{gnunet} to start
1379the peer:
1380
1381@example
1382# su -s /bin/sh - gnunet
1383$ gnunet-arm -c /etc/gnunet.conf -s
1384@end example
1385
1386You may also want to add the last line in the gnunet user's @file{crontab}
1387prefixed with @code{@@reboot} so that it is executed whenever the system
1388is booted:
1389
1390@example
1391@@reboot /usr/local/bin/gnunet-arm -c /etc/gnunet.conf -s
1392@end example
1393
1394@noindent
1395This will only start the system-wide GNUnet services.
1396Type @command{exit} to get back your root shell.
1397Now, you need to configure the per-user part. For each
1398user that should get access to GNUnet on the system, run
1399(replace alice with your username):
1400
1401@example
1402sudo adduser alice gnunet
1403@end example
1404
1405@noindent
1406to allow them to access the system-wide GNUnet services. Then, each
1407user should create a configuration file @file{~/.config/gnunet.conf}
1408with the lines:
1409
1410@example
1411[arm]
1412SYSTEM_ONLY = NO
1413USER_ONLY = YES
1414DEFAULTSERVICES = gns
1415@end example
1416
1417@noindent
1418and start the per-user services using
1419
1420@example
1421$ gnunet-arm -c ~/.config/gnunet.conf -s
1422@end example
1423
1424@noindent
1425Again, adding a @code{crontab} entry to autostart the peer is advised:
1426
1427@example
1428@@reboot /usr/local/bin/gnunet-arm -c $HOME/.config/gnunet.conf -s
1429@end example
1430
1431@noindent
1432Note that some GNUnet services (such as SOCKS5 proxies) may need a
1433system-wide TCP port for each user.
1434For those services, systems with more than one user may require each user
1435to specify a different port number in their personal configuration file.
1436
1437Finally, the user should perform the basic initial setup for the GNU Name
1438System (GNS) certificate authority. This is done by running:
1439
1440@example
1441$ gnunet-gns-proxy-setup-ca
1442@end example
1443
1444@noindent
1445The first generates the default zones, wheras the second setups the GNS
1446Certificate Authority with the user's browser. Now, to activate GNS in the
1447normal DNS resolution process, you need to edit your
1448@file{/etc/nsswitch.conf} where you should find a line like this:
1449
1450@example
1451hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
1452@end example
1453
1454@noindent
1455The exact details may differ a bit, which is fine. Add the text
1456@emph{"gns [NOTFOUND=return]"} after @emph{"files"}.
1457Keep in mind that we included a backslash ("\") here just for
1458markup reasons. You should write the text below on @b{one line}
1459and @b{without} the "\":
1460
1461@example
1462hosts: files gns [NOTFOUND=return] mdns4_minimal \
1463[NOTFOUND=return] dns mdns4
1464@end example
1465
1466@c FIXME: Document new behavior.
1467You might want to make sure that @file{/lib/libnss_gns.so.2} exists on
1468your system, it should have been created during the installation.
1469
1470
1471@c **********************************************************************
1092@cindex TESTING library 1472@cindex TESTING library
1093@node TESTING library 1473@node TESTING library
1094@section TESTING library 1474@section TESTING library
diff --git a/doc/documentation/chapters/installation.texi b/doc/documentation/chapters/installation.texi
deleted file mode 100644
index 665f980be..000000000
--- a/doc/documentation/chapters/installation.texi
+++ /dev/null
@@ -1,4149 +0,0 @@
1@node GNUnet Installation Handbook
2@chapter GNUnet Installation Handbook
3
4This handbook describes how to install (build, setup, compile) and
5setup (configure, start) GNUnet @value{VERSION}. After following these
6instructions you should be able to install and then start user-interfaces
7to interact with the network.
8
9Note: This manual is far from complete, and we welcome contributions, be
10it in the form of new chapters or insightful comments.
11
12@menu
13* Dependencies::
14* Pre-installation notes::
15* Generic installation instructions::
16* Build instructions for Ubuntu 12.04 using Git::
17* Build instructions for software builds from source::
18* Build Instructions for Microsoft Windows Platforms::
19* Build instructions for Debian 7.5::
20* Installing GNUnet from Git on Ubuntu 14.4::
21* Build instructions for Debian 8::
22* Build instructions for macOS::
23@c * Build instructions for OpenBSD 6.2::
24* Outdated build instructions for previous revisions::
25@c * Portable GNUnet::
26* The graphical configuration interface::
27* How to start and stop a GNUnet peer::
28@end menu
29
30@node Dependencies
31@section Dependencies
32@c %**end of header
33
34This section lists the various known dependencies for
35GNUnet @value{EDITION}.
36Suggestions for missing dependencies or wrong version numbers are welcome.
37
38@menu
39* External dependencies::
40* Optional dependencies::
41* Internal dependencies::
42@end menu
43
44@node External dependencies
45@subsection External dependencies
46@c %**end of header
47
48These packages must be installed before a typical GNUnet installation
49can be performed:
50
51@itemize @bullet
52@item autoconf
53@item automake
54@item pkg-config
55@item libltdl
56@item gstreamer
57@item gst-plugins-base
58@item perl
59@item python (only 2.7 supported)@footnote{tests and gnunet-qr}
60@item jansson
61@item nss
62@item glib
63@item gmp
64@item bluez
65@item miniupnpc
66@item gettext
67@item which
68@item texinfo @geq{} 5.2
69@item GNU libmicrohttpd @geq{} 0.9.30 @footnote{We recommend to build it
70with a GnuTLS version that was configured with libunbound}
71@item GNU libextractor @geq{} 1.0
72@item GNU libtool @geq{} 2.2
73@item GNU libunistring @geq{} 0.9.1.1
74@item GNU libidn @geq{} 1.0.0
75@item @uref{https://gnupg.org/software/libgcrypt/, GNU libgcrypt} @geq{}
76@uref{https://gnupg.org/ftp/gcrypt/libgcrypt/, 1.6.0}
77@item @uref{https://gnutls.org/, GnuTLS} @geq{} 3.2.7
78@footnote{We recommend to compile with libunbound for DANE support;
79GnuTLS also requires GNU nettle 2.7 (update: GnuTLS 3.2.7 appears NOT
80to work against GNU nettle > 2.7, due to some API updatings done by
81nettle. Thus it should be compiled against nettle 2.7
82and, in case you get some error on the reference to `rpl_strerror' being
83undefined, follow the instructions on
84@uref{http://lists.gnupg.org/pipermail/gnutls-devel/2013-November/006588.html, this}
85post (and the link inside it)).}
86@item @uref{https://gnunet.org/gnurl, gnURL} libgnurl @geq{} 7.34.0
87@footnote{must be compiled after @code{GnuTLS}}
88@item libglpk @geq{} 4.45
89@item @uref{http://www.openssl.org/, OpenSSL} @geq{} 1.0
90@item TeX Live @geq{} 2012, optional (for gnunet-bcd)
91@item Texinfo @geq{} 5.2 (for documentation)
92@item libsqlite @geq{} 3.8.0 @footnote{(note that the code will
93compile and often work with lower version numbers, but you may get subtle
94bugs with respect to quota management in certain rare cases);
95alternatively, MySQL or Postgres can also be installed, but those
96databases will require more complex configurations (not
97recommended for first-time users)}
98@item zlib
99@end itemize
100
101@node Optional dependencies
102@subsection Optional dependencies
103
104These applications must be installed for various experimental or otherwise
105optional features such as @command{gnunet-conversation},
106and @command{gnunet-conversation-gtk} (most of these features are only build if you
107configure GNUnet with @command{--enable-experimental}):
108
109@itemize @bullet
110@item libpulse @geq{} 2.0,
111optional (for @command{gnunet-conversation})
112@item libopus @geq{} 1.0.1,
113optional (for @command{gnunet-conversation})
114@item libogg @geq{} 1.3.0,
115optional (for @command{gnunet-conversation})
116@item libnss contained @command{certool} binary,
117optional for convenient installation of
118the GNS proxy.
119@item python-zbar @geq{} 0.10,
120optional (for @command{gnunet-qr})
121@item Gtk+ @geq{} 3.0,
122optional (for @command{gnunet-gtk})
123@item libgladeui (must match Gtk+ version),
124optional (for @command{gnunet-gtk})
125@item libqrencode @geq{} 3.0,
126optional (for @command{gnunet-namestore-gtk})
127@item libpbc @geq{} 0.5.14, optional for Attribute-Based Encryption and Identity Provider functionality
128@item libgabe (https://github.com/schanzen/libgabe), optional for Attribute-Based Encryption and Identity Provider functionality
129@end itemize
130
131@node Internal dependencies
132@subsection Internal dependencies
133
134This section tries to give an overview of what processes a typical GNUnet
135peer running a particular application would consist of. All of the
136processes listed here should be automatically started by
137@command{gnunet-arm -s}.
138The list is given as a rough first guide to users for failure diagnostics.
139Ideally, end-users should never have to worry about these internal
140dependencies.
141
142In terms of internal dependencies, a minimum file-sharing system consists
143of the following GNUnet processes (in order of dependency):
144
145@itemize @bullet
146@item gnunet-service-arm
147@item gnunet-service-resolver (required by all)
148@item gnunet-service-statistics (required by all)
149@item gnunet-service-peerinfo
150@item gnunet-service-transport (requires peerinfo)
151@item gnunet-service-core (requires transport)
152@item gnunet-daemon-hostlist (requires core)
153@item gnunet-daemon-topology (requires hostlist, peerinfo)
154@item gnunet-service-datastore
155@item gnunet-service-dht (requires core)
156@item gnunet-service-identity
157@item gnunet-service-fs (requires identity, mesh, dht, datastore, core)
158@end itemize
159
160@noindent
161A minimum VPN system consists of the following GNUnet processes (in
162order of dependency):
163
164@itemize @bullet
165@item gnunet-service-arm
166@item gnunet-service-resolver (required by all)
167@item gnunet-service-statistics (required by all)
168@item gnunet-service-peerinfo
169@item gnunet-service-transport (requires peerinfo)
170@item gnunet-service-core (requires transport)
171@item gnunet-daemon-hostlist (requires core)
172@item gnunet-service-dht (requires core)
173@item gnunet-service-mesh (requires dht, core)
174@item gnunet-service-dns (requires dht)
175@item gnunet-service-regex (requires dht)
176@item gnunet-service-vpn (requires regex, dns, mesh, dht)
177@end itemize
178
179@noindent
180A minimum GNS system consists of the following GNUnet processes (in
181order of dependency):
182
183@itemize @bullet
184@item gnunet-service-arm
185@item gnunet-service-resolver (required by all)
186@item gnunet-service-statistics (required by all)
187@item gnunet-service-peerinfo
188@item gnunet-service-transport (requires peerinfo)
189@item gnunet-service-core (requires transport)
190@item gnunet-daemon-hostlist (requires core)
191@item gnunet-service-dht (requires core)
192@item gnunet-service-mesh (requires dht, core)
193@item gnunet-service-dns (requires dht)
194@item gnunet-service-regex (requires dht)
195@item gnunet-service-vpn (requires regex, dns, mesh, dht)
196@item gnunet-service-identity
197@item gnunet-service-namestore (requires identity)
198@item gnunet-service-gns (requires vpn, dns, dht, namestore, identity)
199@end itemize
200
201@node Pre-installation notes
202@section Pre-installation notes
203
204Please note that in the code instructions for the installation,
205@emph{#} indicates commands run as privileged root user and
206@emph{$} shows commands run as unprivileged ("normal") system user.
207
208
209@node Generic installation instructions
210@section Generic installation instructions
211
212First, in addition to the GNUnet sources you might require downloading the
213latest version of various dependencies, depending on how recent the
214software versions in your distribution of GNU/Linux are.
215Most distributions do not include sufficiently recent versions of these
216dependencies.
217Thus, a typically installation on a "modern" GNU/Linux distribution
218requires you to install the following dependencies (ideally in this
219order):
220
221@itemize @bullet
222@item libgpgerror and libgcrypt
223@item libnettle and libunbound (possibly from distribution), GnuTLS
224@item libgnurl (read the README)
225@item GNU libmicrohttpd
226@item GNU libextractor
227@end itemize
228
229Make sure to first install the various mandatory and optional
230dependencies including development headers from your distribution.
231
232Other dependencies that you should strongly consider to install is a
233database (MySQL, sqlite or Postgres).
234The following instructions will assume that you installed at least sqlite.
235For most distributions you should be able to find pre-build packages for
236the database. Again, make sure to install the client libraries @b{and} the
237respective development headers (if they are packaged separately) as well.
238
239You can find specific, detailed instructions for installing of the
240dependencies (and possibly the rest of the GNUnet installation) in the
241platform-specific descriptions, which can be found in the Index.
242Please consult them now.
243If your distribution is not listed, please study
244@ref{Build instructions for Debian 8}, the build instructions for
245Debian stable, carefully as you try to install the dependencies for your
246own distribution.
247Contributing additional instructions for further platforms is always
248appreciated.
249Please take in mind that operating system development tends to move at
250a rather fast speed. Due to this you should be aware that some of
251the instructions could be outdated by the time you are reading this.
252If you find a mistake, please tell us about it (or even better: send
253a patch to the documentation to fix it!).
254
255Before proceeding further, please double-check the dependency list.
256Note that in addition to satisfying the dependencies, you might have to
257make sure that development headers for the various libraries are also
258installed.
259There maybe files for other distributions, or you might be able to find
260equivalent packages for your distribution.
261
262While it is possible to build and install GNUnet without having root
263access, we will assume that you have full control over your system in
264these instructions.
265First, you should create a system user @emph{gnunet} and an additional
266group @emph{gnunetdns}. On the GNU/Linux distributions Debian and Ubuntu,
267type:
268
269@example
270# adduser --system --home /var/lib/gnunet --group \
271--disabled-password gnunet
272# addgroup --system gnunetdns
273@end example
274
275@noindent
276On other Unixes and GNU systems, this should have the same effect:
277
278@example
279# useradd --system --groups gnunet --home-dir /var/lib/gnunet
280# addgroup --system gnunetdns
281@end example
282
283Now compile and install GNUnet using:
284
285@example
286$ tar xvf gnunet-@value{VERSION}.tar.gz
287$ cd gnunet-@value{VERSION}
288$ ./configure --with-sudo=sudo --with-nssdir=/lib
289$ make
290$ sudo make install
291@end example
292
293If you want to be able to enable DEBUG-level log messages, add
294@code{--enable-logging=verbose} to the end of the
295@command{./configure} command.
296@code{DEBUG}-level log messages are in English only and
297should only be useful for developers (or for filing
298really detailed bug reports).
299
300Finally, you probably want to compile @command{gnunet-gtk}, which
301includes @command{gnunet-setup} (a graphical tool for
302GNUnet configuration) and @command{gnunet-fs-gtk} (a graphical tool for
303GNUnet file-sharing):
304
305@example
306$ tar xvf gnunet-gtk-@value{VERSION}.tar.gz
307$ cd gnunet-gtk-@value{VERSION}
308$ ./configure --with-gnunet=/usr/local/
309$ make
310$ sudo make install
311$ cd ..
312# just to be safe run this:
313$ sudo ldconfig
314@end example
315
316@noindent
317Next, edit the file @file{/etc/gnunet.conf} to contain the following:
318
319@example
320[arm]
321SYSTEM_ONLY = YES
322USER_ONLY = NO
323@end example
324
325@noindent
326You may need to update your @code{ld.so} cache to include
327files installed in @file{/usr/local/lib}:
328
329@example
330# ldconfig
331@end example
332
333@noindent
334Then, switch from user @code{root} to user @code{gnunet} to start
335the peer:
336
337@example
338# su -s /bin/sh - gnunet
339$ gnunet-arm -c /etc/gnunet.conf -s
340@end example
341
342You may also want to add the last line in the gnunet user's @file{crontab}
343prefixed with @code{@@reboot} so that it is executed whenever the system
344is booted:
345
346@example
347@@reboot /usr/local/bin/gnunet-arm -c /etc/gnunet.conf -s
348@end example
349
350@noindent
351This will only start the system-wide GNUnet services.
352Type exit to get back your root shell.
353Now, you need to configure the per-user part. For each
354$USER that should get access to GNUnet on the system, run:
355
356@example
357# adduser $USER gnunet
358@end example
359
360@noindent
361to allow them to access the system-wide GNUnet services. Then, each
362user should create a configuration file @file{~/.config/gnunet.conf}
363with the lines:
364
365@example
366[arm]
367SYSTEM_ONLY = NO
368USER_ONLY = YES
369DEFAULTSERVICES = gns
370@end example
371
372@noindent
373and start the per-user services using
374
375@example
376$ gnunet-arm -c ~/.config/gnunet.conf -s
377@end example
378
379@noindent
380Again, adding a @code{crontab} entry to autostart the peer is advised:
381
382@example
383@@reboot /usr/local/bin/gnunet-arm -c $HOME/.config/gnunet.conf -s
384@end example
385
386@noindent
387Note that some GNUnet services (such as SOCKS5 proxies) may need a
388system-wide TCP port for each user.
389For those services, systems with more than one user may require each user
390to specify a different port number in their personal configuration file.
391
392Finally, the user should perform the basic initial setup for the GNU Name
393System (GNS) certificate authority. This is done by running:
394
395@example
396$ gnunet-gns-proxy-setup-ca
397@end example
398
399@noindent
400The first generates the default zones, wheras the second setups the GNS
401Certificate Authority with the user's browser. Now, to activate GNS in the
402normal DNS resolution process, you need to edit your
403@file{/etc/nsswitch.conf} where you should find a line like this:
404
405@example
406hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
407@end example
408
409@noindent
410The exact details may differ a bit, which is fine. Add the text
411@emph{"gns [NOTFOUND=return]"} after @emph{"files"}.
412Keep in mind that we included a backslash ("\") here just for
413markup reasons. You should write the text below on @b{one line}
414and @b{without} the "\":
415
416@example
417hosts: files gns [NOTFOUND=return] mdns4_minimal \
418[NOTFOUND=return] dns mdns4
419@end example
420
421@c FIXME: Document new behavior.
422You might want to make sure that @file{/lib/libnss_gns.so.2} exists on
423your system, it should have been created during the installation.
424
425@node Build instructions for Ubuntu 12.04 using Git
426@section Build instructions for Ubuntu 12.04 using Git
427
428@menu
429* Install the required build tools::
430* Install libgcrypt 1.6 and libgpg-error::
431* Install gnutls with DANE support::
432* Install libgnurl::
433* Install libmicrohttpd from Git::
434* Install libextractor from Git::
435* Install GNUnet dependencies::
436* Build GNUnet::
437* Install the GNUnet-gtk user interface from Git::
438@end menu
439
440@node Install the required build tools
441@subsection Install the required build tools
442
443First, make sure Git is installed on your system:
444
445@example
446$ sudo apt-get install git
447@end example
448
449Install the essential buildtools:
450
451@example
452$ sudo apt-get install automake autopoint autoconf libtool
453@end example
454
455@node Install libgcrypt 1.6 and libgpg-error
456@subsection Install libgcrypt 1.6 and libgpg-error
457
458@ref{generic source installation - libgpg-error}
459
460@node Install gnutls with DANE support
461@subsection Install gnutls with DANE support
462
463@itemize @bullet
464@item @ref{generic source installation - nettle}
465@item @ref{generic source installation - ldns}
466@item @ref{generic source installation - libunbound/unbound}
467@item @ref{generic source installation - gnutls}
468@item @ref{generic source installation - libgcrypt}
469@end itemize
470
471@node Install libgnurl
472@subsection Install libgnurl
473
474Follow the @ref{generic source installation - libgnurl}.
475
476@node Install libmicrohttpd from Git
477@subsection Install libmicrohttpd from Git
478
479@example
480$ git clone https://gnunet.org/git/libmicrohttpd
481$ cd libmicrohttpd/
482$ ./bootstrap
483$ ./configure
484$ sudo make install ; cd ..
485@end example
486
487@node Install libextractor from Git
488@subsection Install libextractor from Git
489
490Install libextractor dependencies:
491
492@example
493$ sudo apt-get install zlib1g-dev libgsf-1-dev libmpeg2-4-dev \
494 libpoppler-dev libvorbis-dev libexiv2-dev libjpeg-dev \
495 libtiff-dev libgif-dev libvorbis-dev libflac-dev libsmf-dev \
496 g++
497@end example
498
499Build libextractor:
500
501@example
502$ git clone https://gnunet.org/git/libextractor
503$ cd libextractor
504$ ./bootstrap
505$ ./configure
506$ sudo make install ; cd ..
507@end example
508
509@node Install GNUnet dependencies
510@subsection Install GNUnet dependencies
511
512@example
513$ sudo apt-get install libidn11-dev libunistring-dev libglpk-dev \
514 libpulse-dev libbluetooth-dev libsqlite-dev
515@end example
516
517Install libopus:
518
519@example
520$ wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
521$ tar xf opus-1.1.tar.gz
522$ cd opus-1.1/
523$ ./configure
524$ sudo make install ; cd ..
525@end example
526
527Choose one or more database backends:
528
529SQLite3:
530@example
531$ sudo apt-get install libsqlite3-dev
532@end example
533MySQL:
534@example
535$ sudo apt-get install libmysqlclient-dev
536@end example
537PostgreSQL:
538@example
539$ sudo apt-get install libpq-dev postgresql
540@end example
541
542
543
544@node Build GNUnet
545@subsection Build GNUnet
546
547
548
549@menu
550* Configuring the installation path::
551* Configuring the system::
552* Installing components requiring sudo permission::
553* Build::
554@end menu
555
556@node Configuring the installation path
557@subsubsection Configuring the installation path
558
559You can specify the location of the GNUnet installation by setting the
560prefix when calling the configure script with @code{--prefix=DIRECTORY}
561
562@example
563$ export PATH=$PATH:DIRECTORY/bin
564@end example
565
566@node Configuring the system
567@subsubsection Configuring the system
568
569Please make sure NOW that you have created a user and group 'gnunet'
570and additionally a group 'gnunetdns':
571
572@example
573$ sudo addgroup gnunet
574$ sudo addgroup gnunetdns
575$ sudo adduser gnunet
576@end example
577
578Each GNUnet user should be added to the 'gnunet' group (may
579require fresh login to come into effect):
580
581@example
582$ sudo useradd -G gnunet
583@end example
584
585@node Installing components requiring sudo permission
586@subsubsection Installing components requiring sudo permission
587
588Some components, like the nss plugin required for GNS, may require root
589permissions. To allow these few components to be installed use:
590
591@example
592$ ./configure --with-sudo
593@end example
594
595@node Build
596@subsubsection Build
597
598@example
599$ git clone https://gnunet.org/git/gnunet/
600$ cd gnunet/
601$ ./bootstrap
602@end example
603
604Use the required configure call including the optional installation prefix
605@code{PREFIX} or the sudo permissions:
606
607@example
608$ ./configure [ --with-sudo | --with-prefix=PREFIX ]
609@end example
610
611@example
612$ make; sudo make install
613@end example
614
615After installing it, you need to create an empty configuration file:
616
617@example
618mkdir ~/.gnunet; touch ~/.gnunet/gnunet.conf
619@end example
620
621And finally you can start GNUnet with:
622
623@example
624$ gnunet-arm -s
625@end example
626
627@node Install the GNUnet-gtk user interface from Git
628@subsection Install the GNUnet-gtk user interface from Git
629
630
631Install depencies:
632
633@example
634$ sudo apt-get install libgtk-3-dev libunique-3.0-dev libgladeui-dev \
635 libqrencode-dev
636@end example
637
638Build GNUnet (with an optional prefix) and execute:
639
640@example
641$ git clone https://gnunet.org/git/gnunet-gtk/
642$ cd gnunet-gtk/
643$ ./bootstrap
644$ ./configure [--prefix=PREFIX] --with-gnunet=DIRECTORY
645$ make; sudo make install
646@end example
647
648@node Build instructions for software builds from source
649@section Build instructions for software builds from source
650
651This section describes software builds in case your operating
652system lacks binary substitutes / binary builds for some dependencies
653of GNUnet.
654It is assumed that you have installed common build dependencies
655and that these instructions are treated as generic without any
656debugging help.
657It is furthermore assumed that you use the release tarballs of
658the software, installation from the respective version control
659sources might differ in ways that are only minimal different
660(for example a dependency on autotools etc).
661
662@menu
663* generic source installation - nettle::
664* generic source installation - ldns::
665* generic source installation - libunbound/unbound::
666* generic source installation - libav::
667* generic source installation - libextractor::
668* generic source installation - libgpg-error::
669* generic source installation - libgcrypt::
670* generic source installation - gnutls::
671* generic source installation - libmicrohttpd::
672* generic source installation - libgnurl::
673@end menu
674
675@node generic source installation - nettle
676@subsection generic source installation - nettle
677
678@example
679$ wget http://www.lysator.liu.se/~nisse/archive/nettle-2.7.1.tar.gz
680$ tar xf nettle-2.7.1.tar.gz
681$ cd nettle-2.7.1
682$ ./configure
683$ sudo make install ; cd ..
684@end example
685
686@node generic source installation - ldns
687@subsection generic source installation - ldns
688
689@example
690$ wget https://www.nlnetlabs.nl/downloads/ldns/ldns-1.6.16.tar.gz
691$ tar xf ldns-1.6.16.tar.gz
692$ cd ldns-1.6.16
693$ ./configure
694$ sudo make install ; cd ..
695@end example
696
697@node generic source installation - libunbound/unbound
698@subsection generic source installation - libunbound/unbound
699
700@example
701$ wget https://unbound.net/downloads/unbound-1.4.21.tar.gz
702$ tar xf unbound-1.4.21.tar.gz
703$ cd unbound-1.4.21
704$ ./configure
705$ sudo make install ; cd ..
706@end example
707
708@node generic source installation - libav
709@subsection generic source installation - libav
710
711@example
712$ wget https://libav.org/releases/libav-9.10.tar.xz
713$ cd libav-0.9 ; ./configure --enable-shared;
714$ make; sudo make install; cd ..
715@end example
716
717@node generic source installation - libextractor
718@subsection generic source installation - libextractor
719
720@example
721$ wget https://ftp.gnu.org/gnu/libextractor/libextractor-1.3.tar.gz
722$ tar xvf libextractor-1.3.tar.gz
723$ cd libextractor-1.3 ; ./configure;
724$ make ; sudo make install; cd ..
725@end example
726
727@node generic source installation - libgpg-error
728@subsection generic source installation - libgpg-error
729
730@example
731$ wget https://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.12.tar.bz2
732$ tar xvf libgpg-error-1.12.tar.bz2
733$ cd libgpg-error-1.12; ./configure;
734$ make ; sudo make install; cd ..
735@end example
736
737@node generic source installation - libgcrypt
738@subsection generic source installation - libgcrypt
739@example
740$ wget https://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.0.tar.bz2
741$ tar xvf libgcrypt-1.6.0.tar.bz2
742$ cd libgcrypt-1.6.0; ./configure --with-gpg-error-prefix=/usr/local;
743$ make ; sudo make install ; cd ..
744@end example
745
746@node generic source installation - gnutls
747@subsection generic source installation - gnutls
748
749@example
750$ wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.7.tar.xz
751$ tar xvf gnutls-3.2.7.tar.xz
752$ cd gnutls-3.2.7
753@end example
754
755@noindent
756If you want a GnuTLS with DANE functionality (recommended for GNUnet),
757you have to compile it against libunbound. Assuming that libunbound
758is installed on your system:
759
760@example
761$ ./configure --enable-libdane
762@end example
763
764@noindent
765Note that the build system of GnuTLS should pick up libunbound without
766the explicit mention of @code{--enable-libdane}.
767If you don't want libdane support you should pass @code{--disable-libdane}
768instead.
769
770@example
771$ ./configure
772$ make ; sudo make install ; cd ..
773@end example
774
775@node generic source installation - libmicrohttpd
776@subsection generic source installation - libmicrohttpd
777
778@example
779$ wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.33.tar.gz
780$ tar xvf libmicrohttpd-0.9.33.tar.gz
781$ cd libmicrohttpd-0.9.33; ./configure;
782$ make ; sudo make install ; cd ..
783@end example
784
785@node generic source installation - libgnurl
786@subsection generic source installation - libgnurl
787
788Example installation of libgnurl version 7.57.0 from source.
789
790@example
791$ wget https://ftp.gnu.org/gnu/gnunet/gnurl-7.57.0.tar.xz
792$ wget https://ftp.gnu.org/gnu/gnunet/gnurl-7.57.0.tar.xz.sig
793$ gpg --verify gnurl-7.57.0.tar.xz.sig
794@end example
795
796@noindent
797If that command fails because you do not have the required public key,
798then run this command to import it:
799
800@example
801$ gpg --keyserver pgp.mit.edu --recv-keys A88C8ADD129828D7EAC02E52E22F9BBFEE348588
802@end example
803
804@noindent
805and rerun the gpg --verify command.
806
807@example
808$ tar xvf gnurl-7.57.0.tar.xz
809$ cd gnurl-7.57.0
810$ ./configure --disable-ntlm-wb
811$ make ; sudo make install; cd ..
812@end example
813
814You have now build and installed libgnurl from source.
815
816@menu
817* Fixing libgnurl build issues::
818@end menu
819
820@node Fixing libgnurl build issues
821@subsubsection Fixing libgnurl build issues
822
823@c FIXME: Obviously this subsection should be evaluated and
824@c if still necessary moved into gnURL itself (README) or
825@c into a separate section which deals with gnURL.
826If you have to compile libgnurl from source (for example if the version
827included in your distribution is too old or it's not included at all)
828you perhaps might get an error message while running the
829@command{configure} script:
830
831@example
832$ configure
833...
834checking for 64-bit curl_off_t data type... unknown
835checking for 32-bit curl_off_t data type... unknown
836checking for 16-bit curl_off_t data type... unknown
837configure: error: cannot find data type for curl_off_t.
838@end example
839
840@noindent
841Solution:
842
843Before running the @command{configure} script, set:
844
845@example
846CFLAGS="-I. -I$BUILD_ROOT/include"
847@end example
848
849@node Build Instructions for Microsoft Windows Platforms
850@section Build Instructions for Microsoft Windows Platforms
851
852@menu
853* Introduction to building on MS Windows::
854* Requirements::
855* Dependencies & Initial Setup::
856* GNUnet Installation::
857* Adjusting Windows for running and testing GNUnet::
858* Building the GNUnet Installer::
859* Using GNUnet with Netbeans on Windows::
860@end menu
861
862@node Introduction to building on MS Windows
863@subsection Introduction to building on MS Windows
864
865
866This document is a guide to building GNUnet and its dependencies on
867Windows platforms. GNUnet development is mostly done under GNU/Linux and
868especially git checkouts may not build out of the box.
869We regret any inconvenience, and if you have problems, please report
870them.
871
872@node Requirements
873@subsection Requirements
874
875The Howto is based upon a @strong{Windows Server 2008 32bit}
876@strong{Installation}, @strong{sbuild} and thus a
877@uref{http://www.mingw.org/wiki/MSYS, MSYS+MinGW}
878(W32-GCC-Compiler-Suite + Unix-like Userland) installation. sbuild
879is a convenient set of scripts which creates a working msys/mingw
880installation and installs most dependencies required for GNUnet.
881
882As of the point of the creation of these instructions,
883GNUnet @strong{requires} a Windows @strong{Server} 2003 or
884newer for full feature support.
885Windows Vista and later will also work, but
886@strong{non-server version can not run a VPN-Exit-Node} as the NAT
887features have been removed as of Windows Vista.
888
889@c TODO: We should document Windows 10!
890@c It seems like the situation hasn't changed with W10
891
892@node Dependencies & Initial Setup
893@subsection Dependencies & Initial Setup
894
895
896@itemize @bullet
897
898@item
899Install a fresh version of @strong{Python 2.x}, even if you are using a
900x64-OS, install a 32-bit version for use with sbuild.
901Python 3.0 is currently incompatible.
902
903@item
904Install your favorite @uref{http://code.google.com/p/tortoisegit/, git} &
905@uref{http://tortoisesvn.net/, subversion}-clients.
906
907@item
908You will also need some archive-manager like
909@uref{http://www.7-zip.org/, 7zip}.
910
911@item
912Pull a copy of sbuild to a directory of your choice, which will be used
913in the remainder of this guide. For now, we will use
914@file{c:\gnunet\sbuild\}
915
916@item
917in @file{sbuild\src\mingw\mingw32-buildall.sh}, comment out the packages
918@strong{gnunet-svn} and @strong{gnunet-gtk-svn}, as we don't want sbuild
919to compile/install those for us.
920
921@item
922Follow LRN's sbuild installation instructions.-
923@end itemize
924
925Please note that sbuild may (or will most likely) fail during
926installation, thus you really HAVE to @strong{check the logfiles} created
927during the installation process.
928Certain packages may fail to build initially due to missing dependencies,
929thus you may have to
930@strong{substitute those with binary-versions initially}. Later on once
931dependencies are satisfied you can re-build the newer package versions.
932
933@strong{It is normal that you may have to repeat this step multiple times
934and there is no uniform way to fix all compile-time issues, as the
935build-process of many of the dependencies installed are rather unstable
936on win32 and certain releases may not even compile at all.}
937
938Most dependencies for GNUnet have been set up by sbuild, thus we now
939should add the @file{bin/} directories in your new msys and mingw
940installations to PATH. You will want to create a backup of your finished
941msys-environment by now.
942
943@node GNUnet Installation
944@subsection GNUnet Installation
945
946First, we need to launch our msys-shell, you can do this via
947
948@file{C:\gnunet\sbuild\msys\msys.bat}
949
950You might wish to take a look at this file and adjust some
951login-parameters to your msys environment.
952
953Also, sbuild added two pointpoints to your msys-environment, though those
954might remain invisible:
955
956@itemize @bullet
957
958@item
959/mingw, which will mount your mingw-directory from sbuild/mingw and the
960other one is
961
962@item
963/src which contains all the installation sources sbuild just compiled.
964@end itemize
965
966Check out the current GNUnet sources (git HEAD) from the
967GNUnet repository "gnunet.git", we will do this in your home directory:
968
969@code{git clone https://gnunet.org/git/gnunet/ ~/gnunet}
970
971Now, we will first need to bootstrap the checked out installation and then
972configure it accordingly.
973
974@example
975cd ~/gnunet
976./bootstrap
977STRIP=true CPPFLAGS="-DUSE_IPV6=1 -DW32_VEH" CFLAGS="$CFLAGS -g -O2" \
978./configure --prefix=/ --docdir=/share/doc/gnunet \
979--with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw \
980--with-libcurl=/mingw --with-extractor=/mingw --with-sqlite=/mingw \
981--with-microhttpd=/mingw --with-plibc=/mingw --enable-benchmarks \
982--enable-expensivetests --enable-experimental --with-qrencode=/mingw \
983--enable-silent-rules --enable-experimental 2>&1 | tee -a ./configure.log
984@end example
985
986The parameters above will configure for a reasonable GNUnet installation
987to the your msys-root directory.
988Depending on which features your would like to build or you may need to
989specify additional dependencies. Sbuild installed most libs into
990the /mingw subdirectory, so remember to prefix library locations with
991this path.
992
993Like on a unixoid system, you might want to use your home directory as
994prefix for your own GNUnet installation for development, without tainting
995the buildenvironment. Just change the "prefix" parameter to point towards
996~/ in this case.
997
998Now it's time to compile GNUnet as usual. Though this will take some time,
999so you may fetch yourself a coffee or some Mate now...
1000
1001@example
1002make ; make install
1003@end example
1004
1005@node Adjusting Windows for running and testing GNUnet
1006@subsection Adjusting Windows for running and testing GNUnet
1007
1008Assuming the build succeeded and you
1009@strong{added the bin directory of your GNUnet to PATH}, you can now use
1010your gnunet-installation as usual.
1011Remember that UAC or the windows firewall may popup initially, blocking
1012further execution of gnunet until you acknowledge them.
1013
1014You will also have to take the usual steps to get peer-to-peer (p2p)
1015software running properly (port forwarding, ...),
1016and GNUnet will require administrative permissions as it may even
1017install a device-driver (in case you are using gnunet-vpn and/or
1018gnunet-exit).
1019
1020@node Building the GNUnet Installer
1021@subsection Building the GNUnet Installer
1022
1023The GNUnet installer is made with
1024@uref{http://nsis.sourceforge.net/, NSIS}.
1025The installer script is located in @file{contrib\win} in the
1026GNUnet source tree.
1027
1028@node Using GNUnet with Netbeans on Windows
1029@subsection Using GNUnet with Netbeans on Windows
1030
1031TODO
1032
1033@node Build instructions for Debian 7.5
1034@section Build instructions for Debian 7.5
1035
1036
1037These are the installation instructions for Debian 7.5. They were tested
1038using a minimal, fresh Debian 7.5 AMD64 installation without non-free
1039software (no contrib or non-free).
1040By "minimal", we mean that during installation, we did not select any
1041desktop environment, servers or system utilities during the "tasksel"
1042step. Note that the packages and the dependencies that we will install
1043during this chapter take about 1.5 GB of disk space.
1044Combined with GNUnet and space for objects during compilation, you should
1045not even attempt this unless you have about 2.5 GB free after the minimal
1046Debian installation.
1047Using these instructions to build a VM image is likely to require a
1048minimum of 4-5 GB for the VM (as you will likely also want a desktop
1049manager).
1050
1051GNUnet's security model assumes that your @file{/home} directory is
1052encrypted. Thus, if possible, you should encrypt your home partition
1053(or per-user home directory).
1054
1055Naturally, the exact details of the starting state for your installation
1056should not matter much. For example, if you selected any of those
1057installation groups you might simply already have some of the necessary
1058packages installed.
1059We did this for testing, as this way we are less likely to forget to
1060mention a required package.
1061Note that we will not install a desktop environment, but of course you
1062will need to install one to use GNUnet's graphical user interfaces.
1063Thus, it is suggested that you simply install the desktop environment of
1064your choice before beginning with the instructions.
1065
1066
1067
1068@menu
1069* Update::
1070* Stable? Hah!::
1071* Update again::
1072* Installing packages::
1073* Installing dependencies from source::
1074* Installing GNUnet from source::
1075* But wait there is more!::
1076@end menu
1077
1078@node Update
1079@subsection Update
1080
1081After any installation, you should begin by running
1082
1083@example
1084# apt-get update ; apt-get upgrade
1085@end example
1086
1087to ensure that all of your packages are up-to-date. Note that the "#" is
1088used to indicate that you need to type in this command as "root"
1089(or prefix with "sudo"), whereas "$" is used to indicate typing in a
1090command as a normal user.
1091
1092@node Stable? Hah!
1093@subsection Stable? Hah!
1094
1095Yes, we said we start with a Debian 7.5 "stable" system. However, to
1096reduce the amount of compilation by hand, we will begin by allowing the
1097installation of packages from the testing and unstable distributions as
1098well.
1099We will stick to "stable" packages where possible, but some packages will
1100be taken from the other distributions.
1101Start by modifying @file{/etc/apt/sources.list} to contain the
1102following (possibly adjusted to point to your mirror of choice):
1103
1104@example
1105# These were there before:
1106deb http://ftp.de.debian.org/debian/ wheezy main
1107deb-src http://ftp.de.debian.org/debian/ wheezy main
1108deb http://security.debian.org/ wheezy/updates main
1109deb-src http://security.debian.org/ wheezy/updates main
1110deb http://ftp.de.debian.org/debian/ wheezy-updates main
1111deb-src http://ftp.de.debian.org/debian/ wheezy-updates main
1112
1113# Add these lines (feel free to adjust the mirror):
1114deb http://ftp.de.debian.org/debian/ testing main
1115deb http://ftp.de.debian.org/debian/ unstable main
1116@end example
1117
1118The next step is to create/edit your @file{/etc/apt/preferences}
1119file to look like this:
1120
1121@example
1122Package: *
1123Pin: release a=stable,n=wheezy
1124Pin-Priority: 700
1125
1126Package: *
1127Pin: release o=Debian,a=testing
1128Pin-Priority: 650
1129
1130Package: *
1131Pin: release o=Debian,a=unstable
1132Pin-Priority: 600
1133@end example
1134
1135You can read more about Apt Preferences here and here.
1136Note that other pinnings are likely to also work for GNUnet, the key
1137thing is that you need some packages from unstable (as shown below).
1138However, as unstable is unlikely to be comprehensive (missing packages)
1139or might be problematic (crashing packages), you probably want others
1140from stable and/or testing.
1141
1142@node Update again
1143@subsection Update again
1144
1145Now, run again@
1146
1147@example
1148# apt-get update@
1149# apt-get upgrade@
1150@end example
1151
1152to ensure that all your new distribution indices are downloaded, and
1153that your pinning is correct: the upgrade step should cause no changes
1154at all.
1155
1156@node Installing packages
1157@subsection Installing packages
1158
1159We begin by installing a few Debian packages from stable:@
1160
1161@example
1162# apt-get install gcc make python-zbar libltdl-dev libsqlite3-dev \
1163 libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev \
1164 texlive libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev \
1165 libbz2-dev libexiv2-dev libflac-dev libgif-dev libglib2.0-dev \
1166 libgtk-3-dev libmagic-dev libjpeg8-dev libmpeg2-4-dev libmp4v2-dev \
1167 librpm-dev libsmf-dev libtidy-dev libtiff5-dev libvorbis-dev \
1168 libogg-dev zlib1g-dev g++ gettext libgsf-1-dev libunbound-dev \
1169 libqrencode-dev libgladeui-dev nasm texlive-latex-extra \
1170 libunique-3.0-dev gawk miniupnpc libfuse-dev libbluetooth-dev
1171@end example
1172
1173After that, we install a few more packages from unstable:@
1174
1175@example
1176# apt-get install -t unstable nettle-dev libgstreamer1.0-dev \
1177 gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
1178 libgstreamer-plugins-base1.0-dev
1179@end example
1180
1181@node Installing dependencies from source
1182@subsection Installing dependencies from source
1183
1184Next, we need to install a few dependencies from source.
1185You might want to do this as a "normal" user and only run the
1186@code{make install} steps as root (hence the @code{sudo} in the
1187commands below). Also, you do this from any
1188directory. We begin by downloading all dependencies, then extracting the
1189sources, and finally compiling and installing the libraries.
1190
1191For these steps, follow the instructions given in the
1192installation from source instruction in this order:
1193
1194@itemize @bullet
1195@item @ref{generic source installation - libav}
1196@item @ref{generic source installation - libextractor}
1197@item @ref{generic source installation - libgpg-error}
1198@item @ref{generic source installation - libgcrypt}
1199@item @ref{generic source installation - gnutls}
1200@item @ref{generic source installation - libmicrohttpd}
1201@item @ref{generic source installation - libgnurl}
1202@end itemize
1203
1204@node Installing GNUnet from source
1205@subsection Installing GNUnet from source
1206
1207
1208For this, simply follow the generic installation instructions from
1209here.
1210
1211@node But wait there is more!
1212@subsection But wait there is more!
1213
1214So far, we installed all of the packages and dependencies required to
1215ensure that all of GNUnet would be built.
1216However, while for example the plugins to interact with the MySQL or
1217Postgres databases have been created, we did not actually install or
1218configure those databases. Thus, you will need to install
1219and configure those databases or stick with the default Sqlite database.
1220Sqlite is usually fine for most applications, but MySQL can offer better
1221performance and Postgres better resillience.
1222
1223
1224@node Installing GNUnet from Git on Ubuntu 14.4
1225@section Installing GNUnet from Git on Ubuntu 14.4
1226
1227@strong{Install the required build tools:}
1228
1229@example
1230$ sudo apt-get install git automake autopoint autoconf
1231@end example
1232
1233@strong{Install the required dependencies}
1234
1235@example
1236$ sudo apt-get install libltdl-dev libgpg-error-dev libidn11-dev \
1237 libunistring-dev libglpk-dev libbluetooth-dev libextractor-dev \
1238 libmicrohttpd-dev libgnutls28-dev
1239@end example
1240
1241@strong{Choose one or more database backends}
1242
1243@itemize @bullet
1244
1245@item SQLite3:
1246
1247@example
1248$ sudo apt-get install libsqlite3-dev
1249@end example
1250
1251@item MySQL:
1252
1253@example
1254$ sudo apt-get install libmysqlclient-dev
1255@end example
1256
1257@item PostgreSQL:
1258
1259@example
1260$ sudo apt-get install libpq-dev postgresql
1261@end example
1262
1263@end itemize
1264
1265@strong{Install the optional dependencies for gnunet-conversation:}
1266
1267@example
1268$ sudo apt-get install gstreamer1.0 libpulse-dev libopus-dev
1269@end example
1270
1271@strong{Install the libgrypt 1.6.1:}
1272
1273@itemize @bullet
1274
1275@item For Ubuntu 14.04:
1276
1277@example
1278$ sudo apt-get install libgcrypt20-dev
1279@end example
1280
1281@item For Ubuntu older 14.04:
1282
1283@example
1284$ wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.1.tar.bz2
1285$ tar xf libgcrypt-1.6.1.tar.bz2
1286$ cd libgcrypt-1.6.1
1287$ ./configure
1288$ sudo make install
1289$ cd ..
1290@end example
1291
1292@end itemize
1293
1294@strong{Install libgnurl}
1295
1296@example
1297$ wget https://gnunet.org/sites/default/files/gnurl-7.35.0.tar.bz2
1298$ tar xf gnurl-7.35.0.tar.bz2
1299$ cd gnurl-7.35.0
1300$ ./configure --enable-ipv6 --with-gnutls --without-libssh2 \
1301 --without-libmetalink --without-winidn --without-librtmp \
1302 --without-nghttp2 --without-nss --without-cyassl --without-polarssl \
1303 --without-ssl --without-winssl --without-darwinssl --disable-sspi \
1304 --disable-ntlm-wb --disable-ldap --disable-rtsp --disable-dict \
1305 --disable-telnet --disable-tftp --disable-pop3 --disable-imap \
1306 --disable-smtp --disable-gopher --disable-file --disable-ftp
1307$ sudo make install
1308$ cd ..
1309@end example
1310
1311@strong{Install GNUnet}
1312
1313@example
1314$ git clone https://gnunet.org/git/gnunet/
1315$ cd gnunet/
1316$ ./bootstrap
1317@end example
1318
1319If you want to:
1320
1321@itemize @bullet
1322
1323@item Install to a different directory:
1324
1325@example
1326--prefix=PREFIX
1327@end example
1328
1329@item
1330Have sudo permission, but do not want to compile as root:
1331
1332@example
1333--with-sudo
1334@end example
1335
1336@item
1337Want debug message enabled:
1338
1339@example
1340--enable-logging=verbose
1341@end example
1342
1343@end itemize
1344
1345
1346@example
1347$ ./configure [ --with-sudo | --prefix=PREFIX | --enable-logging=verbose]
1348$ make; sudo make install
1349@end example
1350
1351After installing it, you need to create an empty configuration file:
1352
1353@example
1354touch ~/.config/gnunet.conf
1355@end example
1356
1357And finally you can start GNUnet with
1358
1359@example
1360$ gnunet-arm -s
1361@end example
1362
1363@node Build instructions for Debian 8
1364@section Build instructions for Debian 8
1365@c FIXME: I -> we
1366
1367These are the installation instructions for Debian 8. They were tested
1368sing a fresh Debian 8 AMD64 installation without non-free software (no
1369contrib or non-free). During installation, I only selected "lxde" for the
1370desktop environment.
1371Note that the packages and the dependencies that we will install during
1372this chapter take about 1.5 GB of disk space. Combined with GNUnet and
1373space for objects during compilation, you should not even attempt this
1374unless you have about 2.5 GB free after the Debian installation.
1375Using these instructions to build a VM image is likely to require a
1376minimum of 4-5 GB for the VM (as you will likely also want a desktop
1377manager).
1378
1379GNUnet's security model assumes that your @code{/home} directory is
1380encrypted.
1381Thus, if possible, you should encrypt your entire disk, or at least just
1382your home partition (or per-user home directory).
1383
1384Naturally, the exact details of the starting state for your installation
1385should not matter much.
1386For example, if you selected any of those installation groups you might
1387simply already have some of the necessary packages installed. Thus, it is
1388suggested that you simply install the desktop environment of your choice
1389before beginning with the instructions.
1390
1391
1392@menu
1393* Update Debian::
1394* Installing Debian Packages::
1395* Installing Dependencies from Source2::
1396* Installing GNUnet from Source2::
1397* But wait (again) there is more!::
1398@end menu
1399
1400@node Update Debian
1401@subsection Update Debian
1402
1403After any installation, you should begin by running
1404
1405@example
1406# apt-get update
1407# apt-get upgrade
1408@end example
1409
1410to ensure that all of your packages are up-to-date. Note that the "#" is
1411used to indicate that you need to type in this command as "root" (or
1412prefix with "sudo"), whereas "$" is used to indicate typing in a command
1413as a normal user.
1414
1415@node Installing Debian Packages
1416@subsection Installing Debian Packages
1417
1418We begin by installing a few Debian packages from stable:
1419
1420@example
1421# apt-get install gcc make python-zbar libltdl-dev libsqlite3-dev \
1422libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev texlive \
1423libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev libbz2-dev \
1424libflac-dev libgif-dev libglib2.0-dev libgtk-3-dev libmpeg2-4-dev \
1425libtidy-dev libvorbis-dev libogg-dev zlib1g-dev g++ gettext \
1426libgsf-1-dev libunbound-dev libqrencode-dev libgladeui-dev nasm \
1427texlive-latex-extra libunique-3.0-dev gawk miniupnpc libfuse-dev \
1428libbluetooth-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
1429libgstreamer-plugins-base1.0-dev nettle-dev libextractor-dev \
1430libgcrypt20-dev libmicrohttpd-dev
1431@end example
1432
1433@node Installing Dependencies from Source2
1434@subsection Installing Dependencies from Source2
1435
1436Yes, we said we start with a Debian 8 "stable" system, but because Debian
1437linked GnuTLS without support for DANE, we need to compile a few things,
1438in addition to GNUnet, still by hand. Yes, you can run GNUnet using the
1439respective Debian packages, but then you will not get DANE support.
1440
1441Next, we need to install a few dependencies from source. You might want
1442to do this as a "normal" user and only run the @code{make install} steps
1443as root (hence the @code{sudo} in the commands below). Also, you do this
1444from any directory. We begin by downloading all dependencies, then
1445extracting the sources, and finally compiling and installing the
1446libraries:
1447
1448@example
1449$ wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.12.tar.xz
1450$ tar xvf gnutls-3.3.12.tar.xz
1451$ cd gnutls-3.3.12 ; ./configure ; make ; sudo make install ; cd ..
1452@end example
1453
1454For the installation and compilation of libgnurl/gnURL refer to
1455the generic installation section,
1456@xref{generic source installation - libgnurl}.
1457
1458@node Installing GNUnet from Source2
1459@subsection Installing GNUnet from Source2
1460
1461For this, simply follow the generic installation instructions from@
1462here.
1463
1464@node But wait (again) there is more!
1465@subsection But wait (again) there is more!
1466
1467So far, we installed all of the packages and dependencies required to
1468ensure that all of GNUnet would be built. However, while for example the
1469plugins to interact with the MySQL or Postgres databases have been
1470created, we did not actually install or configure those databases.
1471Thus, you will need to install and configure those databases or stick
1472with the default Sqlite database. Sqlite is usually fine for most
1473applications, but MySQL can offer better performance and Postgres better
1474resillience.
1475
1476@node Build instructions for macOS
1477@section Build instructions for macOS
1478@c FIXME: I -> we
1479
1480These are the installation guidelines for macOS.
1481They were tested on macOS High Sierra.
1482
1483@menu
1484* Installing dependencies::
1485* Compile from Source::
1486@end menu
1487
1488@node Installing dependencies
1489@subsection Installing dependencies
1490
1491First, install XCode in the newest version.
1492See https://developer.apple.com/xcode/.
1493
1494Install Homebrew (https://brew.sh) and then install the dependencies listed above.
1495If a dependency does not exists in brew, you need to compile it from source.
1496
1497@example
1498# brew install <dependency>
1499@end example
1500
1501@node Compile from Source
1502@subsection Compile from Source
1503
1504Before you start building GNUnet, you need to setup your environment.
1505This means that you have to make sure the proper tools are used in the build process.
1506For example, after installing texinfo you need to make sure the new texinfo is actually used:
1507
1508@example
1509# echo 'export PATH="/usr/local/opt/texinfo/bin:$PATH"' >> ~/.bash_profile
1510@end example
1511
1512Note: brew tells you the appropriate command when executing
1513
1514@example
1515# brew info texinfo
1516@end example
1517
1518This may also be necessary for the gettext package.
1519
1520Before you start compiling, you need to make sure gcc is used and not the clang compile of your macOS system.
1521On my system, gcc was actually ``gcc-7'' and gcc pointed to the clang compiler.
1522
1523@example
1524# export CC=gcc-7
1525@end example
1526
1527After this the standard compile instructions apply.
1528
1529@c @node Build instructions for OpenBSD 6.2
1530@c @section Build instructions for OpenBSD 6.2
1531
1532@node Outdated build instructions for previous revisions
1533@section Outdated build instructions for previous revisions
1534
1535This chapter contains a collection of outdated, older installation guides.
1536They are mostly intended to serve as a starting point for writing
1537up-to-date instructions and should not be expected to work for
1538GNUnet 0.10.x.
1539A set of older installation instructions can also be found in the
1540file @file{doc/outdated-and-old-installation-instructions.txt} in the
1541source tree of GNUnet.
1542
1543This file covers old instructions which no longer receive security
1544updates or any kind of support.
1545
1546@menu
1547* Installing GNUnet 0.10.1 on Ubuntu 14.04::
1548* Building GLPK for MinGW::
1549* GUI build instructions for Ubuntu 12.04 using Subversion::
1550@c * Installation with gnunet-update::
1551* Instructions for Microsoft Windows Platforms (Old)::
1552@end menu
1553
1554
1555@node Installing GNUnet 0.10.1 on Ubuntu 14.04
1556@subsection Installing GNUnet 0.10.1 on Ubuntu 14.04
1557
1558Install the required dependencies:
1559
1560@example
1561$ sudo apt-get install libltdl-dev libgpg-error-dev libidn11-dev \
1562 libunistring-dev libglpk-dev libbluetooth-dev libextractor-dev \
1563 libmicrohttpd-dev libgnutls28-dev
1564@end example
1565
1566Choose one or more database backends:
1567
1568@itemize @bullet
1569
1570@item SQLite3
1571
1572@example
1573 $ sudo apt-get install libsqlite3-dev@
1574@end example
1575
1576@item MySQL
1577
1578@example
1579$ sudo apt-get install libmysqlclient-dev@
1580@end example
1581
1582@item PostgreSQL
1583
1584@example
1585 $ sudo apt-get install libpq-dev postgresql@
1586@end example
1587
1588@end itemize
1589
1590Install the optional dependencies for gnunet-conversation:
1591
1592@example
1593 $ sudo apt-get install gstreamer1.0 libpulse-dev libopus-dev
1594@end example
1595
1596Install libgcrypt 1.6:
1597
1598@itemize @bullet
1599
1600@item For Ubuntu 14.04:
1601
1602@example
1603$ sudo apt-get install libgcrypt20-dev
1604@end example
1605
1606@item For Ubuntu older than 14.04:
1607
1608@example
1609wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.1.tar.bz2
1610$ tar xf libgcrypt-1.6.1.tar.bz2
1611$ cd libgcrypt-1.6.1
1612$ ./configure
1613$ sudo make install
1614$ cd ..
1615@end example
1616@end itemize
1617
1618Install libgnurl:
1619
1620@pxref{generic source installation - libgnurl}.
1621
1622Install GNUnet:
1623
1624@example
1625$ wget http://ftpmirror.gnu.org/gnunet/gnunet-0.10.1.tar.gz
1626$ tar xf gnunet-0.10.1.tar.gz
1627$ cd gnunet-0.10.1
1628@end example
1629
1630If you want to:
1631
1632@itemize @bullet
1633
1634@item
1635Install to a different directory:
1636
1637@example
1638--prefix=PREFIX
1639@end example
1640
1641@item
1642Have sudo permission, but do not want to compile as root:
1643
1644@example
1645--with-sudo
1646@end example
1647
1648@item
1649Want debug message enabled:
1650
1651@example
1652--enable-logging=verbose
1653@end example
1654
1655@end itemize
1656
1657@example
1658$ ./configure [ --with-sudo | --prefix=PREFIX | --enable-logging=verbose]
1659$ make; sudo make install
1660@end example
1661
1662After installing it, you need to create an empty configuration file:
1663
1664@example
1665touch ~/.config/gnunet.conf
1666@end example
1667
1668And finally you can start GNUnet with
1669
1670@example
1671$ gnunet-arm -s
1672@end example
1673
1674@node Building GLPK for MinGW
1675@subsection Building GLPK for MinGW
1676
1677GNUnet now requires the GNU Linear Programming Kit (GLPK).
1678Since there's is no package you can install with @code{mingw-get} you
1679have to compile it from source:
1680
1681@itemize @bullet
1682
1683@item Download the latest version from
1684@uref{http://ftp.gnu.org/gnu/glpk/}
1685
1686@item Unzip the downloaded source tarball using your favourite
1687unzipper application In the MSYS shell
1688
1689@item change to the respective directory
1690
1691@item Configure glpk for "i686-pc-mingw32":
1692
1693@example
1694./configure '--build=i686-pc-mingw32'
1695@end example
1696
1697@item run
1698
1699@example
1700make install check
1701@end example
1702
1703@end itemize
1704
1705MinGW does not automatically detect the correct buildtype so you have to
1706specify it manually.
1707
1708
1709@node GUI build instructions for Ubuntu 12.04 using Subversion
1710@subsection GUI build instructions for Ubuntu 12.04 using Subversion
1711
1712After installing GNUnet you can continue installing the GNUnet GUI tools:
1713
1714First, install the required dependencies:
1715
1716@example
1717$ sudo apt-get install libgladeui-dev libqrencode-dev
1718@end example
1719
1720Please ensure that the GNUnet shared libraries can be found by the linker.
1721If you installed GNUnet libraries in a non standard path
1722(say GNUNET_PREFIX=/usr/local/lib/), you can
1723
1724@itemize @bullet
1725
1726@item set the environmental variable permanently to:
1727
1728@example
1729LD_LIBRARY_PATH=$GNUNET_PREFIX
1730@end example
1731
1732@item or add @code{$GNUNET_PREFIX} to @file{/etc/ld.so.conf}
1733
1734@end itemize
1735
1736Now you can checkout and compile the GNUnet GUI tools:
1737
1738@example
1739$ git clone https://gnunet.org/git/gnunet-gtk
1740$ cd gnunet-gtk
1741$ ./bootstrap
1742$ ./configure --prefix=$GNUNET_PREFIX/.. --with-gnunet=$GNUNET_PREFIX/..
1743$ make install
1744@end example
1745
1746@c @node Installation with gnunet-update
1747@c @subsection Installation with gnunet-update
1748
1749@c gnunet-update project is an effort to introduce updates to GNUnet
1750@c installations. An interesting to-be-implemented-feature of gnunet-update
1751@c is that these updates are propagated through GNUnet's peer-to-peer
1752@c network. More information about gnunet-update can be found at
1753@c @c FIXME: Use correct cgit URL
1754@c @uref{https://gnunet.org/git/gnunet-update.git/tree/plain/README}.
1755
1756@c While the project is still under development, we have implemented the
1757@c following features which we believe may be helpful for users and we
1758@c would like them to be tested:
1759
1760@c @itemize @bullet
1761
1762@c @item
1763@c Packaging GNUnet installation along with its run-time dependencies into
1764@c update packages
1765
1766@c @item
1767@c Installing update packages into compatible hosts
1768
1769@c @item
1770@c Updating an existing installation (which had been installed by
1771@c gnunet-update) to a newer one
1772
1773@c @end itemize
1774
1775@c The above said features of gnunet-update are currently available for
1776@c testing on GNU/Linux systems.
1777
1778@c The following is a guide to help you get started with gnunet-update.
1779@c It shows you how to install the testing binary packages of GNUnet
1780@c 0.9.1 we have at @uref{https://gnunet.org/install/}.
1781
1782@c gnunet-update needs the following dependencies:
1783
1784@c @itemize @bullet
1785@c @item
1786@c python @geq{} 2.6
1787
1788@c @item
1789@c gnupg
1790
1791@c @item
1792@c python-gpgme
1793@c @end itemize
1794
1795
1796@c Checkout gnunet-update:
1797
1798@c @c FIXME: git!
1799@c @example
1800@c $ svn checkout -r24905 https://gnunet.org/svn/gnunet-update@
1801@c @end example
1802
1803@c For security reasons, all packages released for gnunet-update from us are
1804@c signed with the key at @uref{https://gnunet.org/install/key.txt}.
1805@c You would need to import this key into your gpg key ring.
1806@c gnunet-update uses this key to verify the integrity of the packages it
1807@c installs:
1808
1809@c @example
1810@c $ gpg --recv-keys 7C613D78@
1811@c @end example
1812
1813@c Download the packages relevant to your architecture (currently I have
1814@c access to GNU/Linux machines on x86_64 and i686, so only two for now,
1815@c hopefully more later) from https://gnunet.org/install/.
1816
1817@c To install the downloaded package into the directory /foo:
1818
1819@c @example
1820@c gnunet-update/bin/gnunet-update install downloaded/package /foo
1821@c @end example
1822
1823@c The installer reports the directories into which shared libraries and
1824@c dependencies have been installed. You may need to add the reported shared
1825@c library installation paths to LD_LIBRARY_PATH before you start running any
1826@c installed binaries.
1827
1828@c Please report bugs at https://gnunet.org/bugs/ under the project
1829@c 'gnunet-update'.
1830
1831@node Instructions for Microsoft Windows Platforms (Old)
1832@subsection Instructions for Microsoft Windows Platforms (Old)
1833
1834This document is a @b{DEPRECATED} installation guide for GNUnet on
1835Windows.
1836It will not work for recent GNUnet versions, but maybe it will be of
1837some use if problems arise.
1838
1839The Windows build uses a UNIX emulator for Windows,
1840@uref{http://www.mingw.org/, MinGW}, to build the executable modules.
1841These modules run natively on Windows and do not require additional
1842emulation software besides the usual dependencies.
1843
1844GNUnet development is mostly done under GNU/Linux and especially git
1845checkouts may not build out of the box.
1846We regret any inconvenience, and if you have problems, please report them.
1847
1848@menu
1849* Hardware and OS requirements::
1850* Software installation::
1851* Building libextractor and GNUnet::
1852* Installer::
1853* Source::
1854@end menu
1855
1856@node Hardware and OS requirements
1857@subsubsection Hardware and OS requirements
1858
1859@itemize @bullet
1860
1861@item Pentium II or equivalent processor, @geq{} 350 MHz
1862
1863@item 128 MB RAM
1864
1865@item 600 MB free disk space
1866
1867@item Windows 2000 or Windows XP are recommended
1868
1869@end itemize
1870
1871@node Software installation
1872@subsubsection Software installation
1873
1874@itemize @bullet
1875
1876@item
1877@strong{Compression software}@
1878
1879The software packages GNUnet depends on are usually compressed using UNIX
1880tools like @command{tar}, @command{gzip}, @command{xzip} and
1881@command{bzip2}.
1882If you do not already have an utility that is able to extract such
1883archives, get @uref{http://www.7-zip.org/, 7-Zip}.
1884
1885@item
1886@strong{UNIX environment}@
1887
1888The MinGW project provides the compiler toolchain that is used to build
1889GNUnet.
1890Get the following packages from the
1891@uref{http://sourceforge.net/projects/mingw/files/, MinGW} project:
1892
1893@itemize @bullet
1894
1895@item GCC core
1896@item GCC g++
1897@item MSYS
1898@item MSYS Developer Tool Kit (msysDTK)
1899@item MSYS Developer Tool Kit - msys-autoconf (bin)
1900@item MSYS Developer Tool Kit - msys-automake (bin)
1901@item MinGW Runtime
1902@item MinGW Utilities
1903@item Windows API
1904@item Binutils
1905@item make
1906@item pdcurses
1907@item GDB (snapshot)
1908@end itemize
1909
1910@itemize @bullet
1911
1912
1913@item Install MSYS (to c:\mingw, for example.)@
1914Do @strong{not} use spaces in the pathname.
1915For example, avoid a location such as @file{c:\program files\mingw}.
1916
1917@item Install MinGW runtime, utilities and GCC to a subdirectory
1918(to @file{c:\mingw\mingw}, for example)
1919
1920@item Install the Development Kit to the MSYS directory
1921(@file{c:\mingw})
1922
1923@item Create a batch file bash.bat in your MSYS directory with
1924the files:
1925
1926@example
1927bin\sh.exe --login
1928@end example
1929
1930This batch file opens a shell which is used to invoke the build
1931processes.
1932MinGW's standard shell (@command{msys.bat}) is not suitable
1933because it opens a separate console window.
1934On Vista, @command{bash.bat} needs to be run as Administrator.
1935
1936@item
1937Start @command{bash.sh} and rename
1938@file{c:\mingw\mingw\lib\libstdc++.la} to avoid problems:
1939
1940@example
1941mv /usr/mingw/lib/libstdc++.la /usr/mingw/lib/libstdc++.la.broken
1942@end example
1943
1944@item
1945Unpack the Windows API to the MinGW directory (@file{c:\mingw\mingw\}) and
1946remove the declaration of DATADIR from
1947(@file{c:\mingw\mingw\include\objidl.h} (lines 55-58)
1948
1949@item
1950Unpack autoconf, automake to the MSYS directory (@file{c:\mingw})
1951
1952@item
1953Install all other packages to the MinGW directory (@file{c:\mingw\mingw\})
1954@end itemize
1955
1956
1957@item @strong{GNU Libtool}@
1958GNU Libtool is required to use shared libraries.
1959Get the prebuilt package from here and unpack it to the
1960MinGW directory (@file{c:\mingw})
1961
1962@item @strong{Pthreads}@
1963GNUnet uses the portable POSIX thread library for multi-threading:
1964
1965@itemize @bullet
1966
1967@item Save
1968@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86/libpthreadGC2.a, libpthreadGC2.a}
1969(x86) or
1970@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x64/libpthreadGC2.a, libpthreadGC2.a}
1971(x64) as libpthread.a into the @file{lib}
1972directory (@file{c:\mingw\mingw\lib\libpthread.a}).
1973
1974@item Save
1975@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86/pthreadGC2.dll, pthreadGC2.dll}
1976(x86) or
1977@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x64/pthreadGC2.dll, libpthreadGC2.a}
1978(x64) into the MinGW @file{bin} directory (@file{c:\mingw\mingw\bin}).
1979
1980@item Download all header files from
1981@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/include/, include/}
1982to the @file{include} directory (@file{c:\mingw\mingw\include}).
1983@end itemize
1984
1985
1986@item @strong{GNU MP}@
1987GNUnet uses the GNU Multiple Precision library for special cryptographic
1988operations. Get the GMP binary package from the
1989@uref{http://sourceforge.net/projects/mingwrep/, MinGW repository} and
1990unpack it to the MinGW directory (@file{c:\mingw\mingw})
1991
1992@item @strong{GNU Gettext}@
1993GNU gettext is used to provide national language support.
1994Get the prebuilt package from hereand unpack it to the MinGW
1995directory (@file{c:\mingw\mingw})
1996
1997@item @strong{GNU iconv}@
1998GNU Libiconv is used for character encoding conversion.
1999Get the prebuilt package from here and unpack it to the MinGW
2000directory (@file{c:\mingw\mingw}).
2001
2002@item @strong{SQLite}@
2003GNUnet uses the SQLite database to store data.
2004Get the prebuilt binary from here and unpack it to your MinGW directory.
2005
2006@item @strong{MySQL}@
2007As an alternative to SQLite, GNUnet also supports MySQL.
2008
2009@itemize @bullet
2010
2011@item Get the binary installer from the
2012@uref{http://dev.mysql.com/downloads/mysql/4.1.html#Windows, MySQL project}
2013(version 4.1), install it and follow the instructions in
2014@file{README.mysql}.
2015
2016@item Create a temporary build directory (@file{c:\mysql})
2017
2018@item Copy the directories @file{include\} and @file{lib\} from the
2019MySQL directory to the new directory
2020
2021@item Get the patches from
2022@uref{http://bugs.mysql.com/bug.php?id=8906&files=1, Bug #8906} and
2023@uref{http://bugs.mysql.com/bug.php?id=8872&files=1, Bug #8872} (the
2024latter is only required for MySQL
2025
2026@example
2027patch -p 0
2028@end example
2029
2030@item Move @file{lib\opt\libmysql.dll} to @file{lib\libmysql.dll}
2031
2032@item Change to @file{lib\} and create an import library:
2033
2034@example
2035dlltool --input-def ../include/libmySQL.def \
2036--dllname libmysql.dll \
2037--output-lib libmysqlclient.a -k
2038@end example
2039
2040@item Copy include\* to include\mysql\
2041
2042@item Pass @code{--with-mysql=/c/mysql} to
2043@command{./configure} and copy @file{libmysql.dll}
2044to your PATH or GNUnet's @file{bin} directory
2045@end itemize
2046
2047
2048@item @strong{GTK+}@
2049@command{gnunet-fs-gtk} and @command{libextractor} depend on GTK.
2050Get the the binary and developer packages of @command{atk},
2051@command{glib}, @command{gtk}, @command{iconv},
2052@command{gettext-runtime}, @command{pango} from
2053@uref{ftp://ftp.gtk.org/pub/gtk/v2.6/win32, gtk.org} and unpack them
2054to the MinGW directory (@file{c:\mingw\mingw}).
2055@c FIXME: The URL below for pkg-config seems wrong.
2056Get @uref{http://www.gtk.org/download/win32.php, pkg-config} and
2057@command{libpng} and unpack them to the MinGW directory
2058(@file{c:\mingw\mingw}).
2059Here is an all-in-one package for the
2060@uref{http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip, gtk+dependencies}
2061. Do not overwrite any existing files!
2062
2063@item @strong{Glade}@
2064@command{gnunet-*-gtk} and @command{gnunet-setup} were created using
2065this interface builder
2066
2067@itemize @bullet
2068
2069@item Get the Glade and libglade (-bin and -devel) packages
2070(without GTK!) from
2071@uref{http://gladewin32.sourceforge.net/, GladeWin32} and unpack them to
2072the MinGW directory (@file{c:\mingw\mingw}).
2073
2074@item Get @command{libxml} from here and unpack it to the MinGW
2075directory (@file{c:\mingw\mingw}).
2076@end itemize
2077
2078@c FIXME: URLs
2079@item @strong{zLib}@
2080@command{libextractor} requires @command{zLib} to decompress some file
2081formats. GNUnet uses it to (de)compress meta-data.
2082Get zLib from here (Signature) and unpack it to the MinGW directory
2083(@file{c:\mingw\mingw}).
2084
2085@item @strong{Bzip2}@
2086@command{libextractor} also requires @command{Bzip2} to
2087decompress some file formats.
2088Get the Bzip2 (binary and developer package) from
2089@uref{http://gnuwin32.sourceforge.net/packages/bzip2.htm, GnuWin32} and
2090unpack it to the MinGW directory (@file{c:\mingw\mingw}).
2091
2092@item @strong{Libgcrypt}@
2093@command{Libgcrypt} provides the cryptographic functions used by GNUnet.
2094Get Libgcrypt from @uref{ftp://ftp.gnupg.org/gcrypt/libgcrypt/, here},
2095compile and place it in the MinGW directory
2096(@file{c:\mingw\mingw}). Currently libgcrypt @geq{} 1.4.2 is required to
2097compile GNUnet.
2098
2099@item @strong{PlibC}@
2100PlibC emulates Unix functions under Windows. Get PlibC from here and
2101unpack it to the MinGW directory (c:\mingw\mingw)
2102
2103@item @strong{OGG Vorbis}@
2104@command{OGG Vorbis} is used to extract meta-data from @file{.ogg} files.
2105Get the packages
2106@uref{http://www.gnunet.org/libextractor/download/win/libogg-1.1.4.zip, libogg}
2107and
2108@uref{http://www.gnunet.org/libextractor/download/win/libvorbis-1.2.3.zip, libvorbis}
2109from the
2110@uref{http://ftp.gnu.org/gnu/libextractor/libextractor-w32-1.0.0.zip, libextractor win32 build}
2111and unpack them to the MinGW directory (c:\mingw\mingw).
2112
2113@item @strong{Exiv2}@
2114(lib)Exiv2 is used to extract meta-data from files with Exiv2 meta-data.
2115Download
2116@uref{http://www.gnunet.org/libextractor/download/win/exiv2-0.18.2.zip, Exiv2}
2117and unpack it to the MSYS directory (c:\mingw).
2118@end itemize
2119
2120@node Building libextractor and GNUnet
2121@subsubsection Building libextractor and GNUnet
2122
2123Before you compile @command{libextractor} or @command{GNUnet},
2124be sure to set @code{PKG_CONFIG_PATH}:
2125
2126@example
2127export PKG_CONFIG_PATH=/mingw/lib/pkgconfig
2128@end example
2129
2130@noindent
2131@xref{GNUnet Installation Handbook}, for basic instructions on building
2132@command{libextractor} and @command{GNUnet}.
2133By default, all modules that are created in this way contain
2134debug information and are quite large. To compile release versions
2135(small and fast) set the variable @code{CFLAGS}:
2136
2137@example
2138export CFLAGS='-O2 -march=pentium -fomit-frame-pointer'
2139./configure --prefix=$HOME --with-extractor=$HOME
2140@end example
2141
2142@node Installer
2143@subsubsection Installer
2144
2145The GNUnet installer is made with
2146@uref{http://nsis.sourceforge.net/, NSIS}. The installer script is
2147located in @file{contrib\win} in the GNUnet source tree.
2148
2149@node Source
2150@subsubsection Source
2151
2152@c FIXME: URL
2153The sources of all dependencies are available here.
2154
2155@c @node Portable GNUnet
2156@c @section Portable GNUnet
2157
2158@c Quick instructions on how to use the most recent GNUnet on most GNU/Linux
2159@c distributions
2160
2161@c Currently this has only been tested on Ubuntu 12.04, 12.10, 13.04, Debian
2162@c and CentOS 6, but it should work on almost any GNU/Linux distribution.
2163@c More in-detail information can be found in the handbook.
2164
2165@c Note 2017-10: Currently this section assumes the old SVN repo of GNUnet
2166@c which no longer exists.
2167
2168@c @menu
2169@c * Prerequisites::
2170@c * Download & set up gnunet-update::
2171@c * Install GNUnet::
2172@c @end menu
2173
2174@c @node Prerequisites
2175@c @subsection Prerequisites
2176
2177@c Open a terminal and paste this line into it to install all required tools
2178@c needed:
2179
2180@c @example
2181@c sudo apt-get install python-gpgme subversion
2182@c @end example
2183
2184@c @node Download & set up gnunet-update
2185@c @subsection Download & set up gnunet-update
2186
2187@c The following command will download a working version of gnunet-update
2188@c with the subversion tool and import the public key which is needed for
2189@c authentication:
2190
2191@c @example
2192@c svn checkout -r24905 https://gnunet.org/svn/gnunet-update ~/gnunet-update
2193@c cd ~/gnunet-update
2194@c gpg --keyserver "hkp://keys.gnupg.net" --recv-keys 7C613D78
2195@c @end example
2196
2197@c @node Install GNUnet
2198@c @subsection Install GNUnet
2199
2200@c Download and install GNUnet binaries which can be found here and set
2201@c library paths:
2202
2203@c @example
2204@c wget -P /tmp https://gnunet.org/install/packs/gnunet-0.9.4-`uname -m`.tgz
2205@c ./bin/gnunet-update install /tmp/gnunet-0.9*.tgz ~
2206@c echo "PATH DEFAULT=$@{PATH@}:$HOME/bin" >> ~/.pam_environment
2207@c echo -e "$@{HOME@}/lib\n$@{HOME@}/lib/gnunet-deps" | sudo tee \
2208@c /etc/ld.so.conf.d/gnunet.conf > /dev/null
2209@c sudo ldconfig
2210@c @end example
2211
2212@c You may need to re-login once after executing these last commands
2213
2214@c That's it, GNUnet is installed in your home directory now. GNUnet can be
2215@c configured and afterwards started by executing:
2216
2217@c @example
2218@c gnunet-arm -s
2219@c @end example
2220
2221@node The graphical configuration interface
2222@section The graphical configuration interface
2223
2224If you also would like to use @command{gnunet-gtk} and
2225@command{gnunet-setup} (highly recommended for beginners), do:
2226
2227@example
2228wget -P /tmp \
2229https://gnunet.org/install/packs/gnunet-0.9.4-gtk-0.9.4-`uname -m`.tgz
2230sh ~/gnunet-update/bin/gnunet-update install /tmp/gnunet-*gtk*.tgz ~
2231sudo ldconfig
2232@end example
2233
2234Now you can run @command{gnunet-setup} for easy configuration of your
2235GNUnet peer.
2236
2237@menu
2238* Configuring your peer::
2239* Configuring the Friend-to-Friend (F2F) mode::
2240* Configuring the hostlist to bootstrap::
2241* Configuration of the HOSTLIST proxy settings::
2242* Configuring your peer to provide a hostlist ::
2243* Configuring the datastore::
2244* Configuring the MySQL database::
2245* Reasons for using MySQL::
2246* Reasons for not using MySQL::
2247* Setup Instructions::
2248* Testing::
2249* Performance Tuning::
2250* Setup for running Testcases::
2251* Configuring the Postgres database::
2252* Reasons to use Postgres::
2253* Reasons not to use Postgres::
2254* Manual setup instructions::
2255* Testing the setup manually::
2256* Configuring the datacache::
2257* Configuring the file-sharing service::
2258* Configuring logging::
2259* Configuring the transport service and plugins::
2260* Configuring the wlan transport plugin::
2261* Configuring HTTP(S) reverse proxy functionality using Apache or nginx::
2262* Blacklisting peers::
2263* Configuration of the HTTP and HTTPS transport plugins::
2264* Configuring the GNU Name System::
2265* Configuring the GNUnet VPN::
2266* Bandwidth Configuration::
2267* Configuring NAT::
2268* Peer configuration for distributions::
2269@end menu
2270
2271@node Configuring your peer
2272@subsection Configuring your peer
2273
2274This chapter will describe the various configuration options in GNUnet.
2275
2276The easiest way to configure your peer is to use the
2277@command{gnunet-setup} tool.
2278@command{gnunet-setup} is part of the @command{gnunet-gtk}
2279application. You might have to install it separately.
2280
2281Many of the specific sections from this chapter actually are linked from
2282within @command{gnunet-setup} to help you while using the setup tool.
2283
2284While you can also configure your peer by editing the configuration
2285file by hand, this is not recommended for anyone except for developers
2286as it requires a more in-depth understanding of the configuration files
2287and internal dependencies of GNUnet.
2288
2289@node Configuring the Friend-to-Friend (F2F) mode
2290@subsection Configuring the Friend-to-Friend (F2F) mode
2291
2292GNUnet knows three basic modes of operation:
2293@itemize @bullet
2294@item In standard "peer-to-peer" mode,
2295your peer will connect to any peer.
2296@item In the pure "friend-to-friend"
2297mode, your peer will ONLY connect to peers from a list of friends
2298specified in the configuration.
2299@item Finally, in mixed mode,
2300GNUnet will only connect to arbitrary peers if it
2301has at least a specified number of connections to friends.
2302@end itemize
2303
2304When configuring any of the F2F ("friend-to-friend") modes,
2305you first need to create a file with the peer identities
2306of your friends. Ask your friends to run
2307
2308@example
2309$ gnunet-peerinfo -sq
2310@end example
2311
2312@noindent
2313The resulting output of this command needs to be added to your
2314@file{friends} file, which is simply a plain text file with one line
2315per friend with the output from the above command.
2316
2317You then specify the location of your @file{friends} file in the
2318@code{FRIENDS} option of the "topology" section.
2319
2320Once you have created the @file{friends} file, you can tell GNUnet to only
2321connect to your friends by setting the @code{FRIENDS-ONLY} option
2322(again in the "topology" section) to YES.
2323
2324If you want to run in mixed-mode, set "FRIENDS-ONLY" to NO and configure a
2325minimum number of friends to have (before connecting to arbitrary peers)
2326under the "MINIMUM-FRIENDS" option.
2327
2328If you want to operate in normal P2P-only mode, simply set
2329@code{MINIMUM-FRIENDS} to zero and @code{FRIENDS_ONLY} to NO.
2330This is the default.
2331
2332@node Configuring the hostlist to bootstrap
2333@subsection Configuring the hostlist to bootstrap
2334
2335After installing the software you need to get connected to the GNUnet
2336network. The configuration file included in your download is already
2337configured to connect you to the GNUnet network.
2338In this section the relevant configuration settings are explained.
2339
2340To get an initial connection to the GNUnet network and to get to know
2341peers already connected to the network you can use the so called
2342"bootstrap servers".
2343These servers can give you a list of peers connected to the network.
2344To use these bootstrap servers you have to configure the hostlist daemon
2345to activate bootstrapping.
2346
2347To activate bootstrapping, edit the @code{[hostlist]}-section in your
2348configuration file. You have to set the argument @command{-b} in the
2349options line:
2350
2351@example
2352[hostlist]
2353OPTIONS = -b
2354@end example
2355
2356Additionally you have to specify which server you want to use.
2357The default bootstrapping server is
2358"@uref{http://v10.gnunet.org/hostlist, http://v10.gnunet.org/hostlist}".
2359[^] To set the server you have to edit the line "SERVERS" in the hostlist
2360section. To use the default server you should set the lines to
2361
2362@example
2363SERVERS = http://v10.gnunet.org/hostlist [^]
2364@end example
2365
2366@noindent
2367To use bootstrapping your configuration file should include these lines:
2368
2369@example
2370[hostlist]
2371OPTIONS = -b
2372SERVERS = http://v10.gnunet.org/hostlist [^]
2373@end example
2374
2375@noindent
2376Besides using bootstrap servers you can configure your GNUnet peer to
2377recieve hostlist advertisements.
2378Peers offering hostlists to other peers can send advertisement messages
2379to peers that connect to them. If you configure your peer to receive these
2380messages, your peer can download these lists and connect to the peers
2381included. These lists are persistent, which means that they are saved to
2382your hard disk regularly and are loaded during startup.
2383
2384To activate hostlist learning you have to add the @command{-e}
2385switch to the @code{OPTIONS} line in the hostlist section:
2386
2387@example
2388[hostlist]
2389OPTIONS = -b -e
2390@end example
2391
2392@noindent
2393Furthermore you can specify in which file the lists are saved.
2394To save the lists in the file @file{hostlists.file} just add the line:
2395
2396@example
2397HOSTLISTFILE = hostlists.file
2398@end example
2399
2400@noindent
2401Best practice is to activate both bootstrapping and hostlist learning.
2402So your configuration file should include these lines:
2403
2404@example
2405[hostlist]
2406OPTIONS = -b -e
2407HTTPPORT = 8080
2408SERVERS = http://v10.gnunet.org/hostlist [^]
2409HOSTLISTFILE = $SERVICEHOME/hostlists.file
2410@end example
2411
2412@node Configuration of the HOSTLIST proxy settings
2413@subsection Configuration of the HOSTLIST proxy settings
2414
2415The hostlist client can be configured to use a proxy to connect to the
2416hostlist server.
2417This functionality can be configured in the configuration file directly
2418or using the @command{gnunet-setup} tool.
2419
2420The hostlist client supports the following proxy types at the moment:
2421
2422@itemize @bullet
2423@item HTTP and HTTP 1.0 only proxy
2424@item SOCKS 4/4a/5/5 with hostname
2425@end itemize
2426
2427In addition authentication at the proxy with username and password can be
2428configured.
2429
2430To configure proxy support for the hostlist client in the
2431@command{gnunet-setup} tool, select the "hostlist" tab and select
2432the appropriate proxy type.
2433The hostname or IP address (including port if required) has to be entered
2434in the "Proxy hostname" textbox. If required, enter username and password
2435in the "Proxy username" and "Proxy password" boxes.
2436Be aware that this information will be stored in the configuration in
2437plain text (TODO: Add explanation and generalize the part in Chapter 3.6
2438about the encrypted home).
2439
2440To provide these options directly in the configuration, you can
2441enter the following settings in the @code{[hostlist]} section of
2442the configuration:
2443
2444@example
2445# Type of proxy server,
2446# Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
2447# Default: HTTP
2448# PROXY_TYPE = HTTP
2449
2450# Hostname or IP of proxy server
2451# PROXY =
2452# User name for proxy server
2453# PROXY_USERNAME =
2454# User password for proxy server
2455# PROXY_PASSWORD =
2456@end example
2457
2458@node Configuring your peer to provide a hostlist
2459@subsection Configuring your peer to provide a hostlist
2460
2461If you operate a peer permanently connected to GNUnet you can configure
2462your peer to act as a hostlist server, providing other peers the list of
2463peers known to him.
2464
2465Your server can act as a bootstrap server and peers needing to obtain a
2466list of peers can contact it to download this list.
2467To download this hostlist the peer uses HTTP.
2468For this reason you have to build your peer with libgnurl (or libcurl)
2469and microhttpd support.
2470How you build your peer with these options can be found here:
2471@xref{Generic installation instructions}.
2472
2473To configure your peer to act as a bootstrap server you have to add the
2474@command{-p} option to @code{OPTIONS} in the @code{[hostlist]} section
2475of your configuration file.
2476Besides that you have to specify a port number for the http server.
2477In conclusion you have to add the following lines:
2478
2479@example
2480[hostlist]
2481HTTPPORT = 12980
2482OPTIONS = -p
2483@end example
2484
2485@noindent
2486If your peer acts as a bootstrap server other peers should know about
2487that. You can advertise the hostlist your are providing to other peers.
2488Peers connecting to your peer will get a message containing an
2489advertisement for your hostlist and the URL where it can be downloaded.
2490If this peer is in learning mode, it will test the hostlist and, in the
2491case it can obtain the list successfully, it will save it for
2492bootstrapping.
2493
2494To activate hostlist advertisement on your peer, you have to set the
2495following lines in your configuration file:
2496
2497@example
2498[hostlist]
2499EXTERNAL_DNS_NAME = example.org
2500HTTPPORT = 12981
2501OPTIONS = -p -a
2502@end example
2503
2504@noindent
2505With this configuration your peer will a act as a bootstrap server and
2506advertise this hostlist to other peers connecting to it.
2507The URL used to download the list will be
2508@code{@uref{http://example.org:12981/, http://example.org:12981/}}.
2509
2510Please notice:
2511
2512@itemize @bullet
2513@item The hostlist is @b{not} human readable, so you should not try to
2514download it using your webbrowser. Just point your GNUnet peer to the
2515address!
2516@item Advertising without providing a hostlist does not make sense and
2517will not work.
2518@end itemize
2519
2520@node Configuring the datastore
2521@subsection Configuring the datastore
2522
2523The datastore is what GNUnet uses for long-term storage of file-sharing
2524data. Note that long-term does not mean 'forever' since content does have
2525an expiration date, and of course storage space is finite (and hence
2526sometimes content may have to be discarded).
2527
2528Use the @code{QUOTA} option to specify how many bytes of storage space
2529you are willing to dedicate to GNUnet.
2530
2531In addition to specifying the maximum space GNUnet is allowed to use for
2532the datastore, you need to specify which database GNUnet should use to do
2533so. Currently, you have the choice between sqLite, MySQL and Postgres.
2534
2535@node Configuring the MySQL database
2536@subsection Configuring the MySQL database
2537
2538This section describes how to setup the MySQL database for GNUnet.
2539
2540Note that the mysql plugin does NOT work with mysql before 4.1 since we
2541need prepared statements.
2542We are generally testing the code against MySQL 5.1 at this point.
2543
2544@node Reasons for using MySQL
2545@subsection Reasons for using MySQL
2546
2547@itemize @bullet
2548
2549@item On up-to-date hardware wher
2550mysql can be used comfortably, this module
2551will have better performance than the other database choices (according
2552to our tests).
2553
2554@item Its often possible to recover the mysql database from internal
2555inconsistencies. Some of the other databases do not support repair.
2556@end itemize
2557
2558@node Reasons for not using MySQL
2559@subsection Reasons for not using MySQL
2560
2561@itemize @bullet
2562@item Memory usage (likely not an issue if you have more than 1 GB)
2563@item Complex manual setup
2564@end itemize
2565
2566@node Setup Instructions
2567@subsection Setup Instructions
2568
2569@itemize @bullet
2570
2571@item In @file{gnunet.conf} set in section @code{DATASTORE} the value for
2572@code{DATABASE} to @code{mysql}.
2573
2574@item Access mysql as root:
2575
2576@example
2577$ mysql -u root -p
2578@end example
2579
2580@noindent
2581and issue the following commands, replacing $USER with the username
2582that will be running @command{gnunet-arm} (so typically "gnunet"):
2583
2584@example
2585CREATE DATABASE gnunet;
2586GRANT select,insert,update,delete,create,alter,drop,create \
2587temporary tables ON gnunet.* TO $USER@@localhost;
2588SET PASSWORD FOR $USER@@localhost=PASSWORD('$the_password_you_like');
2589FLUSH PRIVILEGES;
2590@end example
2591
2592@item
2593In the $HOME directory of $USER, create a @file{.my.cnf} file with the
2594following lines
2595
2596@example
2597[client]
2598user=$USER
2599password=$the_password_you_like
2600@end example
2601
2602@end itemize
2603
2604Thats it. Note that @file{.my.cnf} file is a slight security risk unless
2605its on a safe partition. The @file{$HOME/.my.cnf} can of course be
2606a symbolic link.
2607Luckily $USER has only priviledges to mess up GNUnet's tables,
2608which should be pretty harmless.
2609
2610@node Testing
2611@subsection Testing
2612
2613You should briefly try if the database connection works. First, login
2614as $USER. Then use:
2615
2616@example
2617$ mysql -u $USER
2618mysql> use gnunet;
2619@end example
2620
2621@noindent
2622If you get the message
2623
2624@example
2625Database changed
2626@end example
2627
2628@noindent
2629it probably works.
2630
2631If you get
2632
2633@example
2634ERROR 2002: Can't connect to local MySQL server
2635through socket '/tmp/mysql.sock' (2)
2636@end example
2637
2638@noindent
2639it may be resolvable by
2640
2641@example
2642ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
2643@end example
2644
2645@noindent
2646so there may be some additional trouble depending on your mysql setup.
2647
2648@node Performance Tuning
2649@subsection Performance Tuning
2650
2651For GNUnet, you probably want to set the option
2652
2653@example
2654innodb_flush_log_at_trx_commit = 0
2655@end example
2656
2657@noindent
2658for a rather dramatic boost in MySQL performance. However, this reduces
2659the "safety" of your database as with this options you may loose
2660transactions during a power outage.
2661While this is totally harmless for GNUnet, the option applies to all
2662applications using MySQL. So you should set it if (and only if) GNUnet is
2663the only application on your system using MySQL.
2664
2665@node Setup for running Testcases
2666@subsection Setup for running Testcases
2667
2668If you want to run the testcases, you must create a second database
2669"gnunetcheck" with the same username and password. This database will
2670then be used for testing (@command{make check}).
2671
2672@node Configuring the Postgres database
2673@subsection Configuring the Postgres database
2674
2675This text describes how to setup the Postgres database for GNUnet.
2676
2677This Postgres plugin was developed for Postgres 8.3 but might work for
2678earlier versions as well.
2679
2680@node Reasons to use Postgres
2681@subsection Reasons to use Postgres
2682
2683@itemize @bullet
2684@item Easier to setup than MySQL
2685@item Real database
2686@end itemize
2687
2688@node Reasons not to use Postgres
2689@subsection Reasons not to use Postgres
2690
2691@itemize @bullet
2692@item Quite slow
2693@item Still some manual setup required
2694@end itemize
2695
2696@node Manual setup instructions
2697@subsection Manual setup instructions
2698
2699@itemize @bullet
2700@item In @file{gnunet.conf} set in section @code{DATASTORE} the value for
2701@code{DATABASE} to @code{postgres}.
2702@item Access Postgres to create a user:
2703
2704@table @asis
2705@item with Postgres 8.x, use:
2706
2707@example
2708# su - postgres
2709$ createuser
2710@end example
2711
2712@noindent
2713and enter the name of the user running GNUnet for the role interactively.
2714Then, when prompted, do not set it to superuser, allow the creation of
2715databases, and do not allow the creation of new roles.
2716
2717@item with Postgres 9.x, use:
2718
2719@example
2720# su - postgres
2721$ createuser -d $GNUNET_USER
2722@end example
2723
2724@noindent
2725where $GNUNET_USER is the name of the user running GNUnet.
2726
2727@end table
2728
2729
2730@item
2731As that user (so typically as user "gnunet"), create a database (or two):
2732
2733@example
2734$ createdb gnunet
2735# this way you can run "make check"
2736$ createdb gnunetcheck
2737@end example
2738
2739@end itemize
2740
2741Now you should be able to start @code{gnunet-arm}.
2742
2743@node Testing the setup manually
2744@subsection Testing the setup manually
2745
2746You may want to try if the database connection works. First, again login
2747as the user who will run @command{gnunet-arm}. Then use:
2748
2749@example
2750$ psql gnunet # or gnunetcheck
2751gnunet=> \dt
2752@end example
2753
2754@noindent
2755If, after you have started @command{gnunet-arm} at least once, you get
2756a @code{gn090} table here, it probably works.
2757
2758@node Configuring the datacache
2759@subsection Configuring the datacache
2760@c %**end of header
2761
2762The datacache is what GNUnet uses for storing temporary data. This data is
2763expected to be wiped completely each time GNUnet is restarted (or the
2764system is rebooted).
2765
2766You need to specify how many bytes GNUnet is allowed to use for the
2767datacache using the @code{QUOTA} option in the section @code{[dhtcache]}.
2768Furthermore, you need to specify which database backend should be used to
2769store the data. Currently, you have the choice between
2770sqLite, MySQL and Postgres.
2771
2772@node Configuring the file-sharing service
2773@subsection Configuring the file-sharing service
2774
2775In order to use GNUnet for file-sharing, you first need to make sure
2776that the file-sharing service is loaded.
2777This is done by setting the @code{AUTOSTART} option in
2778section @code{[fs]} to "YES". Alternatively, you can run
2779
2780@example
2781$ gnunet-arm -i fs
2782@end example
2783
2784@noindent
2785to start the file-sharing service by hand.
2786
2787Except for configuring the database and the datacache the only important
2788option for file-sharing is content migration.
2789
2790Content migration allows your peer to cache content from other peers as
2791well as send out content stored on your system without explicit requests.
2792This content replication has positive and negative impacts on both system
2793performance and privacy.
2794
2795FIXME: discuss the trade-offs. Here is some older text about it...
2796
2797Setting this option to YES allows gnunetd to migrate data to the local
2798machine. Setting this option to YES is highly recommended for efficiency.
2799Its also the default. If you set this value to YES, GNUnet will store
2800content on your machine that you cannot decrypt.
2801While this may protect you from liability if the judge is sane, it may
2802not (IANAL). If you put illegal content on your machine yourself, setting
2803this option to YES will probably increase your chances to get away with it
2804since you can plausibly deny that you inserted the content.
2805Note that in either case, your anonymity would have to be broken first
2806(which may be possible depending on the size of the GNUnet network and the
2807strength of the adversary).
2808
2809@node Configuring logging
2810@subsection Configuring logging
2811
2812Logging in GNUnet 0.9.0 is controlled via the "-L" and "-l" options.
2813Using @code{-L}, a log level can be specified. With log level
2814@code{ERROR} only serious errors are logged.
2815The default log level is @code{WARNING} which causes anything of
2816concern to be logged.
2817Log level @code{INFO} can be used to log anything that might be
2818interesting information whereas
2819@code{DEBUG} can be used by developers to log debugging messages
2820(but you need to run @code{./configure} with
2821@code{--enable-logging=verbose} to get them compiled).
2822The @code{-l} option is used to specify the log file.
2823
2824Since most GNUnet services are managed by @code{gnunet-arm}, using the
2825@code{-l} or @code{-L} options directly is not possible.
2826Instead, they can be specified using the @code{OPTIONS} configuration
2827value in the respective section for the respective service.
2828In order to enable logging globally without editing the @code{OPTIONS}
2829values for each service, @command{gnunet-arm} supports a
2830@code{GLOBAL_POSTFIX} option.
2831The value specified here is given as an extra option to all services for
2832which the configuration does contain a service-specific @code{OPTIONS}
2833field.
2834
2835@code{GLOBAL_POSTFIX} can contain the special sequence "@{@}" which
2836is replaced by the name of the service that is being started.
2837Furthermore, @code{GLOBAL_POSTFIX} is special in that sequences
2838starting with "$" anywhere in the string are expanded (according
2839to options in @code{PATHS}); this expansion otherwise is
2840only happening for filenames and then the "$" must be the
2841first character in the option. Both of these restrictions do
2842not apply to @code{GLOBAL_POSTFIX}.
2843Note that specifying @code{%} anywhere in the @code{GLOBAL_POSTFIX}
2844disables both of these features.
2845
2846In summary, in order to get all services to log at level
2847@code{INFO} to log-files called @code{SERVICENAME-logs}, the
2848following global prefix should be used:
2849
2850@example
2851GLOBAL_POSTFIX = -l $SERVICEHOME/@{@}-logs -L INFO
2852@end example
2853
2854@node Configuring the transport service and plugins
2855@subsection Configuring the transport service and plugins
2856
2857The transport service in GNUnet is responsible to maintain basic
2858connectivity to other peers.
2859Besides initiating and keeping connections alive it is also responsible
2860for address validation.
2861
2862The GNUnet transport supports more than one transport protocol.
2863These protocols are configured together with the transport service.
2864
2865The configuration section for the transport service itself is quite
2866similar to all the other services
2867
2868@example
2869AUTOSTART = YES
2870@@UNIXONLY@@ PORT = 2091
2871HOSTNAME = localhost
2872HOME = $SERVICEHOME
2873CONFIG = $DEFAULTCONFIG
2874BINARY = gnunet-service-transport
2875#PREFIX = valgrind
2876NEIGHBOUR_LIMIT = 50
2877ACCEPT_FROM = 127.0.0.1;
2878ACCEPT_FROM6 = ::1;
2879PLUGINS = tcp udp
2880UNIXPATH = /tmp/gnunet-service-transport.sock
2881@end example
2882
2883Different are the settings for the plugins to load @code{PLUGINS}.
2884The first setting specifies which transport plugins to load.
2885
2886@itemize @bullet
2887@item transport-unix
2888A plugin for local only communication with UNIX domain sockets. Used for
2889testing and available on unix systems only. Just set the port
2890
2891@example
2892[transport-unix]
2893PORT = 22086
2894TESTING_IGNORE_KEYS = ACCEPT_FROM;
2895@end example
2896
2897@item transport-tcp
2898A plugin for communication with TCP. Set port to 0 for client mode with
2899outbound only connections
2900
2901@example
2902[transport-tcp]
2903# Use 0 to ONLY advertise as a peer behind NAT (no port binding)
2904PORT = 2086
2905ADVERTISED_PORT = 2086
2906TESTING_IGNORE_KEYS = ACCEPT_FROM;
2907# Maximum number of open TCP connections allowed
2908MAX_CONNECTIONS = 128
2909@end example
2910
2911@item transport-udp
2912A plugin for communication with UDP. Supports peer discovery using
2913broadcasts.
2914
2915@example
2916[transport-udp]
2917PORT = 2086
2918BROADCAST = YES
2919BROADCAST_INTERVAL = 30 s
2920MAX_BPS = 1000000
2921TESTING_IGNORE_KEYS = ACCEPT_FROM;
2922@end example
2923
2924@item transport-http
2925HTTP and HTTPS support is split in two part: a client plugin initiating
2926outbound connections and a server part accepting connections from the
2927client. The client plugin just takes the maximum number of connections as
2928an argument.
2929
2930@example
2931[transport-http_client]
2932MAX_CONNECTIONS = 128
2933TESTING_IGNORE_KEYS = ACCEPT_FROM;
2934@end example
2935
2936@example
2937[transport-https_client]
2938MAX_CONNECTIONS = 128
2939TESTING_IGNORE_KEYS = ACCEPT_FROM;
2940@end example
2941
2942@noindent
2943The server has a port configured and the maximum nunber of connections.
2944The HTTPS part has two files with the certificate key and the certificate
2945file.
2946
2947The server plugin supports reverse proxies, so a external hostname can be
2948set using the @code{EXTERNAL_HOSTNAME} setting.
2949The webserver under this address should forward the request to the peer
2950and the configure port.
2951
2952@example
2953[transport-http_server]
2954EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de/gnunet
2955PORT = 1080
2956MAX_CONNECTIONS = 128
2957TESTING_IGNORE_KEYS = ACCEPT_FROM;
2958@end example
2959
2960@example
2961[transport-https_server]
2962PORT = 4433
2963CRYPTO_INIT = NORMAL
2964KEY_FILE = https.key
2965CERT_FILE = https.cert
2966MAX_CONNECTIONS = 128
2967TESTING_IGNORE_KEYS = ACCEPT_FROM;
2968@end example
2969
2970@item transport-wlan
2971
2972The next section describes how to setup the WLAN plugin,
2973so here only the settings. Just specify the interface to use:
2974
2975@example
2976[transport-wlan]
2977# Name of the interface in monitor mode (typically monX)
2978INTERFACE = mon0
2979# Real hardware, no testing
2980TESTMODE = 0
2981TESTING_IGNORE_KEYS = ACCEPT_FROM;
2982@end example
2983@end itemize
2984
2985@node Configuring the wlan transport plugin
2986@subsection Configuring the wlan transport plugin
2987
2988The wlan transport plugin enables GNUnet to send and to receive data on a
2989wlan interface.
2990It has not to be connected to a wlan network as long as sender and
2991receiver are on the same channel. This enables you to get connection to
2992GNUnet where no internet access is possible, for example during
2993catastrophes or when censorship cuts you off from the internet.
2994
2995
2996@menu
2997* Requirements for the WLAN plugin::
2998* Configuration::
2999* Before starting GNUnet::
3000* Limitations and known bugs::
3001@end menu
3002
3003
3004@node Requirements for the WLAN plugin
3005@subsubsection Requirements for the WLAN plugin
3006
3007@itemize @bullet
3008
3009@item wlan network card with monitor support and packet injection
3010(see @uref{http://www.aircrack-ng.org/, aircrack-ng.org})
3011
3012@item Linux kernel with mac80211 stack, introduced in 2.6.22, tested with
30132.6.35 and 2.6.38
3014
3015@item Wlantools to create the a monitor interface, tested with airmon-ng
3016of the aircrack-ng package
3017@end itemize
3018
3019@node Configuration
3020@subsubsection Configuration
3021
3022There are the following options for the wlan plugin (they should be like
3023this in your default config file, you only need to adjust them if the
3024values are incorrect for your system)
3025
3026@example
3027# section for the wlan transport plugin
3028[transport-wlan]
3029# interface to use, more information in the
3030# "Before starting GNUnet" section of the handbook.
3031INTERFACE = mon0
3032# testmode for developers:
3033# 0 use wlan interface,
3034#1 or 2 use loopback driver for tests 1 = server, 2 = client
3035TESTMODE = 0
3036@end example
3037
3038@node Before starting GNUnet
3039@subsubsection Before starting GNUnet
3040
3041Before starting GNUnet, you have to make sure that your wlan interface is
3042in monitor mode.
3043One way to put the wlan interface into monitor mode (if your interface
3044name is wlan0) is by executing:
3045
3046@example
3047sudo airmon-ng start wlan0
3048@end example
3049
3050@noindent
3051Here is an example what the result should look like:
3052
3053@example
3054Interface Chipset Driver
3055wlan0 Intel 4965 a/b/g/n iwl4965 - [phy0]
3056(monitor mode enabled on mon0)
3057@end example
3058
3059@noindent
3060The monitor interface is mon0 is the one that you have to put into the
3061configuration file.
3062
3063@node Limitations and known bugs
3064@subsubsection Limitations and known bugs
3065
3066Wlan speed is at the maximum of 1 Mbit/s because support for choosing the
3067wlan speed with packet injection was removed in newer kernels.
3068Please pester the kernel developers about fixing this.
3069
3070The interface channel depends on the wlan network that the card is
3071connected to. If no connection has been made since the start of the
3072computer, it is usually the first channel of the card.
3073Peers will only find each other and communicate if they are on the same
3074channel. Channels must be set manually, i.e. using:
3075
3076@example
3077iwconfig wlan0 channel 1
3078@end example
3079
3080@node Configuring HTTP(S) reverse proxy functionality using Apache or nginx
3081@subsection Configuring HTTP(S) reverse proxy functionality using Apache or nginx
3082
3083The HTTP plugin supports data transfer using reverse proxies. A reverse
3084proxy forwards the HTTP request he receives with a certain URL to another
3085webserver, here a GNUnet peer.
3086
3087So if you have a running Apache or nginx webserver you can configure it to
3088be a GNUnet reverse proxy. Especially if you have a well-known webiste
3089this improves censorship resistance since it looks as normal surfing
3090behaviour.
3091
3092To do so, you have to do two things:
3093
3094@itemize @bullet
3095@item Configure your webserver to forward the GNUnet HTTP traffic
3096@item Configure your GNUnet peer to announce the respective address
3097@end itemize
3098
3099As an example we want to use GNUnet peer running:
3100
3101@itemize @bullet
3102
3103@item HTTP server plugin on @code{gnunet.foo.org:1080}
3104
3105@item HTTPS server plugin on @code{gnunet.foo.org:4433}
3106
3107@item A apache or nginx webserver on
3108@uref{http://www.foo.org/, http://www.foo.org:80/}
3109
3110@item A apache or nginx webserver on https://www.foo.org:443/
3111@end itemize
3112
3113And we want the webserver to accept GNUnet traffic under
3114@code{http://www.foo.org/bar/}. The required steps are described here:
3115
3116@menu
3117* Reverse Proxy - Configure your Apache2 HTTP webserver::
3118* Reverse Proxy - Configure your Apache2 HTTPS webserver::
3119* Reverse Proxy - Configure your nginx HTTPS webserver::
3120* Reverse Proxy - Configure your nginx HTTP webserver::
3121* Reverse Proxy - Configure your GNUnet peer::
3122@end menu
3123
3124@node Reverse Proxy - Configure your Apache2 HTTP webserver
3125@subsubsection Reverse Proxy - Configure your Apache2 HTTP webserver
3126
3127First of all you need mod_proxy installed.
3128
3129Edit your webserver configuration. Edit
3130@code{/etc/apache2/apache2.conf} or the site-specific configuration file.
3131
3132In the respective @code{server config},@code{virtual host} or
3133@code{directory} section add the following lines:
3134
3135@example
3136ProxyTimeout 300
3137ProxyRequests Off
3138<Location /bar/ >
3139ProxyPass http://gnunet.foo.org:1080/
3140ProxyPassReverse http://gnunet.foo.org:1080/
3141</Location>
3142@end example
3143
3144@node Reverse Proxy - Configure your Apache2 HTTPS webserver
3145@subsubsection Reverse Proxy - Configure your Apache2 HTTPS webserver
3146
3147We assume that you already have an HTTPS server running, if not please
3148check how to configure a HTTPS host. An uncomplicated to use example
3149is the example configuration file for Apache2/HTTPD provided in
3150@file{apache2/sites-available/default-ssl}.
3151
3152In the respective HTTPS @code{server config},@code{virtual host} or
3153@code{directory} section add the following lines:
3154
3155@example
3156SSLProxyEngine On
3157ProxyTimeout 300
3158ProxyRequests Off
3159<Location /bar/ >
3160ProxyPass https://gnunet.foo.org:4433/
3161ProxyPassReverse https://gnunet.foo.org:4433/
3162</Location>
3163@end example
3164
3165@noindent
3166More information about the apache mod_proxy configuration can be found
3167in the Apache documentation@footnote{@uref{http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass, http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass}}
3168
3169@node Reverse Proxy - Configure your nginx HTTPS webserver
3170@subsubsection Reverse Proxy - Configure your nginx HTTPS webserver
3171
3172Since nginx does not support chunked encoding, you first of all have to
3173install the @code{chunkin} module@footnote{@uref{http://wiki.nginx.org/HttpChunkinModule, http://wiki.nginx.org/HttpChunkinModule}}
3174
3175To enable chunkin add:
3176
3177@example
3178chunkin on;
3179error_page 411 = @@my_411_error;
3180location @@my_411_error @{
3181chunkin_resume;
3182@}
3183@end example
3184
3185@noindent
3186Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or
3187the site-specific configuration file.
3188
3189In the @code{server} section add:
3190
3191@example
3192location /bar/ @{
3193proxy_pass http://gnunet.foo.org:1080/;
3194proxy_buffering off;
3195proxy_connect_timeout 5; # more than http_server
3196proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
3197proxy_http_version 1.1; # 1.0 default
3198proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
3199@}
3200@end example
3201
3202@node Reverse Proxy - Configure your nginx HTTP webserver
3203@subsubsection Reverse Proxy - Configure your nginx HTTP webserver
3204
3205Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or
3206the site-specific configuration file.
3207
3208In the @code{server} section add:
3209
3210@example
3211ssl_session_timeout 6m;
3212location /bar/
3213@{
3214proxy_pass https://gnunet.foo.org:4433/;
3215proxy_buffering off;
3216proxy_connect_timeout 5; # more than http_server
3217proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
3218proxy_http_version 1.1; # 1.0 default
3219proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
3220@}
3221@end example
3222
3223@node Reverse Proxy - Configure your GNUnet peer
3224@subsubsection Reverse Proxy - Configure your GNUnet peer
3225
3226To have your GNUnet peer announce the address, you have to specify the
3227@code{EXTERNAL_HOSTNAME} option in the @code{[transport-http_server]}
3228section:
3229
3230@example
3231[transport-http_server]
3232EXTERNAL_HOSTNAME = http://www.foo.org/bar/
3233@end example
3234
3235@noindent
3236and/or @code{[transport-https_server]} section:
3237
3238@example
3239[transport-https_server]
3240EXTERNAL_HOSTNAME = https://www.foo.org/bar/
3241@end example
3242
3243@noindent
3244Now restart your webserver and your peer...
3245
3246@node Blacklisting peers
3247@subsection Blacklisting peers
3248
3249Transport service supports to deny connecting to a specific peer of to a
3250specific peer with a specific transport plugin using te blacklisting
3251component of transport service. With@ blacklisting it is possible to deny
3252connections to specific peers of@ to use a specific plugin to a specific
3253peer. Peers can be blacklisted using@ the configuration or a blacklist
3254client can be asked.
3255
3256To blacklist peers using the configuration you have to add a section to
3257your configuration containing the peer id of the peer to blacklist and
3258the plugin@ if required.
3259
3260Examples:
3261
3262To blacklist connections to P565... on peer AG2P... using tcp add:
3263
3264@c FIXME: This is too long and produces errors in the pdf.
3265@example
3266[transport-blacklist AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
3267P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = tcp
3268@end example
3269
3270To blacklist connections to P565... on peer AG2P... using all plugins add:
3271
3272@example
3273[transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
3274P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G =
3275@end example
3276
3277You can also add a blacklist client usign the blacklist API. On a
3278blacklist check, blacklisting first checks internally if the peer is
3279blacklisted and if not, it asks the blacklisting clients. Clients are
3280asked if it is OK to connect to a peer ID, the plugin is omitted.
3281
3282On blacklist check for (peer, plugin)
3283@itemize @bullet
3284@item Do we have a local blacklist entry for this peer and this plugin?@
3285@item YES: disallow connection@
3286@item Do we have a local blacklist entry for this peer and all plugins?@
3287@item YES: disallow connection@
3288@item Does one of the clients disallow?@
3289@item YES: disallow connection
3290@end itemize
3291
3292@node Configuration of the HTTP and HTTPS transport plugins
3293@subsection Configuration of the HTTP and HTTPS transport plugins
3294
3295The client parts of the http and https transport plugins can be configured
3296to use a proxy to connect to the hostlist server. This functionality can
3297be configured in the configuration file directly or using the
3298gnunet-setup tool.
3299
3300Both the HTTP and HTTPS clients support the following proxy types at
3301the moment:
3302
3303@itemize @bullet
3304@item HTTP 1.1 proxy
3305@item SOCKS 4/4a/5/5 with hostname
3306@end itemize
3307
3308In addition authentication at the proxy with username and password can be
3309configured.
3310
3311To configure proxy support for the clients in the gnunet-setup tool,
3312select the "transport" tab and activate the respective plugin. Now you
3313can select the appropriate proxy type. The hostname or IP address
3314(including port if required) has to be entered in the "Proxy hostname"
3315textbox. If required, enter username and password in the "Proxy username"
3316and "Proxy password" boxes. Be aware that these information will be stored
3317in the configuration in plain text.
3318
3319To configure these options directly in the configuration, you can
3320configure the following settings in the @code{[transport-http_client]}
3321and @code{[transport-https_client]} section of the configuration:
3322
3323@example
3324# Type of proxy server,
3325# Valid values: HTTP, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
3326# Default: HTTP
3327# PROXY_TYPE = HTTP
3328
3329# Hostname or IP of proxy server
3330# PROXY =
3331# User name for proxy server
3332# PROXY_USERNAME =
3333# User password for proxy server
3334# PROXY_PASSWORD =
3335@end example
3336
3337@node Configuring the GNU Name System
3338@subsection Configuring the GNU Name System
3339
3340@menu
3341* Configuring system-wide DNS interception::
3342* Configuring the GNS nsswitch plugin::
3343* Configuring GNS on W32::
3344* GNS Proxy Setup::
3345* Setup of the GNS CA::
3346* Testing the GNS setup::
3347@end menu
3348
3349
3350@node Configuring system-wide DNS interception
3351@subsubsection Configuring system-wide DNS interception
3352
3353Before you install GNUnet, make sure you have a user and group 'gnunet'
3354as well as an empty group 'gnunetdns'.
3355
3356When using GNUnet with system-wide DNS interception, it is absolutely
3357necessary for all GNUnet service processes to be started by
3358@code{gnunet-service-arm} as user and group 'gnunet'. You also need to be
3359sure to run @code{make install} as root (or use the @code{sudo} option to
3360configure) to grant GNUnet sufficient privileges.
3361
3362With this setup, all that is required for enabling system-wide DNS
3363interception is for some GNUnet component (VPN or GNS) to request it.
3364The @code{gnunet-service-dns} will then start helper programs that will
3365make the necessary changes to your firewall (@code{iptables}) rules.
3366
3367Note that this will NOT work if your system sends out DNS traffic to a
3368link-local IPv6 address, as in this case GNUnet can intercept the traffic,
3369but not inject the responses from the link-local IPv6 address. Hence you
3370cannot use system-wide DNS interception in conjunction with link-local
3371IPv6-based DNS servers. If such a DNS server is used, it will bypass
3372GNUnet's DNS traffic interception.
3373
3374Using the GNU Name System (GNS) requires two different configuration
3375steps.
3376First of all, GNS needs to be integrated with the operating system. Most
3377of this section is about the operating system level integration.
3378
3379The remainder of this chapter will detail the various methods for
3380configuring the use of GNS with your operating system.
3381
3382At this point in time you have different options depending on your OS:
3383
3384@table @asis
3385
3386@item Use the gnunet-gns-proxy This approach works for all operating
3387systems and is likely the easiest. However, it enables GNS only for
3388browsers, not for other applications that might be using DNS, such as SSH.
3389Still, using the proxy is required for using HTTP with GNS and is thus
3390recommended for all users. To do this, you simply have to run the
3391@code{gnunet-gns-proxy-setup-ca} script as the user who will run the
3392browser (this will create a GNS certificate authority (CA) on your system
3393and import its key into your browser), then start @code{gnunet-gns-proxy}
3394and inform your browser to use the Socks5 proxy which
3395@code{gnunet-gns-proxy} makes available by default on port 7777.
3396@item Use a nsswitch plugin (recommended on GNU systems)
3397This approach has the advantage of offering fully personalized resolution
3398even on multi-user systems. A potential disadvantage is that some
3399applications might be able to bypass GNS.
3400@item Use a W32 resolver plugin (recommended on W32)
3401This is currently the only option on W32 systems.
3402@item Use system-wide DNS packet interception
3403This approach is recommended for the GNUnet VPN. It can be used to handle
3404GNS at the same time; however, if you only use this method, you will only
3405get one root zone per machine (not so great for multi-user systems).
3406@end table
3407
3408You can combine system-wide DNS packet interception with the nsswitch
3409plugin.
3410The setup of the system-wide DNS interception is described here. All of
3411the other GNS-specific configuration steps are described in the following
3412sections.
3413
3414@node Configuring the GNS nsswitch plugin
3415@subsubsection Configuring the GNS nsswitch plugin
3416
3417The Name Service Switch (NSS) is a facility in Unix-like operating systems
3418@footnote{More accurate: NSS is a functionality of the GNU C Library}
3419that provides a variety of sources for common configuration databases and
3420name resolution mechanisms.
3421A superuser (system administrator) usually configures the
3422operating system's name services using the file
3423@file{/etc/nsswitch.conf}.
3424
3425GNS provides a NSS plugin to integrate GNS name resolution with the
3426operating system's name resolution process.
3427To use the GNS NSS plugin you have to either
3428
3429@itemize @bullet
3430@item install GNUnet as root or
3431@item compile GNUnet with the @code{--with-sudo=yes} switch.
3432@end itemize
3433
3434Name resolution is controlled by the @emph{hosts} section in the NSS
3435configuration. By default this section first performs a lookup in the
3436@file{/etc/hosts} file and then in DNS.
3437The nsswitch file should contain a line similar to:
3438
3439@example
3440hosts: files dns [NOTFOUND=return] mdns4_minimal mdns4
3441@end example
3442
3443@noindent
3444Here the GNS NSS plugin can be added to perform a GNS lookup before
3445performing a DNS lookup.
3446The GNS NSS plugin has to be added to the "hosts" section in
3447@file{/etc/nsswitch.conf} file before DNS related plugins:
3448
3449@example
3450...
3451hosts: files gns [NOTFOUND=return] dns mdns4_minimal mdns4
3452...
3453@end example
3454
3455@noindent
3456The @code{NOTFOUND=return} will ensure that if a @code{.gnu} name is not
3457found in GNS it will not be queried in DNS.
3458
3459@node Configuring GNS on W32
3460@subsubsection Configuring GNS on W32
3461
3462This document is a guide to configuring GNU Name System on W32-compatible
3463platforms.
3464
3465After GNUnet is installed, run the w32nsp-install tool:
3466
3467@example
3468w32nsp-install.exe libw32nsp-0.dll
3469@end example
3470
3471@noindent
3472('0' is the library version of W32 NSP; it might increase in the future,
3473change the invocation accordingly).
3474
3475This will install GNS namespace provider into the system and allow other
3476applications to resolve names that end in '@strong{gnu}'
3477and '@strong{zkey}'. Note that namespace provider requires
3478gnunet-gns-helper-service-w32 to be running, as well as gns service
3479itself (and its usual dependencies).
3480
3481Namespace provider is hardcoded to connect to @strong{127.0.0.1:5353},
3482and this is where gnunet-gns-helper-service-w32 should be listening to
3483(and is configured to listen to by default).
3484
3485To uninstall the provider, run:
3486
3487@example
3488w32nsp-uninstall.exe
3489@end example
3490
3491@noindent
3492(uses provider GUID to uninstall it, does not need a dll name).
3493
3494Note that while MSDN claims that other applications will only be able to
3495use the new namespace provider after re-starting, in reality they might
3496stat to use it without that. Conversely, they might stop using the
3497provider after it's been uninstalled, even if they were not re-started.
3498W32 will not permit namespace provider library to be deleted or
3499overwritten while the provider is installed, and while there is at least
3500one process still using it (even after it was uninstalled).
3501
3502@node GNS Proxy Setup
3503@subsubsection GNS Proxy Setup
3504
3505When using the GNU Name System (GNS) to browse the WWW, there are several
3506issues that can be solved by adding the GNS Proxy to your setup:
3507
3508@itemize @bullet
3509
3510@item If the target website does not support GNS, it might assume that it
3511is operating under some name in the legacy DNS system (such as
3512example.com). It may then attempt to set cookies for that domain, and the
3513web server might expect a @code{Host: example.com} header in the request
3514from your browser.
3515However, your browser might be using @code{example.gnu} for the
3516@code{Host} header and might only accept (and send) cookies for
3517@code{example.gnu}. The GNS Proxy will perform the necessary translations
3518of the hostnames for cookies and HTTP headers (using the LEHO record for
3519the target domain as the desired substitute).
3520
3521@item If using HTTPS, the target site might include an SSL certificate
3522which is either only valid for the LEHO domain or might match a TLSA
3523record in GNS. However, your browser would expect a valid certificate for
3524@code{example.gnu}, not for some legacy domain name. The proxy will
3525validate the certificate (either against LEHO or TLSA) and then
3526on-the-fly produce a valid certificate for the exchange, signed by your
3527own CA. Assuming you installed the CA of your proxy in your browser's
3528certificate authority list, your browser will then trust the
3529HTTPS/SSL/TLS connection, as the hostname mismatch is hidden by the proxy.
3530
3531@item Finally, the proxy will in the future indicate to the server that it
3532speaks GNS, which will enable server operators to deliver GNS-enabled web
3533sites to your browser (and continue to deliver legacy links to legacy
3534browsers)
3535@end itemize
3536
3537@node Setup of the GNS CA
3538@subsubsection Setup of the GNS CA
3539
3540First you need to create a CA certificate that the proxy can use.
3541To do so use the provided script gnunet-gns-proxy-ca:
3542
3543@example
3544$ gnunet-gns-proxy-setup-ca
3545@end example
3546
3547@noindent
3548This will create a personal certification authority for you and add this
3549authority to the firefox and chrome database. The proxy will use the this
3550CA certificate to generate @code{*.gnu} client certificates on the fly.
3551
3552Note that the proxy uses libcurl. Make sure your version of libcurl uses
3553GnuTLS and NOT OpenSSL. The proxy will @b{not} work with libcurl compiled
3554against OpenSSL.
3555
3556You can check the configuration your libcurl was build with by
3557running:
3558
3559@example
3560curl --version
3561@end example
3562
3563the output will look like this (without the linebreaks):
3564
3565@example
3566gnurl --version
3567curl 7.56.0 (x86_64-unknown-linux-gnu) libcurl/7.56.0 \
3568GnuTLS/3.5.13 zlib/1.2.11 libidn2/2.0.4
3569Release-Date: 2017-10-08
3570Protocols: http https
3571Features: AsynchDNS IDN IPv6 Largefile NTLM SSL libz \
3572TLS-SRP UnixSockets HTTPS-proxy
3573@end example
3574
3575@node Testing the GNS setup
3576@subsubsection Testing the GNS setup
3577
3578Now for testing purposes we can create some records in our zone to test
3579the SSL functionality of the proxy:
3580
3581@example
3582$ gnunet-identity -C test
3583$ gnunet-namestore -a -e "1 d" -n "homepage" \
3584 -t A -V 131.159.74.67 -z test
3585$ gnunet-namestore -a -e "1 d" -n "homepage" \
3586 -t LEHO -V "gnunet.org" -z test
3587@end example
3588
3589@noindent
3590At this point we can start the proxy. Simply execute
3591
3592@example
3593$ gnunet-gns-proxy
3594@end example
3595
3596@noindent
3597Configure your browser to use this SOCKSv5 proxy on port 7777 and visit
3598this link.
3599If you use @command{Firefox} (or one of its deriviates/forks such as
3600Icecat) you also have to go to @code{about:config} and set the key
3601@code{network.proxy.socks_remote_dns} to @code{true}.
3602
3603When you visit @code{https://homepage.test/}, you should get to the
3604@code{https://gnunet.org/} frontpage and the browser (with the correctly
3605configured proxy) should give you a valid SSL certificate for
3606@code{homepage.gnu} and no warnings. It should look like this:
3607
3608@c FIXME: Image does not exist, create it or save it from Drupal?
3609@c @image{images/gnunethpgns.png,5in,, picture of homepage.gnu in Webbrowser}
3610
3611
3612@node Configuring the GNUnet VPN
3613@subsection Configuring the GNUnet VPN
3614
3615@menu
3616* IPv4 address for interface::
3617* IPv6 address for interface::
3618* Configuring the GNUnet VPN DNS::
3619* Configuring the GNUnet VPN Exit Service::
3620* IP Address of external DNS resolver::
3621* IPv4 address for Exit interface::
3622* IPv6 address for Exit interface::
3623@end menu
3624
3625Before configuring the GNUnet VPN, please make sure that system-wide DNS
3626interception is configured properly as described in the section on the
3627GNUnet DNS setup. @pxref{Configuring the GNU Name System},
3628if you haven't done so already.
3629
3630The default options for the GNUnet VPN are usually sufficient to use
3631GNUnet as a Layer 2 for your Internet connection.
3632However, what you always have to specify is which IP protocol you want
3633to tunnel: IPv4, IPv6 or both.
3634Furthermore, if you tunnel both, you most likely should also tunnel
3635all of your DNS requests.
3636You theoretically can tunnel "only" your DNS traffic, but that usually
3637makes little sense.
3638
3639The other options as shown on the gnunet-setup tool are:
3640
3641@node IPv4 address for interface
3642@subsubsection IPv4 address for interface
3643
3644This is the IPv4 address the VPN interface will get. You should pick an
3645'private' IPv4 network that is not yet in use for you system. For example,
3646if you use @code{10.0.0.1/255.255.0.0} already, you might use
3647@code{10.1.0.1/255.255.0.0}.
3648If you use @code{10.0.0.1/255.0.0.0} already, then you might use
3649@code{192.168.0.1/255.255.0.0}.
3650If your system is not in a private IP-network, using any of the above will
3651work fine.
3652You should try to make the mask of the address big enough
3653(@code{255.255.0.0} or, even better, @code{255.0.0.0}) to allow more
3654mappings of remote IP Addresses into this range.
3655However, even a @code{255.255.255.0} mask will suffice for most users.
3656
3657@node IPv6 address for interface
3658@subsubsection IPv6 address for interface
3659
3660The IPv6 address the VPN interface will get. Here you can specify any
3661non-link-local address (the address should not begin with @code{fe80:}).
3662A subnet Unique Local Unicast (@code{fd00::/8} prefix) that you are
3663currently not using would be a good choice.
3664
3665@node Configuring the GNUnet VPN DNS
3666@subsubsection Configuring the GNUnet VPN DNS
3667
3668To resolve names for remote nodes, activate the DNS exit option.
3669
3670@node Configuring the GNUnet VPN Exit Service
3671@subsubsection Configuring the GNUnet VPN Exit Service
3672
3673If you want to allow other users to share your Internet connection (yes,
3674this may be dangerous, just as running a Tor exit node) or want to
3675provide access to services on your host (this should be less dangerous,
3676as long as those services are secure), you have to enable the GNUnet exit
3677daemon.
3678
3679You then get to specify which exit functions you want to provide. By
3680enabling the exit daemon, you will always automatically provide exit
3681functions for manually configured local services (this component of the
3682system is under
3683development and not documented further at this time). As for those
3684services you explicitly specify the target IP address and port, there is
3685no significant security risk in doing so.
3686
3687Furthermore, you can serve as a DNS, IPv4 or IPv6 exit to the Internet.
3688Being a DNS exit is usually pretty harmless. However, enabling IPv4 or
3689IPv6-exit without further precautions may enable adversaries to access
3690your local network, send spam, attack other systems from your Internet
3691connection and to other mischief that will appear to come from your
3692machine. This may or may not get you into legal trouble.
3693If you want to allow IPv4 or IPv6-exit functionality, you should strongly
3694consider adding additional firewall rules manually to protect your local
3695network and to restrict outgoing TCP traffic (i.e. by not allowing access
3696to port 25). While we plan to improve exit-filtering in the future,
3697you're currently on your own here.
3698Essentially, be prepared for any kind of IP-traffic to exit the respective
3699TUN interface (and GNUnet will enable IP-forwarding and NAT for the
3700interface automatically).
3701
3702Additional configuration options of the exit as shown by the gnunet-setup
3703tool are:
3704
3705@node IP Address of external DNS resolver
3706@subsubsection IP Address of external DNS resolver
3707
3708If DNS traffic is to exit your machine, it will be send to this DNS
3709resolver. You can specify an IPv4 or IPv6 address.
3710
3711@node IPv4 address for Exit interface
3712@subsubsection IPv4 address for Exit interface
3713
3714This is the IPv4 address the Interface will get. Make the mask of the
3715address big enough (255.255.0.0 or, even better, 255.0.0.0) to allow more
3716mappings of IP addresses into this range. As for the VPN interface, any
3717unused, private IPv4 address range will do.
3718
3719@node IPv6 address for Exit interface
3720@subsubsection IPv6 address for Exit interface
3721
3722The public IPv6 address the interface will get. If your kernel is not a
3723very recent kernel and you are willing to manually enable IPv6-NAT, the
3724IPv6 address you specify here must be a globally routed IPv6 address of
3725your host.
3726
3727Suppose your host has the address @code{2001:4ca0::1234/64}, then
3728using @code{2001:4ca0::1:0/112} would be fine (keep the first 64 bits,
3729then change at least one bit in the range before the bitmask, in the
3730example above we changed bit 111 from 0 to 1).
3731
3732You may also have to configure your router to route traffic for the entire
3733subnet (@code{2001:4ca0::1:0/112} for example) through your computer (this
3734should be automatic with IPv6, but obviously anything can be
3735disabled).
3736
3737@node Bandwidth Configuration
3738@subsection Bandwidth Configuration
3739
3740You can specify how many bandwidth GNUnet is allowed to use to receive
3741and send data. This is important for users with limited bandwidth or
3742traffic volume.
3743
3744@node Configuring NAT
3745@subsection Configuring NAT
3746
3747Most hosts today do not have a normal global IP address but instead are
3748behind a router performing Network Address Translation (NAT) which assigns
3749each host in the local network a private IP address.
3750As a result, these machines cannot trivially receive inbound connections
3751from the Internet. GNUnet supports NAT traversal to enable these machines
3752to receive incoming connections from other peers despite their
3753limitations.
3754
3755In an ideal world, you can press the "Attempt automatic configuration"
3756button in gnunet-setup to automatically configure your peer correctly.
3757Alternatively, your distribution might have already triggered this
3758automatic configuration during the installation process.
3759However, automatic configuration can fail to determine the optimal
3760settings, resulting in your peer either not receiving as many connections
3761as possible, or in the worst case it not connecting to the network at all.
3762
3763To manually configure the peer, you need to know a few things about your
3764network setup. First, determine if you are behind a NAT in the first
3765place.
3766This is always the case if your IP address starts with "10.*" or
3767"192.168.*". Next, if you have control over your NAT router, you may
3768choose to manually configure it to allow GNUnet traffic to your host.
3769If you have configured your NAT to forward traffic on ports 2086 (and
3770possibly 1080) to your host, you can check the "NAT ports have been opened
3771manually" option, which corresponds to the "PUNCHED_NAT" option in the
3772configuration file. If you did not punch your NAT box, it may still be
3773configured to support UPnP, which allows GNUnet to automatically
3774configure it. In that case, you need to install the "upnpc" command,
3775enable UPnP (or PMP) on your NAT box and set the "Enable NAT traversal
3776via UPnP or PMP" option (corresponding to "ENABLE_UPNP" in the
3777configuration file).
3778
3779Some NAT boxes can be traversed using the autonomous NAT traversal method.
3780This requires certain GNUnet components to be installed with "SUID"
3781prividledges on your system (so if you're installing on a system you do
3782not have administrative rights to, this will not work).
3783If you installed as 'root', you can enable autonomous NAT traversal by
3784checking the "Enable NAT traversal using ICMP method".
3785The ICMP method requires a way to determine your NAT's external (global)
3786IP address. This can be done using either UPnP, DynDNS, or by manual
3787configuration. If you have a DynDNS name or know your external IP address,
3788you should enter that name under "External (public) IPv4 address" (which
3789corresponds to the "EXTERNAL_ADDRESS" option in the configuration file).
3790If you leave the option empty, GNUnet will try to determine your external
3791IP address automatically (which may fail, in which case autonomous
3792NAT traversal will then not work).
3793
3794Finally, if you yourself are not behind NAT but want to be able to
3795connect to NATed peers using autonomous NAT traversal, you need to check
3796the "Enable connecting to NATed peers using ICMP method" box.
3797
3798
3799@node Peer configuration for distributions
3800@subsection Peer configuration for distributions
3801
3802The "GNUNET_DATA_HOME" in "[path]" in @file{/etc/gnunet.conf} should be
3803manually set to "/var/lib/gnunet/data/" as the default
3804"~/.local/share/gnunet/" is probably not that appropriate in this case.
3805Similarly, distributions may consider pointing "GNUNET_RUNTIME_DIR" to
3806"/var/run/gnunet/" and "GNUNET_HOME" to "/var/lib/gnunet/". Also, should a
3807distribution decide to override system defaults, all of these changes
3808should be done in a custom @file{/etc/gnunet.conf} and not in the files
3809in the @file{config.d/} directory.
3810
3811Given the proposed access permissions, the "gnunet-setup" tool must be
3812run as use "gnunet" (and with option "-c /etc/gnunet.conf" so that it
3813modifies the system configuration). As always, gnunet-setup should be run
3814after the GNUnet peer was stopped using "gnunet-arm -e". Distributions
3815might want to include a wrapper for gnunet-setup that allows the
3816desktop-user to "sudo" (i.e. using gtksudo) to the "gnunet" user account
3817and then runs "gnunet-arm -e", "gnunet-setup" and "gnunet-arm -s" in
3818sequence.
3819
3820@node How to start and stop a GNUnet peer
3821@section How to start and stop a GNUnet peer
3822
3823This section describes how to start a GNUnet peer. It assumes that you
3824have already compiled and installed GNUnet and its' dependencies.
3825Before you start a GNUnet peer, you may want to create a configuration
3826file using gnunet-setup (but you do not have to).
3827Sane defaults should exist in your
3828@file{$GNUNET_PREFIX/share/gnunet/config.d/} directory, so in practice
3829you could simply start without any configuration. If you want to
3830configure your peer later, you need to stop it before invoking the
3831@code{gnunet-setup} tool to customize further and to test your
3832configuration (@code{gnunet-setup} has build-in test functions).
3833
3834The most important option you might have to still set by hand is in
3835[PATHS]. Here, you use the option "GNUNET_HOME" to specify the path where
3836GNUnet should store its data.
3837It defaults to @code{$HOME/}, which again should work for most users.
3838Make sure that the directory specified as GNUNET_HOME is writable to
3839the user that you will use to run GNUnet (note that you can run frontends
3840using other users, GNUNET_HOME must only be accessible to the user used to
3841run the background processes).
3842
3843You will also need to make one central decision: should all of GNUnet be
3844run under your normal UID, or do you want distinguish between system-wide
3845(user-independent) GNUnet services and personal GNUnet services. The
3846multi-user setup is slightly more complicated, but also more secure and
3847generally recommended.
3848
3849@menu
3850* The Single-User Setup::
3851* The Multi-User Setup::
3852* Killing GNUnet services::
3853* Access Control for GNUnet::
3854@end menu
3855
3856@node The Single-User Setup
3857@subsection The Single-User Setup
3858
3859For the single-user setup, you do not need to do anything special and can
3860just start the GNUnet background processes using @code{gnunet-arm}.
3861By default, GNUnet looks in @file{~/.config/gnunet.conf} for a
3862configuration (or @code{$XDG_CONFIG_HOME/gnunet.conf} if@
3863@code{$XDG_CONFIG_HOME} is defined). If your configuration lives
3864elsewhere, you need to pass the @code{-c FILENAME} option to all GNUnet
3865commands.
3866
3867Assuming the configuration file is called @file{~/.config/gnunet.conf},
3868you start your peer using the @code{gnunet-arm} command (say as user
3869@code{gnunet}) using:
3870
3871@example
3872gnunet-arm -c ~/.config/gnunet.conf -s
3873@end example
3874
3875@noindent
3876The "-s" option here is for "start". The command should return almost
3877instantly. If you want to stop GNUnet, you can use:
3878
3879@example
3880gnunet-arm -c ~/.config/gnunet.conf -e
3881@end example
3882
3883@noindent
3884The "-e" option here is for "end".
3885
3886Note that this will only start the basic peer, no actual applications
3887will be available.
3888If you want to start the file-sharing service, use (after starting
3889GNUnet):
3890
3891@example
3892gnunet-arm -c ~/.config/gnunet.conf -i fs
3893@end example
3894
3895@noindent
3896The "-i fs" option here is for "initialize" the "fs" (file-sharing)
3897application. You can also selectively kill only file-sharing support using
3898
3899@example
3900gnunet-arm -c ~/.config/gnunet.conf -k fs
3901@end example
3902
3903@noindent
3904Assuming that you want certain services (like file-sharing) to be always
3905automatically started whenever you start GNUnet, you can activate them by
3906setting "FORCESTART=YES" in the respective section of the configuration
3907file (for example, "[fs]"). Then GNUnet with file-sharing support would
3908be started whenever you@ enter:
3909
3910@example
3911gnunet-arm -c ~/.config/gnunet.conf -s
3912@end example
3913
3914@noindent
3915Alternatively, you can combine the two options:
3916
3917@example
3918gnunet-arm -c ~/.config/gnunet.conf -s -i fs
3919@end example
3920
3921@noindent
3922Using @code{gnunet-arm} is also the preferred method for initializing
3923GNUnet from @code{init}.
3924
3925Finally, you should edit your @code{crontab} (using the @code{crontab}
3926command) and insert a line@
3927
3928@example
3929@@reboot gnunet-arm -c ~/.config/gnunet.conf -s
3930@end example
3931
3932to automatically start your peer whenever your system boots.
3933
3934@node The Multi-User Setup
3935@subsection The Multi-User Setup
3936
3937This requires you to create a user @code{gnunet} and an additional group
3938@code{gnunetdns}, prior to running @code{make install} during
3939installation.
3940Then, you create a configuration file @file{/etc/gnunet.conf} which should
3941contain the lines:@
3942
3943@example
3944[arm]
3945SYSTEM_ONLY = YES
3946USER_ONLY = NO
3947@end example
3948
3949@noindent
3950Then, perform the same steps to run GNUnet as in the per-user
3951configuration, except as user @code{gnunet} (including the
3952@code{crontab} installation).
3953You may also want to run @code{gnunet-setup} to configure your peer
3954(databases, etc.).
3955Make sure to pass @code{-c /etc/gnunet.conf} to all commands. If you
3956run @code{gnunet-setup} as user @code{gnunet}, you might need to change
3957permissions on @file{/etc/gnunet.conf} so that the @code{gnunet} user can
3958write to the file (during setup).
3959
3960Afterwards, you need to perform another setup step for each normal user
3961account from which you want to access GNUnet. First, grant the normal user
3962(@code{$USER}) permission to the group gnunet:
3963
3964@example
3965# adduser $USER gnunet
3966@end example
3967
3968@noindent
3969Then, create a configuration file in @file{~/.config/gnunet.conf} for the
3970$USER with the lines:
3971
3972@example
3973[arm]
3974SYSTEM_ONLY = NO
3975USER_ONLY = YES
3976@end example
3977
3978@noindent
3979This will ensure that @code{gnunet-arm} when started by the normal user
3980will only run services that are per-user, and otherwise rely on the
3981system-wide services.
3982Note that the normal user may run gnunet-setup, but the
3983configuration would be ineffective as the system-wide services will use
3984@file{/etc/gnunet.conf} and ignore options set by individual users.
3985
3986Again, each user should then start the peer using
3987@file{gnunet-arm -s} --- and strongly consider adding logic to start
3988the peer automatically to their crontab.
3989
3990Afterwards, you should see two (or more, if you have more than one USER)
3991@code{gnunet-service-arm} processes running in your system.
3992
3993@node Killing GNUnet services
3994@subsection Killing GNUnet services
3995
3996It is not necessary to stop GNUnet services explicitly when shutting
3997down your computer.
3998
3999It should be noted that manually killing "most" of the
4000@code{gnunet-service} processes is generally not a successful method for
4001stopping a peer (since @code{gnunet-service-arm} will instantly restart
4002them). The best way to explicitly stop a peer is using
4003@code{gnunet-arm -e}; note that the per-user services may need to be
4004terminated before the system-wide services will terminate normally.
4005
4006@node Access Control for GNUnet
4007@subsection Access Control for GNUnet
4008
4009This chapter documents how we plan to make access control work within the
4010GNUnet system for a typical peer. It should be read as a best-practice
4011installation guide for advanced users and builders of binary
4012distributions. The recommendations in this guide apply to POSIX-systems
4013with full support for UNIX domain sockets only.
4014
4015Note that this is an advanced topic. The discussion presumes a very good
4016understanding of users, groups and file permissions. Normal users on
4017hosts with just a single user can just install GNUnet under their own
4018account (and possibly allow the installer to use SUDO to grant additional
4019permissions for special GNUnet tools that need additional rights).
4020The discussion below largely applies to installations where multiple users
4021share a system and to installations where the best possible security is
4022paramount.
4023
4024A typical GNUnet system consists of components that fall into four
4025categories:
4026
4027@table @asis
4028
4029@item User interfaces
4030User interfaces are not security sensitive and are supposed to be run and
4031used by normal system users.
4032The GTK GUIs and most command-line programs fall into this category.
4033Some command-line tools (like gnunet-transport) should be excluded as they
4034offer low-level access that normal users should not need.
4035@item System services and support tools
4036System services should always run and offer services that can then be
4037accessed by the normal users.
4038System services do not require special permissions, but as they are not
4039specific to a particular user, they probably should not run as a
4040particular user. Also, there should typically only be one GNUnet peer per
4041host. System services include the gnunet-service and gnunet-daemon
4042programs; support tools include command-line programs such as gnunet-arm.
4043@item Priviledged helpers
4044Some GNUnet components require root rights to open raw sockets or perform
4045other special operations. These gnunet-helper binaries are typically
4046installed SUID and run from services or daemons.
4047@item Critical services
4048Some GNUnet services (such as the DNS service) can manipulate the service
4049in deep and possibly highly security sensitive ways. For example, the DNS
4050service can be used to intercept and alter any DNS query originating from
4051the local machine. Access to the APIs of these critical services and their
4052priviledged helpers must be tightly controlled.
4053@end table
4054
4055@c FIXME: The titles of these chapters are too long in the index.
4056
4057@menu
4058* Recommendation - Disable access to services via TCP::
4059* Recommendation - Run most services as system user "gnunet"::
4060* Recommendation - Control access to services using group "gnunet"::
4061* Recommendation - Limit access to certain SUID binaries by group "gnunet"::
4062* Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"::
4063* Differences between "make install" and these recommendations::
4064@end menu
4065
4066@node Recommendation - Disable access to services via TCP
4067@subsubsection Recommendation - Disable access to services via TCP
4068
4069GNUnet services allow two types of access: via TCP socket or via UNIX
4070domain socket.
4071If the service is available via TCP, access control can only be
4072implemented by restricting connections to a particular range of IP
4073addresses.
4074This is acceptable for non-critical services that are supposed to be
4075available to all users on the local system or local network.
4076However, as TCP is generally less efficient and it is rarely the case
4077that a single GNUnet peer is supposed to serve an entire local network,
4078the default configuration should disable TCP access to all GNUnet
4079services on systems with support for UNIX domain sockets.
4080As of GNUnet 0.9.2, configuration files with TCP access disabled should be
4081generated by default. Users can re-enable TCP access to particular
4082services simply by specifying a non-zero port number in the section of
4083the respective service.
4084
4085
4086@node Recommendation - Run most services as system user "gnunet"
4087@subsubsection Recommendation - Run most services as system user "gnunet"
4088
4089GNUnet's main services should be run as a separate user "gnunet" in a
4090special group "gnunet".
4091The user "gnunet" should start the peer using "gnunet-arm -s" during
4092system startup. The home directory for this user should be
4093@file{/var/lib/gnunet} and the configuration file should be
4094@file{/etc/gnunet.conf}.
4095Only the @code{gnunet} user should have the right to access
4096@file{/var/lib/gnunet} (@emph{mode: 700}).
4097
4098@node Recommendation - Control access to services using group "gnunet"
4099@subsubsection Recommendation - Control access to services using group "gnunet"
4100
4101Users that should be allowed to use the GNUnet peer should be added to the
4102group "gnunet". Using GNUnet's access control mechanism for UNIX domain
4103sockets, those services that are considered useful to ordinary users
4104should be made available by setting "UNIX_MATCH_GID=YES" for those
4105services.
4106Again, as shipped, GNUnet provides reasonable defaults.
4107Permissions to access the transport and core subsystems might additionally
4108be granted without necessarily causing security concerns.
4109Some services, such as DNS, must NOT be made accessible to the "gnunet"
4110group (and should thus only be accessible to the "gnunet" user and
4111services running with this UID).
4112
4113@node Recommendation - Limit access to certain SUID binaries by group "gnunet"
4114@subsubsection Recommendation - Limit access to certain SUID binaries by group "gnunet"
4115
4116Most of GNUnet's SUID binaries should be safe even if executed by normal
4117users. However, it is possible to reduce the risk a little bit more by
4118making these binaries owned by the group "gnunet" and restricting their
4119execution to user of the group "gnunet" as well (4750).
4120
4121@node Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"
4122@subsubsection Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"
4123
4124A special group "gnunetdns" should be created for controlling access to
4125the "gnunet-helper-dns".
4126The binary should then be owned by root and be in group "gnunetdns" and
4127be installed SUID and only be group-executable (2750).
4128@b{Note that the group "gnunetdns" should have no users in it at all,
4129ever.}
4130The "gnunet-service-dns" program should be executed by user "gnunet" (via
4131gnunet-service-arm) with the binary owned by the user "root" and the group
4132"gnunetdns" and be SGID (2700). This way, @strong{only}
4133"gnunet-service-dns" can change its group to "gnunetdns" and execute the
4134helper, and the helper can then run as root (as per SUID).
4135Access to the API offered by "gnunet-service-dns" is in turn restricted
4136to the user "gnunet" (not the group!), which means that only
4137"benign" services can manipulate DNS queries using "gnunet-service-dns".
4138
4139@node Differences between "make install" and these recommendations
4140@subsubsection Differences between "make install" and these recommendations
4141
4142The current build system does not set all permissions automatically based
4143on the recommendations above. In particular, it does not use the group
4144"gnunet" at all (so setting gnunet-helpers other than the
4145gnunet-helper-dns to be owned by group "gnunet" must be done manually).
4146Furthermore, 'make install' will silently fail to set the DNS binaries to
4147be owned by group "gnunetdns" unless that group already exists (!).
4148An alternative name for the "gnunetdns" group can be specified using the
4149@code{--with-gnunetdns=GRPNAME} configure option.
diff --git a/doc/documentation/chapters/user.texi b/doc/documentation/chapters/user.texi
index e5ebf5371..422619f84 100644
--- a/doc/documentation/chapters/user.texi
+++ b/doc/documentation/chapters/user.texi
@@ -2,20 +2,21 @@
2@chapter Using GNUnet 2@chapter Using GNUnet
3@c %**end of header 3@c %**end of header
4 4
5This tutorial is supposed to give a first introduction for end-users 5This tutorial is supposed to give a first introduction for users
6trying to do something "real" with GNUnet. Installation and 6trying to do something real with GNUnet. Installation and
7configuration are specifically outside of the scope of this tutorial. 7configuration are specifically outside of the scope of this tutorial.
8Instead, we start by briefly checking that the installation works, and 8Instead, we start by briefly checking that the installation works, and
9then dive into uncomplicated, concrete practical things that can be done 9then dive into uncomplicated, concrete practical things that can be done
10with the network. 10with the framework provided by GNUnet.
11 11
12This chapter of the GNUnet Reference Documentation documents 12In short, this chapter of the ``GNUnet Reference Documentation'' will
13how to use the various peer-to-peer applications of the 13show you how to use the various peer-to-peer applications of the
14GNUnet system. 14GNUnet system.
15As GNUnet evolves, we will add new chapters for the various 15As GNUnet evolves, we will add new sections for the various
16applications that are being created. 16applications that are being created.
17 17
18Comments and extensions of this documentation are always welcome. 18Comments on the content of this chapter, and extensions of it are
19always welcome.
19 20
20 21
21@menu 22@menu
@@ -27,16 +28,19 @@ Comments and extensions of this documentation are always welcome.
27* File-sharing:: 28* File-sharing::
28* The GNU Name System:: 29* The GNU Name System::
29* Using the Virtual Public Network:: 30* Using the Virtual Public Network::
31* The graphical configuration interface::
32* How to start and stop a GNUnet peer::
30@end menu 33@end menu
31 34
32@node Checking the Installation 35@node Checking the Installation
33@section Checking the Installation 36@section Checking the Installation
34@c %**end of header 37@c %**end of header
35 38
36This section describes a quick casual way to check if your GNUnet 39This section describes a quick, casual way to check if your GNUnet
37installation works. However, if it does not, we do not cover 40installation works. However, if it does not, we do not cover
38steps for recovery --- for this, please study the installation and 41steps for recovery --- for this, please study the instructions
39configuration handbooks. 42provided in the developer handbook as well as the system-specific
43instruction in the source code repository@footnote{The system specific instructions are not provided as part of this handbook!}.
40 44
41 45
42@menu 46@menu
@@ -45,13 +49,16 @@ configuration handbooks.
45* Peer Information:: 49* Peer Information::
46@end menu 50@end menu
47 51
52@cindex GNUnet GTK
53@cindex GTK
54@cindex GTK user interface
48@node gnunet-gtk 55@node gnunet-gtk
49@subsection gnunet-gtk 56@subsection gnunet-gtk
50@c %**end of header 57@c %**end of header
51 58
52The @command{gnunet-gtk} package contains several graphical 59The @command{gnunet-gtk} package contains several graphical
53user interfaces for the respective GNUnet applications. 60user interfaces for the respective GNUnet applications.
54Those currently are: 61Currently these interfaces cover:
55 62
56@itemize @bullet 63@itemize @bullet
57@item Statistics 64@item Statistics
@@ -66,20 +73,21 @@ Those currently are:
66@subsection Statistics 73@subsection Statistics
67@c %**end of header 74@c %**end of header
68 75
69First, you should launch the graphical user interface. You can do 76First, you should launch GNUnet gtk@footnote{Obviously you should also start gnunet, via gnunet-arm or the system provided method}.
70this from the command-line by typing 77You can do this from the command-line by typing
71 78
72@example 79@example
73$ gnunet-statistics-gtk 80gnunet-statistics-gtk
74@end example 81@end example
75 82
76If your peer is running correctly, you should see a bunch of 83If your peer@footnote{The term ``peer'' is a common word used in federated and distributed networks to describe a participating device which is connected to the network. Thus, your Personal Computer or whatever it is you are looking at the Gtk+ interface describes a ``Peer'' or a ``Node''.}
77lines, all of which should be "significantly" above zero (at least if your 84is running correctly, you should see a bunch of lines,
78peer has been running for a few seconds). The lines indicate how many 85all of which should be ``significantly'' above zero (at least if your
79other 86peer has been running for more than a few seconds). The lines indicate
80peers your peer is connected to (via different mechanisms) and how large 87how many other peers your peer is connected to (via different
81the overall overlay network is currently estimated to be. The X-axis 88mechanisms) and how large the entire overlay network is currently
82represents time (in seconds since the start of @command{gnunet-gtk}). 89estimated to be. The X-axis represents time (in seconds since the
90start of @command{gnunet-gtk}).
83 91
84You can click on "Traffic" to see information about the amount of 92You can click on "Traffic" to see information about the amount of
85bandwidth your peer has consumed, and on "Storage" to check the amount 93bandwidth your peer has consumed, and on "Storage" to check the amount
@@ -2006,3 +2014,1925 @@ service offered by that peer, you can create an IP tunnel to
2006that peer by specifying the peer's identity, service name and 2014that peer by specifying the peer's identity, service name and
2007protocol (--tcp or --udp) and you will again receive an IP address 2015protocol (--tcp or --udp) and you will again receive an IP address
2008that will terminate at the respective peer's service. 2016that will terminate at the respective peer's service.
2017
2018
2019
2020@c NOTE: Inserted from Installation Handbook in original ``order'':
2021@c FIXME: Move this to User Handbook.
2022@node The graphical configuration interface
2023@section The graphical configuration interface
2024
2025If you also would like to use @command{gnunet-gtk} and
2026@command{gnunet-setup} (highly recommended for beginners), do:
2027
2028@menu
2029* Configuring your peer::
2030* Configuring the Friend-to-Friend (F2F) mode::
2031* Configuring the hostlist to bootstrap::
2032* Configuration of the HOSTLIST proxy settings::
2033* Configuring your peer to provide a hostlist ::
2034* Configuring the datastore::
2035* Configuring the MySQL database::
2036* Reasons for using MySQL::
2037* Reasons for not using MySQL::
2038* Setup Instructions::
2039* Testing::
2040* Performance Tuning::
2041* Setup for running Testcases::
2042* Configuring the Postgres database::
2043* Reasons to use Postgres::
2044* Reasons not to use Postgres::
2045* Manual setup instructions::
2046* Testing the setup manually::
2047* Configuring the datacache::
2048* Configuring the file-sharing service::
2049* Configuring logging::
2050* Configuring the transport service and plugins::
2051* Configuring the wlan transport plugin::
2052* Configuring HTTP(S) reverse proxy functionality using Apache or nginx::
2053* Blacklisting peers::
2054* Configuration of the HTTP and HTTPS transport plugins::
2055* Configuring the GNU Name System::
2056* Configuring the GNUnet VPN::
2057* Bandwidth Configuration::
2058* Configuring NAT::
2059* Peer configuration for distributions::
2060@end menu
2061
2062@node Configuring your peer
2063@subsection Configuring your peer
2064
2065This chapter will describe the various configuration options in GNUnet.
2066
2067The easiest way to configure your peer is to use the
2068@command{gnunet-setup} tool.
2069@command{gnunet-setup} is part of the @command{gnunet-gtk}
2070application. You might have to install it separately.
2071
2072Many of the specific sections from this chapter actually are linked from
2073within @command{gnunet-setup} to help you while using the setup tool.
2074
2075While you can also configure your peer by editing the configuration
2076file by hand, this is not recommended for anyone except for developers
2077as it requires a more in-depth understanding of the configuration files
2078and internal dependencies of GNUnet.
2079
2080@node Configuring the Friend-to-Friend (F2F) mode
2081@subsection Configuring the Friend-to-Friend (F2F) mode
2082
2083GNUnet knows three basic modes of operation:
2084@itemize @bullet
2085@item In standard "peer-to-peer" mode,
2086your peer will connect to any peer.
2087@item In the pure "friend-to-friend"
2088mode, your peer will ONLY connect to peers from a list of friends
2089specified in the configuration.
2090@item Finally, in mixed mode,
2091GNUnet will only connect to arbitrary peers if it
2092has at least a specified number of connections to friends.
2093@end itemize
2094
2095When configuring any of the F2F ("friend-to-friend") modes,
2096you first need to create a file with the peer identities
2097of your friends. Ask your friends to run
2098
2099@example
2100$ gnunet-peerinfo -sq
2101@end example
2102
2103@noindent
2104The resulting output of this command needs to be added to your
2105@file{friends} file, which is simply a plain text file with one line
2106per friend with the output from the above command.
2107
2108You then specify the location of your @file{friends} file in the
2109@code{FRIENDS} option of the "topology" section.
2110
2111Once you have created the @file{friends} file, you can tell GNUnet to only
2112connect to your friends by setting the @code{FRIENDS-ONLY} option
2113(again in the "topology" section) to YES.
2114
2115If you want to run in mixed-mode, set "FRIENDS-ONLY" to NO and configure a
2116minimum number of friends to have (before connecting to arbitrary peers)
2117under the "MINIMUM-FRIENDS" option.
2118
2119If you want to operate in normal P2P-only mode, simply set
2120@code{MINIMUM-FRIENDS} to zero and @code{FRIENDS_ONLY} to NO.
2121This is the default.
2122
2123@node Configuring the hostlist to bootstrap
2124@subsection Configuring the hostlist to bootstrap
2125
2126After installing the software you need to get connected to the GNUnet
2127network. The configuration file included in your download is already
2128configured to connect you to the GNUnet network.
2129In this section the relevant configuration settings are explained.
2130
2131To get an initial connection to the GNUnet network and to get to know
2132peers already connected to the network you can use the so called
2133"bootstrap servers".
2134These servers can give you a list of peers connected to the network.
2135To use these bootstrap servers you have to configure the hostlist daemon
2136to activate bootstrapping.
2137
2138To activate bootstrapping, edit the @code{[hostlist]}-section in your
2139configuration file. You have to set the argument @command{-b} in the
2140options line:
2141
2142@example
2143[hostlist]
2144OPTIONS = -b
2145@end example
2146
2147Additionally you have to specify which server you want to use.
2148The default bootstrapping server is
2149"@uref{http://v10.gnunet.org/hostlist, http://v10.gnunet.org/hostlist}".
2150[^] To set the server you have to edit the line "SERVERS" in the hostlist
2151section. To use the default server you should set the lines to
2152
2153@example
2154SERVERS = http://v10.gnunet.org/hostlist [^]
2155@end example
2156
2157@noindent
2158To use bootstrapping your configuration file should include these lines:
2159
2160@example
2161[hostlist]
2162OPTIONS = -b
2163SERVERS = http://v10.gnunet.org/hostlist [^]
2164@end example
2165
2166@noindent
2167Besides using bootstrap servers you can configure your GNUnet peer to
2168recieve hostlist advertisements.
2169Peers offering hostlists to other peers can send advertisement messages
2170to peers that connect to them. If you configure your peer to receive these
2171messages, your peer can download these lists and connect to the peers
2172included. These lists are persistent, which means that they are saved to
2173your hard disk regularly and are loaded during startup.
2174
2175To activate hostlist learning you have to add the @command{-e}
2176switch to the @code{OPTIONS} line in the hostlist section:
2177
2178@example
2179[hostlist]
2180OPTIONS = -b -e
2181@end example
2182
2183@noindent
2184Furthermore you can specify in which file the lists are saved.
2185To save the lists in the file @file{hostlists.file} just add the line:
2186
2187@example
2188HOSTLISTFILE = hostlists.file
2189@end example
2190
2191@noindent
2192Best practice is to activate both bootstrapping and hostlist learning.
2193So your configuration file should include these lines:
2194
2195@example
2196[hostlist]
2197OPTIONS = -b -e
2198HTTPPORT = 8080
2199SERVERS = http://v10.gnunet.org/hostlist [^]
2200HOSTLISTFILE = $SERVICEHOME/hostlists.file
2201@end example
2202
2203@node Configuration of the HOSTLIST proxy settings
2204@subsection Configuration of the HOSTLIST proxy settings
2205
2206The hostlist client can be configured to use a proxy to connect to the
2207hostlist server.
2208This functionality can be configured in the configuration file directly
2209or using the @command{gnunet-setup} tool.
2210
2211The hostlist client supports the following proxy types at the moment:
2212
2213@itemize @bullet
2214@item HTTP and HTTP 1.0 only proxy
2215@item SOCKS 4/4a/5/5 with hostname
2216@end itemize
2217
2218In addition authentication at the proxy with username and password can be
2219configured.
2220
2221To configure proxy support for the hostlist client in the
2222@command{gnunet-setup} tool, select the "hostlist" tab and select
2223the appropriate proxy type.
2224The hostname or IP address (including port if required) has to be entered
2225in the "Proxy hostname" textbox. If required, enter username and password
2226in the "Proxy username" and "Proxy password" boxes.
2227Be aware that this information will be stored in the configuration in
2228plain text (TODO: Add explanation and generalize the part in Chapter 3.6
2229about the encrypted home).
2230
2231To provide these options directly in the configuration, you can
2232enter the following settings in the @code{[hostlist]} section of
2233the configuration:
2234
2235@example
2236# Type of proxy server,
2237# Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
2238# Default: HTTP
2239# PROXY_TYPE = HTTP
2240
2241# Hostname or IP of proxy server
2242# PROXY =
2243# User name for proxy server
2244# PROXY_USERNAME =
2245# User password for proxy server
2246# PROXY_PASSWORD =
2247@end example
2248
2249@node Configuring your peer to provide a hostlist
2250@subsection Configuring your peer to provide a hostlist
2251
2252If you operate a peer permanently connected to GNUnet you can configure
2253your peer to act as a hostlist server, providing other peers the list of
2254peers known to him.
2255
2256Your server can act as a bootstrap server and peers needing to obtain a
2257list of peers can contact it to download this list.
2258To download this hostlist the peer uses HTTP.
2259For this reason you have to build your peer with libgnurl (or libcurl)
2260and microhttpd support.
2261
2262To configure your peer to act as a bootstrap server you have to add the
2263@command{-p} option to @code{OPTIONS} in the @code{[hostlist]} section
2264of your configuration file.
2265Besides that you have to specify a port number for the http server.
2266In conclusion you have to add the following lines:
2267
2268@example
2269[hostlist]
2270HTTPPORT = 12980
2271OPTIONS = -p
2272@end example
2273
2274@noindent
2275If your peer acts as a bootstrap server other peers should know about
2276that. You can advertise the hostlist your are providing to other peers.
2277Peers connecting to your peer will get a message containing an
2278advertisement for your hostlist and the URL where it can be downloaded.
2279If this peer is in learning mode, it will test the hostlist and, in the
2280case it can obtain the list successfully, it will save it for
2281bootstrapping.
2282
2283To activate hostlist advertisement on your peer, you have to set the
2284following lines in your configuration file:
2285
2286@example
2287[hostlist]
2288EXTERNAL_DNS_NAME = example.org
2289HTTPPORT = 12981
2290OPTIONS = -p -a
2291@end example
2292
2293@noindent
2294With this configuration your peer will a act as a bootstrap server and
2295advertise this hostlist to other peers connecting to it.
2296The URL used to download the list will be
2297@code{@uref{http://example.org:12981/, http://example.org:12981/}}.
2298
2299Please notice:
2300
2301@itemize @bullet
2302@item The hostlist is @b{not} human readable, so you should not try to
2303download it using your webbrowser. Just point your GNUnet peer to the
2304address!
2305@item Advertising without providing a hostlist does not make sense and
2306will not work.
2307@end itemize
2308
2309@node Configuring the datastore
2310@subsection Configuring the datastore
2311
2312The datastore is what GNUnet uses for long-term storage of file-sharing
2313data. Note that long-term does not mean 'forever' since content does have
2314an expiration date, and of course storage space is finite (and hence
2315sometimes content may have to be discarded).
2316
2317Use the @code{QUOTA} option to specify how many bytes of storage space
2318you are willing to dedicate to GNUnet.
2319
2320In addition to specifying the maximum space GNUnet is allowed to use for
2321the datastore, you need to specify which database GNUnet should use to do
2322so. Currently, you have the choice between sqLite, MySQL and Postgres.
2323
2324@node Configuring the MySQL database
2325@subsection Configuring the MySQL database
2326
2327This section describes how to setup the MySQL database for GNUnet.
2328
2329Note that the mysql plugin does NOT work with mysql before 4.1 since we
2330need prepared statements.
2331We are generally testing the code against MySQL 5.1 at this point.
2332
2333@node Reasons for using MySQL
2334@subsection Reasons for using MySQL
2335
2336@itemize @bullet
2337
2338@item On up-to-date hardware wher
2339mysql can be used comfortably, this module
2340will have better performance than the other database choices (according
2341to our tests).
2342
2343@item Its often possible to recover the mysql database from internal
2344inconsistencies. Some of the other databases do not support repair.
2345@end itemize
2346
2347@node Reasons for not using MySQL
2348@subsection Reasons for not using MySQL
2349
2350@itemize @bullet
2351@item Memory usage (likely not an issue if you have more than 1 GB)
2352@item Complex manual setup
2353@end itemize
2354
2355@node Setup Instructions
2356@subsection Setup Instructions
2357
2358@itemize @bullet
2359
2360@item In @file{gnunet.conf} set in section @code{DATASTORE} the value for
2361@code{DATABASE} to @code{mysql}.
2362
2363@item Access mysql as root:
2364
2365@example
2366$ mysql -u root -p
2367@end example
2368
2369@noindent
2370and issue the following commands, replacing $USER with the username
2371that will be running @command{gnunet-arm} (so typically "gnunet"):
2372
2373@example
2374CREATE DATABASE gnunet;
2375GRANT select,insert,update,delete,create,alter,drop,create \
2376temporary tables ON gnunet.* TO $USER@@localhost;
2377SET PASSWORD FOR $USER@@localhost=PASSWORD('$the_password_you_like');
2378FLUSH PRIVILEGES;
2379@end example
2380
2381@item
2382In the $HOME directory of $USER, create a @file{.my.cnf} file with the
2383following lines
2384
2385@example
2386[client]
2387user=$USER
2388password=$the_password_you_like
2389@end example
2390
2391@end itemize
2392
2393Thats it. Note that @file{.my.cnf} file is a slight security risk unless
2394its on a safe partition. The @file{$HOME/.my.cnf} can of course be
2395a symbolic link.
2396Luckily $USER has only priviledges to mess up GNUnet's tables,
2397which should be pretty harmless.
2398
2399@node Testing
2400@subsection Testing
2401
2402You should briefly try if the database connection works. First, login
2403as $USER. Then use:
2404
2405@example
2406$ mysql -u $USER
2407mysql> use gnunet;
2408@end example
2409
2410@noindent
2411If you get the message
2412
2413@example
2414Database changed
2415@end example
2416
2417@noindent
2418it probably works.
2419
2420If you get
2421
2422@example
2423ERROR 2002: Can't connect to local MySQL server
2424through socket '/tmp/mysql.sock' (2)
2425@end example
2426
2427@noindent
2428it may be resolvable by
2429
2430@example
2431ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
2432@end example
2433
2434@noindent
2435so there may be some additional trouble depending on your mysql setup.
2436
2437@node Performance Tuning
2438@subsection Performance Tuning
2439
2440For GNUnet, you probably want to set the option
2441
2442@example
2443innodb_flush_log_at_trx_commit = 0
2444@end example
2445
2446@noindent
2447for a rather dramatic boost in MySQL performance. However, this reduces
2448the "safety" of your database as with this options you may loose
2449transactions during a power outage.
2450While this is totally harmless for GNUnet, the option applies to all
2451applications using MySQL. So you should set it if (and only if) GNUnet is
2452the only application on your system using MySQL.
2453
2454@node Setup for running Testcases
2455@subsection Setup for running Testcases
2456
2457If you want to run the testcases, you must create a second database
2458"gnunetcheck" with the same username and password. This database will
2459then be used for testing (@command{make check}).
2460
2461@node Configuring the Postgres database
2462@subsection Configuring the Postgres database
2463
2464This text describes how to setup the Postgres database for GNUnet.
2465
2466This Postgres plugin was developed for Postgres 8.3 but might work for
2467earlier versions as well.
2468
2469@node Reasons to use Postgres
2470@subsection Reasons to use Postgres
2471
2472@itemize @bullet
2473@item Easier to setup than MySQL
2474@item Real database
2475@end itemize
2476
2477@node Reasons not to use Postgres
2478@subsection Reasons not to use Postgres
2479
2480@itemize @bullet
2481@item Quite slow
2482@item Still some manual setup required
2483@end itemize
2484
2485@node Manual setup instructions
2486@subsection Manual setup instructions
2487
2488@itemize @bullet
2489@item In @file{gnunet.conf} set in section @code{DATASTORE} the value for
2490@code{DATABASE} to @code{postgres}.
2491@item Access Postgres to create a user:
2492
2493@table @asis
2494@item with Postgres 8.x, use:
2495
2496@example
2497# su - postgres
2498$ createuser
2499@end example
2500
2501@noindent
2502and enter the name of the user running GNUnet for the role interactively.
2503Then, when prompted, do not set it to superuser, allow the creation of
2504databases, and do not allow the creation of new roles.
2505
2506@item with Postgres 9.x, use:
2507
2508@example
2509# su - postgres
2510$ createuser -d $GNUNET_USER
2511@end example
2512
2513@noindent
2514where $GNUNET_USER is the name of the user running GNUnet.
2515
2516@end table
2517
2518
2519@item
2520As that user (so typically as user "gnunet"), create a database (or two):
2521
2522@example
2523$ createdb gnunet
2524# this way you can run "make check"
2525$ createdb gnunetcheck
2526@end example
2527
2528@end itemize
2529
2530Now you should be able to start @code{gnunet-arm}.
2531
2532@node Testing the setup manually
2533@subsection Testing the setup manually
2534
2535You may want to try if the database connection works. First, again login
2536as the user who will run @command{gnunet-arm}. Then use:
2537
2538@example
2539$ psql gnunet # or gnunetcheck
2540gnunet=> \dt
2541@end example
2542
2543@noindent
2544If, after you have started @command{gnunet-arm} at least once, you get
2545a @code{gn090} table here, it probably works.
2546
2547@node Configuring the datacache
2548@subsection Configuring the datacache
2549@c %**end of header
2550
2551The datacache is what GNUnet uses for storing temporary data. This data is
2552expected to be wiped completely each time GNUnet is restarted (or the
2553system is rebooted).
2554
2555You need to specify how many bytes GNUnet is allowed to use for the
2556datacache using the @code{QUOTA} option in the section @code{[dhtcache]}.
2557Furthermore, you need to specify which database backend should be used to
2558store the data. Currently, you have the choice between
2559sqLite, MySQL and Postgres.
2560
2561@node Configuring the file-sharing service
2562@subsection Configuring the file-sharing service
2563
2564In order to use GNUnet for file-sharing, you first need to make sure
2565that the file-sharing service is loaded.
2566This is done by setting the @code{AUTOSTART} option in
2567section @code{[fs]} to "YES". Alternatively, you can run
2568
2569@example
2570$ gnunet-arm -i fs
2571@end example
2572
2573@noindent
2574to start the file-sharing service by hand.
2575
2576Except for configuring the database and the datacache the only important
2577option for file-sharing is content migration.
2578
2579Content migration allows your peer to cache content from other peers as
2580well as send out content stored on your system without explicit requests.
2581This content replication has positive and negative impacts on both system
2582performance and privacy.
2583
2584FIXME: discuss the trade-offs. Here is some older text about it...
2585
2586Setting this option to YES allows gnunetd to migrate data to the local
2587machine. Setting this option to YES is highly recommended for efficiency.
2588Its also the default. If you set this value to YES, GNUnet will store
2589content on your machine that you cannot decrypt.
2590While this may protect you from liability if the judge is sane, it may
2591not (IANAL). If you put illegal content on your machine yourself, setting
2592this option to YES will probably increase your chances to get away with it
2593since you can plausibly deny that you inserted the content.
2594Note that in either case, your anonymity would have to be broken first
2595(which may be possible depending on the size of the GNUnet network and the
2596strength of the adversary).
2597
2598@node Configuring logging
2599@subsection Configuring logging
2600
2601Logging in GNUnet 0.9.0 is controlled via the "-L" and "-l" options.
2602Using @code{-L}, a log level can be specified. With log level
2603@code{ERROR} only serious errors are logged.
2604The default log level is @code{WARNING} which causes anything of
2605concern to be logged.
2606Log level @code{INFO} can be used to log anything that might be
2607interesting information whereas
2608@code{DEBUG} can be used by developers to log debugging messages
2609(but you need to run @code{./configure} with
2610@code{--enable-logging=verbose} to get them compiled).
2611The @code{-l} option is used to specify the log file.
2612
2613Since most GNUnet services are managed by @code{gnunet-arm}, using the
2614@code{-l} or @code{-L} options directly is not possible.
2615Instead, they can be specified using the @code{OPTIONS} configuration
2616value in the respective section for the respective service.
2617In order to enable logging globally without editing the @code{OPTIONS}
2618values for each service, @command{gnunet-arm} supports a
2619@code{GLOBAL_POSTFIX} option.
2620The value specified here is given as an extra option to all services for
2621which the configuration does contain a service-specific @code{OPTIONS}
2622field.
2623
2624@code{GLOBAL_POSTFIX} can contain the special sequence "@{@}" which
2625is replaced by the name of the service that is being started.
2626Furthermore, @code{GLOBAL_POSTFIX} is special in that sequences
2627starting with "$" anywhere in the string are expanded (according
2628to options in @code{PATHS}); this expansion otherwise is
2629only happening for filenames and then the "$" must be the
2630first character in the option. Both of these restrictions do
2631not apply to @code{GLOBAL_POSTFIX}.
2632Note that specifying @code{%} anywhere in the @code{GLOBAL_POSTFIX}
2633disables both of these features.
2634
2635In summary, in order to get all services to log at level
2636@code{INFO} to log-files called @code{SERVICENAME-logs}, the
2637following global prefix should be used:
2638
2639@example
2640GLOBAL_POSTFIX = -l $SERVICEHOME/@{@}-logs -L INFO
2641@end example
2642
2643@node Configuring the transport service and plugins
2644@subsection Configuring the transport service and plugins
2645
2646The transport service in GNUnet is responsible to maintain basic
2647connectivity to other peers.
2648Besides initiating and keeping connections alive it is also responsible
2649for address validation.
2650
2651The GNUnet transport supports more than one transport protocol.
2652These protocols are configured together with the transport service.
2653
2654The configuration section for the transport service itself is quite
2655similar to all the other services
2656
2657@example
2658AUTOSTART = YES
2659@@UNIXONLY@@ PORT = 2091
2660HOSTNAME = localhost
2661HOME = $SERVICEHOME
2662CONFIG = $DEFAULTCONFIG
2663BINARY = gnunet-service-transport
2664#PREFIX = valgrind
2665NEIGHBOUR_LIMIT = 50
2666ACCEPT_FROM = 127.0.0.1;
2667ACCEPT_FROM6 = ::1;
2668PLUGINS = tcp udp
2669UNIXPATH = /tmp/gnunet-service-transport.sock
2670@end example
2671
2672Different are the settings for the plugins to load @code{PLUGINS}.
2673The first setting specifies which transport plugins to load.
2674
2675@itemize @bullet
2676@item transport-unix
2677A plugin for local only communication with UNIX domain sockets. Used for
2678testing and available on unix systems only. Just set the port
2679
2680@example
2681[transport-unix]
2682PORT = 22086
2683TESTING_IGNORE_KEYS = ACCEPT_FROM;
2684@end example
2685
2686@item transport-tcp
2687A plugin for communication with TCP. Set port to 0 for client mode with
2688outbound only connections
2689
2690@example
2691[transport-tcp]
2692# Use 0 to ONLY advertise as a peer behind NAT (no port binding)
2693PORT = 2086
2694ADVERTISED_PORT = 2086
2695TESTING_IGNORE_KEYS = ACCEPT_FROM;
2696# Maximum number of open TCP connections allowed
2697MAX_CONNECTIONS = 128
2698@end example
2699
2700@item transport-udp
2701A plugin for communication with UDP. Supports peer discovery using
2702broadcasts.
2703
2704@example
2705[transport-udp]
2706PORT = 2086
2707BROADCAST = YES
2708BROADCAST_INTERVAL = 30 s
2709MAX_BPS = 1000000
2710TESTING_IGNORE_KEYS = ACCEPT_FROM;
2711@end example
2712
2713@item transport-http
2714HTTP and HTTPS support is split in two part: a client plugin initiating
2715outbound connections and a server part accepting connections from the
2716client. The client plugin just takes the maximum number of connections as
2717an argument.
2718
2719@example
2720[transport-http_client]
2721MAX_CONNECTIONS = 128
2722TESTING_IGNORE_KEYS = ACCEPT_FROM;
2723@end example
2724
2725@example
2726[transport-https_client]
2727MAX_CONNECTIONS = 128
2728TESTING_IGNORE_KEYS = ACCEPT_FROM;
2729@end example
2730
2731@noindent
2732The server has a port configured and the maximum nunber of connections.
2733The HTTPS part has two files with the certificate key and the certificate
2734file.
2735
2736The server plugin supports reverse proxies, so a external hostname can be
2737set using the @code{EXTERNAL_HOSTNAME} setting.
2738The webserver under this address should forward the request to the peer
2739and the configure port.
2740
2741@example
2742[transport-http_server]
2743EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de/gnunet
2744PORT = 1080
2745MAX_CONNECTIONS = 128
2746TESTING_IGNORE_KEYS = ACCEPT_FROM;
2747@end example
2748
2749@example
2750[transport-https_server]
2751PORT = 4433
2752CRYPTO_INIT = NORMAL
2753KEY_FILE = https.key
2754CERT_FILE = https.cert
2755MAX_CONNECTIONS = 128
2756TESTING_IGNORE_KEYS = ACCEPT_FROM;
2757@end example
2758
2759@item transport-wlan
2760
2761The next section describes how to setup the WLAN plugin,
2762so here only the settings. Just specify the interface to use:
2763
2764@example
2765[transport-wlan]
2766# Name of the interface in monitor mode (typically monX)
2767INTERFACE = mon0
2768# Real hardware, no testing
2769TESTMODE = 0
2770TESTING_IGNORE_KEYS = ACCEPT_FROM;
2771@end example
2772@end itemize
2773
2774@node Configuring the wlan transport plugin
2775@subsection Configuring the wlan transport plugin
2776
2777The wlan transport plugin enables GNUnet to send and to receive data on a
2778wlan interface.
2779It has not to be connected to a wlan network as long as sender and
2780receiver are on the same channel. This enables you to get connection to
2781GNUnet where no internet access is possible, for example during
2782catastrophes or when censorship cuts you off from the internet.
2783
2784
2785@menu
2786* Requirements for the WLAN plugin::
2787* Configuration::
2788* Before starting GNUnet::
2789* Limitations and known bugs::
2790@end menu
2791
2792
2793@node Requirements for the WLAN plugin
2794@subsubsection Requirements for the WLAN plugin
2795
2796@itemize @bullet
2797
2798@item wlan network card with monitor support and packet injection
2799(see @uref{http://www.aircrack-ng.org/, aircrack-ng.org})
2800
2801@item Linux kernel with mac80211 stack, introduced in 2.6.22, tested with
28022.6.35 and 2.6.38
2803
2804@item Wlantools to create the a monitor interface, tested with airmon-ng
2805of the aircrack-ng package
2806@end itemize
2807
2808@node Configuration
2809@subsubsection Configuration
2810
2811There are the following options for the wlan plugin (they should be like
2812this in your default config file, you only need to adjust them if the
2813values are incorrect for your system)
2814
2815@example
2816# section for the wlan transport plugin
2817[transport-wlan]
2818# interface to use, more information in the
2819# "Before starting GNUnet" section of the handbook.
2820INTERFACE = mon0
2821# testmode for developers:
2822# 0 use wlan interface,
2823#1 or 2 use loopback driver for tests 1 = server, 2 = client
2824TESTMODE = 0
2825@end example
2826
2827@node Before starting GNUnet
2828@subsubsection Before starting GNUnet
2829
2830Before starting GNUnet, you have to make sure that your wlan interface is
2831in monitor mode.
2832One way to put the wlan interface into monitor mode (if your interface
2833name is wlan0) is by executing:
2834
2835@example
2836sudo airmon-ng start wlan0
2837@end example
2838
2839@noindent
2840Here is an example what the result should look like:
2841
2842@example
2843Interface Chipset Driver
2844wlan0 Intel 4965 a/b/g/n iwl4965 - [phy0]
2845(monitor mode enabled on mon0)
2846@end example
2847
2848@noindent
2849The monitor interface is mon0 is the one that you have to put into the
2850configuration file.
2851
2852@node Limitations and known bugs
2853@subsubsection Limitations and known bugs
2854
2855Wlan speed is at the maximum of 1 Mbit/s because support for choosing the
2856wlan speed with packet injection was removed in newer kernels.
2857Please pester the kernel developers about fixing this.
2858
2859The interface channel depends on the wlan network that the card is
2860connected to. If no connection has been made since the start of the
2861computer, it is usually the first channel of the card.
2862Peers will only find each other and communicate if they are on the same
2863channel. Channels must be set manually, i.e. using:
2864
2865@example
2866iwconfig wlan0 channel 1
2867@end example
2868
2869@node Configuring HTTP(S) reverse proxy functionality using Apache or nginx
2870@subsection Configuring HTTP(S) reverse proxy functionality using Apache or nginx
2871
2872The HTTP plugin supports data transfer using reverse proxies. A reverse
2873proxy forwards the HTTP request he receives with a certain URL to another
2874webserver, here a GNUnet peer.
2875
2876So if you have a running Apache or nginx webserver you can configure it to
2877be a GNUnet reverse proxy. Especially if you have a well-known webiste
2878this improves censorship resistance since it looks as normal surfing
2879behaviour.
2880
2881To do so, you have to do two things:
2882
2883@itemize @bullet
2884@item Configure your webserver to forward the GNUnet HTTP traffic
2885@item Configure your GNUnet peer to announce the respective address
2886@end itemize
2887
2888As an example we want to use GNUnet peer running:
2889
2890@itemize @bullet
2891
2892@item HTTP server plugin on @code{gnunet.foo.org:1080}
2893
2894@item HTTPS server plugin on @code{gnunet.foo.org:4433}
2895
2896@item A apache or nginx webserver on
2897@uref{http://www.foo.org/, http://www.foo.org:80/}
2898
2899@item A apache or nginx webserver on https://www.foo.org:443/
2900@end itemize
2901
2902And we want the webserver to accept GNUnet traffic under
2903@code{http://www.foo.org/bar/}. The required steps are described here:
2904
2905@menu
2906* Reverse Proxy - Configure your Apache2 HTTP webserver::
2907* Reverse Proxy - Configure your Apache2 HTTPS webserver::
2908* Reverse Proxy - Configure your nginx HTTPS webserver::
2909* Reverse Proxy - Configure your nginx HTTP webserver::
2910* Reverse Proxy - Configure your GNUnet peer::
2911@end menu
2912
2913@node Reverse Proxy - Configure your Apache2 HTTP webserver
2914@subsubsection Reverse Proxy - Configure your Apache2 HTTP webserver
2915
2916First of all you need mod_proxy installed.
2917
2918Edit your webserver configuration. Edit
2919@code{/etc/apache2/apache2.conf} or the site-specific configuration file.
2920
2921In the respective @code{server config},@code{virtual host} or
2922@code{directory} section add the following lines:
2923
2924@example
2925ProxyTimeout 300
2926ProxyRequests Off
2927<Location /bar/ >
2928ProxyPass http://gnunet.foo.org:1080/
2929ProxyPassReverse http://gnunet.foo.org:1080/
2930</Location>
2931@end example
2932
2933@node Reverse Proxy - Configure your Apache2 HTTPS webserver
2934@subsubsection Reverse Proxy - Configure your Apache2 HTTPS webserver
2935
2936We assume that you already have an HTTPS server running, if not please
2937check how to configure a HTTPS host. An uncomplicated to use example
2938is the example configuration file for Apache2/HTTPD provided in
2939@file{apache2/sites-available/default-ssl}.
2940
2941In the respective HTTPS @code{server config},@code{virtual host} or
2942@code{directory} section add the following lines:
2943
2944@example
2945SSLProxyEngine On
2946ProxyTimeout 300
2947ProxyRequests Off
2948<Location /bar/ >
2949ProxyPass https://gnunet.foo.org:4433/
2950ProxyPassReverse https://gnunet.foo.org:4433/
2951</Location>
2952@end example
2953
2954@noindent
2955More information about the apache mod_proxy configuration can be found
2956in the Apache documentation@footnote{@uref{http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass, http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass}}
2957
2958@node Reverse Proxy - Configure your nginx HTTPS webserver
2959@subsubsection Reverse Proxy - Configure your nginx HTTPS webserver
2960
2961Since nginx does not support chunked encoding, you first of all have to
2962install the @code{chunkin} module@footnote{@uref{http://wiki.nginx.org/HttpChunkinModule, http://wiki.nginx.org/HttpChunkinModule}}
2963
2964To enable chunkin add:
2965
2966@example
2967chunkin on;
2968error_page 411 = @@my_411_error;
2969location @@my_411_error @{
2970chunkin_resume;
2971@}
2972@end example
2973
2974@noindent
2975Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or
2976the site-specific configuration file.
2977
2978In the @code{server} section add:
2979
2980@example
2981location /bar/ @{
2982proxy_pass http://gnunet.foo.org:1080/;
2983proxy_buffering off;
2984proxy_connect_timeout 5; # more than http_server
2985proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
2986proxy_http_version 1.1; # 1.0 default
2987proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
2988@}
2989@end example
2990
2991@node Reverse Proxy - Configure your nginx HTTP webserver
2992@subsubsection Reverse Proxy - Configure your nginx HTTP webserver
2993
2994Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or
2995the site-specific configuration file.
2996
2997In the @code{server} section add:
2998
2999@example
3000ssl_session_timeout 6m;
3001location /bar/
3002@{
3003proxy_pass https://gnunet.foo.org:4433/;
3004proxy_buffering off;
3005proxy_connect_timeout 5; # more than http_server
3006proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
3007proxy_http_version 1.1; # 1.0 default
3008proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
3009@}
3010@end example
3011
3012@node Reverse Proxy - Configure your GNUnet peer
3013@subsubsection Reverse Proxy - Configure your GNUnet peer
3014
3015To have your GNUnet peer announce the address, you have to specify the
3016@code{EXTERNAL_HOSTNAME} option in the @code{[transport-http_server]}
3017section:
3018
3019@example
3020[transport-http_server]
3021EXTERNAL_HOSTNAME = http://www.foo.org/bar/
3022@end example
3023
3024@noindent
3025and/or @code{[transport-https_server]} section:
3026
3027@example
3028[transport-https_server]
3029EXTERNAL_HOSTNAME = https://www.foo.org/bar/
3030@end example
3031
3032@noindent
3033Now restart your webserver and your peer...
3034
3035@node Blacklisting peers
3036@subsection Blacklisting peers
3037
3038Transport service supports to deny connecting to a specific peer of to a
3039specific peer with a specific transport plugin using te blacklisting
3040component of transport service. With@ blacklisting it is possible to deny
3041connections to specific peers of@ to use a specific plugin to a specific
3042peer. Peers can be blacklisted using@ the configuration or a blacklist
3043client can be asked.
3044
3045To blacklist peers using the configuration you have to add a section to
3046your configuration containing the peer id of the peer to blacklist and
3047the plugin@ if required.
3048
3049Examples:
3050
3051To blacklist connections to P565... on peer AG2P... using tcp add:
3052
3053@c FIXME: This is too long and produces errors in the pdf.
3054@example
3055[transport-blacklist AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
3056P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = tcp
3057@end example
3058
3059To blacklist connections to P565... on peer AG2P... using all plugins add:
3060
3061@example
3062[transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
3063P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G =
3064@end example
3065
3066You can also add a blacklist client usign the blacklist API. On a
3067blacklist check, blacklisting first checks internally if the peer is
3068blacklisted and if not, it asks the blacklisting clients. Clients are
3069asked if it is OK to connect to a peer ID, the plugin is omitted.
3070
3071On blacklist check for (peer, plugin)
3072@itemize @bullet
3073@item Do we have a local blacklist entry for this peer and this plugin?@
3074@item YES: disallow connection@
3075@item Do we have a local blacklist entry for this peer and all plugins?@
3076@item YES: disallow connection@
3077@item Does one of the clients disallow?@
3078@item YES: disallow connection
3079@end itemize
3080
3081@node Configuration of the HTTP and HTTPS transport plugins
3082@subsection Configuration of the HTTP and HTTPS transport plugins
3083
3084The client parts of the http and https transport plugins can be configured
3085to use a proxy to connect to the hostlist server. This functionality can
3086be configured in the configuration file directly or using the
3087gnunet-setup tool.
3088
3089Both the HTTP and HTTPS clients support the following proxy types at
3090the moment:
3091
3092@itemize @bullet
3093@item HTTP 1.1 proxy
3094@item SOCKS 4/4a/5/5 with hostname
3095@end itemize
3096
3097In addition authentication at the proxy with username and password can be
3098configured.
3099
3100To configure proxy support for the clients in the gnunet-setup tool,
3101select the "transport" tab and activate the respective plugin. Now you
3102can select the appropriate proxy type. The hostname or IP address
3103(including port if required) has to be entered in the "Proxy hostname"
3104textbox. If required, enter username and password in the "Proxy username"
3105and "Proxy password" boxes. Be aware that these information will be stored
3106in the configuration in plain text.
3107
3108To configure these options directly in the configuration, you can
3109configure the following settings in the @code{[transport-http_client]}
3110and @code{[transport-https_client]} section of the configuration:
3111
3112@example
3113# Type of proxy server,
3114# Valid values: HTTP, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
3115# Default: HTTP
3116# PROXY_TYPE = HTTP
3117
3118# Hostname or IP of proxy server
3119# PROXY =
3120# User name for proxy server
3121# PROXY_USERNAME =
3122# User password for proxy server
3123# PROXY_PASSWORD =
3124@end example
3125
3126@node Configuring the GNU Name System
3127@subsection Configuring the GNU Name System
3128
3129@menu
3130* Configuring system-wide DNS interception::
3131* Configuring the GNS nsswitch plugin::
3132* Configuring GNS on W32::
3133* GNS Proxy Setup::
3134* Setup of the GNS CA::
3135* Testing the GNS setup::
3136@end menu
3137
3138
3139@node Configuring system-wide DNS interception
3140@subsubsection Configuring system-wide DNS interception
3141
3142Before you install GNUnet, make sure you have a user and group 'gnunet'
3143as well as an empty group 'gnunetdns'.
3144
3145When using GNUnet with system-wide DNS interception, it is absolutely
3146necessary for all GNUnet service processes to be started by
3147@code{gnunet-service-arm} as user and group 'gnunet'. You also need to be
3148sure to run @code{make install} as root (or use the @code{sudo} option to
3149configure) to grant GNUnet sufficient privileges.
3150
3151With this setup, all that is required for enabling system-wide DNS
3152interception is for some GNUnet component (VPN or GNS) to request it.
3153The @code{gnunet-service-dns} will then start helper programs that will
3154make the necessary changes to your firewall (@code{iptables}) rules.
3155
3156Note that this will NOT work if your system sends out DNS traffic to a
3157link-local IPv6 address, as in this case GNUnet can intercept the traffic,
3158but not inject the responses from the link-local IPv6 address. Hence you
3159cannot use system-wide DNS interception in conjunction with link-local
3160IPv6-based DNS servers. If such a DNS server is used, it will bypass
3161GNUnet's DNS traffic interception.
3162
3163Using the GNU Name System (GNS) requires two different configuration
3164steps.
3165First of all, GNS needs to be integrated with the operating system. Most
3166of this section is about the operating system level integration.
3167
3168The remainder of this chapter will detail the various methods for
3169configuring the use of GNS with your operating system.
3170
3171At this point in time you have different options depending on your OS:
3172
3173@table @asis
3174
3175@item Use the gnunet-gns-proxy This approach works for all operating
3176systems and is likely the easiest. However, it enables GNS only for
3177browsers, not for other applications that might be using DNS, such as SSH.
3178Still, using the proxy is required for using HTTP with GNS and is thus
3179recommended for all users. To do this, you simply have to run the
3180@code{gnunet-gns-proxy-setup-ca} script as the user who will run the
3181browser (this will create a GNS certificate authority (CA) on your system
3182and import its key into your browser), then start @code{gnunet-gns-proxy}
3183and inform your browser to use the Socks5 proxy which
3184@code{gnunet-gns-proxy} makes available by default on port 7777.
3185@item Use a nsswitch plugin (recommended on GNU systems)
3186This approach has the advantage of offering fully personalized resolution
3187even on multi-user systems. A potential disadvantage is that some
3188applications might be able to bypass GNS.
3189@item Use a W32 resolver plugin (recommended on W32)
3190This is currently the only option on W32 systems.
3191@item Use system-wide DNS packet interception
3192This approach is recommended for the GNUnet VPN. It can be used to handle
3193GNS at the same time; however, if you only use this method, you will only
3194get one root zone per machine (not so great for multi-user systems).
3195@end table
3196
3197You can combine system-wide DNS packet interception with the nsswitch
3198plugin.
3199The setup of the system-wide DNS interception is described here. All of
3200the other GNS-specific configuration steps are described in the following
3201sections.
3202
3203@node Configuring the GNS nsswitch plugin
3204@subsubsection Configuring the GNS nsswitch plugin
3205
3206The Name Service Switch (NSS) is a facility in Unix-like operating systems
3207@footnote{More accurate: NSS is a functionality of the GNU C Library}
3208that provides a variety of sources for common configuration databases and
3209name resolution mechanisms.
3210A superuser (system administrator) usually configures the
3211operating system's name services using the file
3212@file{/etc/nsswitch.conf}.
3213
3214GNS provides a NSS plugin to integrate GNS name resolution with the
3215operating system's name resolution process.
3216To use the GNS NSS plugin you have to either
3217
3218@itemize @bullet
3219@item install GNUnet as root or
3220@item compile GNUnet with the @code{--with-sudo=yes} switch.
3221@end itemize
3222
3223Name resolution is controlled by the @emph{hosts} section in the NSS
3224configuration. By default this section first performs a lookup in the
3225@file{/etc/hosts} file and then in DNS.
3226The nsswitch file should contain a line similar to:
3227
3228@example
3229hosts: files dns [NOTFOUND=return] mdns4_minimal mdns4
3230@end example
3231
3232@noindent
3233Here the GNS NSS plugin can be added to perform a GNS lookup before
3234performing a DNS lookup.
3235The GNS NSS plugin has to be added to the "hosts" section in
3236@file{/etc/nsswitch.conf} file before DNS related plugins:
3237
3238@example
3239...
3240hosts: files gns [NOTFOUND=return] dns mdns4_minimal mdns4
3241...
3242@end example
3243
3244@noindent
3245The @code{NOTFOUND=return} will ensure that if a @code{.gnu} name is not
3246found in GNS it will not be queried in DNS.
3247
3248@node Configuring GNS on W32
3249@subsubsection Configuring GNS on W32
3250
3251This document is a guide to configuring GNU Name System on W32-compatible
3252platforms.
3253
3254After GNUnet is installed, run the w32nsp-install tool:
3255
3256@example
3257w32nsp-install.exe libw32nsp-0.dll
3258@end example
3259
3260@noindent
3261('0' is the library version of W32 NSP; it might increase in the future,
3262change the invocation accordingly).
3263
3264This will install GNS namespace provider into the system and allow other
3265applications to resolve names that end in '@strong{gnu}'
3266and '@strong{zkey}'. Note that namespace provider requires
3267gnunet-gns-helper-service-w32 to be running, as well as gns service
3268itself (and its usual dependencies).
3269
3270Namespace provider is hardcoded to connect to @strong{127.0.0.1:5353},
3271and this is where gnunet-gns-helper-service-w32 should be listening to
3272(and is configured to listen to by default).
3273
3274To uninstall the provider, run:
3275
3276@example
3277w32nsp-uninstall.exe
3278@end example
3279
3280@noindent
3281(uses provider GUID to uninstall it, does not need a dll name).
3282
3283Note that while MSDN claims that other applications will only be able to
3284use the new namespace provider after re-starting, in reality they might
3285stat to use it without that. Conversely, they might stop using the
3286provider after it's been uninstalled, even if they were not re-started.
3287W32 will not permit namespace provider library to be deleted or
3288overwritten while the provider is installed, and while there is at least
3289one process still using it (even after it was uninstalled).
3290
3291@node GNS Proxy Setup
3292@subsubsection GNS Proxy Setup
3293
3294When using the GNU Name System (GNS) to browse the WWW, there are several
3295issues that can be solved by adding the GNS Proxy to your setup:
3296
3297@itemize @bullet
3298
3299@item If the target website does not support GNS, it might assume that it
3300is operating under some name in the legacy DNS system (such as
3301example.com). It may then attempt to set cookies for that domain, and the
3302web server might expect a @code{Host: example.com} header in the request
3303from your browser.
3304However, your browser might be using @code{example.gnu} for the
3305@code{Host} header and might only accept (and send) cookies for
3306@code{example.gnu}. The GNS Proxy will perform the necessary translations
3307of the hostnames for cookies and HTTP headers (using the LEHO record for
3308the target domain as the desired substitute).
3309
3310@item If using HTTPS, the target site might include an SSL certificate
3311which is either only valid for the LEHO domain or might match a TLSA
3312record in GNS. However, your browser would expect a valid certificate for
3313@code{example.gnu}, not for some legacy domain name. The proxy will
3314validate the certificate (either against LEHO or TLSA) and then
3315on-the-fly produce a valid certificate for the exchange, signed by your
3316own CA. Assuming you installed the CA of your proxy in your browser's
3317certificate authority list, your browser will then trust the
3318HTTPS/SSL/TLS connection, as the hostname mismatch is hidden by the proxy.
3319
3320@item Finally, the proxy will in the future indicate to the server that it
3321speaks GNS, which will enable server operators to deliver GNS-enabled web
3322sites to your browser (and continue to deliver legacy links to legacy
3323browsers)
3324@end itemize
3325
3326@node Setup of the GNS CA
3327@subsubsection Setup of the GNS CA
3328
3329First you need to create a CA certificate that the proxy can use.
3330To do so use the provided script gnunet-gns-proxy-ca:
3331
3332@example
3333$ gnunet-gns-proxy-setup-ca
3334@end example
3335
3336@noindent
3337This will create a personal certification authority for you and add this
3338authority to the firefox and chrome database. The proxy will use the this
3339CA certificate to generate @code{*.gnu} client certificates on the fly.
3340
3341Note that the proxy uses libcurl. Make sure your version of libcurl uses
3342GnuTLS and NOT OpenSSL. The proxy will @b{not} work with libcurl compiled
3343against OpenSSL.
3344
3345You can check the configuration your libcurl was build with by
3346running:
3347
3348@example
3349curl --version
3350@end example
3351
3352the output will look like this (without the linebreaks):
3353
3354@example
3355gnurl --version
3356curl 7.56.0 (x86_64-unknown-linux-gnu) libcurl/7.56.0 \
3357GnuTLS/3.5.13 zlib/1.2.11 libidn2/2.0.4
3358Release-Date: 2017-10-08
3359Protocols: http https
3360Features: AsynchDNS IDN IPv6 Largefile NTLM SSL libz \
3361TLS-SRP UnixSockets HTTPS-proxy
3362@end example
3363
3364@node Testing the GNS setup
3365@subsubsection Testing the GNS setup
3366
3367Now for testing purposes we can create some records in our zone to test
3368the SSL functionality of the proxy:
3369
3370@example
3371$ gnunet-identity -C test
3372$ gnunet-namestore -a -e "1 d" -n "homepage" \
3373 -t A -V 131.159.74.67 -z test
3374$ gnunet-namestore -a -e "1 d" -n "homepage" \
3375 -t LEHO -V "gnunet.org" -z test
3376@end example
3377
3378@noindent
3379At this point we can start the proxy. Simply execute
3380
3381@example
3382$ gnunet-gns-proxy
3383@end example
3384
3385@noindent
3386Configure your browser to use this SOCKSv5 proxy on port 7777 and visit
3387this link.
3388If you use @command{Firefox} (or one of its deriviates/forks such as
3389Icecat) you also have to go to @code{about:config} and set the key
3390@code{network.proxy.socks_remote_dns} to @code{true}.
3391
3392When you visit @code{https://homepage.test/}, you should get to the
3393@code{https://gnunet.org/} frontpage and the browser (with the correctly
3394configured proxy) should give you a valid SSL certificate for
3395@code{homepage.gnu} and no warnings. It should look like this:
3396
3397@c FIXME: Image does not exist, create it or save it from Drupal?
3398@c @image{images/gnunethpgns.png,5in,, picture of homepage.gnu in Webbrowser}
3399
3400
3401@node Configuring the GNUnet VPN
3402@subsection Configuring the GNUnet VPN
3403
3404@menu
3405* IPv4 address for interface::
3406* IPv6 address for interface::
3407* Configuring the GNUnet VPN DNS::
3408* Configuring the GNUnet VPN Exit Service::
3409* IP Address of external DNS resolver::
3410* IPv4 address for Exit interface::
3411* IPv6 address for Exit interface::
3412@end menu
3413
3414Before configuring the GNUnet VPN, please make sure that system-wide DNS
3415interception is configured properly as described in the section on the
3416GNUnet DNS setup. @pxref{Configuring the GNU Name System},
3417if you haven't done so already.
3418
3419The default options for the GNUnet VPN are usually sufficient to use
3420GNUnet as a Layer 2 for your Internet connection.
3421However, what you always have to specify is which IP protocol you want
3422to tunnel: IPv4, IPv6 or both.
3423Furthermore, if you tunnel both, you most likely should also tunnel
3424all of your DNS requests.
3425You theoretically can tunnel "only" your DNS traffic, but that usually
3426makes little sense.
3427
3428The other options as shown on the gnunet-setup tool are:
3429
3430@node IPv4 address for interface
3431@subsubsection IPv4 address for interface
3432
3433This is the IPv4 address the VPN interface will get. You should pick an
3434'private' IPv4 network that is not yet in use for you system. For example,
3435if you use @code{10.0.0.1/255.255.0.0} already, you might use
3436@code{10.1.0.1/255.255.0.0}.
3437If you use @code{10.0.0.1/255.0.0.0} already, then you might use
3438@code{192.168.0.1/255.255.0.0}.
3439If your system is not in a private IP-network, using any of the above will
3440work fine.
3441You should try to make the mask of the address big enough
3442(@code{255.255.0.0} or, even better, @code{255.0.0.0}) to allow more
3443mappings of remote IP Addresses into this range.
3444However, even a @code{255.255.255.0} mask will suffice for most users.
3445
3446@node IPv6 address for interface
3447@subsubsection IPv6 address for interface
3448
3449The IPv6 address the VPN interface will get. Here you can specify any
3450non-link-local address (the address should not begin with @code{fe80:}).
3451A subnet Unique Local Unicast (@code{fd00::/8} prefix) that you are
3452currently not using would be a good choice.
3453
3454@node Configuring the GNUnet VPN DNS
3455@subsubsection Configuring the GNUnet VPN DNS
3456
3457To resolve names for remote nodes, activate the DNS exit option.
3458
3459@node Configuring the GNUnet VPN Exit Service
3460@subsubsection Configuring the GNUnet VPN Exit Service
3461
3462If you want to allow other users to share your Internet connection (yes,
3463this may be dangerous, just as running a Tor exit node) or want to
3464provide access to services on your host (this should be less dangerous,
3465as long as those services are secure), you have to enable the GNUnet exit
3466daemon.
3467
3468You then get to specify which exit functions you want to provide. By
3469enabling the exit daemon, you will always automatically provide exit
3470functions for manually configured local services (this component of the
3471system is under
3472development and not documented further at this time). As for those
3473services you explicitly specify the target IP address and port, there is
3474no significant security risk in doing so.
3475
3476Furthermore, you can serve as a DNS, IPv4 or IPv6 exit to the Internet.
3477Being a DNS exit is usually pretty harmless. However, enabling IPv4 or
3478IPv6-exit without further precautions may enable adversaries to access
3479your local network, send spam, attack other systems from your Internet
3480connection and to other mischief that will appear to come from your
3481machine. This may or may not get you into legal trouble.
3482If you want to allow IPv4 or IPv6-exit functionality, you should strongly
3483consider adding additional firewall rules manually to protect your local
3484network and to restrict outgoing TCP traffic (i.e. by not allowing access
3485to port 25). While we plan to improve exit-filtering in the future,
3486you're currently on your own here.
3487Essentially, be prepared for any kind of IP-traffic to exit the respective
3488TUN interface (and GNUnet will enable IP-forwarding and NAT for the
3489interface automatically).
3490
3491Additional configuration options of the exit as shown by the gnunet-setup
3492tool are:
3493
3494@node IP Address of external DNS resolver
3495@subsubsection IP Address of external DNS resolver
3496
3497If DNS traffic is to exit your machine, it will be send to this DNS
3498resolver. You can specify an IPv4 or IPv6 address.
3499
3500@node IPv4 address for Exit interface
3501@subsubsection IPv4 address for Exit interface
3502
3503This is the IPv4 address the Interface will get. Make the mask of the
3504address big enough (255.255.0.0 or, even better, 255.0.0.0) to allow more
3505mappings of IP addresses into this range. As for the VPN interface, any
3506unused, private IPv4 address range will do.
3507
3508@node IPv6 address for Exit interface
3509@subsubsection IPv6 address for Exit interface
3510
3511The public IPv6 address the interface will get. If your kernel is not a
3512very recent kernel and you are willing to manually enable IPv6-NAT, the
3513IPv6 address you specify here must be a globally routed IPv6 address of
3514your host.
3515
3516Suppose your host has the address @code{2001:4ca0::1234/64}, then
3517using @code{2001:4ca0::1:0/112} would be fine (keep the first 64 bits,
3518then change at least one bit in the range before the bitmask, in the
3519example above we changed bit 111 from 0 to 1).
3520
3521You may also have to configure your router to route traffic for the entire
3522subnet (@code{2001:4ca0::1:0/112} for example) through your computer (this
3523should be automatic with IPv6, but obviously anything can be
3524disabled).
3525
3526@node Bandwidth Configuration
3527@subsection Bandwidth Configuration
3528
3529You can specify how many bandwidth GNUnet is allowed to use to receive
3530and send data. This is important for users with limited bandwidth or
3531traffic volume.
3532
3533@node Configuring NAT
3534@subsection Configuring NAT
3535
3536Most hosts today do not have a normal global IP address but instead are
3537behind a router performing Network Address Translation (NAT) which assigns
3538each host in the local network a private IP address.
3539As a result, these machines cannot trivially receive inbound connections
3540from the Internet. GNUnet supports NAT traversal to enable these machines
3541to receive incoming connections from other peers despite their
3542limitations.
3543
3544In an ideal world, you can press the "Attempt automatic configuration"
3545button in gnunet-setup to automatically configure your peer correctly.
3546Alternatively, your distribution might have already triggered this
3547automatic configuration during the installation process.
3548However, automatic configuration can fail to determine the optimal
3549settings, resulting in your peer either not receiving as many connections
3550as possible, or in the worst case it not connecting to the network at all.
3551
3552To manually configure the peer, you need to know a few things about your
3553network setup. First, determine if you are behind a NAT in the first
3554place.
3555This is always the case if your IP address starts with "10.*" or
3556"192.168.*". Next, if you have control over your NAT router, you may
3557choose to manually configure it to allow GNUnet traffic to your host.
3558If you have configured your NAT to forward traffic on ports 2086 (and
3559possibly 1080) to your host, you can check the "NAT ports have been opened
3560manually" option, which corresponds to the "PUNCHED_NAT" option in the
3561configuration file. If you did not punch your NAT box, it may still be
3562configured to support UPnP, which allows GNUnet to automatically
3563configure it. In that case, you need to install the "upnpc" command,
3564enable UPnP (or PMP) on your NAT box and set the "Enable NAT traversal
3565via UPnP or PMP" option (corresponding to "ENABLE_UPNP" in the
3566configuration file).
3567
3568Some NAT boxes can be traversed using the autonomous NAT traversal method.
3569This requires certain GNUnet components to be installed with "SUID"
3570prividledges on your system (so if you're installing on a system you do
3571not have administrative rights to, this will not work).
3572If you installed as 'root', you can enable autonomous NAT traversal by
3573checking the "Enable NAT traversal using ICMP method".
3574The ICMP method requires a way to determine your NAT's external (global)
3575IP address. This can be done using either UPnP, DynDNS, or by manual
3576configuration. If you have a DynDNS name or know your external IP address,
3577you should enter that name under "External (public) IPv4 address" (which
3578corresponds to the "EXTERNAL_ADDRESS" option in the configuration file).
3579If you leave the option empty, GNUnet will try to determine your external
3580IP address automatically (which may fail, in which case autonomous
3581NAT traversal will then not work).
3582
3583Finally, if you yourself are not behind NAT but want to be able to
3584connect to NATed peers using autonomous NAT traversal, you need to check
3585the "Enable connecting to NATed peers using ICMP method" box.
3586
3587
3588@node Peer configuration for distributions
3589@subsection Peer configuration for distributions
3590
3591The "GNUNET_DATA_HOME" in "[path]" in @file{/etc/gnunet.conf} should be
3592manually set to "/var/lib/gnunet/data/" as the default
3593"~/.local/share/gnunet/" is probably not that appropriate in this case.
3594Similarly, distributions may consider pointing "GNUNET_RUNTIME_DIR" to
3595"/var/run/gnunet/" and "GNUNET_HOME" to "/var/lib/gnunet/". Also, should a
3596distribution decide to override system defaults, all of these changes
3597should be done in a custom @file{/etc/gnunet.conf} and not in the files
3598in the @file{config.d/} directory.
3599
3600Given the proposed access permissions, the "gnunet-setup" tool must be
3601run as use "gnunet" (and with option "-c /etc/gnunet.conf" so that it
3602modifies the system configuration). As always, gnunet-setup should be run
3603after the GNUnet peer was stopped using "gnunet-arm -e". Distributions
3604might want to include a wrapper for gnunet-setup that allows the
3605desktop-user to "sudo" (i.e. using gtksudo) to the "gnunet" user account
3606and then runs "gnunet-arm -e", "gnunet-setup" and "gnunet-arm -s" in
3607sequence.
3608
3609@node How to start and stop a GNUnet peer
3610@section How to start and stop a GNUnet peer
3611
3612This section describes how to start a GNUnet peer. It assumes that you
3613have already compiled and installed GNUnet and its' dependencies.
3614Before you start a GNUnet peer, you may want to create a configuration
3615file using gnunet-setup (but you do not have to).
3616Sane defaults should exist in your
3617@file{$GNUNET_PREFIX/share/gnunet/config.d/} directory, so in practice
3618you could simply start without any configuration. If you want to
3619configure your peer later, you need to stop it before invoking the
3620@code{gnunet-setup} tool to customize further and to test your
3621configuration (@code{gnunet-setup} has build-in test functions).
3622
3623The most important option you might have to still set by hand is in
3624[PATHS]. Here, you use the option "GNUNET_HOME" to specify the path where
3625GNUnet should store its data.
3626It defaults to @code{$HOME/}, which again should work for most users.
3627Make sure that the directory specified as GNUNET_HOME is writable to
3628the user that you will use to run GNUnet (note that you can run frontends
3629using other users, GNUNET_HOME must only be accessible to the user used to
3630run the background processes).
3631
3632You will also need to make one central decision: should all of GNUnet be
3633run under your normal UID, or do you want distinguish between system-wide
3634(user-independent) GNUnet services and personal GNUnet services. The
3635multi-user setup is slightly more complicated, but also more secure and
3636generally recommended.
3637
3638@menu
3639* The Single-User Setup::
3640* The Multi-User Setup::
3641* Killing GNUnet services::
3642* Access Control for GNUnet::
3643@end menu
3644
3645@node The Single-User Setup
3646@subsection The Single-User Setup
3647
3648For the single-user setup, you do not need to do anything special and can
3649just start the GNUnet background processes using @code{gnunet-arm}.
3650By default, GNUnet looks in @file{~/.config/gnunet.conf} for a
3651configuration (or @code{$XDG_CONFIG_HOME/gnunet.conf} if@
3652@code{$XDG_CONFIG_HOME} is defined). If your configuration lives
3653elsewhere, you need to pass the @code{-c FILENAME} option to all GNUnet
3654commands.
3655
3656Assuming the configuration file is called @file{~/.config/gnunet.conf},
3657you start your peer using the @code{gnunet-arm} command (say as user
3658@code{gnunet}) using:
3659
3660@example
3661gnunet-arm -c ~/.config/gnunet.conf -s
3662@end example
3663
3664@noindent
3665The "-s" option here is for "start". The command should return almost
3666instantly. If you want to stop GNUnet, you can use:
3667
3668@example
3669gnunet-arm -c ~/.config/gnunet.conf -e
3670@end example
3671
3672@noindent
3673The "-e" option here is for "end".
3674
3675Note that this will only start the basic peer, no actual applications
3676will be available.
3677If you want to start the file-sharing service, use (after starting
3678GNUnet):
3679
3680@example
3681gnunet-arm -c ~/.config/gnunet.conf -i fs
3682@end example
3683
3684@noindent
3685The "-i fs" option here is for "initialize" the "fs" (file-sharing)
3686application. You can also selectively kill only file-sharing support using
3687
3688@example
3689gnunet-arm -c ~/.config/gnunet.conf -k fs
3690@end example
3691
3692@noindent
3693Assuming that you want certain services (like file-sharing) to be always
3694automatically started whenever you start GNUnet, you can activate them by
3695setting "FORCESTART=YES" in the respective section of the configuration
3696file (for example, "[fs]"). Then GNUnet with file-sharing support would
3697be started whenever you@ enter:
3698
3699@example
3700gnunet-arm -c ~/.config/gnunet.conf -s
3701@end example
3702
3703@noindent
3704Alternatively, you can combine the two options:
3705
3706@example
3707gnunet-arm -c ~/.config/gnunet.conf -s -i fs
3708@end example
3709
3710@noindent
3711Using @code{gnunet-arm} is also the preferred method for initializing
3712GNUnet from @code{init}.
3713
3714Finally, you should edit your @code{crontab} (using the @code{crontab}
3715command) and insert a line@
3716
3717@example
3718@@reboot gnunet-arm -c ~/.config/gnunet.conf -s
3719@end example
3720
3721to automatically start your peer whenever your system boots.
3722
3723@node The Multi-User Setup
3724@subsection The Multi-User Setup
3725
3726This requires you to create a user @code{gnunet} and an additional group
3727@code{gnunetdns}, prior to running @code{make install} during
3728installation.
3729Then, you create a configuration file @file{/etc/gnunet.conf} which should
3730contain the lines:@
3731
3732@example
3733[arm]
3734SYSTEM_ONLY = YES
3735USER_ONLY = NO
3736@end example
3737
3738@noindent
3739Then, perform the same steps to run GNUnet as in the per-user
3740configuration, except as user @code{gnunet} (including the
3741@code{crontab} installation).
3742You may also want to run @code{gnunet-setup} to configure your peer
3743(databases, etc.).
3744Make sure to pass @code{-c /etc/gnunet.conf} to all commands. If you
3745run @code{gnunet-setup} as user @code{gnunet}, you might need to change
3746permissions on @file{/etc/gnunet.conf} so that the @code{gnunet} user can
3747write to the file (during setup).
3748
3749Afterwards, you need to perform another setup step for each normal user
3750account from which you want to access GNUnet. First, grant the normal user
3751(@code{$USER}) permission to the group gnunet:
3752
3753@example
3754# adduser $USER gnunet
3755@end example
3756
3757@noindent
3758Then, create a configuration file in @file{~/.config/gnunet.conf} for the
3759$USER with the lines:
3760
3761@example
3762[arm]
3763SYSTEM_ONLY = NO
3764USER_ONLY = YES
3765@end example
3766
3767@noindent
3768This will ensure that @code{gnunet-arm} when started by the normal user
3769will only run services that are per-user, and otherwise rely on the
3770system-wide services.
3771Note that the normal user may run gnunet-setup, but the
3772configuration would be ineffective as the system-wide services will use
3773@file{/etc/gnunet.conf} and ignore options set by individual users.
3774
3775Again, each user should then start the peer using
3776@file{gnunet-arm -s} --- and strongly consider adding logic to start
3777the peer automatically to their crontab.
3778
3779Afterwards, you should see two (or more, if you have more than one USER)
3780@code{gnunet-service-arm} processes running in your system.
3781
3782@node Killing GNUnet services
3783@subsection Killing GNUnet services
3784
3785It is not necessary to stop GNUnet services explicitly when shutting
3786down your computer.
3787
3788It should be noted that manually killing "most" of the
3789@code{gnunet-service} processes is generally not a successful method for
3790stopping a peer (since @code{gnunet-service-arm} will instantly restart
3791them). The best way to explicitly stop a peer is using
3792@code{gnunet-arm -e}; note that the per-user services may need to be
3793terminated before the system-wide services will terminate normally.
3794
3795@node Access Control for GNUnet
3796@subsection Access Control for GNUnet
3797
3798This chapter documents how we plan to make access control work within the
3799GNUnet system for a typical peer. It should be read as a best-practice
3800installation guide for advanced users and builders of binary
3801distributions. The recommendations in this guide apply to POSIX-systems
3802with full support for UNIX domain sockets only.
3803
3804Note that this is an advanced topic. The discussion presumes a very good
3805understanding of users, groups and file permissions. Normal users on
3806hosts with just a single user can just install GNUnet under their own
3807account (and possibly allow the installer to use SUDO to grant additional
3808permissions for special GNUnet tools that need additional rights).
3809The discussion below largely applies to installations where multiple users
3810share a system and to installations where the best possible security is
3811paramount.
3812
3813A typical GNUnet system consists of components that fall into four
3814categories:
3815
3816@table @asis
3817
3818@item User interfaces
3819User interfaces are not security sensitive and are supposed to be run and
3820used by normal system users.
3821The GTK GUIs and most command-line programs fall into this category.
3822Some command-line tools (like gnunet-transport) should be excluded as they
3823offer low-level access that normal users should not need.
3824@item System services and support tools
3825System services should always run and offer services that can then be
3826accessed by the normal users.
3827System services do not require special permissions, but as they are not
3828specific to a particular user, they probably should not run as a
3829particular user. Also, there should typically only be one GNUnet peer per
3830host. System services include the gnunet-service and gnunet-daemon
3831programs; support tools include command-line programs such as gnunet-arm.
3832@item Priviledged helpers
3833Some GNUnet components require root rights to open raw sockets or perform
3834other special operations. These gnunet-helper binaries are typically
3835installed SUID and run from services or daemons.
3836@item Critical services
3837Some GNUnet services (such as the DNS service) can manipulate the service
3838in deep and possibly highly security sensitive ways. For example, the DNS
3839service can be used to intercept and alter any DNS query originating from
3840the local machine. Access to the APIs of these critical services and their
3841priviledged helpers must be tightly controlled.
3842@end table
3843
3844@c FIXME: The titles of these chapters are too long in the index.
3845
3846@menu
3847* Recommendation - Disable access to services via TCP::
3848* Recommendation - Run most services as system user "gnunet"::
3849* Recommendation - Control access to services using group "gnunet"::
3850* Recommendation - Limit access to certain SUID binaries by group "gnunet"::
3851* Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"::
3852* Differences between "make install" and these recommendations::
3853@end menu
3854
3855@node Recommendation - Disable access to services via TCP
3856@subsubsection Recommendation - Disable access to services via TCP
3857
3858GNUnet services allow two types of access: via TCP socket or via UNIX
3859domain socket.
3860If the service is available via TCP, access control can only be
3861implemented by restricting connections to a particular range of IP
3862addresses.
3863This is acceptable for non-critical services that are supposed to be
3864available to all users on the local system or local network.
3865However, as TCP is generally less efficient and it is rarely the case
3866that a single GNUnet peer is supposed to serve an entire local network,
3867the default configuration should disable TCP access to all GNUnet
3868services on systems with support for UNIX domain sockets.
3869As of GNUnet 0.9.2, configuration files with TCP access disabled should be
3870generated by default. Users can re-enable TCP access to particular
3871services simply by specifying a non-zero port number in the section of
3872the respective service.
3873
3874
3875@node Recommendation - Run most services as system user "gnunet"
3876@subsubsection Recommendation - Run most services as system user "gnunet"
3877
3878GNUnet's main services should be run as a separate user "gnunet" in a
3879special group "gnunet".
3880The user "gnunet" should start the peer using "gnunet-arm -s" during
3881system startup. The home directory for this user should be
3882@file{/var/lib/gnunet} and the configuration file should be
3883@file{/etc/gnunet.conf}.
3884Only the @code{gnunet} user should have the right to access
3885@file{/var/lib/gnunet} (@emph{mode: 700}).
3886
3887@node Recommendation - Control access to services using group "gnunet"
3888@subsubsection Recommendation - Control access to services using group "gnunet"
3889
3890Users that should be allowed to use the GNUnet peer should be added to the
3891group "gnunet". Using GNUnet's access control mechanism for UNIX domain
3892sockets, those services that are considered useful to ordinary users
3893should be made available by setting "UNIX_MATCH_GID=YES" for those
3894services.
3895Again, as shipped, GNUnet provides reasonable defaults.
3896Permissions to access the transport and core subsystems might additionally
3897be granted without necessarily causing security concerns.
3898Some services, such as DNS, must NOT be made accessible to the "gnunet"
3899group (and should thus only be accessible to the "gnunet" user and
3900services running with this UID).
3901
3902@node Recommendation - Limit access to certain SUID binaries by group "gnunet"
3903@subsubsection Recommendation - Limit access to certain SUID binaries by group "gnunet"
3904
3905Most of GNUnet's SUID binaries should be safe even if executed by normal
3906users. However, it is possible to reduce the risk a little bit more by
3907making these binaries owned by the group "gnunet" and restricting their
3908execution to user of the group "gnunet" as well (4750).
3909
3910@node Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"
3911@subsubsection Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"
3912
3913A special group "gnunetdns" should be created for controlling access to
3914the "gnunet-helper-dns".
3915The binary should then be owned by root and be in group "gnunetdns" and
3916be installed SUID and only be group-executable (2750).
3917@b{Note that the group "gnunetdns" should have no users in it at all,
3918ever.}
3919The "gnunet-service-dns" program should be executed by user "gnunet" (via
3920gnunet-service-arm) with the binary owned by the user "root" and the group
3921"gnunetdns" and be SGID (2700). This way, @strong{only}
3922"gnunet-service-dns" can change its group to "gnunetdns" and execute the
3923helper, and the helper can then run as root (as per SUID).
3924Access to the API offered by "gnunet-service-dns" is in turn restricted
3925to the user "gnunet" (not the group!), which means that only
3926"benign" services can manipulate DNS queries using "gnunet-service-dns".
3927
3928@node Differences between "make install" and these recommendations
3929@subsubsection Differences between "make install" and these recommendations
3930
3931The current build system does not set all permissions automatically based
3932on the recommendations above. In particular, it does not use the group
3933"gnunet" at all (so setting gnunet-helpers other than the
3934gnunet-helper-dns to be owned by group "gnunet" must be done manually).
3935Furthermore, 'make install' will silently fail to set the DNS binaries to
3936be owned by group "gnunetdns" unless that group already exists (!).
3937An alternative name for the "gnunetdns" group can be specified using the
3938@code{--with-gnunetdns=GRPNAME} configure option.
diff --git a/doc/documentation/gnunet.texi b/doc/documentation/gnunet.texi
index 22ee8206a..e1847c227 100644
--- a/doc/documentation/gnunet.texi
+++ b/doc/documentation/gnunet.texi
@@ -75,7 +75,6 @@ This document is the Reference Manual for GNUnet version @value{VERSION}.
75* Preface:: Chapter 0 75* Preface:: Chapter 0
76* Philosophy:: About GNUnet 76* Philosophy:: About GNUnet
77@c * Vocabulary:: Vocabulary 77@c * Vocabulary:: Vocabulary
78* GNUnet Installation Handbook:: How to install GNUnet
79* Using GNUnet:: Using GNUnet 78* Using GNUnet:: Using GNUnet
80@c * Configuration Handbook:: Configuring GNUnet 79@c * Configuration Handbook:: Configuring GNUnet
81* GNUnet Contributors Handbook:: Contributing to GNUnet 80* GNUnet Contributors Handbook:: Contributing to GNUnet
@@ -113,22 +112,6 @@ Philosophy
113* Backup of Identities and Egos:: 112* Backup of Identities and Egos::
114* Revocation:: 113* Revocation::
115 114
116GNUnet Installation Handbook
117
118* Dependencies::
119* Pre-installation notes::
120* Generic installation instructions::
121* Build instructions for Ubuntu 12.04 using Git::
122* Build instructions for software builds from source::
123* Build Instructions for Microsoft Windows Platforms::
124* Build instructions for Debian 7.5::
125* Installing GNUnet from Git on Ubuntu 14.4::
126* Build instructions for Debian 8::
127* Outdated build instructions for previous revisions::
128@c * Portable GNUnet::
129* The graphical configuration interface::
130* How to start and stop a GNUnet peer::
131
132Using GNUnet 115Using GNUnet
133 116
134* Checking the Installation:: 117* Checking the Installation::
@@ -139,8 +122,8 @@ Using GNUnet
139* File-sharing:: 122* File-sharing::
140* The GNU Name System:: 123* The GNU Name System::
141* Using the Virtual Public Network:: 124* Using the Virtual Public Network::
142 125* The graphical configuration interface::
143@c Configuration Handbook 126* How to start and stop a GNUnet peer::
144 127
145GNUnet Contributors Handbook 128GNUnet Contributors Handbook
146 129
@@ -152,6 +135,7 @@ GNUnet Contributors Handbook
152GNUnet Developer Handbook 135GNUnet Developer Handbook
153 136
154* Developer Introduction:: 137* Developer Introduction::
138* Internal dependencies::
155* Code overview:: 139* Code overview::
156* System Architecture:: 140* System Architecture::
157* Subsystem stability:: 141* Subsystem stability::
@@ -159,6 +143,7 @@ GNUnet Developer Handbook
159* Build-system:: 143* Build-system::
160* Developing extensions for GNUnet using the gnunet-ext template:: 144* Developing extensions for GNUnet using the gnunet-ext template::
161* Writing testcases:: 145* Writing testcases::
146* Building GNUnet and its dependencies::
162* TESTING library:: 147* TESTING library::
163* Performance regression analysis with Gauger:: 148* Performance regression analysis with Gauger::
164* TESTBED Subsystem:: 149* TESTBED Subsystem::
@@ -199,20 +184,10 @@ GNUnet Developer Handbook
199@include chapters/philosophy.texi 184@include chapters/philosophy.texi
200@c ********************************************************************* 185@c *********************************************************************
201 186
202@c WIP:
203@c @include chapters/vocabulary.texi
204
205@c *********************************************************************
206@include chapters/installation.texi
207@c *********************************************************************
208
209@c ********************************************************************* 187@c *********************************************************************
210@include chapters/user.texi 188@include chapters/user.texi
211@c ********************************************************************* 189@c *********************************************************************
212 190
213@c WIP:
214@c @include chapters/configuration.texi
215
216@include chapters/contributing.texi 191@include chapters/contributing.texi
217 192
218@c ********************************************************************* 193@c *********************************************************************
diff --git a/doc/system_specific/FROM_SOURCE b/doc/system_specific/FROM_SOURCE
new file mode 100644
index 000000000..074b6a91e
--- /dev/null
+++ b/doc/system_specific/FROM_SOURCE
@@ -0,0 +1,1423 @@
1@node Build instructions for Ubuntu 12.04 using Git
2@section Build instructions for Ubuntu 12.04 using Git
3
4@menu
5* Install the required build tools::
6* Install libgcrypt 1.6 and libgpg-error::
7* Install gnutls with DANE support::
8* Install libgnurl::
9* Install libmicrohttpd from Git::
10* Install libextractor from Git::
11* Install GNUnet dependencies::
12* Build GNUnet::
13* Install the GNUnet-gtk user interface from Git::
14@end menu
15
16@node Install the required build tools
17@subsection Install the required build tools
18
19First, make sure Git is installed on your system:
20
21@example
22$ sudo apt-get install git
23@end example
24
25Install the essential buildtools:
26
27@example
28$ sudo apt-get install automake autopoint autoconf libtool
29@end example
30
31@node Install libgcrypt 1.6 and libgpg-error
32@subsection Install libgcrypt 1.6 and libgpg-error
33
34@ref{generic source installation - libgpg-error}
35
36@node Install gnutls with DANE support
37@subsection Install gnutls with DANE support
38
39@itemize @bullet
40@item @ref{generic source installation - nettle}
41@item @ref{generic source installation - ldns}
42@item @ref{generic source installation - libunbound/unbound}
43@item @ref{generic source installation - gnutls}
44@item @ref{generic source installation - libgcrypt}
45@end itemize
46
47@node Install libgnurl
48@subsection Install libgnurl
49
50Follow the @ref{generic source installation - libgnurl}.
51
52@node Install libmicrohttpd from Git
53@subsection Install libmicrohttpd from Git
54
55@example
56$ git clone https://gnunet.org/git/libmicrohttpd
57$ cd libmicrohttpd/
58$ ./bootstrap
59$ ./configure
60$ sudo make install ; cd ..
61@end example
62
63@node Install libextractor from Git
64@subsection Install libextractor from Git
65
66Install libextractor dependencies:
67
68@example
69$ sudo apt-get install zlib1g-dev libgsf-1-dev libmpeg2-4-dev \
70 libpoppler-dev libvorbis-dev libexiv2-dev libjpeg-dev \
71 libtiff-dev libgif-dev libvorbis-dev libflac-dev libsmf-dev \
72 g++
73@end example
74
75Build libextractor:
76
77@example
78$ git clone https://gnunet.org/git/libextractor
79$ cd libextractor
80$ ./bootstrap
81$ ./configure
82$ sudo make install ; cd ..
83@end example
84
85@node Install GNUnet dependencies
86@subsection Install GNUnet dependencies
87
88@example
89$ sudo apt-get install libidn11-dev libunistring-dev libglpk-dev \
90 libpulse-dev libbluetooth-dev libsqlite-dev
91@end example
92
93Install libopus:
94
95@example
96$ wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
97$ tar xf opus-1.1.tar.gz
98$ cd opus-1.1/
99$ ./configure
100$ sudo make install ; cd ..
101@end example
102
103Choose one or more database backends:
104
105SQLite3:
106@example
107$ sudo apt-get install libsqlite3-dev
108@end example
109MySQL:
110@example
111$ sudo apt-get install libmysqlclient-dev
112@end example
113PostgreSQL:
114@example
115$ sudo apt-get install libpq-dev postgresql
116@end example
117
118
119
120@node Build GNUnet
121@subsection Build GNUnet
122
123
124
125@menu
126* Configuring the installation path::
127* Configuring the system::
128* Installing components requiring sudo permission::
129* Build::
130@end menu
131
132@node Configuring the installation path
133@subsubsection Configuring the installation path
134
135You can specify the location of the GNUnet installation by setting the
136prefix when calling the configure script with @code{--prefix=DIRECTORY}
137
138@example
139$ export PATH=$PATH:DIRECTORY/bin
140@end example
141
142@node Configuring the system
143@subsubsection Configuring the system
144
145Please make sure NOW that you have created a user and group 'gnunet'
146and additionally a group 'gnunetdns':
147
148@example
149$ sudo addgroup gnunet
150$ sudo addgroup gnunetdns
151$ sudo adduser gnunet
152@end example
153
154Each GNUnet user should be added to the 'gnunet' group (may
155require fresh login to come into effect):
156
157@example
158$ sudo useradd -G gnunet
159@end example
160
161@node Installing components requiring sudo permission
162@subsubsection Installing components requiring sudo permission
163
164Some components, like the nss plugin required for GNS, may require root
165permissions. To allow these few components to be installed use:
166
167@example
168$ ./configure --with-sudo
169@end example
170
171@node Build
172@subsubsection Build
173
174@example
175$ git clone https://gnunet.org/git/gnunet/
176$ cd gnunet/
177$ ./bootstrap
178@end example
179
180Use the required configure call including the optional installation prefix
181@code{PREFIX} or the sudo permissions:
182
183@example
184$ ./configure [ --with-sudo | --with-prefix=PREFIX ]
185@end example
186
187@example
188$ make; sudo make install
189@end example
190
191After installing it, you need to create an empty configuration file:
192
193@example
194mkdir ~/.gnunet; touch ~/.gnunet/gnunet.conf
195@end example
196
197And finally you can start GNUnet with:
198
199@example
200$ gnunet-arm -s
201@end example
202
203@node Install the GNUnet-gtk user interface from Git
204@subsection Install the GNUnet-gtk user interface from Git
205
206
207Install depencies:
208
209@example
210$ sudo apt-get install libgtk-3-dev libunique-3.0-dev libgladeui-dev \
211 libqrencode-dev
212@end example
213
214Build GNUnet (with an optional prefix) and execute:
215
216@example
217$ git clone https://gnunet.org/git/gnunet-gtk/
218$ cd gnunet-gtk/
219$ ./bootstrap
220$ ./configure [--prefix=PREFIX] --with-gnunet=DIRECTORY
221$ make; sudo make install
222@end example
223
224@node Build Instructions for Microsoft Windows Platforms
225@section Build Instructions for Microsoft Windows Platforms
226
227@menu
228* Introduction to building on MS Windows::
229* Requirements::
230* Dependencies & Initial Setup::
231* GNUnet Installation::
232* Adjusting Windows for running and testing GNUnet::
233* Building the GNUnet Installer::
234* Using GNUnet with Netbeans on Windows::
235@end menu
236
237@node Introduction to building on MS Windows
238@subsection Introduction to building on MS Windows
239
240
241This document is a guide to building GNUnet and its dependencies on
242Windows platforms. GNUnet development is mostly done under GNU/Linux and
243especially git checkouts may not build out of the box.
244We regret any inconvenience, and if you have problems, please report
245them.
246
247@node Requirements
248@subsection Requirements
249
250The Howto is based upon a @strong{Windows Server 2008 32bit}
251@strong{Installation}, @strong{sbuild} and thus a
252@uref{http://www.mingw.org/wiki/MSYS, MSYS+MinGW}
253(W32-GCC-Compiler-Suite + Unix-like Userland) installation. sbuild
254is a convenient set of scripts which creates a working msys/mingw
255installation and installs most dependencies required for GNUnet.
256
257As of the point of the creation of these instructions,
258GNUnet @strong{requires} a Windows @strong{Server} 2003 or
259newer for full feature support.
260Windows Vista and later will also work, but
261@strong{non-server version can not run a VPN-Exit-Node} as the NAT
262features have been removed as of Windows Vista.
263
264@c TODO: We should document Windows 10!
265@c It seems like the situation hasn't changed with W10
266
267@node Dependencies & Initial Setup
268@subsection Dependencies & Initial Setup
269
270
271@itemize @bullet
272
273@item
274Install a fresh version of @strong{Python 2.x}, even if you are using a
275x64-OS, install a 32-bit version for use with sbuild.
276Python 3.0 is currently incompatible.
277
278@item
279Install your favorite @uref{http://code.google.com/p/tortoisegit/, git} &
280@uref{http://tortoisesvn.net/, subversion}-clients.
281
282@item
283You will also need some archive-manager like
284@uref{http://www.7-zip.org/, 7zip}.
285
286@item
287Pull a copy of sbuild to a directory of your choice, which will be used
288in the remainder of this guide. For now, we will use
289@file{c:\gnunet\sbuild\}
290
291@item
292in @file{sbuild\src\mingw\mingw32-buildall.sh}, comment out the packages
293@strong{gnunet-svn} and @strong{gnunet-gtk-svn}, as we don't want sbuild
294to compile/install those for us.
295
296@item
297Follow LRN's sbuild installation instructions.-
298@end itemize
299
300Please note that sbuild may (or will most likely) fail during
301installation, thus you really HAVE to @strong{check the logfiles} created
302during the installation process.
303Certain packages may fail to build initially due to missing dependencies,
304thus you may have to
305@strong{substitute those with binary-versions initially}. Later on once
306dependencies are satisfied you can re-build the newer package versions.
307
308@strong{It is normal that you may have to repeat this step multiple times
309and there is no uniform way to fix all compile-time issues, as the
310build-process of many of the dependencies installed are rather unstable
311on win32 and certain releases may not even compile at all.}
312
313Most dependencies for GNUnet have been set up by sbuild, thus we now
314should add the @file{bin/} directories in your new msys and mingw
315installations to PATH. You will want to create a backup of your finished
316msys-environment by now.
317
318@node GNUnet Installation
319@subsection GNUnet Installation
320
321First, we need to launch our msys-shell, you can do this via
322
323@file{C:\gnunet\sbuild\msys\msys.bat}
324
325You might wish to take a look at this file and adjust some
326login-parameters to your msys environment.
327
328Also, sbuild added two pointpoints to your msys-environment, though those
329might remain invisible:
330
331@itemize @bullet
332
333@item
334/mingw, which will mount your mingw-directory from sbuild/mingw and the
335other one is
336
337@item
338/src which contains all the installation sources sbuild just compiled.
339@end itemize
340
341Check out the current GNUnet sources (git HEAD) from the
342GNUnet repository "gnunet.git", we will do this in your home directory:
343
344@code{git clone https://gnunet.org/git/gnunet/ ~/gnunet}
345
346Now, we will first need to bootstrap the checked out installation and then
347configure it accordingly.
348
349@example
350cd ~/gnunet
351./bootstrap
352STRIP=true CPPFLAGS="-DUSE_IPV6=1 -DW32_VEH" CFLAGS="$CFLAGS -g -O2" \
353./configure --prefix=/ --docdir=/share/doc/gnunet \
354--with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw \
355--with-libcurl=/mingw --with-extractor=/mingw --with-sqlite=/mingw \
356--with-microhttpd=/mingw --with-plibc=/mingw --enable-benchmarks \
357--enable-expensivetests --enable-experimental --with-qrencode=/mingw \
358--enable-silent-rules --enable-experimental 2>&1 | tee -a ./configure.log
359@end example
360
361The parameters above will configure for a reasonable GNUnet installation
362to the your msys-root directory.
363Depending on which features your would like to build or you may need to
364specify additional dependencies. Sbuild installed most libs into
365the /mingw subdirectory, so remember to prefix library locations with
366this path.
367
368Like on a unixoid system, you might want to use your home directory as
369prefix for your own GNUnet installation for development, without tainting
370the buildenvironment. Just change the "prefix" parameter to point towards
371~/ in this case.
372
373Now it's time to compile GNUnet as usual. Though this will take some time,
374so you may fetch yourself a coffee or some Mate now...
375
376@example
377make ; make install
378@end example
379
380@node Adjusting Windows for running and testing GNUnet
381@subsection Adjusting Windows for running and testing GNUnet
382
383Assuming the build succeeded and you
384@strong{added the bin directory of your GNUnet to PATH}, you can now use
385your gnunet-installation as usual.
386Remember that UAC or the windows firewall may popup initially, blocking
387further execution of gnunet until you acknowledge them.
388
389You will also have to take the usual steps to get peer-to-peer (p2p)
390software running properly (port forwarding, ...),
391and GNUnet will require administrative permissions as it may even
392install a device-driver (in case you are using gnunet-vpn and/or
393gnunet-exit).
394
395@node Building the GNUnet Installer
396@subsection Building the GNUnet Installer
397
398The GNUnet installer is made with
399@uref{http://nsis.sourceforge.net/, NSIS}.
400The installer script is located in @file{contrib\win} in the
401GNUnet source tree.
402
403@node Using GNUnet with Netbeans on Windows
404@subsection Using GNUnet with Netbeans on Windows
405
406TODO
407
408@node Build instructions for Debian 7.5
409@section Build instructions for Debian 7.5
410
411
412These are the installation instructions for Debian 7.5. They were tested
413using a minimal, fresh Debian 7.5 AMD64 installation without non-free
414software (no contrib or non-free).
415By "minimal", we mean that during installation, we did not select any
416desktop environment, servers or system utilities during the "tasksel"
417step. Note that the packages and the dependencies that we will install
418during this chapter take about 1.5 GB of disk space.
419Combined with GNUnet and space for objects during compilation, you should
420not even attempt this unless you have about 2.5 GB free after the minimal
421Debian installation.
422Using these instructions to build a VM image is likely to require a
423minimum of 4-5 GB for the VM (as you will likely also want a desktop
424manager).
425
426GNUnet's security model assumes that your @file{/home} directory is
427encrypted. Thus, if possible, you should encrypt your home partition
428(or per-user home directory).
429
430Naturally, the exact details of the starting state for your installation
431should not matter much. For example, if you selected any of those
432installation groups you might simply already have some of the necessary
433packages installed.
434We did this for testing, as this way we are less likely to forget to
435mention a required package.
436Note that we will not install a desktop environment, but of course you
437will need to install one to use GNUnet's graphical user interfaces.
438Thus, it is suggested that you simply install the desktop environment of
439your choice before beginning with the instructions.
440
441
442
443@menu
444* Update::
445* Stable? Hah!::
446* Update again::
447* Installing packages::
448* Installing dependencies from source::
449* Installing GNUnet from source::
450* But wait there is more!::
451@end menu
452
453@node Update
454@subsection Update
455
456After any installation, you should begin by running
457
458@example
459# apt-get update ; apt-get upgrade
460@end example
461
462to ensure that all of your packages are up-to-date. Note that the "#" is
463used to indicate that you need to type in this command as "root"
464(or prefix with "sudo"), whereas "$" is used to indicate typing in a
465command as a normal user.
466
467@node Stable? Hah!
468@subsection Stable? Hah!
469
470Yes, we said we start with a Debian 7.5 "stable" system. However, to
471reduce the amount of compilation by hand, we will begin by allowing the
472installation of packages from the testing and unstable distributions as
473well.
474We will stick to "stable" packages where possible, but some packages will
475be taken from the other distributions.
476Start by modifying @file{/etc/apt/sources.list} to contain the
477following (possibly adjusted to point to your mirror of choice):
478
479@example
480# These were there before:
481deb http://ftp.de.debian.org/debian/ wheezy main
482deb-src http://ftp.de.debian.org/debian/ wheezy main
483deb http://security.debian.org/ wheezy/updates main
484deb-src http://security.debian.org/ wheezy/updates main
485deb http://ftp.de.debian.org/debian/ wheezy-updates main
486deb-src http://ftp.de.debian.org/debian/ wheezy-updates main
487
488# Add these lines (feel free to adjust the mirror):
489deb http://ftp.de.debian.org/debian/ testing main
490deb http://ftp.de.debian.org/debian/ unstable main
491@end example
492
493The next step is to create/edit your @file{/etc/apt/preferences}
494file to look like this:
495
496@example
497Package: *
498Pin: release a=stable,n=wheezy
499Pin-Priority: 700
500
501Package: *
502Pin: release o=Debian,a=testing
503Pin-Priority: 650
504
505Package: *
506Pin: release o=Debian,a=unstable
507Pin-Priority: 600
508@end example
509
510You can read more about Apt Preferences here and here.
511Note that other pinnings are likely to also work for GNUnet, the key
512thing is that you need some packages from unstable (as shown below).
513However, as unstable is unlikely to be comprehensive (missing packages)
514or might be problematic (crashing packages), you probably want others
515from stable and/or testing.
516
517@node Update again
518@subsection Update again
519
520Now, run again@
521
522@example
523# apt-get update@
524# apt-get upgrade@
525@end example
526
527to ensure that all your new distribution indices are downloaded, and
528that your pinning is correct: the upgrade step should cause no changes
529at all.
530
531@node Installing packages
532@subsection Installing packages
533
534We begin by installing a few Debian packages from stable:@
535
536@example
537# apt-get install gcc make python-zbar libltdl-dev libsqlite3-dev \
538 libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev \
539 texlive libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev \
540 libbz2-dev libexiv2-dev libflac-dev libgif-dev libglib2.0-dev \
541 libgtk-3-dev libmagic-dev libjpeg8-dev libmpeg2-4-dev libmp4v2-dev \
542 librpm-dev libsmf-dev libtidy-dev libtiff5-dev libvorbis-dev \
543 libogg-dev zlib1g-dev g++ gettext libgsf-1-dev libunbound-dev \
544 libqrencode-dev libgladeui-dev nasm texlive-latex-extra \
545 libunique-3.0-dev gawk miniupnpc libfuse-dev libbluetooth-dev
546@end example
547
548After that, we install a few more packages from unstable:@
549
550@example
551# apt-get install -t unstable nettle-dev libgstreamer1.0-dev \
552 gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
553 libgstreamer-plugins-base1.0-dev
554@end example
555
556@node Installing dependencies from source
557@subsection Installing dependencies from source
558
559Next, we need to install a few dependencies from source.
560You might want to do this as a "normal" user and only run the
561@code{make install} steps as root (hence the @code{sudo} in the
562commands below). Also, you do this from any
563directory. We begin by downloading all dependencies, then extracting the
564sources, and finally compiling and installing the libraries.
565
566For these steps, follow the instructions given in the
567installation from source instruction in this order:
568
569@itemize @bullet
570@item @ref{generic source installation - libav}
571@item @ref{generic source installation - libextractor}
572@item @ref{generic source installation - libgpg-error}
573@item @ref{generic source installation - libgcrypt}
574@item @ref{generic source installation - gnutls}
575@item @ref{generic source installation - libmicrohttpd}
576@item @ref{generic source installation - libgnurl}
577@end itemize
578
579@node Installing GNUnet from source
580@subsection Installing GNUnet from source
581
582
583For this, simply follow the generic installation instructions from
584here.
585
586@node But wait there is more!
587@subsection But wait there is more!
588
589So far, we installed all of the packages and dependencies required to
590ensure that all of GNUnet would be built.
591However, while for example the plugins to interact with the MySQL or
592Postgres databases have been created, we did not actually install or
593configure those databases. Thus, you will need to install
594and configure those databases or stick with the default Sqlite database.
595Sqlite is usually fine for most applications, but MySQL can offer better
596performance and Postgres better resillience.
597
598
599@node Installing GNUnet from Git on Ubuntu 14.4
600@section Installing GNUnet from Git on Ubuntu 14.4
601
602@strong{Install the required build tools:}
603
604@example
605$ sudo apt-get install git automake autopoint autoconf
606@end example
607
608@strong{Install the required dependencies}
609
610@example
611$ sudo apt-get install libltdl-dev libgpg-error-dev libidn11-dev \
612 libunistring-dev libglpk-dev libbluetooth-dev libextractor-dev \
613 libmicrohttpd-dev libgnutls28-dev
614@end example
615
616@strong{Choose one or more database backends}
617
618@itemize @bullet
619
620@item SQLite3:
621
622@example
623$ sudo apt-get install libsqlite3-dev
624@end example
625
626@item MySQL:
627
628@example
629$ sudo apt-get install libmysqlclient-dev
630@end example
631
632@item PostgreSQL:
633
634@example
635$ sudo apt-get install libpq-dev postgresql
636@end example
637
638@end itemize
639
640@strong{Install the optional dependencies for gnunet-conversation:}
641
642@example
643$ sudo apt-get install gstreamer1.0 libpulse-dev libopus-dev
644@end example
645
646@strong{Install the libgrypt 1.6.1:}
647
648@itemize @bullet
649
650@item For Ubuntu 14.04:
651
652@example
653$ sudo apt-get install libgcrypt20-dev
654@end example
655
656@item For Ubuntu older 14.04:
657
658@example
659$ wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.1.tar.bz2
660$ tar xf libgcrypt-1.6.1.tar.bz2
661$ cd libgcrypt-1.6.1
662$ ./configure
663$ sudo make install
664$ cd ..
665@end example
666
667@end itemize
668
669@strong{Install libgnurl}
670
671@strong{Install GNUnet}
672
673@example
674$ git clone https://gnunet.org/git/gnunet/
675$ cd gnunet/
676$ ./bootstrap
677@end example
678
679If you want to:
680
681@itemize @bullet
682
683@item Install to a different directory:
684
685@example
686--prefix=PREFIX
687@end example
688
689@item
690Have sudo permission, but do not want to compile as root:
691
692@example
693--with-sudo
694@end example
695
696@item
697Want debug message enabled:
698
699@example
700--enable-logging=verbose
701@end example
702
703@end itemize
704
705
706@example
707$ ./configure [ --with-sudo | --prefix=PREFIX | --enable-logging=verbose]
708$ make; sudo make install
709@end example
710
711After installing it, you need to create an empty configuration file:
712
713@example
714touch ~/.config/gnunet.conf
715@end example
716
717And finally you can start GNUnet with
718
719@example
720$ gnunet-arm -s
721@end example
722
723@node Build instructions for Debian 8
724@section Build instructions for Debian 8
725@c FIXME: I -> we
726
727These are the installation instructions for Debian 8. They were tested
728sing a fresh Debian 8 AMD64 installation without non-free software (no
729contrib or non-free). During installation, I only selected "lxde" for the
730desktop environment.
731Note that the packages and the dependencies that we will install during
732this chapter take about 1.5 GB of disk space. Combined with GNUnet and
733space for objects during compilation, you should not even attempt this
734unless you have about 2.5 GB free after the Debian installation.
735Using these instructions to build a VM image is likely to require a
736minimum of 4-5 GB for the VM (as you will likely also want a desktop
737manager).
738
739GNUnet's security model assumes that your @code{/home} directory is
740encrypted.
741Thus, if possible, you should encrypt your entire disk, or at least just
742your home partition (or per-user home directory).
743
744Naturally, the exact details of the starting state for your installation
745should not matter much.
746For example, if you selected any of those installation groups you might
747simply already have some of the necessary packages installed. Thus, it is
748suggested that you simply install the desktop environment of your choice
749before beginning with the instructions.
750
751
752@menu
753* Update Debian::
754* Installing Debian Packages::
755* Installing Dependencies from Source2::
756* Installing GNUnet from Source2::
757* But wait (again) there is more!::
758@end menu
759
760@node Update Debian
761@subsection Update Debian
762
763After any installation, you should begin by running
764
765@example
766# apt-get update
767# apt-get upgrade
768@end example
769
770to ensure that all of your packages are up-to-date. Note that the "#" is
771used to indicate that you need to type in this command as "root" (or
772prefix with "sudo"), whereas "$" is used to indicate typing in a command
773as a normal user.
774
775@node Installing Debian Packages
776@subsection Installing Debian Packages
777
778We begin by installing a few Debian packages from stable:
779
780@example
781# apt-get install gcc make python-zbar libltdl-dev libsqlite3-dev \
782libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev texlive \
783libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev libbz2-dev \
784libflac-dev libgif-dev libglib2.0-dev libgtk-3-dev libmpeg2-4-dev \
785libtidy-dev libvorbis-dev libogg-dev zlib1g-dev g++ gettext \
786libgsf-1-dev libunbound-dev libqrencode-dev libgladeui-dev nasm \
787texlive-latex-extra libunique-3.0-dev gawk miniupnpc libfuse-dev \
788libbluetooth-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
789libgstreamer-plugins-base1.0-dev nettle-dev libextractor-dev \
790libgcrypt20-dev libmicrohttpd-dev
791@end example
792
793@node Installing Dependencies from Source2
794@subsection Installing Dependencies from Source2
795
796Yes, we said we start with a Debian 8 "stable" system, but because Debian
797linked GnuTLS without support for DANE, we need to compile a few things,
798in addition to GNUnet, still by hand. Yes, you can run GNUnet using the
799respective Debian packages, but then you will not get DANE support.
800
801Next, we need to install a few dependencies from source. You might want
802to do this as a "normal" user and only run the @code{make install} steps
803as root (hence the @code{sudo} in the commands below). Also, you do this
804from any directory. We begin by downloading all dependencies, then
805extracting the sources, and finally compiling and installing the
806libraries:
807
808@example
809$ wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.12.tar.xz
810$ tar xvf gnutls-3.3.12.tar.xz
811$ cd gnutls-3.3.12 ; ./configure ; make ; sudo make install ; cd ..
812@end example
813
814For the installation and compilation of libgnurl/gnURL refer to
815the generic installation section,
816@xref{generic source installation - libgnurl}.
817
818@node Installing GNUnet from Source2
819@subsection Installing GNUnet from Source2
820
821For this, simply follow the generic installation instructions from@
822here.
823
824@node But wait (again) there is more!
825@subsection But wait (again) there is more!
826
827So far, we installed all of the packages and dependencies required to
828ensure that all of GNUnet would be built. However, while for example the
829plugins to interact with the MySQL or Postgres databases have been
830created, we did not actually install or configure those databases.
831Thus, you will need to install and configure those databases or stick
832with the default Sqlite database. Sqlite is usually fine for most
833applications, but MySQL can offer better performance and Postgres better
834resillience.
835
836@node Build instructions for macOS
837@section Build instructions for macOS
838@c FIXME: I -> we
839
840These are the installation guidelines for macOS.
841They were tested on macOS High Sierra.
842
843@menu
844* Installing dependencies::
845* Compile from Source::
846@end menu
847
848@node Installing dependencies
849@subsection Installing dependencies
850
851First, install XCode in the newest version.
852See https://developer.apple.com/xcode/.
853
854Install Homebrew (https://brew.sh) and then install the dependencies listed above.
855If a dependency does not exists in brew, you need to compile it from source.
856
857@example
858# brew install <dependency>
859@end example
860
861@node Compile from Source
862@subsection Compile from Source
863
864Before you start building GNUnet, you need to setup your environment.
865This means that you have to make sure the proper tools are used in the build process.
866For example, after installing texinfo you need to make sure the new texinfo is actually used:
867
868@example
869# echo 'export PATH="/usr/local/opt/texinfo/bin:$PATH"' >> ~/.bash_profile
870@end example
871
872Note: brew tells you the appropriate command when executing
873
874@example
875# brew info texinfo
876@end example
877
878This may also be necessary for the gettext package.
879
880Before you start compiling, you need to make sure gcc is used and not the clang compile of your macOS system.
881On my system, gcc was actually ``gcc-7'' and gcc pointed to the clang compiler.
882
883@example
884# export CC=gcc-7
885@end example
886
887After this the standard compile instructions apply.
888
889@c @node Build instructions for OpenBSD 6.2
890@c @section Build instructions for OpenBSD 6.2
891
892@node Outdated build instructions for previous revisions
893@section Outdated build instructions for previous revisions
894
895This chapter contains a collection of outdated, older installation guides.
896They are mostly intended to serve as a starting point for writing
897up-to-date instructions and should not be expected to work for
898GNUnet 0.10.x.
899A set of older installation instructions can also be found in the
900file @file{doc/outdated-and-old-installation-instructions.txt} in the
901source tree of GNUnet.
902
903This file covers old instructions which no longer receive security
904updates or any kind of support.
905
906@menu
907* Installing GNUnet 0.10.1 on Ubuntu 14.04::
908* Building GLPK for MinGW::
909* GUI build instructions for Ubuntu 12.04 using Subversion::
910@c * Installation with gnunet-update::
911* Instructions for Microsoft Windows Platforms (Old)::
912@end menu
913
914
915@node Installing GNUnet 0.10.1 on Ubuntu 14.04
916@subsection Installing GNUnet 0.10.1 on Ubuntu 14.04
917
918Install the required dependencies:
919
920@example
921$ sudo apt-get install libltdl-dev libgpg-error-dev libidn11-dev \
922 libunistring-dev libglpk-dev libbluetooth-dev libextractor-dev \
923 libmicrohttpd-dev libgnutls28-dev
924@end example
925
926Choose one or more database backends:
927
928@itemize @bullet
929
930@item SQLite3
931
932@example
933 $ sudo apt-get install libsqlite3-dev@
934@end example
935
936@item MySQL
937
938@example
939$ sudo apt-get install libmysqlclient-dev@
940@end example
941
942@item PostgreSQL
943
944@example
945 $ sudo apt-get install libpq-dev postgresql@
946@end example
947
948@end itemize
949
950Install the optional dependencies for gnunet-conversation:
951
952@example
953 $ sudo apt-get install gstreamer1.0 libpulse-dev libopus-dev
954@end example
955
956Install libgcrypt 1.6:
957
958@itemize @bullet
959
960@item For Ubuntu 14.04:
961
962@example
963$ sudo apt-get install libgcrypt20-dev
964@end example
965
966@item For Ubuntu older than 14.04:
967
968@example
969wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.1.tar.bz2
970$ tar xf libgcrypt-1.6.1.tar.bz2
971$ cd libgcrypt-1.6.1
972$ ./configure
973$ sudo make install
974$ cd ..
975@end example
976@end itemize
977
978Install libgnurl:
979
980@pxref{generic source installation - libgnurl}.
981
982Install GNUnet:
983
984@example
985$ wget http://ftpmirror.gnu.org/gnunet/gnunet-0.10.1.tar.gz
986$ tar xf gnunet-0.10.1.tar.gz
987$ cd gnunet-0.10.1
988@end example
989
990If you want to:
991
992@itemize @bullet
993
994@item
995Install to a different directory:
996
997@example
998--prefix=PREFIX
999@end example
1000
1001@item
1002Have sudo permission, but do not want to compile as root:
1003
1004@example
1005--with-sudo
1006@end example
1007
1008@item
1009Want debug message enabled:
1010
1011@example
1012--enable-logging=verbose
1013@end example
1014
1015@end itemize
1016
1017@example
1018$ ./configure [ --with-sudo | --prefix=PREFIX | --enable-logging=verbose]
1019$ make; sudo make install
1020@end example
1021
1022After installing it, you need to create an empty configuration file:
1023
1024@example
1025touch ~/.config/gnunet.conf
1026@end example
1027
1028And finally you can start GNUnet with
1029
1030@example
1031$ gnunet-arm -s
1032@end example
1033
1034@node Building GLPK for MinGW
1035@subsection Building GLPK for MinGW
1036
1037GNUnet now requires the GNU Linear Programming Kit (GLPK).
1038Since there's is no package you can install with @code{mingw-get} you
1039have to compile it from source:
1040
1041@itemize @bullet
1042
1043@item Download the latest version from
1044@uref{http://ftp.gnu.org/gnu/glpk/}
1045
1046@item Unzip the downloaded source tarball using your favourite
1047unzipper application In the MSYS shell
1048
1049@item change to the respective directory
1050
1051@item Configure glpk for "i686-pc-mingw32":
1052
1053@example
1054./configure '--build=i686-pc-mingw32'
1055@end example
1056
1057@item run
1058
1059@example
1060make install check
1061@end example
1062
1063@end itemize
1064
1065MinGW does not automatically detect the correct buildtype so you have to
1066specify it manually.
1067
1068
1069@node GUI build instructions for Ubuntu 12.04 using Subversion
1070@subsection GUI build instructions for Ubuntu 12.04 using Subversion
1071
1072After installing GNUnet you can continue installing the GNUnet GUI tools:
1073
1074First, install the required dependencies:
1075
1076@example
1077$ sudo apt-get install libgladeui-dev libqrencode-dev
1078@end example
1079
1080Please ensure that the GNUnet shared libraries can be found by the linker.
1081If you installed GNUnet libraries in a non standard path
1082(say GNUNET_PREFIX=/usr/local/lib/), you can
1083
1084@itemize @bullet
1085
1086@item set the environmental variable permanently to:
1087
1088@example
1089LD_LIBRARY_PATH=$GNUNET_PREFIX
1090@end example
1091
1092@item or add @code{$GNUNET_PREFIX} to @file{/etc/ld.so.conf}
1093
1094@end itemize
1095
1096Now you can checkout and compile the GNUnet GUI tools:
1097
1098@example
1099$ git clone https://gnunet.org/git/gnunet-gtk
1100$ cd gnunet-gtk
1101$ ./bootstrap
1102$ ./configure --prefix=$GNUNET_PREFIX/.. --with-gnunet=$GNUNET_PREFIX/..
1103$ make install
1104@end example
1105
1106@node Instructions for Microsoft Windows Platforms (Old)
1107@subsection Instructions for Microsoft Windows Platforms (Old)
1108
1109This document is a @b{DEPRECATED} installation guide for GNUnet on
1110Windows.
1111It will not work for recent GNUnet versions, but maybe it will be of
1112some use if problems arise.
1113
1114The Windows build uses a UNIX emulator for Windows,
1115@uref{http://www.mingw.org/, MinGW}, to build the executable modules.
1116These modules run natively on Windows and do not require additional
1117emulation software besides the usual dependencies.
1118
1119GNUnet development is mostly done under GNU/Linux and especially git
1120checkouts may not build out of the box.
1121We regret any inconvenience, and if you have problems, please report them.
1122
1123@menu
1124* Hardware and OS requirements::
1125* Software installation::
1126* Building libextractor and GNUnet::
1127* Installer::
1128* Source::
1129@end menu
1130
1131@node Hardware and OS requirements
1132@subsubsection Hardware and OS requirements
1133
1134@itemize @bullet
1135@item Pentium II or equivalent processor, @geq{} 350 MHz
1136@item 128 MB RAM
1137@item 600 MB free disk space
1138@item Windows 2000 or Windows XP are recommended
1139@end itemize
1140
1141@node Software installation
1142@subsubsection Software installation
1143
1144@itemize @bullet
1145
1146@item
1147@strong{Compression software}@
1148
1149The software packages GNUnet depends on are usually compressed using UNIX
1150tools like @command{tar}, @command{gzip}, @command{xzip} and
1151@command{bzip2}.
1152If you do not already have an utility that is able to extract such
1153archives, get @uref{http://www.7-zip.org/, 7-Zip}.
1154
1155@item
1156@strong{UNIX environment}@
1157
1158The MinGW project provides the compiler toolchain that is used to build
1159GNUnet.
1160Get the following packages from the
1161@uref{http://sourceforge.net/projects/mingw/files/, MinGW} project:
1162
1163@itemize @bullet
1164
1165@item GCC core
1166@item GCC g++
1167@item MSYS
1168@item MSYS Developer Tool Kit (msysDTK)
1169@item MSYS Developer Tool Kit - msys-autoconf (bin)
1170@item MSYS Developer Tool Kit - msys-automake (bin)
1171@item MinGW Runtime
1172@item MinGW Utilities
1173@item Windows API
1174@item Binutils
1175@item make
1176@item pdcurses
1177@item GDB (snapshot)
1178@end itemize
1179
1180@itemize @bullet
1181
1182
1183@item Install MSYS (to c:\mingw, for example.)@
1184Do @strong{not} use spaces in the pathname.
1185For example, avoid a location such as @file{c:\program files\mingw}.
1186
1187@item Install MinGW runtime, utilities and GCC to a subdirectory
1188(to @file{c:\mingw\mingw}, for example)
1189
1190@item Install the Development Kit to the MSYS directory
1191(@file{c:\mingw})
1192
1193@item Create a batch file bash.bat in your MSYS directory with
1194the files:
1195
1196@example
1197bin\sh.exe --login
1198@end example
1199
1200This batch file opens a shell which is used to invoke the build
1201processes.
1202MinGW's standard shell (@command{msys.bat}) is not suitable
1203because it opens a separate console window.
1204On Vista, @command{bash.bat} needs to be run as Administrator.
1205
1206@item
1207Start @command{bash.sh} and rename
1208@file{c:\mingw\mingw\lib\libstdc++.la} to avoid problems:
1209
1210@example
1211mv /usr/mingw/lib/libstdc++.la /usr/mingw/lib/libstdc++.la.broken
1212@end example
1213
1214@item
1215Unpack the Windows API to the MinGW directory (@file{c:\mingw\mingw\}) and
1216remove the declaration of DATADIR from
1217(@file{c:\mingw\mingw\include\objidl.h} (lines 55-58)
1218
1219@item
1220Unpack autoconf, automake to the MSYS directory (@file{c:\mingw})
1221
1222@item
1223Install all other packages to the MinGW directory (@file{c:\mingw\mingw\})
1224@end itemize
1225
1226
1227@item @strong{GNU Libtool}@
1228GNU Libtool is required to use shared libraries.
1229Get the prebuilt package from here and unpack it to the
1230MinGW directory (@file{c:\mingw})
1231
1232@item @strong{Pthreads}@
1233GNUnet uses the portable POSIX thread library for multi-threading:
1234
1235@itemize @bullet
1236
1237@item Save
1238@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86/libpthreadGC2.a, libpthreadGC2.a}
1239(x86) or
1240@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x64/libpthreadGC2.a, libpthreadGC2.a}
1241(x64) as libpthread.a into the @file{lib}
1242directory (@file{c:\mingw\mingw\lib\libpthread.a}).
1243
1244@item Save
1245@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86/pthreadGC2.dll, pthreadGC2.dll}
1246(x86) or
1247@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x64/pthreadGC2.dll, libpthreadGC2.a}
1248(x64) into the MinGW @file{bin} directory (@file{c:\mingw\mingw\bin}).
1249
1250@item Download all header files from
1251@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/include/, include/}
1252to the @file{include} directory (@file{c:\mingw\mingw\include}).
1253@end itemize
1254
1255
1256@item @strong{GNU MP}@
1257GNUnet uses the GNU Multiple Precision library for special cryptographic
1258operations. Get the GMP binary package from the
1259@uref{http://sourceforge.net/projects/mingwrep/, MinGW repository} and
1260unpack it to the MinGW directory (@file{c:\mingw\mingw})
1261
1262@item @strong{GNU Gettext}@
1263GNU gettext is used to provide national language support.
1264Get the prebuilt package from hereand unpack it to the MinGW
1265directory (@file{c:\mingw\mingw})
1266
1267@item @strong{GNU iconv}@
1268GNU Libiconv is used for character encoding conversion.
1269Get the prebuilt package from here and unpack it to the MinGW
1270directory (@file{c:\mingw\mingw}).
1271
1272@item @strong{SQLite}@
1273GNUnet uses the SQLite database to store data.
1274Get the prebuilt binary from here and unpack it to your MinGW directory.
1275
1276@item @strong{MySQL}@
1277As an alternative to SQLite, GNUnet also supports MySQL.
1278
1279@itemize @bullet
1280
1281@item Get the binary installer from the
1282@uref{http://dev.mysql.com/downloads/mysql/4.1.html#Windows, MySQL project}
1283(version 4.1), install it and follow the instructions in
1284@file{README.mysql}.
1285
1286@item Create a temporary build directory (@file{c:\mysql})
1287
1288@item Copy the directories @file{include\} and @file{lib\} from the
1289MySQL directory to the new directory
1290
1291@item Get the patches from
1292@uref{http://bugs.mysql.com/bug.php?id=8906&files=1, Bug #8906} and
1293@uref{http://bugs.mysql.com/bug.php?id=8872&files=1, Bug #8872} (the
1294latter is only required for MySQL
1295
1296@example
1297patch -p 0
1298@end example
1299
1300@item Move @file{lib\opt\libmysql.dll} to @file{lib\libmysql.dll}
1301
1302@item Change to @file{lib\} and create an import library:
1303
1304@example
1305dlltool --input-def ../include/libmySQL.def \
1306--dllname libmysql.dll \
1307--output-lib libmysqlclient.a -k
1308@end example
1309
1310@item Copy include\* to include\mysql\
1311
1312@item Pass @code{--with-mysql=/c/mysql} to
1313@command{./configure} and copy @file{libmysql.dll}
1314to your PATH or GNUnet's @file{bin} directory
1315@end itemize
1316
1317
1318@item @strong{GTK+}@
1319@command{gnunet-fs-gtk} and @command{libextractor} depend on GTK.
1320Get the the binary and developer packages of @command{atk},
1321@command{glib}, @command{gtk}, @command{iconv},
1322@command{gettext-runtime}, @command{pango} from
1323@uref{ftp://ftp.gtk.org/pub/gtk/v2.6/win32, gtk.org} and unpack them
1324to the MinGW directory (@file{c:\mingw\mingw}).
1325@c FIXME: The URL below for pkg-config seems wrong.
1326Get @uref{http://www.gtk.org/download/win32.php, pkg-config} and
1327@command{libpng} and unpack them to the MinGW directory
1328(@file{c:\mingw\mingw}).
1329Here is an all-in-one package for the
1330@uref{http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip, gtk+dependencies}
1331. Do not overwrite any existing files!
1332
1333@item @strong{Glade}@
1334@command{gnunet-*-gtk} and @command{gnunet-setup} were created using
1335this interface builder
1336
1337@itemize @bullet
1338
1339@item Get the Glade and libglade (-bin and -devel) packages
1340(without GTK!) from
1341@uref{http://gladewin32.sourceforge.net/, GladeWin32} and unpack them to
1342the MinGW directory (@file{c:\mingw\mingw}).
1343
1344@item Get @command{libxml} from here and unpack it to the MinGW
1345directory (@file{c:\mingw\mingw}).
1346@end itemize
1347
1348@c FIXME: URLs
1349@item @strong{zLib}@
1350@command{libextractor} requires @command{zLib} to decompress some file
1351formats. GNUnet uses it to (de)compress meta-data.
1352Get zLib from here (Signature) and unpack it to the MinGW directory
1353(@file{c:\mingw\mingw}).
1354
1355@item @strong{Bzip2}@
1356@command{libextractor} also requires @command{Bzip2} to
1357decompress some file formats.
1358Get the Bzip2 (binary and developer package) from
1359@uref{http://gnuwin32.sourceforge.net/packages/bzip2.htm, GnuWin32} and
1360unpack it to the MinGW directory (@file{c:\mingw\mingw}).
1361
1362@item @strong{Libgcrypt}@
1363@command{Libgcrypt} provides the cryptographic functions used by GNUnet.
1364Get Libgcrypt from @uref{ftp://ftp.gnupg.org/gcrypt/libgcrypt/, here},
1365compile and place it in the MinGW directory
1366(@file{c:\mingw\mingw}). Currently libgcrypt @geq{} 1.4.2 is required to
1367compile GNUnet.
1368
1369@item @strong{PlibC}@
1370PlibC emulates Unix functions under Windows. Get PlibC from here and
1371unpack it to the MinGW directory (c:\mingw\mingw)
1372
1373@item @strong{OGG Vorbis}@
1374@command{OGG Vorbis} is used to extract meta-data from @file{.ogg} files.
1375Get the packages
1376@uref{http://www.gnunet.org/libextractor/download/win/libogg-1.1.4.zip, libogg}
1377and
1378@uref{http://www.gnunet.org/libextractor/download/win/libvorbis-1.2.3.zip, libvorbis}
1379from the
1380@uref{http://ftp.gnu.org/gnu/libextractor/libextractor-w32-1.0.0.zip, libextractor win32 build}
1381and unpack them to the MinGW directory (c:\mingw\mingw).
1382
1383@item @strong{Exiv2}@
1384(lib)Exiv2 is used to extract meta-data from files with Exiv2 meta-data.
1385Download
1386@uref{http://www.gnunet.org/libextractor/download/win/exiv2-0.18.2.zip, Exiv2}
1387and unpack it to the MSYS directory (c:\mingw).
1388@end itemize
1389
1390@node Building libextractor and GNUnet
1391@subsubsection Building libextractor and GNUnet
1392
1393Before you compile @command{libextractor} or @command{GNUnet},
1394be sure to set @code{PKG_CONFIG_PATH}:
1395
1396@example
1397export PKG_CONFIG_PATH=/mingw/lib/pkgconfig
1398@end example
1399
1400@noindent
1401@xref{GNUnet Installation Handbook}, for basic instructions on building
1402@command{libextractor} and @command{GNUnet}.
1403By default, all modules that are created in this way contain
1404debug information and are quite large. To compile release versions
1405(small and fast) set the variable @code{CFLAGS}:
1406
1407@example
1408export CFLAGS='-O2 -march=pentium -fomit-frame-pointer'
1409./configure --prefix=$HOME --with-extractor=$HOME
1410@end example
1411
1412@node Installer
1413@subsubsection Installer
1414
1415The GNUnet installer is made with
1416@uref{http://nsis.sourceforge.net/, NSIS}. The installer script is
1417located in @file{contrib\win} in the GNUnet source tree.
1418
1419@node Source
1420@subsubsection Source
1421
1422@c FIXME: URL... or: WHERE is HERE?
1423The sources of all dependencies are available here.
diff --git a/doc/outdated-and-old-installation-instructions.txt b/doc/system_specific/outdated-and-old-installation-instructions.txt
index f2cbe1847..f2cbe1847 100644
--- a/doc/outdated-and-old-installation-instructions.txt
+++ b/doc/system_specific/outdated-and-old-installation-instructions.txt
diff --git a/guix-env.scm b/guix-env.scm
index 16fdc7528..d905ab716 100644
--- a/guix-env.scm
+++ b/guix-env.scm
@@ -96,10 +96,11 @@
96 ("pulseaudio" ,pulseaudio) 96 ("pulseaudio" ,pulseaudio)
97 ("sqlite" ,sqlite) 97 ("sqlite" ,sqlite)
98 ("postgresql" ,postgresql) 98 ("postgresql" ,postgresql)
99 ("mysql" ,mysql) 99 ("mysql" ,mariadb)
100 ("zlib" ,zlib) 100 ("zlib" ,zlib)
101 ("perl" ,perl) 101 ("perl" ,perl)
102 ("python-2" ,python-2) ; tests and gnunet-qr 102 ("python-2" ,python-2) ; tests and gnunet-qr
103 ("python2-future" ,python2-future)
103 ("jansson" ,jansson) 104 ("jansson" ,jansson)
104 ("nss" ,nss) 105 ("nss" ,nss)
105 ("glib" ,glib "bin") 106 ("glib" ,glib "bin")
diff --git a/po/POTFILES.in b/po/POTFILES.in
index dd9966302..28f51f366 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -460,7 +460,6 @@ src/util/container_multihashmap.c
460src/util/container_multipeermap.c 460src/util/container_multipeermap.c
461src/util/container_multishortmap.c 461src/util/container_multishortmap.c
462src/util/crypto_abe.c 462src/util/crypto_abe.c
463src/util/crypto_bug.c
464src/util/crypto_crc.c 463src/util/crypto_crc.c
465src/util/crypto_ecc.c 464src/util/crypto_ecc.c
466src/util/crypto_ecc_dlog.c 465src/util/crypto_ecc_dlog.c
diff --git a/src/curl/curl.c b/src/curl/curl.c
index 2d0b09d92..cdd39ab8e 100644
--- a/src/curl/curl.c
+++ b/src/curl/curl.c
@@ -448,6 +448,25 @@ download_get_result (struct DownloadBuffer *db,
448 448
449 449
450/** 450/**
451 * Add custom request header.
452 *
453 * @param ctx cURL context.
454 * @param header header string; will be given to the context AS IS.
455 * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise.
456 */
457int
458GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx,
459 const char *header)
460{
461 ctx->json_header = curl_slist_append (ctx->json_header,
462 header);
463 if (NULL == ctx->json_header)
464 return GNUNET_SYSERR;
465
466 return GNUNET_OK;
467}
468
469/**
451 * Run the main event loop for the Taler interaction. 470 * Run the main event loop for the Taler interaction.
452 * 471 *
453 * @param ctx the library context 472 * @param ctx the library context
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c
index 2a08fc81b..494d1ae17 100644
--- a/src/datacache/plugin_datacache_heap.c
+++ b/src/datacache/plugin_datacache_heap.c
@@ -314,6 +314,9 @@ get_cb (void *cls,
314 if ( (get_ctx->type != val->type) && 314 if ( (get_ctx->type != val->type) &&
315 (GNUNET_BLOCK_TYPE_ANY != get_ctx->type) ) 315 (GNUNET_BLOCK_TYPE_ANY != get_ctx->type) )
316 return GNUNET_OK; 316 return GNUNET_OK;
317 if (0 ==
318 GNUNET_TIME_absolute_get_remaining (val->discard_time).rel_value_us)
319 return GNUNET_OK;
317 if (NULL != get_ctx->iter) 320 if (NULL != get_ctx->iter)
318 ret = get_ctx->iter (get_ctx->iter_cls, 321 ret = get_ctx->iter (get_ctx->iter_cls,
319 key, 322 key,
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index 6eeeb5873..ea87acc1f 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -82,12 +82,12 @@ init_connection (struct Plugin *plugin)
82 struct GNUNET_PQ_PreparedStatement ps[] = { 82 struct GNUNET_PQ_PreparedStatement ps[] = {
83 GNUNET_PQ_make_prepare ("getkt", 83 GNUNET_PQ_make_prepare ("getkt",
84 "SELECT discard_time,type,value,path FROM gn011dc " 84 "SELECT discard_time,type,value,path FROM gn011dc "
85 "WHERE key=$1 AND type=$2", 85 "WHERE key=$1 AND type=$2 AND discard_time >= $3",
86 2), 86 3),
87 GNUNET_PQ_make_prepare ("getk", 87 GNUNET_PQ_make_prepare ("getk",
88 "SELECT discard_time,type,value,path FROM gn011dc " 88 "SELECT discard_time,type,value,path FROM gn011dc "
89 "WHERE key=$1", 89 "WHERE key=$1 AND discard_time >= $2",
90 1), 90 2),
91 GNUNET_PQ_make_prepare ("getex", 91 GNUNET_PQ_make_prepare ("getex",
92 "SELECT length(value) AS len,oid,key FROM gn011dc" 92 "SELECT length(value) AS len,oid,key FROM gn011dc"
93 " WHERE discard_time < $1" 93 " WHERE discard_time < $1"
@@ -97,18 +97,15 @@ init_connection (struct Plugin *plugin)
97 "SELECT length(value) AS len,oid,key FROM gn011dc" 97 "SELECT length(value) AS len,oid,key FROM gn011dc"
98 " ORDER BY prox ASC, discard_time ASC LIMIT 1", 98 " ORDER BY prox ASC, discard_time ASC LIMIT 1",
99 0), 99 0),
100 GNUNET_PQ_make_prepare ("getp",
101 "SELECT length(value) AS len,oid,key FROM gn011dc "
102 "ORDER BY discard_time ASC LIMIT 1",
103 0),
104 GNUNET_PQ_make_prepare ("get_random", 100 GNUNET_PQ_make_prepare ("get_random",
105 "SELECT discard_time,type,value,path,key FROM gn011dc " 101 "SELECT discard_time,type,value,path,key FROM gn011dc"
106 "ORDER BY key ASC LIMIT 1 OFFSET $1", 102 " WHERE discard_time >= $1"
107 1), 103 " ORDER BY key ASC LIMIT 1 OFFSET $2",
104 2),
108 GNUNET_PQ_make_prepare ("get_closest", 105 GNUNET_PQ_make_prepare ("get_closest",
109 "SELECT discard_time,type,value,path,key FROM gn011dc " 106 "SELECT discard_time,type,value,path,key FROM gn011dc "
110 "WHERE key>=$1 ORDER BY key ASC LIMIT $2", 107 "WHERE key>=$1 AND discard_time >= $2 ORDER BY key ASC LIMIT $3",
111 1), 108 3),
112 GNUNET_PQ_make_prepare ("delrow", 109 GNUNET_PQ_make_prepare ("delrow",
113 "DELETE FROM gn011dc WHERE oid=$1", 110 "DELETE FROM gn011dc WHERE oid=$1",
114 1), 111 1),
@@ -313,18 +310,22 @@ postgres_plugin_get (void *cls,
313{ 310{
314 struct Plugin *plugin = cls; 311 struct Plugin *plugin = cls;
315 uint32_t type32 = (uint32_t) type; 312 uint32_t type32 = (uint32_t) type;
313 struct GNUNET_TIME_Absolute now;
316 struct GNUNET_PQ_QueryParam paramk[] = { 314 struct GNUNET_PQ_QueryParam paramk[] = {
317 GNUNET_PQ_query_param_auto_from_type (key), 315 GNUNET_PQ_query_param_auto_from_type (key),
316 GNUNET_PQ_query_param_absolute_time (&now),
318 GNUNET_PQ_query_param_end 317 GNUNET_PQ_query_param_end
319 }; 318 };
320 struct GNUNET_PQ_QueryParam paramkt[] = { 319 struct GNUNET_PQ_QueryParam paramkt[] = {
321 GNUNET_PQ_query_param_auto_from_type (key), 320 GNUNET_PQ_query_param_auto_from_type (key),
322 GNUNET_PQ_query_param_uint32 (&type32), 321 GNUNET_PQ_query_param_uint32 (&type32),
322 GNUNET_PQ_query_param_absolute_time (&now),
323 GNUNET_PQ_query_param_end 323 GNUNET_PQ_query_param_end
324 }; 324 };
325 enum GNUNET_DB_QueryStatus res; 325 enum GNUNET_DB_QueryStatus res;
326 struct HandleResultContext hr_ctx; 326 struct HandleResultContext hr_ctx;
327 327
328 now = GNUNET_TIME_absolute_get ();
328 hr_ctx.iter = iter; 329 hr_ctx.iter = iter;
329 hr_ctx.iter_cls = iter_cls; 330 hr_ctx.iter_cls = iter_cls;
330 hr_ctx.key = key; 331 hr_ctx.key = key;
@@ -427,6 +428,7 @@ postgres_plugin_get_random (void *cls,
427{ 428{
428 struct Plugin *plugin = cls; 429 struct Plugin *plugin = cls;
429 uint32_t off; 430 uint32_t off;
431 struct GNUNET_TIME_Absolute now;
430 struct GNUNET_TIME_Absolute expiration_time; 432 struct GNUNET_TIME_Absolute expiration_time;
431 size_t data_size; 433 size_t data_size;
432 void *data; 434 void *data;
@@ -436,6 +438,7 @@ postgres_plugin_get_random (void *cls,
436 uint32_t type; 438 uint32_t type;
437 enum GNUNET_DB_QueryStatus res; 439 enum GNUNET_DB_QueryStatus res;
438 struct GNUNET_PQ_QueryParam params[] = { 440 struct GNUNET_PQ_QueryParam params[] = {
441 GNUNET_PQ_query_param_absolute_time (&now),
439 GNUNET_PQ_query_param_uint32 (&off), 442 GNUNET_PQ_query_param_uint32 (&off),
440 GNUNET_PQ_query_param_end 443 GNUNET_PQ_query_param_end
441 }; 444 };
@@ -459,6 +462,7 @@ postgres_plugin_get_random (void *cls,
459 return 0; 462 return 0;
460 if (NULL == iter) 463 if (NULL == iter)
461 return 1; 464 return 1;
465 now = GNUNET_TIME_absolute_get ();
462 off = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, 466 off = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
463 plugin->num_items); 467 plugin->num_items);
464 res = GNUNET_PQ_eval_prepared_singleton_select (plugin->dbh, 468 res = GNUNET_PQ_eval_prepared_singleton_select (plugin->dbh,
@@ -620,8 +624,10 @@ postgres_plugin_get_closest (void *cls,
620{ 624{
621 struct Plugin *plugin = cls; 625 struct Plugin *plugin = cls;
622 uint32_t num_results32 = (uint32_t) num_results; 626 uint32_t num_results32 = (uint32_t) num_results;
627 struct GNUNET_TIME_Absolute now;
623 struct GNUNET_PQ_QueryParam params[] = { 628 struct GNUNET_PQ_QueryParam params[] = {
624 GNUNET_PQ_query_param_auto_from_type (key), 629 GNUNET_PQ_query_param_auto_from_type (key),
630 GNUNET_PQ_query_param_absolute_time (&now),
625 GNUNET_PQ_query_param_uint32 (&num_results32), 631 GNUNET_PQ_query_param_uint32 (&num_results32),
626 GNUNET_PQ_query_param_end 632 GNUNET_PQ_query_param_end
627 }; 633 };
@@ -630,6 +636,7 @@ postgres_plugin_get_closest (void *cls,
630 636
631 erc.iter = iter; 637 erc.iter = iter;
632 erc.iter_cls = iter_cls; 638 erc.iter_cls = iter_cls;
639 now = GNUNET_TIME_absolute_get ();
633 res = GNUNET_PQ_eval_prepared_multi_select (plugin->dbh, 640 res = GNUNET_PQ_eval_prepared_multi_select (plugin->dbh,
634 "get_closest", 641 "get_closest",
635 params, 642 params,
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index 12edb62f8..50e45012d 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -44,6 +44,11 @@ checkIt (void *cls,
44 unsigned int path_len, 44 unsigned int path_len,
45 const struct GNUNET_PeerIdentity *path) 45 const struct GNUNET_PeerIdentity *path)
46{ 46{
47 (void) key;
48 (void) type;
49 (void) exp;
50 (void) path_len;
51 (void) path;
47 if (size != sizeof (struct GNUNET_HashCode)) 52 if (size != sizeof (struct GNUNET_HashCode))
48 { 53 {
49 GNUNET_break (0); 54 GNUNET_break (0);
@@ -59,17 +64,22 @@ checkIt (void *cls,
59 64
60 65
61static void 66static void
62run (void *cls, char *const *args, const char *cfgfile, 67run (void *cls,
68 char *const *args,
69 const char *cfgfile,
63 const struct GNUNET_CONFIGURATION_Handle *cfg) 70 const struct GNUNET_CONFIGURATION_Handle *cfg)
64{ 71{
65 struct GNUNET_DATACACHE_Handle *h; 72 struct GNUNET_DATACACHE_Handle *h;
66 struct GNUNET_HashCode k; 73 struct GNUNET_HashCode k;
67 struct GNUNET_HashCode n; 74 struct GNUNET_HashCode n;
68 struct GNUNET_TIME_Absolute exp; 75 struct GNUNET_TIME_Absolute exp;
69 unsigned int i;
70 76
77 (void) cls;
78 (void) args;
79 (void) cfgfile;
71 ok = 0; 80 ok = 0;
72 h = GNUNET_DATACACHE_create (cfg, "testcache"); 81 h = GNUNET_DATACACHE_create (cfg,
82 "testcache");
73 if (h == NULL) 83 if (h == NULL)
74 { 84 {
75 FPRINTF (stderr, 85 FPRINTF (stderr,
@@ -81,7 +91,7 @@ run (void *cls, char *const *args, const char *cfgfile,
81 exp = GNUNET_TIME_absolute_get (); 91 exp = GNUNET_TIME_absolute_get ();
82 exp.abs_value_us += 5 * 60 * 1000 * 1000LL; 92 exp.abs_value_us += 5 * 60 * 1000 * 1000LL;
83 memset (&k, 0, sizeof (struct GNUNET_HashCode)); 93 memset (&k, 0, sizeof (struct GNUNET_HashCode));
84 for (i = 0; i < 100; i++) 94 for (unsigned int i = 0; i < 100; i++)
85 { 95 {
86 GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); 96 GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
87 ASSERT (GNUNET_OK == 97 ASSERT (GNUNET_OK ==
@@ -93,26 +103,43 @@ run (void *cls, char *const *args, const char *cfgfile,
93 0, NULL)); 103 0, NULL));
94 k = n; 104 k = n;
95 } 105 }
96 memset (&k, 0, sizeof (struct GNUNET_HashCode)); 106 memset (&k,
97 for (i = 0; i < 100; i++) 107 0,
108 sizeof (struct GNUNET_HashCode));
109 for (unsigned int i = 0; i < 100; i++)
98 { 110 {
99 GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); 111 GNUNET_CRYPTO_hash (&k,
100 ASSERT (1 == GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n)); 112 sizeof (struct GNUNET_HashCode),
113 &n);
114 ASSERT (1 == GNUNET_DATACACHE_get (h,
115 &k,
116 1 + i % 16,
117 &checkIt,
118 &n));
101 k = n; 119 k = n;
102 } 120 }
103 121
104 memset (&k, 42, sizeof (struct GNUNET_HashCode)); 122 memset (&k,
105 GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); 123 42,
124 sizeof (struct GNUNET_HashCode));
125 GNUNET_CRYPTO_hash (&k,
126 sizeof (struct GNUNET_HashCode),
127 &n);
106 ASSERT (GNUNET_OK == 128 ASSERT (GNUNET_OK ==
107 GNUNET_DATACACHE_put (h, 129 GNUNET_DATACACHE_put (h,
108 &k, 130 &k,
109 GNUNET_YES, 131 GNUNET_YES,
110 sizeof (struct GNUNET_HashCode), 132 sizeof (struct GNUNET_HashCode),
111 (const char *) &n, 792, 133 (const char *) &n,
134 792,
112 GNUNET_TIME_UNIT_FOREVER_ABS, 135 GNUNET_TIME_UNIT_FOREVER_ABS,
113 0, NULL)); 136 0,
114 ASSERT (0 != GNUNET_DATACACHE_get (h, &k, 792, &checkIt, &n)); 137 NULL));
115 138 ASSERT (0 != GNUNET_DATACACHE_get (h,
139 &k,
140 792,
141 &checkIt,
142 &n));
116 GNUNET_DATACACHE_destroy (h); 143 GNUNET_DATACACHE_destroy (h);
117 ASSERT (ok == 0); 144 ASSERT (ok == 0);
118 return; 145 return;
@@ -137,16 +164,26 @@ main (int argc, char *argv[])
137 GNUNET_GETOPT_OPTION_END 164 GNUNET_GETOPT_OPTION_END
138 }; 165 };
139 166
167 (void) argc;
140 GNUNET_log_setup ("test-datacache", 168 GNUNET_log_setup ("test-datacache",
141 "WARNING", 169 "WARNING",
142 NULL); 170 NULL);
143 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]); 171 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
144 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf", 172 GNUNET_snprintf (cfg_name,
173 sizeof (cfg_name),
174 "test_datacache_data_%s.conf",
145 plugin_name); 175 plugin_name);
146 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 176 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1,
147 "test-datacache", "nohelp", options, &run, NULL); 177 xargv,
178 "test-datacache",
179 "nohelp",
180 options,
181 &run,
182 NULL);
148 if ( (0 != ok) && (77 != ok) ) 183 if ( (0 != ok) && (77 != ok) )
149 FPRINTF (stderr, "Missed some testcases: %d\n", ok); 184 FPRINTF (stderr,
185 "Missed some testcases: %d\n",
186 ok);
150 return ok; 187 return ok;
151} 188}
152 189
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c
index 3d02a7244..21e373608 100644
--- a/src/datacache/test_datacache_quota.c
+++ b/src/datacache/test_datacache_quota.c
@@ -41,7 +41,9 @@ static const char *plugin_name;
41 * some of the data from the last iteration is still there. 41 * some of the data from the last iteration is still there.
42 */ 42 */
43static void 43static void
44run (void *cls, char *const *args, const char *cfgfile, 44run (void *cls,
45 char *const *args,
46 const char *cfgfile,
45 const struct GNUNET_CONFIGURATION_Handle *cfg) 47 const struct GNUNET_CONFIGURATION_Handle *cfg)
46{ 48{
47 struct GNUNET_DATACACHE_Handle *h; 49 struct GNUNET_DATACACHE_Handle *h;
@@ -50,8 +52,12 @@ run (void *cls, char *const *args, const char *cfgfile,
50 char buf[3200]; 52 char buf[3200];
51 struct GNUNET_TIME_Absolute exp; 53 struct GNUNET_TIME_Absolute exp;
52 54
55 (void) cls;
56 (void) args;
57 (void) cfgfile;
53 ok = 0; 58 ok = 0;
54 h = GNUNET_DATACACHE_create (cfg, "testcache"); 59 h = GNUNET_DATACACHE_create (cfg,
60 "testcache");
55 61
56 if (h == NULL) 62 if (h == NULL)
57 { 63 {
@@ -112,7 +118,8 @@ FAILURE:
112 118
113 119
114int 120int
115main (int argc, char *argv[]) 121main (int argc,
122 char *argv[])
116{ 123{
117 char cfg_name[128]; 124 char cfg_name[128];
118 char *const xargv[] = { 125 char *const xargv[] = {
@@ -125,17 +132,27 @@ main (int argc, char *argv[])
125 GNUNET_GETOPT_OPTION_END 132 GNUNET_GETOPT_OPTION_END
126 }; 133 };
127 134
135 (void) argc;
128 GNUNET_log_setup ("test-datacache-quota", 136 GNUNET_log_setup ("test-datacache-quota",
129 "WARNING", 137 "WARNING",
130 NULL); 138 NULL);
131 139
132 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]); 140 plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
133 GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf", 141 GNUNET_snprintf (cfg_name,
142 sizeof (cfg_name),
143 "test_datacache_data_%s.conf",
134 plugin_name); 144 plugin_name);
135 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 145 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1,
136 "test-datacache-quota", "nohelp", options, &run, NULL); 146 xargv,
147 "test-datacache-quota",
148 "nohelp",
149 options,
150 &run,
151 NULL);
137 if (0 != ok) 152 if (0 != ok)
138 FPRINTF (stderr, "Missed some testcases: %d\n", ok); 153 FPRINTF (stderr,
154 "Missed some testcases: %d\n",
155 ok);
139 return ok; 156 return ok;
140} 157}
141 158
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c
index 1f01387ff..7ad9aa728 100644
--- a/src/dht/gnunet-service-dht_datacache.c
+++ b/src/dht/gnunet-service-dht_datacache.c
@@ -171,6 +171,11 @@ datacache_get_iterator (void *cls,
171 struct GetRequestContext *ctx = cls; 171 struct GetRequestContext *ctx = cls;
172 enum GNUNET_BLOCK_EvaluationResult eval; 172 enum GNUNET_BLOCK_EvaluationResult eval;
173 173
174 if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us)
175 {
176 GNUNET_break (0); /* why does datacache return expired values? */
177 return GNUNET_OK; /* skip expired record */
178 }
174 if ( (NULL == data) && 179 if ( (NULL == data) &&
175 (0 == data_size) ) 180 (0 == data_size) )
176 data = &non_null; /* point anywhere, but not to NULL */ 181 data = &non_null; /* point anywhere, but not to NULL */
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 9c1395782..56639448f 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -468,6 +468,7 @@ free_connect_info (void *cls,
468{ 468{
469 struct ConnectInfo *ci = value; 469 struct ConnectInfo *ci = value;
470 470
471 (void) cls;
471 GNUNET_assert (GNUNET_YES == 472 GNUNET_assert (GNUNET_YES ==
472 GNUNET_CONTAINER_multipeermap_remove (all_desired_peers, 473 GNUNET_CONTAINER_multipeermap_remove (all_desired_peers,
473 peer, 474 peer,
@@ -579,7 +580,10 @@ update_desire_strength (void *cls,
579 const struct GNUNET_PeerIdentity *pid, 580 const struct GNUNET_PeerIdentity *pid,
580 void *value) 581 void *value)
581{ 582{
582 try_connect (pid, NULL); 583 (void) cls;
584 (void) value;
585 try_connect (pid,
586 NULL);
583 return GNUNET_YES; 587 return GNUNET_YES;
584} 588}
585 589
@@ -616,6 +620,8 @@ add_known_to_bloom (void *cls,
616 struct GNUNET_BLOCK_Group *bg = cls; 620 struct GNUNET_BLOCK_Group *bg = cls;
617 struct GNUNET_HashCode key_hash; 621 struct GNUNET_HashCode key_hash;
618 622
623 (void) cls;
624 (void) value;
619 GNUNET_CRYPTO_hash (key, 625 GNUNET_CRYPTO_hash (key,
620 sizeof (struct GNUNET_PeerIdentity), 626 sizeof (struct GNUNET_PeerIdentity),
621 &key_hash); 627 &key_hash);
@@ -643,7 +649,8 @@ send_find_peer_message (void *cls)
643 struct GNUNET_BLOCK_Group *bg; 649 struct GNUNET_BLOCK_Group *bg;
644 struct GNUNET_CONTAINER_BloomFilter *peer_bf; 650 struct GNUNET_CONTAINER_BloomFilter *peer_bf;
645 651
646 find_peer_task = NULL; 652 (void) cls;
653 find_peer_task = NULL;
647 if (newly_found_peers > bucket_size) 654 if (newly_found_peers > bucket_size)
648 { 655 {
649 /* If we are finding many peers already, no need to send out our request right now! */ 656 /* If we are finding many peers already, no need to send out our request right now! */
@@ -716,7 +723,8 @@ handle_core_connect (void *cls,
716{ 723{
717 struct PeerInfo *pi; 724 struct PeerInfo *pi;
718 725
719 /* Check for connect to self message */ 726 (void) cls;
727 /* Check for connect to self message */
720 if (0 == memcmp (&my_identity, 728 if (0 == memcmp (&my_identity,
721 peer, 729 peer,
722 sizeof (struct GNUNET_PeerIdentity))) 730 sizeof (struct GNUNET_PeerIdentity)))
@@ -739,13 +747,13 @@ handle_core_connect (void *cls,
739 &pi->phash); 747 &pi->phash);
740 pi->peer_bucket = find_bucket (&pi->phash); 748 pi->peer_bucket = find_bucket (&pi->phash);
741 GNUNET_assert ( (pi->peer_bucket >= 0) && 749 GNUNET_assert ( (pi->peer_bucket >= 0) &&
742 (pi->peer_bucket < MAX_BUCKETS) ); 750 ((unsigned int) pi->peer_bucket < MAX_BUCKETS) );
743 GNUNET_CONTAINER_DLL_insert_tail (k_buckets[pi->peer_bucket].head, 751 GNUNET_CONTAINER_DLL_insert_tail (k_buckets[pi->peer_bucket].head,
744 k_buckets[pi->peer_bucket].tail, 752 k_buckets[pi->peer_bucket].tail,
745 pi); 753 pi);
746 k_buckets[pi->peer_bucket].peers_size++; 754 k_buckets[pi->peer_bucket].peers_size++;
747 closest_bucket = GNUNET_MAX (closest_bucket, 755 closest_bucket = GNUNET_MAX (closest_bucket,
748 pi->peer_bucket); 756 (unsigned int) pi->peer_bucket);
749 GNUNET_assert (GNUNET_OK == 757 GNUNET_assert (GNUNET_OK ==
750 GNUNET_CONTAINER_multipeermap_put (all_connected_peers, 758 GNUNET_CONTAINER_multipeermap_put (all_connected_peers,
751 pi->id, 759 pi->id,
@@ -783,6 +791,7 @@ handle_core_disconnect (void *cls,
783{ 791{
784 struct PeerInfo *to_remove = internal_cls; 792 struct PeerInfo *to_remove = internal_cls;
785 793
794 (void) cls;
786 /* Check for disconnect from self message */ 795 /* Check for disconnect from self message */
787 if (NULL == to_remove) 796 if (NULL == to_remove)
788 return; 797 return;
@@ -946,23 +955,23 @@ GDS_am_closest_peer (const struct GNUNET_HashCode *key,
946 int bits; 955 int bits;
947 int other_bits; 956 int other_bits;
948 int bucket_num; 957 int bucket_num;
949 int count;
950 struct PeerInfo *pos; 958 struct PeerInfo *pos;
951 959
952 if (0 == memcmp (&my_identity_hash, key, sizeof (struct GNUNET_HashCode))) 960 if (0 == memcmp (&my_identity_hash,
961 key,
962 sizeof (struct GNUNET_HashCode)))
953 return GNUNET_YES; 963 return GNUNET_YES;
954 bucket_num = find_bucket (key); 964 bucket_num = find_bucket (key);
955 GNUNET_assert (bucket_num >= 0); 965 GNUNET_assert (bucket_num >= 0);
956 bits = GNUNET_CRYPTO_hash_matching_bits (&my_identity_hash, 966 bits = GNUNET_CRYPTO_hash_matching_bits (&my_identity_hash,
957 key); 967 key);
958 pos = k_buckets[bucket_num].head; 968 pos = k_buckets[bucket_num].head;
959 count = 0; 969 while (NULL != pos)
960 while ((NULL != pos) && (count < bucket_size))
961 { 970 {
962 if ((NULL != bloom) && 971 if ( (NULL != bloom) &&
963 (GNUNET_YES == 972 (GNUNET_YES ==
964 GNUNET_CONTAINER_bloomfilter_test (bloom, 973 GNUNET_CONTAINER_bloomfilter_test (bloom,
965 &pos->phash))) 974 &pos->phash)) )
966 { 975 {
967 pos = pos->next; 976 pos = pos->next;
968 continue; /* Skip already checked entries */ 977 continue; /* Skip already checked entries */
@@ -1594,6 +1603,7 @@ static void
1594core_init (void *cls, 1603core_init (void *cls,
1595 const struct GNUNET_PeerIdentity *identity) 1604 const struct GNUNET_PeerIdentity *identity)
1596{ 1605{
1606 (void) cls;
1597 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1607 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1598 "CORE called, I am %s\n", 1608 "CORE called, I am %s\n",
1599 GNUNET_i2s (identity)); 1609 GNUNET_i2s (identity));
@@ -1619,6 +1629,7 @@ check_dht_p2p_put (void *cls,
1619 uint32_t putlen; 1629 uint32_t putlen;
1620 uint16_t msize; 1630 uint16_t msize;
1621 1631
1632 (void) cls;
1622 msize = ntohs (put->header.size); 1633 msize = ntohs (put->header.size);
1623 putlen = ntohl (put->put_path_length); 1634 putlen = ntohl (put->put_path_length);
1624 if ((msize < 1635 if ((msize <
@@ -1654,7 +1665,17 @@ handle_dht_p2p_put (void *cls,
1654 struct GNUNET_CONTAINER_BloomFilter *bf; 1665 struct GNUNET_CONTAINER_BloomFilter *bf;
1655 struct GNUNET_HashCode test_key; 1666 struct GNUNET_HashCode test_key;
1656 int forwarded; 1667 int forwarded;
1668 struct GNUNET_TIME_Absolute exp_time;
1657 1669
1670 exp_time = GNUNET_TIME_absolute_ntoh (put->expiration_time);
1671 if (0 == GNUNET_TIME_absolute_get_remaining (exp_time).rel_value_us)
1672 {
1673 GNUNET_STATISTICS_update (GDS_stats,
1674 gettext_noop ("# Expired PUTs discarded"),
1675 1,
1676 GNUNET_NO);
1677 return;
1678 }
1658 msize = ntohs (put->header.size); 1679 msize = ntohs (put->header.size);
1659 putlen = ntohl (put->put_path_length); 1680 putlen = ntohl (put->put_path_length);
1660 GNUNET_STATISTICS_update (GDS_stats, 1681 GNUNET_STATISTICS_update (GDS_stats,
@@ -1790,7 +1811,7 @@ handle_dht_p2p_put (void *cls,
1790 putlen = 0; 1811 putlen = 0;
1791 1812
1792 /* give to local clients */ 1813 /* give to local clients */
1793 GDS_CLIENTS_handle_reply (GNUNET_TIME_absolute_ntoh (put->expiration_time), 1814 GDS_CLIENTS_handle_reply (exp_time,
1794 &put->key, 1815 &put->key,
1795 0, 1816 0,
1796 NULL, 1817 NULL,
@@ -1802,7 +1823,7 @@ handle_dht_p2p_put (void *cls,
1802 /* store locally */ 1823 /* store locally */
1803 if ((0 != (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE)) || 1824 if ((0 != (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE)) ||
1804 (GDS_am_closest_peer (&put->key, bf))) 1825 (GDS_am_closest_peer (&put->key, bf)))
1805 GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put->expiration_time), 1826 GDS_DATACACHE_handle_put (exp_time,
1806 &put->key, 1827 &put->key,
1807 putlen, 1828 putlen,
1808 pp, 1829 pp,
@@ -1813,7 +1834,7 @@ handle_dht_p2p_put (void *cls,
1813 forwarded = GDS_NEIGHBOURS_handle_put (ntohl (put->type), 1834 forwarded = GDS_NEIGHBOURS_handle_put (ntohl (put->type),
1814 options, 1835 options,
1815 ntohl (put->desired_replication_level), 1836 ntohl (put->desired_replication_level),
1816 GNUNET_TIME_absolute_ntoh (put->expiration_time), 1837 exp_time,
1817 ntohl (put->hop_count), 1838 ntohl (put->hop_count),
1818 bf, 1839 bf,
1819 &put->key, 1840 &put->key,
@@ -1830,7 +1851,7 @@ handle_dht_p2p_put (void *cls,
1830 ntohl (put->hop_count), 1851 ntohl (put->hop_count),
1831 ntohl (put->desired_replication_level), 1852 ntohl (put->desired_replication_level),
1832 putlen, pp, 1853 putlen, pp,
1833 GNUNET_TIME_absolute_ntoh (put->expiration_time), 1854 exp_time,
1834 &put->key, 1855 &put->key,
1835 payload, 1856 payload,
1836 payload_size); 1857 payload_size);
@@ -1907,9 +1928,9 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender,
1907 sizeof (struct GNUNET_HashCode))) 1928 sizeof (struct GNUNET_HashCode)))
1908 bucket_idx = closest_bucket; 1929 bucket_idx = closest_bucket;
1909 else 1930 else
1910 bucket_idx = GNUNET_MIN (closest_bucket, 1931 bucket_idx = GNUNET_MIN ((int) closest_bucket,
1911 find_bucket (key)); 1932 find_bucket (key));
1912 if (bucket_idx == GNUNET_SYSERR) 1933 if (bucket_idx < 0)
1913 return; 1934 return;
1914 bucket = &k_buckets[bucket_idx]; 1935 bucket = &k_buckets[bucket_idx];
1915 if (bucket->peers_size == 0) 1936 if (bucket->peers_size == 0)
@@ -2016,6 +2037,7 @@ check_dht_p2p_get (void *cls,
2016 uint32_t xquery_size; 2037 uint32_t xquery_size;
2017 uint16_t msize; 2038 uint16_t msize;
2018 2039
2040 (void) cls;
2019 msize = ntohs (get->header.size); 2041 msize = ntohs (get->header.size);
2020 xquery_size = ntohl (get->xquery_size); 2042 xquery_size = ntohl (get->xquery_size);
2021 if (msize < sizeof (struct PeerGetMessage) + xquery_size) 2043 if (msize < sizeof (struct PeerGetMessage) + xquery_size)
@@ -2203,6 +2225,7 @@ check_dht_p2p_result (void *cls,
2203 uint32_t put_path_length; 2225 uint32_t put_path_length;
2204 uint16_t msize; 2226 uint16_t msize;
2205 2227
2228 (void) cls;
2206 msize = ntohs (prm->header.size); 2229 msize = ntohs (prm->header.size);
2207 put_path_length = ntohl (prm->put_path_length); 2230 put_path_length = ntohl (prm->put_path_length);
2208 get_path_length = ntohl (prm->get_path_length); 2231 get_path_length = ntohl (prm->get_path_length);
@@ -2316,8 +2339,18 @@ handle_dht_p2p_result (void *cls,
2316 uint16_t msize; 2339 uint16_t msize;
2317 size_t data_size; 2340 size_t data_size;
2318 enum GNUNET_BLOCK_Type type; 2341 enum GNUNET_BLOCK_Type type;
2342 struct GNUNET_TIME_Absolute exp_time;
2319 2343
2320 /* parse and validate message */ 2344 /* parse and validate message */
2345 exp_time = GNUNET_TIME_absolute_ntoh (prm->expiration_time);
2346 if (0 == GNUNET_TIME_absolute_get_remaining (exp_time).rel_value_us)
2347 {
2348 GNUNET_STATISTICS_update (GDS_stats,
2349 gettext_noop ("# Expired results discarded"),
2350 1,
2351 GNUNET_NO);
2352 return;
2353 }
2321 msize = ntohs (prm->header.size); 2354 msize = ntohs (prm->header.size);
2322 put_path_length = ntohl (prm->put_path_length); 2355 put_path_length = ntohl (prm->put_path_length);
2323 get_path_length = ntohl (prm->get_path_length); 2356 get_path_length = ntohl (prm->get_path_length);
@@ -2391,7 +2424,6 @@ handle_dht_p2p_result (void *cls,
2391 h); 2424 h);
2392 } 2425 }
2393 2426
2394
2395 /* First, check if 'peer' is already on the path, and if 2427 /* First, check if 'peer' is already on the path, and if
2396 so, truncate it instead of expanding. */ 2428 so, truncate it instead of expanding. */
2397 for (unsigned int i=0;i<=get_path_length;i++) 2429 for (unsigned int i=0;i<=get_path_length;i++)
@@ -2399,7 +2431,7 @@ handle_dht_p2p_result (void *cls,
2399 peer->id, 2431 peer->id,
2400 sizeof (struct GNUNET_PeerIdentity))) 2432 sizeof (struct GNUNET_PeerIdentity)))
2401 { 2433 {
2402 process_reply_with_path (GNUNET_TIME_absolute_ntoh (prm->expiration_time), 2434 process_reply_with_path (exp_time,
2403 &prm->key, 2435 &prm->key,
2404 i, 2436 i,
2405 get_path, 2437 get_path,
@@ -2420,7 +2452,7 @@ handle_dht_p2p_result (void *cls,
2420 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 2452 get_path_length * sizeof (struct GNUNET_PeerIdentity));
2421 xget_path[get_path_length] = *peer->id; 2453 xget_path[get_path_length] = *peer->id;
2422 2454
2423 process_reply_with_path (GNUNET_TIME_absolute_ntoh (prm->expiration_time), 2455 process_reply_with_path (exp_time,
2424 &prm->key, 2456 &prm->key,
2425 get_path_length + 1, 2457 get_path_length + 1,
2426 xget_path, 2458 xget_path,
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index a90cc4c0e..54c3cba23 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -1377,6 +1377,10 @@ vpn_allocation_cb (void *cls,
1377 } 1377 }
1378 } 1378 }
1379 GNUNET_assert (i < vpn_ctx->rd_count); 1379 GNUNET_assert (i < vpn_ctx->rd_count);
1380 if (0 == vpn_ctx->rd_count)
1381 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1382 _("VPN returned empty result for `%s'\n"),
1383 rh->name);
1380 handle_gns_resolution_result (rh, 1384 handle_gns_resolution_result (rh,
1381 vpn_ctx->rd_count, 1385 vpn_ctx->rd_count,
1382 rd); 1386 rd);
@@ -1859,7 +1863,8 @@ handle_gns_resolution_result (void *cls,
1859 if (0 == rd_count) 1863 if (0 == rd_count)
1860 { 1864 {
1861 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1865 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1862 _("GNS lookup failed (zero records found)\n")); 1866 _("GNS lookup failed (zero records found for `%s')\n"),
1867 rh->name);
1863 fail_resolution (rh); 1868 fail_resolution (rh);
1864 return; 1869 return;
1865 } 1870 }
@@ -2370,6 +2375,11 @@ handle_dht_response (void *cls,
2370 fail_resolution (rh); 2375 fail_resolution (rh);
2371 return; 2376 return;
2372 } 2377 }
2378 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2379 "Decrypting DHT block of size %u for `%s', expires %s\n",
2380 ntohl (block->purpose.size),
2381 rh->name,
2382 GNUNET_STRINGS_absolute_time_to_string (exp));
2373 if (GNUNET_OK != 2383 if (GNUNET_OK !=
2374 GNUNET_GNSRECORD_block_decrypt (block, 2384 GNUNET_GNSRECORD_block_decrypt (block,
2375 &ac->authority_info.gns_authority, 2385 &ac->authority_info.gns_authority,
@@ -2450,6 +2460,10 @@ handle_gns_namecache_resolution_result (void *cls,
2450{ 2460{
2451 struct GNS_ResolverHandle *rh = cls; 2461 struct GNS_ResolverHandle *rh = cls;
2452 2462
2463 if (0 == rd_count)
2464 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2465 _("GNS namecache returned empty result for `%s'\n"),
2466 rh->name);
2453 handle_gns_resolution_result (rh, 2467 handle_gns_resolution_result (rh,
2454 rd_count, 2468 rd_count,
2455 rd); 2469 rd);
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index 0752086fe..295d31100 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -377,6 +377,8 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
377 (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) ) 377 (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) )
378 { 378 {
379 include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */ 379 include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */
380 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
381 "Ignoring shadow record\n");
380 break; 382 break;
381 } 383 }
382 } 384 }
@@ -395,6 +397,16 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
395 rd[j] = rd[i]; 397 rd[j] = rd[i];
396 j++; 398 j++;
397 } 399 }
400 else
401 {
402 struct GNUNET_TIME_Absolute at;
403
404 at.abs_value_us = rd[i].expiration_time;
405 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
406 "Excluding record that expired %s (%llu ago)\n",
407 GNUNET_STRINGS_absolute_time_to_string (at),
408 (unsigned long long) rd[i].expiration_time - now.abs_value_us);
409 }
398 } 410 }
399 rd_count = j; 411 rd_count = j;
400 if (NULL != proc) 412 if (NULL != proc)
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index 17e9aeea4..2b2442a52 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -99,6 +99,17 @@ GNUNET_CURL_get_select_info (struct GNUNET_CURL_Context *ctx,
99 99
100 100
101/** 101/**
102 * Add custom request header.
103 *
104 * @param ctx cURL context.
105 * @param header header string; will be given to the context AS IS.
106 * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise.
107 */
108int
109GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx,
110 const char *header);
111
112/**
102 * Run the main event loop for the CURL interaction. 113 * Run the main event loop for the CURL interaction.
103 * 114 *
104 * @param ctx the library context 115 * @param ctx the library context
diff --git a/src/my/my.c b/src/my/my.c
index b9d5c8424..2f4cd3ba3 100644
--- a/src/my/my.c
+++ b/src/my/my.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2016 Inria & GNUnet e.V. 3 Copyright (C) 2016, 2018 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -43,19 +43,20 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc,
43{ 43{
44 const struct GNUNET_MY_QueryParam *p; 44 const struct GNUNET_MY_QueryParam *p;
45 unsigned int num; 45 unsigned int num;
46 unsigned int i;
47 MYSQL_STMT *stmt; 46 MYSQL_STMT *stmt;
48 47
49 num = 0; 48 num = 0;
50 for (i=0;NULL != params[i].conv;i++) 49 for (unsigned int i=0;NULL != params[i].conv;i++)
51 num += params[i].num_params; 50 num += params[i].num_params;
52 { 51 {
53 MYSQL_BIND qbind[num]; 52 MYSQL_BIND qbind[num];
54 unsigned int off; 53 unsigned int off;
55 54
56 memset (qbind, 0, sizeof(qbind)); 55 memset (qbind,
56 0,
57 sizeof(qbind));
57 off = 0; 58 off = 0;
58 for (i=0;NULL != (p = &params[i])->conv;i++) 59 for (unsigned int i=0;NULL != (p = &params[i])->conv;i++)
59 { 60 {
60 if (GNUNET_OK != 61 if (GNUNET_OK !=
61 p->conv (p->conv_cls, 62 p->conv (p->conv_cls,
@@ -111,9 +112,7 @@ void
111GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp, 112GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp,
112 MYSQL_BIND *qbind) 113 MYSQL_BIND *qbind)
113{ 114{
114 unsigned int i; 115 for (unsigned int i=0; NULL != qp[i].conv ;i++)
115
116 for (i=0; NULL != qp[i].conv ;i++)
117 if (NULL != qp[i].cleaner) 116 if (NULL != qp[i].cleaner)
118 qp[i].cleaner (qp[i].conv_cls, 117 qp[i].cleaner (qp[i].conv_cls,
119 &qbind[i]); 118 &qbind[i]);
@@ -136,7 +135,6 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
136 struct GNUNET_MY_ResultSpec *rs) 135 struct GNUNET_MY_ResultSpec *rs)
137{ 136{
138 unsigned int num_fields; 137 unsigned int num_fields;
139 unsigned int i;
140 int ret; 138 int ret;
141 MYSQL_STMT *stmt; 139 MYSQL_STMT *stmt;
142 140
@@ -153,7 +151,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
153 } 151 }
154 152
155 num_fields = 0; 153 num_fields = 0;
156 for (i=0;NULL != rs[i].pre_conv;i++) 154 for (unsigned int i=0;NULL != rs[i].pre_conv;i++)
157 num_fields += rs[i].num_fields; 155 num_fields += rs[i].num_fields;
158 156
159 if (mysql_stmt_field_count (stmt) != num_fields) 157 if (mysql_stmt_field_count (stmt) != num_fields)
@@ -169,7 +167,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
169 167
170 memset (result, 0, sizeof (MYSQL_BIND) * num_fields); 168 memset (result, 0, sizeof (MYSQL_BIND) * num_fields);
171 field_off = 0; 169 field_off = 0;
172 for (i=0;NULL != rs[i].pre_conv;i++) 170 for (unsigned int i=0;NULL != rs[i].pre_conv;i++)
173 { 171 {
174 struct GNUNET_MY_ResultSpec *rp = &rs[i]; 172 struct GNUNET_MY_ResultSpec *rp = &rs[i];
175 173
@@ -221,7 +219,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
221 return GNUNET_SYSERR; 219 return GNUNET_SYSERR;
222 } 220 }
223 field_off = 0; 221 field_off = 0;
224 for (i=0;NULL != rs[i].post_conv;i++) 222 for (unsigned int i=0;NULL != rs[i].post_conv;i++)
225 { 223 {
226 struct GNUNET_MY_ResultSpec *rp = &rs[i]; 224 struct GNUNET_MY_ResultSpec *rp = &rs[i];
227 225
@@ -256,9 +254,7 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
256void 254void
257GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs) 255GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs)
258{ 256{
259 unsigned int i; 257 for (unsigned int i=0;NULL != rs[i].post_conv;i++)
260
261 for (i=0;NULL != rs[i].post_conv;i++)
262 if (NULL != rs[i].cleaner) 258 if (NULL != rs[i].cleaner)
263 rs[i].cleaner (rs[i].conv_cls, 259 rs[i].cleaner (rs[i].conv_cls,
264 &rs[i]); 260 &rs[i]);
diff --git a/src/my/my_query_helper.c b/src/my/my_query_helper.c
index c4516715a..b2a893a44 100644
--- a/src/my/my_query_helper.c
+++ b/src/my/my_query_helper.c
@@ -37,6 +37,7 @@ static void
37my_clean_query (void *cls, 37my_clean_query (void *cls,
38 MYSQL_BIND *qbind) 38 MYSQL_BIND *qbind)
39{ 39{
40 (void) cls;
40 GNUNET_free (qbind[0].buffer); 41 GNUNET_free (qbind[0].buffer);
41} 42}
42 43
@@ -54,6 +55,7 @@ my_conv_fixed_size (void *cls,
54 const struct GNUNET_MY_QueryParam *qp, 55 const struct GNUNET_MY_QueryParam *qp,
55 MYSQL_BIND *qbind) 56 MYSQL_BIND *qbind)
56{ 57{
58 (void) cls;
57 GNUNET_assert (1 == qp->num_params); 59 GNUNET_assert (1 == qp->num_params);
58 qbind->buffer = (void *) qp->data; 60 qbind->buffer = (void *) qp->data;
59 qbind->buffer_length = qp->data_len; 61 qbind->buffer_length = qp->data_len;
@@ -99,12 +101,11 @@ my_conv_string (void *cls,
99 const struct GNUNET_MY_QueryParam *qp, 101 const struct GNUNET_MY_QueryParam *qp,
100 MYSQL_BIND *qbind) 102 MYSQL_BIND *qbind)
101{ 103{
104 (void) cls;
102 GNUNET_assert (1 == qp->num_params); 105 GNUNET_assert (1 == qp->num_params);
103
104 qbind->buffer = (void *) qp->data; 106 qbind->buffer = (void *) qp->data;
105 qbind->buffer_length = qp->data_len; 107 qbind->buffer_length = qp->data_len;
106 qbind->buffer_type = MYSQL_TYPE_STRING; 108 qbind->buffer_type = MYSQL_TYPE_STRING;
107
108 return 1; 109 return 1;
109} 110}
110 111
@@ -142,10 +143,12 @@ my_conv_uint16 (void *cls,
142 const struct GNUNET_MY_QueryParam *qp, 143 const struct GNUNET_MY_QueryParam *qp,
143 MYSQL_BIND *qbind) 144 MYSQL_BIND *qbind)
144{ 145{
146 (void) cls;
145 GNUNET_assert (1 == qp->num_params); 147 GNUNET_assert (1 == qp->num_params);
146 qbind->buffer = (void *) qp->data; 148 qbind->buffer = (void *) qp->data;
147 qbind->buffer_length = sizeof (uint16_t); 149 qbind->buffer_length = sizeof (uint16_t);
148 qbind->buffer_type = MYSQL_TYPE_SHORT; 150 qbind->buffer_type = MYSQL_TYPE_SHORT;
151 qbind->is_unsigned = 1;
149 return 1; 152 return 1;
150} 153}
151 154
@@ -184,11 +187,12 @@ my_conv_uint32 (void *cls,
184 const struct GNUNET_MY_QueryParam *qp, 187 const struct GNUNET_MY_QueryParam *qp,
185 MYSQL_BIND *qbind) 188 MYSQL_BIND *qbind)
186{ 189{
190 (void) cls;
187 GNUNET_assert (1 == qp->num_params); 191 GNUNET_assert (1 == qp->num_params);
188 qbind->buffer = (void *) qp->data; 192 qbind->buffer = (void *) qp->data;
189 qbind->buffer_length = sizeof(uint32_t); 193 qbind->buffer_length = sizeof(uint32_t);
190 qbind->buffer_type = MYSQL_TYPE_LONG; 194 qbind->buffer_type = MYSQL_TYPE_LONG;
191 195 qbind->is_unsigned = 1;
192 return 1; 196 return 1;
193} 197}
194 198
@@ -227,10 +231,12 @@ my_conv_uint64 (void *cls,
227 const struct GNUNET_MY_QueryParam *qp, 231 const struct GNUNET_MY_QueryParam *qp,
228 MYSQL_BIND * qbind) 232 MYSQL_BIND * qbind)
229{ 233{
234 (void) cls;
230 GNUNET_assert (1 == qp->num_params); 235 GNUNET_assert (1 == qp->num_params);
231 qbind->buffer = (void *) qp->data; 236 qbind->buffer = (void *) qp->data;
232 qbind->buffer_length = sizeof (uint64_t); 237 qbind->buffer_length = sizeof (uint64_t);
233 qbind->buffer_type = MYSQL_TYPE_LONGLONG; 238 qbind->buffer_type = MYSQL_TYPE_LONGLONG;
239 qbind->is_unsigned = 1;
234 return 1; 240 return 1;
235} 241}
236 242
@@ -273,14 +279,13 @@ my_conv_rsa_public_key (void *cls,
273 char *buf; 279 char *buf;
274 size_t buf_size; 280 size_t buf_size;
275 281
282 (void) cls;
276 GNUNET_assert(1 == qp->num_params); 283 GNUNET_assert(1 == qp->num_params);
277 284 buf_size = GNUNET_CRYPTO_rsa_public_key_encode (rsa,
278 buf_size = GNUNET_CRYPTO_rsa_public_key_encode (rsa, &buf); 285 &buf);
279
280 qbind->buffer = (void *) buf; 286 qbind->buffer = (void *) buf;
281 qbind->buffer_length = buf_size; 287 qbind->buffer_length = buf_size;
282 qbind->buffer_type = MYSQL_TYPE_BLOB; 288 qbind->buffer_type = MYSQL_TYPE_BLOB;
283
284 return 1; 289 return 1;
285} 290}
286 291
@@ -325,14 +330,13 @@ my_conv_rsa_signature (void *cls,
325 char *buf; 330 char *buf;
326 size_t buf_size; 331 size_t buf_size;
327 332
333 (void) cls;
328 GNUNET_assert(1 == qp->num_params); 334 GNUNET_assert(1 == qp->num_params);
329
330 buf_size = GNUNET_CRYPTO_rsa_signature_encode (sig, 335 buf_size = GNUNET_CRYPTO_rsa_signature_encode (sig,
331 &buf); 336 &buf);
332 qbind->buffer = (void *) buf; 337 qbind->buffer = (void *) buf;
333 qbind->buffer_length = buf_size; 338 qbind->buffer_length = buf_size;
334 qbind->buffer_type = MYSQL_TYPE_BLOB; 339 qbind->buffer_type = MYSQL_TYPE_BLOB;
335
336 return 1; 340 return 1;
337} 341}
338 342
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index 799f82ebe..98f697b5d 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -50,6 +50,8 @@ qconv_fixed (void *cls,
50 void *scratch[], 50 void *scratch[],
51 unsigned int scratch_length) 51 unsigned int scratch_length)
52{ 52{
53 (void) scratch;
54 (void) scratch_length;
53 GNUNET_break (NULL == cls); 55 GNUNET_break (NULL == cls);
54 if (1 != param_length) 56 if (1 != param_length)
55 return -1; 57 return -1;
@@ -117,6 +119,8 @@ qconv_uint16 (void *cls,
117 const uint16_t *u_hbo = data; 119 const uint16_t *u_hbo = data;
118 uint16_t *u_nbo; 120 uint16_t *u_nbo;
119 121
122 (void) scratch;
123 (void) scratch_length;
120 GNUNET_break (NULL == cls); 124 GNUNET_break (NULL == cls);
121 if (1 != param_length) 125 if (1 != param_length)
122 return -1; 126 return -1;
@@ -172,6 +176,8 @@ qconv_uint32 (void *cls,
172 const uint32_t *u_hbo = data; 176 const uint32_t *u_hbo = data;
173 uint32_t *u_nbo; 177 uint32_t *u_nbo;
174 178
179 (void) scratch;
180 (void) scratch_length;
175 GNUNET_break (NULL == cls); 181 GNUNET_break (NULL == cls);
176 if (1 != param_length) 182 if (1 != param_length)
177 return -1; 183 return -1;
@@ -227,6 +233,8 @@ qconv_uint64 (void *cls,
227 const uint64_t *u_hbo = data; 233 const uint64_t *u_hbo = data;
228 uint64_t *u_nbo; 234 uint64_t *u_nbo;
229 235
236 (void) scratch;
237 (void) scratch_length;
230 GNUNET_break (NULL == cls); 238 GNUNET_break (NULL == cls);
231 if (1 != param_length) 239 if (1 != param_length)
232 return -1; 240 return -1;
@@ -371,6 +379,51 @@ GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x)
371 379
372 380
373/** 381/**
382 * Function called to convert input argument into SQL parameters.
383 *
384 * @param cls closure
385 * @param data pointer to input argument
386 * @param data_len number of bytes in @a data (if applicable)
387 * @param[out] param_values SQL data to set
388 * @param[out] param_lengths SQL length data to set
389 * @param[out] param_formats SQL format data to set
390 * @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
391 * @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
392 * @param scratch_length number of entries left in @a scratch
393 * @return -1 on error, number of offsets used in @a scratch otherwise
394 */
395static int
396qconv_abs_time (void *cls,
397 const void *data,
398 size_t data_len,
399 void *param_values[],
400 int param_lengths[],
401 int param_formats[],
402 unsigned int param_length,
403 void *scratch[],
404 unsigned int scratch_length)
405{
406 const struct GNUNET_TIME_Absolute *u = data;
407 struct GNUNET_TIME_Absolute abs;
408 uint64_t *u_nbo;
409
410 GNUNET_break (NULL == cls);
411 if (1 != param_length)
412 return -1;
413 abs = *u;
414 if (abs.abs_value_us > INT64_MAX)
415 abs.abs_value_us = INT64_MAX;
416 u_nbo = GNUNET_new (uint64_t);
417 scratch[0] = u_nbo;
418 *u_nbo = GNUNET_htonll (abs.abs_value_us);
419 param_values[0] = (void *) u_nbo;
420 param_lengths[0] = sizeof (uint64_t);
421 param_formats[0] = 1;
422 return 1;
423}
424
425
426/**
374 * Generate query parameter for an absolute time value. 427 * Generate query parameter for an absolute time value.
375 * The database must store a 64-bit integer. 428 * The database must store a 64-bit integer.
376 * 429 *
@@ -380,7 +433,10 @@ GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x)
380struct GNUNET_PQ_QueryParam 433struct GNUNET_PQ_QueryParam
381GNUNET_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x) 434GNUNET_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x)
382{ 435{
383 return GNUNET_PQ_query_param_uint64 (&x->abs_value_us); 436 struct GNUNET_PQ_QueryParam res =
437 { &qconv_abs_time, NULL, x, sizeof (*x), 1 };
438
439 return res;
384} 440}
385 441
386 442
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index 3805b8a8d..dc1a1554f 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -38,6 +38,7 @@ clean_varsize_blob (void *cls,
38{ 38{
39 void **dst = rd; 39 void **dst = rd;
40 40
41 (void) cls;
41 if (NULL != *dst) 42 if (NULL != *dst)
42 { 43 {
43 GNUNET_free (*dst); 44 GNUNET_free (*dst);
@@ -72,6 +73,7 @@ extract_varsize_blob (void *cls,
72 void *idst; 73 void *idst;
73 int fnum; 74 int fnum;
74 75
76 (void) cls;
75 *dst_size = 0; 77 *dst_size = 0;
76 *((void **) dst) = NULL; 78 *((void **) dst) = NULL;
77 79
@@ -154,6 +156,7 @@ extract_fixed_blob (void *cls,
154 const char *res; 156 const char *res;
155 int fnum; 157 int fnum;
156 158
159 (void) cls;
157 fnum = PQfnumber (result, 160 fnum = PQfnumber (result,
158 fname); 161 fname);
159 if (fnum < 0) 162 if (fnum < 0)
@@ -237,6 +240,7 @@ extract_rsa_public_key (void *cls,
237 const char *res; 240 const char *res;
238 int fnum; 241 int fnum;
239 242
243 (void) cls;
240 *pk = NULL; 244 *pk = NULL;
241 fnum = PQfnumber (result, 245 fnum = PQfnumber (result,
242 fname); 246 fname);
@@ -284,6 +288,7 @@ clean_rsa_public_key (void *cls,
284{ 288{
285 struct GNUNET_CRYPTO_RsaPublicKey **pk = rd; 289 struct GNUNET_CRYPTO_RsaPublicKey **pk = rd;
286 290
291 (void) cls;
287 if (NULL != *pk) 292 if (NULL != *pk)
288 { 293 {
289 GNUNET_CRYPTO_rsa_public_key_free (*pk); 294 GNUNET_CRYPTO_rsa_public_key_free (*pk);
@@ -338,6 +343,7 @@ extract_rsa_signature (void *cls,
338 const char *res; 343 const char *res;
339 int fnum; 344 int fnum;
340 345
346 (void) cls;
341 *sig = NULL; 347 *sig = NULL;
342 fnum = PQfnumber (result, 348 fnum = PQfnumber (result,
343 fname); 349 fname);
@@ -385,6 +391,7 @@ clean_rsa_signature (void *cls,
385{ 391{
386 struct GNUNET_CRYPTO_RsaSignature **sig = rd; 392 struct GNUNET_CRYPTO_RsaSignature **sig = rd;
387 393
394 (void) cls;
388 if (NULL != *sig) 395 if (NULL != *sig)
389 { 396 {
390 GNUNET_CRYPTO_rsa_signature_free (*sig); 397 GNUNET_CRYPTO_rsa_signature_free (*sig);
@@ -439,6 +446,7 @@ extract_string (void *cls,
439 const char *res; 446 const char *res;
440 int fnum; 447 int fnum;
441 448
449 (void) cls;
442 *str = NULL; 450 *str = NULL;
443 fnum = PQfnumber (result, 451 fnum = PQfnumber (result,
444 fname); 452 fname);
@@ -486,6 +494,7 @@ clean_string (void *cls,
486{ 494{
487 char **str = rd; 495 char **str = rd;
488 496
497 (void) cls;
489 if (NULL != *str) 498 if (NULL != *str)
490 { 499 {
491 GNUNET_free (*str); 500 GNUNET_free (*str);
@@ -515,6 +524,71 @@ GNUNET_PQ_result_spec_string (const char *name,
515 524
516 525
517/** 526/**
527 * Extract data from a Postgres database @a result at row @a row.
528 *
529 * @param cls closure
530 * @param result where to extract data from
531 * @param int row to extract data from
532 * @param fname name (or prefix) of the fields to extract from
533 * @param[in,out] dst_size where to store size of result, may be NULL
534 * @param[out] dst where to store the result
535 * @return
536 * #GNUNET_YES if all results could be extracted
537 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
538 */
539static int
540extract_abs_time (void *cls,
541 PGresult *result,
542 int row,
543 const char *fname,
544 size_t *dst_size,
545 void *dst)
546{
547 struct GNUNET_TIME_Absolute *udst = dst;
548 const int64_t *res;
549 int fnum;
550
551 (void) cls;
552 fnum = PQfnumber (result,
553 fname);
554 if (fnum < 0)
555 {
556 GNUNET_break (0);
557 return GNUNET_SYSERR;
558 }
559 if (PQgetisnull (result,
560 row,
561 fnum))
562 {
563 GNUNET_break (0);
564 return GNUNET_SYSERR;
565 }
566 GNUNET_assert (NULL != dst);
567 if (sizeof (struct GNUNET_TIME_Absolute) != *dst_size)
568 {
569 GNUNET_break (0);
570 return GNUNET_SYSERR;
571 }
572 if (sizeof (int64_t) !=
573 PQgetlength (result,
574 row,
575 fnum))
576 {
577 GNUNET_break (0);
578 return GNUNET_SYSERR;
579 }
580 res = (int64_t *) PQgetvalue (result,
581 row,
582 fnum);
583 if (INT64_MAX == *res)
584 *udst = GNUNET_TIME_UNIT_FOREVER_ABS;
585 else
586 udst->abs_value_us = GNUNET_ntohll ((uint64_t) *res);
587 return GNUNET_OK;
588}
589
590
591/**
518 * Absolute time expected. 592 * Absolute time expected.
519 * 593 *
520 * @param name name of the field in the table 594 * @param name name of the field in the table
@@ -525,8 +599,12 @@ struct GNUNET_PQ_ResultSpec
525GNUNET_PQ_result_spec_absolute_time (const char *name, 599GNUNET_PQ_result_spec_absolute_time (const char *name,
526 struct GNUNET_TIME_Absolute *at) 600 struct GNUNET_TIME_Absolute *at)
527{ 601{
528 return GNUNET_PQ_result_spec_uint64 (name, 602 struct GNUNET_PQ_ResultSpec res =
529 &at->abs_value_us); 603 { &extract_abs_time,
604 NULL,
605 NULL,
606 (void *) at, sizeof (*at), (name), NULL };
607 return res;
530} 608}
531 609
532 610
@@ -572,6 +650,7 @@ extract_uint16 (void *cls,
572 const uint16_t *res; 650 const uint16_t *res;
573 int fnum; 651 int fnum;
574 652
653 (void) cls;
575 fnum = PQfnumber (result, 654 fnum = PQfnumber (result,
576 fname); 655 fname);
577 if (fnum < 0) 656 if (fnum < 0)
@@ -653,6 +732,7 @@ extract_uint32 (void *cls,
653 const uint32_t *res; 732 const uint32_t *res;
654 int fnum; 733 int fnum;
655 734
735 (void) cls;
656 fnum = PQfnumber (result, 736 fnum = PQfnumber (result,
657 fname); 737 fname);
658 if (fnum < 0) 738 if (fnum < 0)
@@ -734,6 +814,7 @@ extract_uint64 (void *cls,
734 const uint64_t *res; 814 const uint64_t *res;
735 int fnum; 815 int fnum;
736 816
817 (void) cls;
737 fnum = PQfnumber (result, 818 fnum = PQfnumber (result,
738 fname); 819 fname);
739 if (fnum < 0) 820 if (fnum < 0)
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index 5ef42187f..4a7a89b15 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -42,6 +42,11 @@
42static uint32_t num_peers; 42static uint32_t num_peers;
43 43
44/** 44/**
45 * @brief numer of bits required to represent the largest peer id
46 */
47static unsigned bits_needed;
48
49/**
45 * How long do we run the test? 50 * How long do we run the test?
46 * In seconds. 51 * In seconds.
47 */ 52 */
@@ -1698,6 +1703,7 @@ profiler_reply_handle (void *cls,
1698 char *file_name; 1703 char *file_name;
1699 char *file_name_dh; 1704 char *file_name_dh;
1700 char *file_name_dhr; 1705 char *file_name_dhr;
1706 char *file_name_dhru;
1701 unsigned int i; 1707 unsigned int i;
1702 struct PendingReply *pending_rep = (struct PendingReply *) cls; 1708 struct PendingReply *pending_rep = (struct PendingReply *) cls;
1703 1709
@@ -1706,6 +1712,7 @@ profiler_reply_handle (void *cls,
1706 file_name = "/tmp/rps/received_ids"; 1712 file_name = "/tmp/rps/received_ids";
1707 file_name_dh = "/tmp/rps/diehard_input"; 1713 file_name_dh = "/tmp/rps/diehard_input";
1708 file_name_dhr = "/tmp/rps/diehard_input_raw"; 1714 file_name_dhr = "/tmp/rps/diehard_input_raw";
1715 file_name_dhru = "/tmp/rps/diehard_input_raw_aligned";
1709 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1716 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1710 "[%s] got %" PRIu64 " peers:\n", 1717 "[%s] got %" PRIu64 " peers:\n",
1711 GNUNET_i2s (rps_peer->peer_id), 1718 GNUNET_i2s (rps_peer->peer_id),
@@ -1725,8 +1732,12 @@ profiler_reply_handle (void *cls,
1725 "%" PRIu32 "\n", 1732 "%" PRIu32 "\n",
1726 (uint32_t) rcv_rps_peer->index); 1733 (uint32_t) rcv_rps_peer->index);
1727 to_file_raw (file_name_dhr, 1734 to_file_raw (file_name_dhr,
1728 &rcv_rps_peer->index, 1735 (char *) &rcv_rps_peer->index,
1729 sizeof (uint32_t)); 1736 sizeof (uint32_t));
1737 to_file_raw_unaligned (file_name_dhru,
1738 (char *) &rcv_rps_peer->index,
1739 sizeof (uint32_t),
1740 bits_needed);
1730 } 1741 }
1731 default_reply_handle (cls, n, recv_peers); 1742 default_reply_handle (cls, n, recv_peers);
1732} 1743}
@@ -2626,6 +2637,14 @@ run (void *cls,
2626 GNUNET_DISK_directory_create ("/tmp/rps/"); 2637 GNUNET_DISK_directory_create ("/tmp/rps/");
2627 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, timeout_s); 2638 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, timeout_s);
2628 2639
2640 /* Compute number of bits for representing largest peer id */
2641 for (bits_needed = 1; (bits_needed << 1) < num_peers - 1; bits_needed++)
2642 ;
2643 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2644 "Need %u bits to represent largest peer id %" PRIu32 "\n",
2645 bits_needed,
2646 num_peers - 1);
2647
2629 rps_peers = GNUNET_new_array (num_peers, struct RPSPeer); 2648 rps_peers = GNUNET_new_array (num_peers, struct RPSPeer);
2630 peer_map = GNUNET_CONTAINER_multipeermap_create (num_peers, GNUNET_NO); 2649 peer_map = GNUNET_CONTAINER_multipeermap_create (num_peers, GNUNET_NO);
2631 rps_peer_ids = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity); 2650 rps_peer_ids = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity);
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index ea55deac5..9a1dfe0d8 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -29,13 +29,26 @@
29 29
30#include <inttypes.h> 30#include <inttypes.h>
31 31
32#define LOG(kind, ...) GNUNET_log_from(kind,"rps-sampler",__VA_ARGS__) 32#define LOG(kind, ...) GNUNET_log_from(kind,"rps-test_util",__VA_ARGS__)
33 33
34#ifndef TO_FILE 34#ifndef TO_FILE
35#define TO_FILE 35#define TO_FILE
36#endif /* TO_FILE */ 36#endif /* TO_FILE */
37 37
38#ifdef TO_FILE 38#ifdef TO_FILE
39
40#define min(x,y) ((x) > (y) ? (y) : (x))
41
42/**
43 * @brief buffer for storing the unaligned bits for the next write
44 */
45static char buf_unaligned;
46
47/**
48 * @brief number of bits in unaligned buffer
49 */
50static unsigned num_bits_buf_unaligned;
51
39void 52void
40to_file_ (const char *file_name, char *line) 53to_file_ (const char *file_name, char *line)
41{ 54{
@@ -108,11 +121,10 @@ to_file_ (const char *file_name, char *line)
108} 121}
109 122
110void 123void
111to_file_raw (const char *file_name, void *buf, size_t size_buf) 124to_file_raw (const char *file_name, const char *buf, size_t size_buf)
112{ 125{
113 struct GNUNET_DISK_FileHandle *f; 126 struct GNUNET_DISK_FileHandle *f;
114 size_t size2; 127 size_t size_written;
115
116 128
117 if (NULL == (f = GNUNET_DISK_file_open (file_name, 129 if (NULL == (f = GNUNET_DISK_file_open (file_name,
118 GNUNET_DISK_OPEN_APPEND | 130 GNUNET_DISK_OPEN_APPEND |
@@ -129,13 +141,13 @@ to_file_raw (const char *file_name, void *buf, size_t size_buf)
129 return; 141 return;
130 } 142 }
131 143
132 size2 = GNUNET_DISK_file_write (f, buf, size_buf); 144 size_written = GNUNET_DISK_file_write (f, buf, size_buf);
133 if (size_buf != size2) 145 if (size_buf != size_written)
134 { 146 {
135 LOG (GNUNET_ERROR_TYPE_WARNING, 147 LOG (GNUNET_ERROR_TYPE_WARNING,
136 "Unable to write to file! (Size: %u, size2: %u)\n", 148 "Unable to write to file! (Size: %u, size_written: %u)\n",
137 size_buf, 149 size_buf,
138 size2); 150 size_written);
139 151
140 if (GNUNET_YES != GNUNET_DISK_file_close (f)) 152 if (GNUNET_YES != GNUNET_DISK_file_close (f))
141 LOG (GNUNET_ERROR_TYPE_WARNING, 153 LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -143,15 +155,110 @@ to_file_raw (const char *file_name, void *buf, size_t size_buf)
143 155
144 return; 156 return;
145 } 157 }
158}
146 159
147 //if (512 < size_buf) 160void
161to_file_raw_unaligned (const char *file_name,
162 const char *buf,
163 size_t size_buf,
164 unsigned bits_needed)
165{
166 // TODO endianness!
167 GNUNET_assert (size_buf >= (bits_needed/8));
168 //if (0 == num_bits_buf_unaligned)
148 //{ 169 //{
149 // GNUNET_free (output_buffer_p); 170 // if (0 == (bits_needed % 8))
171 // {
172 // to_file_raw (file_name, buf, size_buf);
173 // return;
174 // }
175 // to_file_raw (file_name, buf, size_buf - 1);
176 // buf_unaligned = buf[size_buf - 1];
177 // num_bits_buf_unaligned = bits_needed % 8;
178 // return;
150 //} 179 //}
151 180
152 //if (GNUNET_YES != GNUNET_DISK_file_close (f)) 181 char buf_write[size_buf + 1];
153 // LOG (GNUNET_ERROR_TYPE_WARNING, 182 const unsigned bytes_iter = (0 != bits_needed % 8?
154 // "Unable to close file\n"); 183 (bits_needed/8)+1:
184 bits_needed/8);
185 // TODO what if no iteration happens?
186 unsigned size_buf_write = 0;
187 buf_write[0] = buf_unaligned;
188 /* Iterate over input bytes */
189 for (unsigned i = 0; i < bytes_iter; i++)
190 {
191 /* Number of bits needed in this iteration - 8 for all except last iter */
192 unsigned num_bits_needed_iter;
193 /* Mask for bits to actually use */
194 unsigned mask_bits_needed_iter;
195 char byte_input;
196 /* Number of bits needed to align unaligned byte */
197 unsigned num_bits_to_align;
198 /* Number of bits that are to be moved */
199 unsigned num_bits_to_move;
200 /* Mask for bytes to be moved */
201 char mask_input_to_move;
202 /* Masked bits to be moved */
203 char bits_to_move;
204 /* The amount of bits needed to fit the bits to shift to the nearest spot */
205 unsigned distance_shift_bits;
206 /* Shifted bits on the move */
207 char bits_moving;
208 /* (unaligned) byte being filled with bits */
209 char byte_to_fill;
210 /* mask for needed bits of the input byte that have not been moved */
211 char mask_input_leftover;
212 /* needed bits of the input byte that have not been moved */
213 char byte_input_leftover;
214 unsigned num_bits_leftover;
215 unsigned num_bits_discard;
216 char byte_unaligned_new;
217
218 if ( (bits_needed - (i * 8)) <= 8)
219 {
220 /* last iteration */
221 num_bits_needed_iter = bits_needed - (i * 8);
222 }
223 else
224 {
225 num_bits_needed_iter = 8;
226 }
227 mask_bits_needed_iter = ((char) 1 << num_bits_needed_iter) - 1;
228 byte_input = buf[i];
229 byte_input &= mask_bits_needed_iter;
230 num_bits_to_align = 8 - num_bits_buf_unaligned;
231 num_bits_to_move = min (num_bits_to_align, num_bits_needed_iter);
232 mask_input_to_move = ((char) 1 << num_bits_to_move) - 1;
233 bits_to_move = byte_input & mask_input_to_move;
234 distance_shift_bits = num_bits_buf_unaligned;
235 bits_moving = bits_to_move << distance_shift_bits;
236 byte_to_fill = buf_unaligned | bits_moving;
237 if (num_bits_buf_unaligned + num_bits_needed_iter > 8)
238 {
239 /* buf_unaligned was aligned by filling
240 * -> can be written to storage */
241 buf_write[i] = byte_to_fill;
242 size_buf_write++;
243
244 /* store the leftover, unaligned bits in buffer */
245 mask_input_leftover = mask_bits_needed_iter & (~ mask_input_to_move);
246 byte_input_leftover = byte_input & mask_input_leftover;
247 num_bits_leftover = num_bits_needed_iter - num_bits_to_move;
248 num_bits_discard = 8 - num_bits_needed_iter;
249 byte_unaligned_new = byte_input_leftover >> num_bits_to_move;
250 buf_unaligned = byte_unaligned_new;
251 num_bits_buf_unaligned = num_bits_leftover % 8;
252 }
253 else
254 {
255 /* unaligned buffer still unaligned but 'fuller' */
256 buf_unaligned = byte_to_fill;
257 num_bits_buf_unaligned = (num_bits_buf_unaligned + bits_needed) % 8;
258 }
259 }
260 to_file_raw (file_name, buf_write, size_buf_write);
261 LOG (GNUNET_ERROR_TYPE_DEBUG, "\n");
155} 262}
156 263
157char * 264char *
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h
index d42422750..577a2b0a7 100644
--- a/src/rps/rps-test_util.h
+++ b/src/rps/rps-test_util.h
@@ -75,7 +75,13 @@ store_prefix_file_name (const struct GNUNET_PeerIdentity *peer,
75 const char *prefix); 75 const char *prefix);
76 76
77void 77void
78to_file_raw (const char *file_name, void *buf, size_t size_buf); 78to_file_raw (const char *file_name, const char *buf, size_t size_buf);
79
80void
81to_file_raw_unaligned (const char *file_name,
82 const char *buf,
83 size_t size_buf,
84 unsigned bits_needed);
79 85
80#endif /* RPS_TEST_UTIL_H */ 86#endif /* RPS_TEST_UTIL_H */
81/* end of gnunet-service-rps.c */ 87/* end of gnunet-service-rps.c */