aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Gillmann <ng0@n0.is>2018-06-11 06:34:14 +0000
committerNils Gillmann <ng0@n0.is>2018-06-11 06:34:14 +0000
commit0183db872cb4df16971ea045ef204f190d901ed9 (patch)
tree969ae2cbd76ef60e85fa2cfcf56afca5e39dfaaa
parent9c6274c6af9b86952de81029e4c36b724a356af5 (diff)
downloadgnunet-0183db872cb4df16971ea045ef204f190d901ed9.tar.gz
gnunet-0183db872cb4df16971ea045ef204f190d901ed9.zip
documentation: user + developer changes
Signed-off-by: Nils Gillmann <ng0@n0.is>
-rw-r--r--doc/documentation/chapters/developer.texi383
-rw-r--r--doc/documentation/chapters/user.texi1926
-rw-r--r--doc/documentation/gnunet.texi12
3 files changed, 2310 insertions, 11 deletions
diff --git a/doc/documentation/chapters/developer.texi b/doc/documentation/chapters/developer.texi
index 6a895ed11..16039c8d3 100644
--- a/doc/documentation/chapters/developer.texi
+++ b/doc/documentation/chapters/developer.texi
@@ -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,314 @@ 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@exmaple
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
1305@ref{Build instructions for Debian 8}, the build instructions for
1306Debian stable, carefully as you try to install the dependencies for your
1307own distribution.
1308Contributing additional instructions for further platforms is always
1309appreciated.
1310Please take in mind that operating system development tends to move at
1311a rather fast speed. Due to this you should be aware that some of
1312the instructions could be outdated by the time you are reading this.
1313If you find a mistake, please tell us about it (or even better: send
1314a patch to the documentation to fix it!).
1315
1316Before proceeding further, please double-check the dependency list.
1317Note that in addition to satisfying the dependencies, you might have to
1318make sure that development headers for the various libraries are also
1319installed.
1320There maybe files for other distributions, or you might be able to find
1321equivalent packages for your distribution.
1322
1323While it is possible to build and install GNUnet without having root
1324access, we will assume that you have full control over your system in
1325these instructions.
1326First, you should create a system user @emph{gnunet} and an additional
1327group @emph{gnunetdns}. On the GNU/Linux distributions Debian and Ubuntu,
1328type:
1329
1330@example
1331sudo adduser --system --home /var/lib/gnunet --group \
1332--disabled-password gnunet
1333sudo addgroup --system gnunetdns
1334@end example
1335
1336@noindent
1337On other Unixes and GNU systems, this should have the same effect:
1338
1339@example
1340sudo useradd --system --groups gnunet --home-dir /var/lib/gnunet
1341sudo addgroup --system gnunetdns
1342@end example
1343
1344Now compile and install GNUnet using:
1345
1346@example
1347tar xvf gnunet-@value{VERSION}.tar.gz
1348cd gnunet-@value{VERSION}
1349./configure --with-sudo=sudo --with-nssdir=/lib
1350make
1351sudo make install
1352@end example
1353
1354If you want to be able to enable DEBUG-level log messages, add
1355@code{--enable-logging=verbose} to the end of the
1356@command{./configure} command.
1357@code{DEBUG}-level log messages are in English only and
1358should only be useful for developers (or for filing
1359really detailed bug reports).
1360
1361@noindent
1362Next, edit the file @file{/etc/gnunet.conf} to contain the following:
1363
1364@example
1365[arm]
1366SYSTEM_ONLY = YES
1367USER_ONLY = NO
1368@end example
1369
1370@noindent
1371You may need to update your @code{ld.so} cache to include
1372files installed in @file{/usr/local/lib}:
1373
1374@example
1375# ldconfig
1376@end example
1377
1378@noindent
1379Then, switch from user @code{root} to user @code{gnunet} to start
1380the peer:
1381
1382@example
1383# su -s /bin/sh - gnunet
1384$ gnunet-arm -c /etc/gnunet.conf -s
1385@end example
1386
1387You may also want to add the last line in the gnunet user's @file{crontab}
1388prefixed with @code{@@reboot} so that it is executed whenever the system
1389is booted:
1390
1391@example
1392@@reboot /usr/local/bin/gnunet-arm -c /etc/gnunet.conf -s
1393@end example
1394
1395@noindent
1396This will only start the system-wide GNUnet services.
1397Type @command{exit} to get back your root shell.
1398Now, you need to configure the per-user part. For each
1399user that should get access to GNUnet on the system, run
1400(replace alice with your username):
1401
1402@example
1403sudo adduser alice gnunet
1404@end example
1405
1406@noindent
1407to allow them to access the system-wide GNUnet services. Then, each
1408user should create a configuration file @file{~/.config/gnunet.conf}
1409with the lines:
1410
1411@example
1412[arm]
1413SYSTEM_ONLY = NO
1414USER_ONLY = YES
1415DEFAULTSERVICES = gns
1416@end example
1417
1418@noindent
1419and start the per-user services using
1420
1421@example
1422$ gnunet-arm -c ~/.config/gnunet.conf -s
1423@end example
1424
1425@noindent
1426Again, adding a @code{crontab} entry to autostart the peer is advised:
1427
1428@example
1429@@reboot /usr/local/bin/gnunet-arm -c $HOME/.config/gnunet.conf -s
1430@end example
1431
1432@noindent
1433Note that some GNUnet services (such as SOCKS5 proxies) may need a
1434system-wide TCP port for each user.
1435For those services, systems with more than one user may require each user
1436to specify a different port number in their personal configuration file.
1437
1438Finally, the user should perform the basic initial setup for the GNU Name
1439System (GNS) certificate authority. This is done by running:
1440
1441@example
1442$ gnunet-gns-proxy-setup-ca
1443@end example
1444
1445@noindent
1446The first generates the default zones, wheras the second setups the GNS
1447Certificate Authority with the user's browser. Now, to activate GNS in the
1448normal DNS resolution process, you need to edit your
1449@file{/etc/nsswitch.conf} where you should find a line like this:
1450
1451@example
1452hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
1453@end example
1454
1455@noindent
1456The exact details may differ a bit, which is fine. Add the text
1457@emph{"gns [NOTFOUND=return]"} after @emph{"files"}.
1458Keep in mind that we included a backslash ("\") here just for
1459markup reasons. You should write the text below on @b{one line}
1460and @b{without} the "\":
1461
1462@example
1463hosts: files gns [NOTFOUND=return] mdns4_minimal \
1464[NOTFOUND=return] dns mdns4
1465@end example
1466
1467@c FIXME: Document new behavior.
1468You might want to make sure that @file{/lib/libnss_gns.so.2} exists on
1469your system, it should have been created during the installation.
1470
1471
1472@c **********************************************************************
1092@cindex TESTING library 1473@cindex TESTING library
1093@node TESTING library 1474@node TESTING library
1094@section TESTING library 1475@section TESTING library
diff --git a/doc/documentation/chapters/user.texi b/doc/documentation/chapters/user.texi
index e5ebf5371..48fcc04c3 100644
--- a/doc/documentation/chapters/user.texi
+++ b/doc/documentation/chapters/user.texi
@@ -27,6 +27,8 @@ Comments and extensions of this documentation are always welcome.
27* File-sharing:: 27* File-sharing::
28* The GNU Name System:: 28* The GNU Name System::
29* Using the Virtual Public Network:: 29* Using the Virtual Public Network::
30* The graphical configuration interface::
31* How to start and stop a GNUnet peer::
30@end menu 32@end menu
31 33
32@node Checking the Installation 34@node Checking the Installation
@@ -2006,3 +2008,1927 @@ service offered by that peer, you can create an IP tunnel to
2006that peer by specifying the peer's identity, service name and 2008that peer by specifying the peer's identity, service name and
2007protocol (--tcp or --udp) and you will again receive an IP address 2009protocol (--tcp or --udp) and you will again receive an IP address
2008that will terminate at the respective peer's service. 2010that will terminate at the respective peer's service.
2011
2012
2013
2014@c NOTE: Inserted from Installation Handbook in original ``order'':
2015@c FIXME: Move this to User Handbook.
2016@node The graphical configuration interface
2017@section The graphical configuration interface
2018
2019If you also would like to use @command{gnunet-gtk} and
2020@command{gnunet-setup} (highly recommended for beginners), do:
2021
2022@menu
2023* Configuring your peer::
2024* Configuring the Friend-to-Friend (F2F) mode::
2025* Configuring the hostlist to bootstrap::
2026* Configuration of the HOSTLIST proxy settings::
2027* Configuring your peer to provide a hostlist ::
2028* Configuring the datastore::
2029* Configuring the MySQL database::
2030* Reasons for using MySQL::
2031* Reasons for not using MySQL::
2032* Setup Instructions::
2033* Testing::
2034* Performance Tuning::
2035* Setup for running Testcases::
2036* Configuring the Postgres database::
2037* Reasons to use Postgres::
2038* Reasons not to use Postgres::
2039* Manual setup instructions::
2040* Testing the setup manually::
2041* Configuring the datacache::
2042* Configuring the file-sharing service::
2043* Configuring logging::
2044* Configuring the transport service and plugins::
2045* Configuring the wlan transport plugin::
2046* Configuring HTTP(S) reverse proxy functionality using Apache or nginx::
2047* Blacklisting peers::
2048* Configuration of the HTTP and HTTPS transport plugins::
2049* Configuring the GNU Name System::
2050* Configuring the GNUnet VPN::
2051* Bandwidth Configuration::
2052* Configuring NAT::
2053* Peer configuration for distributions::
2054@end menu
2055
2056@node Configuring your peer
2057@subsection Configuring your peer
2058
2059This chapter will describe the various configuration options in GNUnet.
2060
2061The easiest way to configure your peer is to use the
2062@command{gnunet-setup} tool.
2063@command{gnunet-setup} is part of the @command{gnunet-gtk}
2064application. You might have to install it separately.
2065
2066Many of the specific sections from this chapter actually are linked from
2067within @command{gnunet-setup} to help you while using the setup tool.
2068
2069While you can also configure your peer by editing the configuration
2070file by hand, this is not recommended for anyone except for developers
2071as it requires a more in-depth understanding of the configuration files
2072and internal dependencies of GNUnet.
2073
2074@node Configuring the Friend-to-Friend (F2F) mode
2075@subsection Configuring the Friend-to-Friend (F2F) mode
2076
2077GNUnet knows three basic modes of operation:
2078@itemize @bullet
2079@item In standard "peer-to-peer" mode,
2080your peer will connect to any peer.
2081@item In the pure "friend-to-friend"
2082mode, your peer will ONLY connect to peers from a list of friends
2083specified in the configuration.
2084@item Finally, in mixed mode,
2085GNUnet will only connect to arbitrary peers if it
2086has at least a specified number of connections to friends.
2087@end itemize
2088
2089When configuring any of the F2F ("friend-to-friend") modes,
2090you first need to create a file with the peer identities
2091of your friends. Ask your friends to run
2092
2093@example
2094$ gnunet-peerinfo -sq
2095@end example
2096
2097@noindent
2098The resulting output of this command needs to be added to your
2099@file{friends} file, which is simply a plain text file with one line
2100per friend with the output from the above command.
2101
2102You then specify the location of your @file{friends} file in the
2103@code{FRIENDS} option of the "topology" section.
2104
2105Once you have created the @file{friends} file, you can tell GNUnet to only
2106connect to your friends by setting the @code{FRIENDS-ONLY} option
2107(again in the "topology" section) to YES.
2108
2109If you want to run in mixed-mode, set "FRIENDS-ONLY" to NO and configure a
2110minimum number of friends to have (before connecting to arbitrary peers)
2111under the "MINIMUM-FRIENDS" option.
2112
2113If you want to operate in normal P2P-only mode, simply set
2114@code{MINIMUM-FRIENDS} to zero and @code{FRIENDS_ONLY} to NO.
2115This is the default.
2116
2117@node Configuring the hostlist to bootstrap
2118@subsection Configuring the hostlist to bootstrap
2119
2120After installing the software you need to get connected to the GNUnet
2121network. The configuration file included in your download is already
2122configured to connect you to the GNUnet network.
2123In this section the relevant configuration settings are explained.
2124
2125To get an initial connection to the GNUnet network and to get to know
2126peers already connected to the network you can use the so called
2127"bootstrap servers".
2128These servers can give you a list of peers connected to the network.
2129To use these bootstrap servers you have to configure the hostlist daemon
2130to activate bootstrapping.
2131
2132To activate bootstrapping, edit the @code{[hostlist]}-section in your
2133configuration file. You have to set the argument @command{-b} in the
2134options line:
2135
2136@example
2137[hostlist]
2138OPTIONS = -b
2139@end example
2140
2141Additionally you have to specify which server you want to use.
2142The default bootstrapping server is
2143"@uref{http://v10.gnunet.org/hostlist, http://v10.gnunet.org/hostlist}".
2144[^] To set the server you have to edit the line "SERVERS" in the hostlist
2145section. To use the default server you should set the lines to
2146
2147@example
2148SERVERS = http://v10.gnunet.org/hostlist [^]
2149@end example
2150
2151@noindent
2152To use bootstrapping your configuration file should include these lines:
2153
2154@example
2155[hostlist]
2156OPTIONS = -b
2157SERVERS = http://v10.gnunet.org/hostlist [^]
2158@end example
2159
2160@noindent
2161Besides using bootstrap servers you can configure your GNUnet peer to
2162recieve hostlist advertisements.
2163Peers offering hostlists to other peers can send advertisement messages
2164to peers that connect to them. If you configure your peer to receive these
2165messages, your peer can download these lists and connect to the peers
2166included. These lists are persistent, which means that they are saved to
2167your hard disk regularly and are loaded during startup.
2168
2169To activate hostlist learning you have to add the @command{-e}
2170switch to the @code{OPTIONS} line in the hostlist section:
2171
2172@example
2173[hostlist]
2174OPTIONS = -b -e
2175@end example
2176
2177@noindent
2178Furthermore you can specify in which file the lists are saved.
2179To save the lists in the file @file{hostlists.file} just add the line:
2180
2181@example
2182HOSTLISTFILE = hostlists.file
2183@end example
2184
2185@noindent
2186Best practice is to activate both bootstrapping and hostlist learning.
2187So your configuration file should include these lines:
2188
2189@example
2190[hostlist]
2191OPTIONS = -b -e
2192HTTPPORT = 8080
2193SERVERS = http://v10.gnunet.org/hostlist [^]
2194HOSTLISTFILE = $SERVICEHOME/hostlists.file
2195@end example
2196
2197@node Configuration of the HOSTLIST proxy settings
2198@subsection Configuration of the HOSTLIST proxy settings
2199
2200The hostlist client can be configured to use a proxy to connect to the
2201hostlist server.
2202This functionality can be configured in the configuration file directly
2203or using the @command{gnunet-setup} tool.
2204
2205The hostlist client supports the following proxy types at the moment:
2206
2207@itemize @bullet
2208@item HTTP and HTTP 1.0 only proxy
2209@item SOCKS 4/4a/5/5 with hostname
2210@end itemize
2211
2212In addition authentication at the proxy with username and password can be
2213configured.
2214
2215To configure proxy support for the hostlist client in the
2216@command{gnunet-setup} tool, select the "hostlist" tab and select
2217the appropriate proxy type.
2218The hostname or IP address (including port if required) has to be entered
2219in the "Proxy hostname" textbox. If required, enter username and password
2220in the "Proxy username" and "Proxy password" boxes.
2221Be aware that this information will be stored in the configuration in
2222plain text (TODO: Add explanation and generalize the part in Chapter 3.6
2223about the encrypted home).
2224
2225To provide these options directly in the configuration, you can
2226enter the following settings in the @code{[hostlist]} section of
2227the configuration:
2228
2229@example
2230# Type of proxy server,
2231# Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
2232# Default: HTTP
2233# PROXY_TYPE = HTTP
2234
2235# Hostname or IP of proxy server
2236# PROXY =
2237# User name for proxy server
2238# PROXY_USERNAME =
2239# User password for proxy server
2240# PROXY_PASSWORD =
2241@end example
2242
2243@node Configuring your peer to provide a hostlist
2244@subsection Configuring your peer to provide a hostlist
2245
2246If you operate a peer permanently connected to GNUnet you can configure
2247your peer to act as a hostlist server, providing other peers the list of
2248peers known to him.
2249
2250Your server can act as a bootstrap server and peers needing to obtain a
2251list of peers can contact it to download this list.
2252To download this hostlist the peer uses HTTP.
2253For this reason you have to build your peer with libgnurl (or libcurl)
2254and microhttpd support.
2255How you build your peer with these options can be found here:
2256@xref{Generic installation instructions}.
2257
2258To configure your peer to act as a bootstrap server you have to add the
2259@command{-p} option to @code{OPTIONS} in the @code{[hostlist]} section
2260of your configuration file.
2261Besides that you have to specify a port number for the http server.
2262In conclusion you have to add the following lines:
2263
2264@example
2265[hostlist]
2266HTTPPORT = 12980
2267OPTIONS = -p
2268@end example
2269
2270@noindent
2271If your peer acts as a bootstrap server other peers should know about
2272that. You can advertise the hostlist your are providing to other peers.
2273Peers connecting to your peer will get a message containing an
2274advertisement for your hostlist and the URL where it can be downloaded.
2275If this peer is in learning mode, it will test the hostlist and, in the
2276case it can obtain the list successfully, it will save it for
2277bootstrapping.
2278
2279To activate hostlist advertisement on your peer, you have to set the
2280following lines in your configuration file:
2281
2282@example
2283[hostlist]
2284EXTERNAL_DNS_NAME = example.org
2285HTTPPORT = 12981
2286OPTIONS = -p -a
2287@end example
2288
2289@noindent
2290With this configuration your peer will a act as a bootstrap server and
2291advertise this hostlist to other peers connecting to it.
2292The URL used to download the list will be
2293@code{@uref{http://example.org:12981/, http://example.org:12981/}}.
2294
2295Please notice:
2296
2297@itemize @bullet
2298@item The hostlist is @b{not} human readable, so you should not try to
2299download it using your webbrowser. Just point your GNUnet peer to the
2300address!
2301@item Advertising without providing a hostlist does not make sense and
2302will not work.
2303@end itemize
2304
2305@node Configuring the datastore
2306@subsection Configuring the datastore
2307
2308The datastore is what GNUnet uses for long-term storage of file-sharing
2309data. Note that long-term does not mean 'forever' since content does have
2310an expiration date, and of course storage space is finite (and hence
2311sometimes content may have to be discarded).
2312
2313Use the @code{QUOTA} option to specify how many bytes of storage space
2314you are willing to dedicate to GNUnet.
2315
2316In addition to specifying the maximum space GNUnet is allowed to use for
2317the datastore, you need to specify which database GNUnet should use to do
2318so. Currently, you have the choice between sqLite, MySQL and Postgres.
2319
2320@node Configuring the MySQL database
2321@subsection Configuring the MySQL database
2322
2323This section describes how to setup the MySQL database for GNUnet.
2324
2325Note that the mysql plugin does NOT work with mysql before 4.1 since we
2326need prepared statements.
2327We are generally testing the code against MySQL 5.1 at this point.
2328
2329@node Reasons for using MySQL
2330@subsection Reasons for using MySQL
2331
2332@itemize @bullet
2333
2334@item On up-to-date hardware wher
2335mysql can be used comfortably, this module
2336will have better performance than the other database choices (according
2337to our tests).
2338
2339@item Its often possible to recover the mysql database from internal
2340inconsistencies. Some of the other databases do not support repair.
2341@end itemize
2342
2343@node Reasons for not using MySQL
2344@subsection Reasons for not using MySQL
2345
2346@itemize @bullet
2347@item Memory usage (likely not an issue if you have more than 1 GB)
2348@item Complex manual setup
2349@end itemize
2350
2351@node Setup Instructions
2352@subsection Setup Instructions
2353
2354@itemize @bullet
2355
2356@item In @file{gnunet.conf} set in section @code{DATASTORE} the value for
2357@code{DATABASE} to @code{mysql}.
2358
2359@item Access mysql as root:
2360
2361@example
2362$ mysql -u root -p
2363@end example
2364
2365@noindent
2366and issue the following commands, replacing $USER with the username
2367that will be running @command{gnunet-arm} (so typically "gnunet"):
2368
2369@example
2370CREATE DATABASE gnunet;
2371GRANT select,insert,update,delete,create,alter,drop,create \
2372temporary tables ON gnunet.* TO $USER@@localhost;
2373SET PASSWORD FOR $USER@@localhost=PASSWORD('$the_password_you_like');
2374FLUSH PRIVILEGES;
2375@end example
2376
2377@item
2378In the $HOME directory of $USER, create a @file{.my.cnf} file with the
2379following lines
2380
2381@example
2382[client]
2383user=$USER
2384password=$the_password_you_like
2385@end example
2386
2387@end itemize
2388
2389Thats it. Note that @file{.my.cnf} file is a slight security risk unless
2390its on a safe partition. The @file{$HOME/.my.cnf} can of course be
2391a symbolic link.
2392Luckily $USER has only priviledges to mess up GNUnet's tables,
2393which should be pretty harmless.
2394
2395@node Testing
2396@subsection Testing
2397
2398You should briefly try if the database connection works. First, login
2399as $USER. Then use:
2400
2401@example
2402$ mysql -u $USER
2403mysql> use gnunet;
2404@end example
2405
2406@noindent
2407If you get the message
2408
2409@example
2410Database changed
2411@end example
2412
2413@noindent
2414it probably works.
2415
2416If you get
2417
2418@example
2419ERROR 2002: Can't connect to local MySQL server
2420through socket '/tmp/mysql.sock' (2)
2421@end example
2422
2423@noindent
2424it may be resolvable by
2425
2426@example
2427ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
2428@end example
2429
2430@noindent
2431so there may be some additional trouble depending on your mysql setup.
2432
2433@node Performance Tuning
2434@subsection Performance Tuning
2435
2436For GNUnet, you probably want to set the option
2437
2438@example
2439innodb_flush_log_at_trx_commit = 0
2440@end example
2441
2442@noindent
2443for a rather dramatic boost in MySQL performance. However, this reduces
2444the "safety" of your database as with this options you may loose
2445transactions during a power outage.
2446While this is totally harmless for GNUnet, the option applies to all
2447applications using MySQL. So you should set it if (and only if) GNUnet is
2448the only application on your system using MySQL.
2449
2450@node Setup for running Testcases
2451@subsection Setup for running Testcases
2452
2453If you want to run the testcases, you must create a second database
2454"gnunetcheck" with the same username and password. This database will
2455then be used for testing (@command{make check}).
2456
2457@node Configuring the Postgres database
2458@subsection Configuring the Postgres database
2459
2460This text describes how to setup the Postgres database for GNUnet.
2461
2462This Postgres plugin was developed for Postgres 8.3 but might work for
2463earlier versions as well.
2464
2465@node Reasons to use Postgres
2466@subsection Reasons to use Postgres
2467
2468@itemize @bullet
2469@item Easier to setup than MySQL
2470@item Real database
2471@end itemize
2472
2473@node Reasons not to use Postgres
2474@subsection Reasons not to use Postgres
2475
2476@itemize @bullet
2477@item Quite slow
2478@item Still some manual setup required
2479@end itemize
2480
2481@node Manual setup instructions
2482@subsection Manual setup instructions
2483
2484@itemize @bullet
2485@item In @file{gnunet.conf} set in section @code{DATASTORE} the value for
2486@code{DATABASE} to @code{postgres}.
2487@item Access Postgres to create a user:
2488
2489@table @asis
2490@item with Postgres 8.x, use:
2491
2492@example
2493# su - postgres
2494$ createuser
2495@end example
2496
2497@noindent
2498and enter the name of the user running GNUnet for the role interactively.
2499Then, when prompted, do not set it to superuser, allow the creation of
2500databases, and do not allow the creation of new roles.
2501
2502@item with Postgres 9.x, use:
2503
2504@example
2505# su - postgres
2506$ createuser -d $GNUNET_USER
2507@end example
2508
2509@noindent
2510where $GNUNET_USER is the name of the user running GNUnet.
2511
2512@end table
2513
2514
2515@item
2516As that user (so typically as user "gnunet"), create a database (or two):
2517
2518@example
2519$ createdb gnunet
2520# this way you can run "make check"
2521$ createdb gnunetcheck
2522@end example
2523
2524@end itemize
2525
2526Now you should be able to start @code{gnunet-arm}.
2527
2528@node Testing the setup manually
2529@subsection Testing the setup manually
2530
2531You may want to try if the database connection works. First, again login
2532as the user who will run @command{gnunet-arm}. Then use:
2533
2534@example
2535$ psql gnunet # or gnunetcheck
2536gnunet=> \dt
2537@end example
2538
2539@noindent
2540If, after you have started @command{gnunet-arm} at least once, you get
2541a @code{gn090} table here, it probably works.
2542
2543@node Configuring the datacache
2544@subsection Configuring the datacache
2545@c %**end of header
2546
2547The datacache is what GNUnet uses for storing temporary data. This data is
2548expected to be wiped completely each time GNUnet is restarted (or the
2549system is rebooted).
2550
2551You need to specify how many bytes GNUnet is allowed to use for the
2552datacache using the @code{QUOTA} option in the section @code{[dhtcache]}.
2553Furthermore, you need to specify which database backend should be used to
2554store the data. Currently, you have the choice between
2555sqLite, MySQL and Postgres.
2556
2557@node Configuring the file-sharing service
2558@subsection Configuring the file-sharing service
2559
2560In order to use GNUnet for file-sharing, you first need to make sure
2561that the file-sharing service is loaded.
2562This is done by setting the @code{AUTOSTART} option in
2563section @code{[fs]} to "YES". Alternatively, you can run
2564
2565@example
2566$ gnunet-arm -i fs
2567@end example
2568
2569@noindent
2570to start the file-sharing service by hand.
2571
2572Except for configuring the database and the datacache the only important
2573option for file-sharing is content migration.
2574
2575Content migration allows your peer to cache content from other peers as
2576well as send out content stored on your system without explicit requests.
2577This content replication has positive and negative impacts on both system
2578performance and privacy.
2579
2580FIXME: discuss the trade-offs. Here is some older text about it...
2581
2582Setting this option to YES allows gnunetd to migrate data to the local
2583machine. Setting this option to YES is highly recommended for efficiency.
2584Its also the default. If you set this value to YES, GNUnet will store
2585content on your machine that you cannot decrypt.
2586While this may protect you from liability if the judge is sane, it may
2587not (IANAL). If you put illegal content on your machine yourself, setting
2588this option to YES will probably increase your chances to get away with it
2589since you can plausibly deny that you inserted the content.
2590Note that in either case, your anonymity would have to be broken first
2591(which may be possible depending on the size of the GNUnet network and the
2592strength of the adversary).
2593
2594@node Configuring logging
2595@subsection Configuring logging
2596
2597Logging in GNUnet 0.9.0 is controlled via the "-L" and "-l" options.
2598Using @code{-L}, a log level can be specified. With log level
2599@code{ERROR} only serious errors are logged.
2600The default log level is @code{WARNING} which causes anything of
2601concern to be logged.
2602Log level @code{INFO} can be used to log anything that might be
2603interesting information whereas
2604@code{DEBUG} can be used by developers to log debugging messages
2605(but you need to run @code{./configure} with
2606@code{--enable-logging=verbose} to get them compiled).
2607The @code{-l} option is used to specify the log file.
2608
2609Since most GNUnet services are managed by @code{gnunet-arm}, using the
2610@code{-l} or @code{-L} options directly is not possible.
2611Instead, they can be specified using the @code{OPTIONS} configuration
2612value in the respective section for the respective service.
2613In order to enable logging globally without editing the @code{OPTIONS}
2614values for each service, @command{gnunet-arm} supports a
2615@code{GLOBAL_POSTFIX} option.
2616The value specified here is given as an extra option to all services for
2617which the configuration does contain a service-specific @code{OPTIONS}
2618field.
2619
2620@code{GLOBAL_POSTFIX} can contain the special sequence "@{@}" which
2621is replaced by the name of the service that is being started.
2622Furthermore, @code{GLOBAL_POSTFIX} is special in that sequences
2623starting with "$" anywhere in the string are expanded (according
2624to options in @code{PATHS}); this expansion otherwise is
2625only happening for filenames and then the "$" must be the
2626first character in the option. Both of these restrictions do
2627not apply to @code{GLOBAL_POSTFIX}.
2628Note that specifying @code{%} anywhere in the @code{GLOBAL_POSTFIX}
2629disables both of these features.
2630
2631In summary, in order to get all services to log at level
2632@code{INFO} to log-files called @code{SERVICENAME-logs}, the
2633following global prefix should be used:
2634
2635@example
2636GLOBAL_POSTFIX = -l $SERVICEHOME/@{@}-logs -L INFO
2637@end example
2638
2639@node Configuring the transport service and plugins
2640@subsection Configuring the transport service and plugins
2641
2642The transport service in GNUnet is responsible to maintain basic
2643connectivity to other peers.
2644Besides initiating and keeping connections alive it is also responsible
2645for address validation.
2646
2647The GNUnet transport supports more than one transport protocol.
2648These protocols are configured together with the transport service.
2649
2650The configuration section for the transport service itself is quite
2651similar to all the other services
2652
2653@example
2654AUTOSTART = YES
2655@@UNIXONLY@@ PORT = 2091
2656HOSTNAME = localhost
2657HOME = $SERVICEHOME
2658CONFIG = $DEFAULTCONFIG
2659BINARY = gnunet-service-transport
2660#PREFIX = valgrind
2661NEIGHBOUR_LIMIT = 50
2662ACCEPT_FROM = 127.0.0.1;
2663ACCEPT_FROM6 = ::1;
2664PLUGINS = tcp udp
2665UNIXPATH = /tmp/gnunet-service-transport.sock
2666@end example
2667
2668Different are the settings for the plugins to load @code{PLUGINS}.
2669The first setting specifies which transport plugins to load.
2670
2671@itemize @bullet
2672@item transport-unix
2673A plugin for local only communication with UNIX domain sockets. Used for
2674testing and available on unix systems only. Just set the port
2675
2676@example
2677[transport-unix]
2678PORT = 22086
2679TESTING_IGNORE_KEYS = ACCEPT_FROM;
2680@end example
2681
2682@item transport-tcp
2683A plugin for communication with TCP. Set port to 0 for client mode with
2684outbound only connections
2685
2686@example
2687[transport-tcp]
2688# Use 0 to ONLY advertise as a peer behind NAT (no port binding)
2689PORT = 2086
2690ADVERTISED_PORT = 2086
2691TESTING_IGNORE_KEYS = ACCEPT_FROM;
2692# Maximum number of open TCP connections allowed
2693MAX_CONNECTIONS = 128
2694@end example
2695
2696@item transport-udp
2697A plugin for communication with UDP. Supports peer discovery using
2698broadcasts.
2699
2700@example
2701[transport-udp]
2702PORT = 2086
2703BROADCAST = YES
2704BROADCAST_INTERVAL = 30 s
2705MAX_BPS = 1000000
2706TESTING_IGNORE_KEYS = ACCEPT_FROM;
2707@end example
2708
2709@item transport-http
2710HTTP and HTTPS support is split in two part: a client plugin initiating
2711outbound connections and a server part accepting connections from the
2712client. The client plugin just takes the maximum number of connections as
2713an argument.
2714
2715@example
2716[transport-http_client]
2717MAX_CONNECTIONS = 128
2718TESTING_IGNORE_KEYS = ACCEPT_FROM;
2719@end example
2720
2721@example
2722[transport-https_client]
2723MAX_CONNECTIONS = 128
2724TESTING_IGNORE_KEYS = ACCEPT_FROM;
2725@end example
2726
2727@noindent
2728The server has a port configured and the maximum nunber of connections.
2729The HTTPS part has two files with the certificate key and the certificate
2730file.
2731
2732The server plugin supports reverse proxies, so a external hostname can be
2733set using the @code{EXTERNAL_HOSTNAME} setting.
2734The webserver under this address should forward the request to the peer
2735and the configure port.
2736
2737@example
2738[transport-http_server]
2739EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de/gnunet
2740PORT = 1080
2741MAX_CONNECTIONS = 128
2742TESTING_IGNORE_KEYS = ACCEPT_FROM;
2743@end example
2744
2745@example
2746[transport-https_server]
2747PORT = 4433
2748CRYPTO_INIT = NORMAL
2749KEY_FILE = https.key
2750CERT_FILE = https.cert
2751MAX_CONNECTIONS = 128
2752TESTING_IGNORE_KEYS = ACCEPT_FROM;
2753@end example
2754
2755@item transport-wlan
2756
2757The next section describes how to setup the WLAN plugin,
2758so here only the settings. Just specify the interface to use:
2759
2760@example
2761[transport-wlan]
2762# Name of the interface in monitor mode (typically monX)
2763INTERFACE = mon0
2764# Real hardware, no testing
2765TESTMODE = 0
2766TESTING_IGNORE_KEYS = ACCEPT_FROM;
2767@end example
2768@end itemize
2769
2770@node Configuring the wlan transport plugin
2771@subsection Configuring the wlan transport plugin
2772
2773The wlan transport plugin enables GNUnet to send and to receive data on a
2774wlan interface.
2775It has not to be connected to a wlan network as long as sender and
2776receiver are on the same channel. This enables you to get connection to
2777GNUnet where no internet access is possible, for example during
2778catastrophes or when censorship cuts you off from the internet.
2779
2780
2781@menu
2782* Requirements for the WLAN plugin::
2783* Configuration::
2784* Before starting GNUnet::
2785* Limitations and known bugs::
2786@end menu
2787
2788
2789@node Requirements for the WLAN plugin
2790@subsubsection Requirements for the WLAN plugin
2791
2792@itemize @bullet
2793
2794@item wlan network card with monitor support and packet injection
2795(see @uref{http://www.aircrack-ng.org/, aircrack-ng.org})
2796
2797@item Linux kernel with mac80211 stack, introduced in 2.6.22, tested with
27982.6.35 and 2.6.38
2799
2800@item Wlantools to create the a monitor interface, tested with airmon-ng
2801of the aircrack-ng package
2802@end itemize
2803
2804@node Configuration
2805@subsubsection Configuration
2806
2807There are the following options for the wlan plugin (they should be like
2808this in your default config file, you only need to adjust them if the
2809values are incorrect for your system)
2810
2811@example
2812# section for the wlan transport plugin
2813[transport-wlan]
2814# interface to use, more information in the
2815# "Before starting GNUnet" section of the handbook.
2816INTERFACE = mon0
2817# testmode for developers:
2818# 0 use wlan interface,
2819#1 or 2 use loopback driver for tests 1 = server, 2 = client
2820TESTMODE = 0
2821@end example
2822
2823@node Before starting GNUnet
2824@subsubsection Before starting GNUnet
2825
2826Before starting GNUnet, you have to make sure that your wlan interface is
2827in monitor mode.
2828One way to put the wlan interface into monitor mode (if your interface
2829name is wlan0) is by executing:
2830
2831@example
2832sudo airmon-ng start wlan0
2833@end example
2834
2835@noindent
2836Here is an example what the result should look like:
2837
2838@example
2839Interface Chipset Driver
2840wlan0 Intel 4965 a/b/g/n iwl4965 - [phy0]
2841(monitor mode enabled on mon0)
2842@end example
2843
2844@noindent
2845The monitor interface is mon0 is the one that you have to put into the
2846configuration file.
2847
2848@node Limitations and known bugs
2849@subsubsection Limitations and known bugs
2850
2851Wlan speed is at the maximum of 1 Mbit/s because support for choosing the
2852wlan speed with packet injection was removed in newer kernels.
2853Please pester the kernel developers about fixing this.
2854
2855The interface channel depends on the wlan network that the card is
2856connected to. If no connection has been made since the start of the
2857computer, it is usually the first channel of the card.
2858Peers will only find each other and communicate if they are on the same
2859channel. Channels must be set manually, i.e. using:
2860
2861@example
2862iwconfig wlan0 channel 1
2863@end example
2864
2865@node Configuring HTTP(S) reverse proxy functionality using Apache or nginx
2866@subsection Configuring HTTP(S) reverse proxy functionality using Apache or nginx
2867
2868The HTTP plugin supports data transfer using reverse proxies. A reverse
2869proxy forwards the HTTP request he receives with a certain URL to another
2870webserver, here a GNUnet peer.
2871
2872So if you have a running Apache or nginx webserver you can configure it to
2873be a GNUnet reverse proxy. Especially if you have a well-known webiste
2874this improves censorship resistance since it looks as normal surfing
2875behaviour.
2876
2877To do so, you have to do two things:
2878
2879@itemize @bullet
2880@item Configure your webserver to forward the GNUnet HTTP traffic
2881@item Configure your GNUnet peer to announce the respective address
2882@end itemize
2883
2884As an example we want to use GNUnet peer running:
2885
2886@itemize @bullet
2887
2888@item HTTP server plugin on @code{gnunet.foo.org:1080}
2889
2890@item HTTPS server plugin on @code{gnunet.foo.org:4433}
2891
2892@item A apache or nginx webserver on
2893@uref{http://www.foo.org/, http://www.foo.org:80/}
2894
2895@item A apache or nginx webserver on https://www.foo.org:443/
2896@end itemize
2897
2898And we want the webserver to accept GNUnet traffic under
2899@code{http://www.foo.org/bar/}. The required steps are described here:
2900
2901@menu
2902* Reverse Proxy - Configure your Apache2 HTTP webserver::
2903* Reverse Proxy - Configure your Apache2 HTTPS webserver::
2904* Reverse Proxy - Configure your nginx HTTPS webserver::
2905* Reverse Proxy - Configure your nginx HTTP webserver::
2906* Reverse Proxy - Configure your GNUnet peer::
2907@end menu
2908
2909@node Reverse Proxy - Configure your Apache2 HTTP webserver
2910@subsubsection Reverse Proxy - Configure your Apache2 HTTP webserver
2911
2912First of all you need mod_proxy installed.
2913
2914Edit your webserver configuration. Edit
2915@code{/etc/apache2/apache2.conf} or the site-specific configuration file.
2916
2917In the respective @code{server config},@code{virtual host} or
2918@code{directory} section add the following lines:
2919
2920@example
2921ProxyTimeout 300
2922ProxyRequests Off
2923<Location /bar/ >
2924ProxyPass http://gnunet.foo.org:1080/
2925ProxyPassReverse http://gnunet.foo.org:1080/
2926</Location>
2927@end example
2928
2929@node Reverse Proxy - Configure your Apache2 HTTPS webserver
2930@subsubsection Reverse Proxy - Configure your Apache2 HTTPS webserver
2931
2932We assume that you already have an HTTPS server running, if not please
2933check how to configure a HTTPS host. An uncomplicated to use example
2934is the example configuration file for Apache2/HTTPD provided in
2935@file{apache2/sites-available/default-ssl}.
2936
2937In the respective HTTPS @code{server config},@code{virtual host} or
2938@code{directory} section add the following lines:
2939
2940@example
2941SSLProxyEngine On
2942ProxyTimeout 300
2943ProxyRequests Off
2944<Location /bar/ >
2945ProxyPass https://gnunet.foo.org:4433/
2946ProxyPassReverse https://gnunet.foo.org:4433/
2947</Location>
2948@end example
2949
2950@noindent
2951More information about the apache mod_proxy configuration can be found
2952in 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}}
2953
2954@node Reverse Proxy - Configure your nginx HTTPS webserver
2955@subsubsection Reverse Proxy - Configure your nginx HTTPS webserver
2956
2957Since nginx does not support chunked encoding, you first of all have to
2958install the @code{chunkin} module@footnote{@uref{http://wiki.nginx.org/HttpChunkinModule, http://wiki.nginx.org/HttpChunkinModule}}
2959
2960To enable chunkin add:
2961
2962@example
2963chunkin on;
2964error_page 411 = @@my_411_error;
2965location @@my_411_error @{
2966chunkin_resume;
2967@}
2968@end example
2969
2970@noindent
2971Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or
2972the site-specific configuration file.
2973
2974In the @code{server} section add:
2975
2976@example
2977location /bar/ @{
2978proxy_pass http://gnunet.foo.org:1080/;
2979proxy_buffering off;
2980proxy_connect_timeout 5; # more than http_server
2981proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
2982proxy_http_version 1.1; # 1.0 default
2983proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
2984@}
2985@end example
2986
2987@node Reverse Proxy - Configure your nginx HTTP webserver
2988@subsubsection Reverse Proxy - Configure your nginx HTTP webserver
2989
2990Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or
2991the site-specific configuration file.
2992
2993In the @code{server} section add:
2994
2995@example
2996ssl_session_timeout 6m;
2997location /bar/
2998@{
2999proxy_pass https://gnunet.foo.org:4433/;
3000proxy_buffering off;
3001proxy_connect_timeout 5; # more than http_server
3002proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
3003proxy_http_version 1.1; # 1.0 default
3004proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
3005@}
3006@end example
3007
3008@node Reverse Proxy - Configure your GNUnet peer
3009@subsubsection Reverse Proxy - Configure your GNUnet peer
3010
3011To have your GNUnet peer announce the address, you have to specify the
3012@code{EXTERNAL_HOSTNAME} option in the @code{[transport-http_server]}
3013section:
3014
3015@example
3016[transport-http_server]
3017EXTERNAL_HOSTNAME = http://www.foo.org/bar/
3018@end example
3019
3020@noindent
3021and/or @code{[transport-https_server]} section:
3022
3023@example
3024[transport-https_server]
3025EXTERNAL_HOSTNAME = https://www.foo.org/bar/
3026@end example
3027
3028@noindent
3029Now restart your webserver and your peer...
3030
3031@node Blacklisting peers
3032@subsection Blacklisting peers
3033
3034Transport service supports to deny connecting to a specific peer of to a
3035specific peer with a specific transport plugin using te blacklisting
3036component of transport service. With@ blacklisting it is possible to deny
3037connections to specific peers of@ to use a specific plugin to a specific
3038peer. Peers can be blacklisted using@ the configuration or a blacklist
3039client can be asked.
3040
3041To blacklist peers using the configuration you have to add a section to
3042your configuration containing the peer id of the peer to blacklist and
3043the plugin@ if required.
3044
3045Examples:
3046
3047To blacklist connections to P565... on peer AG2P... using tcp add:
3048
3049@c FIXME: This is too long and produces errors in the pdf.
3050@example
3051[transport-blacklist AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
3052P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = tcp
3053@end example
3054
3055To blacklist connections to P565... on peer AG2P... using all plugins add:
3056
3057@example
3058[transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
3059P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G =
3060@end example
3061
3062You can also add a blacklist client usign the blacklist API. On a
3063blacklist check, blacklisting first checks internally if the peer is
3064blacklisted and if not, it asks the blacklisting clients. Clients are
3065asked if it is OK to connect to a peer ID, the plugin is omitted.
3066
3067On blacklist check for (peer, plugin)
3068@itemize @bullet
3069@item Do we have a local blacklist entry for this peer and this plugin?@
3070@item YES: disallow connection@
3071@item Do we have a local blacklist entry for this peer and all plugins?@
3072@item YES: disallow connection@
3073@item Does one of the clients disallow?@
3074@item YES: disallow connection
3075@end itemize
3076
3077@node Configuration of the HTTP and HTTPS transport plugins
3078@subsection Configuration of the HTTP and HTTPS transport plugins
3079
3080The client parts of the http and https transport plugins can be configured
3081to use a proxy to connect to the hostlist server. This functionality can
3082be configured in the configuration file directly or using the
3083gnunet-setup tool.
3084
3085Both the HTTP and HTTPS clients support the following proxy types at
3086the moment:
3087
3088@itemize @bullet
3089@item HTTP 1.1 proxy
3090@item SOCKS 4/4a/5/5 with hostname
3091@end itemize
3092
3093In addition authentication at the proxy with username and password can be
3094configured.
3095
3096To configure proxy support for the clients in the gnunet-setup tool,
3097select the "transport" tab and activate the respective plugin. Now you
3098can select the appropriate proxy type. The hostname or IP address
3099(including port if required) has to be entered in the "Proxy hostname"
3100textbox. If required, enter username and password in the "Proxy username"
3101and "Proxy password" boxes. Be aware that these information will be stored
3102in the configuration in plain text.
3103
3104To configure these options directly in the configuration, you can
3105configure the following settings in the @code{[transport-http_client]}
3106and @code{[transport-https_client]} section of the configuration:
3107
3108@example
3109# Type of proxy server,
3110# Valid values: HTTP, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
3111# Default: HTTP
3112# PROXY_TYPE = HTTP
3113
3114# Hostname or IP of proxy server
3115# PROXY =
3116# User name for proxy server
3117# PROXY_USERNAME =
3118# User password for proxy server
3119# PROXY_PASSWORD =
3120@end example
3121
3122@node Configuring the GNU Name System
3123@subsection Configuring the GNU Name System
3124
3125@menu
3126* Configuring system-wide DNS interception::
3127* Configuring the GNS nsswitch plugin::
3128* Configuring GNS on W32::
3129* GNS Proxy Setup::
3130* Setup of the GNS CA::
3131* Testing the GNS setup::
3132@end menu
3133
3134
3135@node Configuring system-wide DNS interception
3136@subsubsection Configuring system-wide DNS interception
3137
3138Before you install GNUnet, make sure you have a user and group 'gnunet'
3139as well as an empty group 'gnunetdns'.
3140
3141When using GNUnet with system-wide DNS interception, it is absolutely
3142necessary for all GNUnet service processes to be started by
3143@code{gnunet-service-arm} as user and group 'gnunet'. You also need to be
3144sure to run @code{make install} as root (or use the @code{sudo} option to
3145configure) to grant GNUnet sufficient privileges.
3146
3147With this setup, all that is required for enabling system-wide DNS
3148interception is for some GNUnet component (VPN or GNS) to request it.
3149The @code{gnunet-service-dns} will then start helper programs that will
3150make the necessary changes to your firewall (@code{iptables}) rules.
3151
3152Note that this will NOT work if your system sends out DNS traffic to a
3153link-local IPv6 address, as in this case GNUnet can intercept the traffic,
3154but not inject the responses from the link-local IPv6 address. Hence you
3155cannot use system-wide DNS interception in conjunction with link-local
3156IPv6-based DNS servers. If such a DNS server is used, it will bypass
3157GNUnet's DNS traffic interception.
3158
3159Using the GNU Name System (GNS) requires two different configuration
3160steps.
3161First of all, GNS needs to be integrated with the operating system. Most
3162of this section is about the operating system level integration.
3163
3164The remainder of this chapter will detail the various methods for
3165configuring the use of GNS with your operating system.
3166
3167At this point in time you have different options depending on your OS:
3168
3169@table @asis
3170
3171@item Use the gnunet-gns-proxy This approach works for all operating
3172systems and is likely the easiest. However, it enables GNS only for
3173browsers, not for other applications that might be using DNS, such as SSH.
3174Still, using the proxy is required for using HTTP with GNS and is thus
3175recommended for all users. To do this, you simply have to run the
3176@code{gnunet-gns-proxy-setup-ca} script as the user who will run the
3177browser (this will create a GNS certificate authority (CA) on your system
3178and import its key into your browser), then start @code{gnunet-gns-proxy}
3179and inform your browser to use the Socks5 proxy which
3180@code{gnunet-gns-proxy} makes available by default on port 7777.
3181@item Use a nsswitch plugin (recommended on GNU systems)
3182This approach has the advantage of offering fully personalized resolution
3183even on multi-user systems. A potential disadvantage is that some
3184applications might be able to bypass GNS.
3185@item Use a W32 resolver plugin (recommended on W32)
3186This is currently the only option on W32 systems.
3187@item Use system-wide DNS packet interception
3188This approach is recommended for the GNUnet VPN. It can be used to handle
3189GNS at the same time; however, if you only use this method, you will only
3190get one root zone per machine (not so great for multi-user systems).
3191@end table
3192
3193You can combine system-wide DNS packet interception with the nsswitch
3194plugin.
3195The setup of the system-wide DNS interception is described here. All of
3196the other GNS-specific configuration steps are described in the following
3197sections.
3198
3199@node Configuring the GNS nsswitch plugin
3200@subsubsection Configuring the GNS nsswitch plugin
3201
3202The Name Service Switch (NSS) is a facility in Unix-like operating systems
3203@footnote{More accurate: NSS is a functionality of the GNU C Library}
3204that provides a variety of sources for common configuration databases and
3205name resolution mechanisms.
3206A superuser (system administrator) usually configures the
3207operating system's name services using the file
3208@file{/etc/nsswitch.conf}.
3209
3210GNS provides a NSS plugin to integrate GNS name resolution with the
3211operating system's name resolution process.
3212To use the GNS NSS plugin you have to either
3213
3214@itemize @bullet
3215@item install GNUnet as root or
3216@item compile GNUnet with the @code{--with-sudo=yes} switch.
3217@end itemize
3218
3219Name resolution is controlled by the @emph{hosts} section in the NSS
3220configuration. By default this section first performs a lookup in the
3221@file{/etc/hosts} file and then in DNS.
3222The nsswitch file should contain a line similar to:
3223
3224@example
3225hosts: files dns [NOTFOUND=return] mdns4_minimal mdns4
3226@end example
3227
3228@noindent
3229Here the GNS NSS plugin can be added to perform a GNS lookup before
3230performing a DNS lookup.
3231The GNS NSS plugin has to be added to the "hosts" section in
3232@file{/etc/nsswitch.conf} file before DNS related plugins:
3233
3234@example
3235...
3236hosts: files gns [NOTFOUND=return] dns mdns4_minimal mdns4
3237...
3238@end example
3239
3240@noindent
3241The @code{NOTFOUND=return} will ensure that if a @code{.gnu} name is not
3242found in GNS it will not be queried in DNS.
3243
3244@node Configuring GNS on W32
3245@subsubsection Configuring GNS on W32
3246
3247This document is a guide to configuring GNU Name System on W32-compatible
3248platforms.
3249
3250After GNUnet is installed, run the w32nsp-install tool:
3251
3252@example
3253w32nsp-install.exe libw32nsp-0.dll
3254@end example
3255
3256@noindent
3257('0' is the library version of W32 NSP; it might increase in the future,
3258change the invocation accordingly).
3259
3260This will install GNS namespace provider into the system and allow other
3261applications to resolve names that end in '@strong{gnu}'
3262and '@strong{zkey}'. Note that namespace provider requires
3263gnunet-gns-helper-service-w32 to be running, as well as gns service
3264itself (and its usual dependencies).
3265
3266Namespace provider is hardcoded to connect to @strong{127.0.0.1:5353},
3267and this is where gnunet-gns-helper-service-w32 should be listening to
3268(and is configured to listen to by default).
3269
3270To uninstall the provider, run:
3271
3272@example
3273w32nsp-uninstall.exe
3274@end example
3275
3276@noindent
3277(uses provider GUID to uninstall it, does not need a dll name).
3278
3279Note that while MSDN claims that other applications will only be able to
3280use the new namespace provider after re-starting, in reality they might
3281stat to use it without that. Conversely, they might stop using the
3282provider after it's been uninstalled, even if they were not re-started.
3283W32 will not permit namespace provider library to be deleted or
3284overwritten while the provider is installed, and while there is at least
3285one process still using it (even after it was uninstalled).
3286
3287@node GNS Proxy Setup
3288@subsubsection GNS Proxy Setup
3289
3290When using the GNU Name System (GNS) to browse the WWW, there are several
3291issues that can be solved by adding the GNS Proxy to your setup:
3292
3293@itemize @bullet
3294
3295@item If the target website does not support GNS, it might assume that it
3296is operating under some name in the legacy DNS system (such as
3297example.com). It may then attempt to set cookies for that domain, and the
3298web server might expect a @code{Host: example.com} header in the request
3299from your browser.
3300However, your browser might be using @code{example.gnu} for the
3301@code{Host} header and might only accept (and send) cookies for
3302@code{example.gnu}. The GNS Proxy will perform the necessary translations
3303of the hostnames for cookies and HTTP headers (using the LEHO record for
3304the target domain as the desired substitute).
3305
3306@item If using HTTPS, the target site might include an SSL certificate
3307which is either only valid for the LEHO domain or might match a TLSA
3308record in GNS. However, your browser would expect a valid certificate for
3309@code{example.gnu}, not for some legacy domain name. The proxy will
3310validate the certificate (either against LEHO or TLSA) and then
3311on-the-fly produce a valid certificate for the exchange, signed by your
3312own CA. Assuming you installed the CA of your proxy in your browser's
3313certificate authority list, your browser will then trust the
3314HTTPS/SSL/TLS connection, as the hostname mismatch is hidden by the proxy.
3315
3316@item Finally, the proxy will in the future indicate to the server that it
3317speaks GNS, which will enable server operators to deliver GNS-enabled web
3318sites to your browser (and continue to deliver legacy links to legacy
3319browsers)
3320@end itemize
3321
3322@node Setup of the GNS CA
3323@subsubsection Setup of the GNS CA
3324
3325First you need to create a CA certificate that the proxy can use.
3326To do so use the provided script gnunet-gns-proxy-ca:
3327
3328@example
3329$ gnunet-gns-proxy-setup-ca
3330@end example
3331
3332@noindent
3333This will create a personal certification authority for you and add this
3334authority to the firefox and chrome database. The proxy will use the this
3335CA certificate to generate @code{*.gnu} client certificates on the fly.
3336
3337Note that the proxy uses libcurl. Make sure your version of libcurl uses
3338GnuTLS and NOT OpenSSL. The proxy will @b{not} work with libcurl compiled
3339against OpenSSL.
3340
3341You can check the configuration your libcurl was build with by
3342running:
3343
3344@example
3345curl --version
3346@end example
3347
3348the output will look like this (without the linebreaks):
3349
3350@example
3351gnurl --version
3352curl 7.56.0 (x86_64-unknown-linux-gnu) libcurl/7.56.0 \
3353GnuTLS/3.5.13 zlib/1.2.11 libidn2/2.0.4
3354Release-Date: 2017-10-08
3355Protocols: http https
3356Features: AsynchDNS IDN IPv6 Largefile NTLM SSL libz \
3357TLS-SRP UnixSockets HTTPS-proxy
3358@end example
3359
3360@node Testing the GNS setup
3361@subsubsection Testing the GNS setup
3362
3363Now for testing purposes we can create some records in our zone to test
3364the SSL functionality of the proxy:
3365
3366@example
3367$ gnunet-identity -C test
3368$ gnunet-namestore -a -e "1 d" -n "homepage" \
3369 -t A -V 131.159.74.67 -z test
3370$ gnunet-namestore -a -e "1 d" -n "homepage" \
3371 -t LEHO -V "gnunet.org" -z test
3372@end example
3373
3374@noindent
3375At this point we can start the proxy. Simply execute
3376
3377@example
3378$ gnunet-gns-proxy
3379@end example
3380
3381@noindent
3382Configure your browser to use this SOCKSv5 proxy on port 7777 and visit
3383this link.
3384If you use @command{Firefox} (or one of its deriviates/forks such as
3385Icecat) you also have to go to @code{about:config} and set the key
3386@code{network.proxy.socks_remote_dns} to @code{true}.
3387
3388When you visit @code{https://homepage.test/}, you should get to the
3389@code{https://gnunet.org/} frontpage and the browser (with the correctly
3390configured proxy) should give you a valid SSL certificate for
3391@code{homepage.gnu} and no warnings. It should look like this:
3392
3393@c FIXME: Image does not exist, create it or save it from Drupal?
3394@c @image{images/gnunethpgns.png,5in,, picture of homepage.gnu in Webbrowser}
3395
3396
3397@node Configuring the GNUnet VPN
3398@subsection Configuring the GNUnet VPN
3399
3400@menu
3401* IPv4 address for interface::
3402* IPv6 address for interface::
3403* Configuring the GNUnet VPN DNS::
3404* Configuring the GNUnet VPN Exit Service::
3405* IP Address of external DNS resolver::
3406* IPv4 address for Exit interface::
3407* IPv6 address for Exit interface::
3408@end menu
3409
3410Before configuring the GNUnet VPN, please make sure that system-wide DNS
3411interception is configured properly as described in the section on the
3412GNUnet DNS setup. @pxref{Configuring the GNU Name System},
3413if you haven't done so already.
3414
3415The default options for the GNUnet VPN are usually sufficient to use
3416GNUnet as a Layer 2 for your Internet connection.
3417However, what you always have to specify is which IP protocol you want
3418to tunnel: IPv4, IPv6 or both.
3419Furthermore, if you tunnel both, you most likely should also tunnel
3420all of your DNS requests.
3421You theoretically can tunnel "only" your DNS traffic, but that usually
3422makes little sense.
3423
3424The other options as shown on the gnunet-setup tool are:
3425
3426@node IPv4 address for interface
3427@subsubsection IPv4 address for interface
3428
3429This is the IPv4 address the VPN interface will get. You should pick an
3430'private' IPv4 network that is not yet in use for you system. For example,
3431if you use @code{10.0.0.1/255.255.0.0} already, you might use
3432@code{10.1.0.1/255.255.0.0}.
3433If you use @code{10.0.0.1/255.0.0.0} already, then you might use
3434@code{192.168.0.1/255.255.0.0}.
3435If your system is not in a private IP-network, using any of the above will
3436work fine.
3437You should try to make the mask of the address big enough
3438(@code{255.255.0.0} or, even better, @code{255.0.0.0}) to allow more
3439mappings of remote IP Addresses into this range.
3440However, even a @code{255.255.255.0} mask will suffice for most users.
3441
3442@node IPv6 address for interface
3443@subsubsection IPv6 address for interface
3444
3445The IPv6 address the VPN interface will get. Here you can specify any
3446non-link-local address (the address should not begin with @code{fe80:}).
3447A subnet Unique Local Unicast (@code{fd00::/8} prefix) that you are
3448currently not using would be a good choice.
3449
3450@node Configuring the GNUnet VPN DNS
3451@subsubsection Configuring the GNUnet VPN DNS
3452
3453To resolve names for remote nodes, activate the DNS exit option.
3454
3455@node Configuring the GNUnet VPN Exit Service
3456@subsubsection Configuring the GNUnet VPN Exit Service
3457
3458If you want to allow other users to share your Internet connection (yes,
3459this may be dangerous, just as running a Tor exit node) or want to
3460provide access to services on your host (this should be less dangerous,
3461as long as those services are secure), you have to enable the GNUnet exit
3462daemon.
3463
3464You then get to specify which exit functions you want to provide. By
3465enabling the exit daemon, you will always automatically provide exit
3466functions for manually configured local services (this component of the
3467system is under
3468development and not documented further at this time). As for those
3469services you explicitly specify the target IP address and port, there is
3470no significant security risk in doing so.
3471
3472Furthermore, you can serve as a DNS, IPv4 or IPv6 exit to the Internet.
3473Being a DNS exit is usually pretty harmless. However, enabling IPv4 or
3474IPv6-exit without further precautions may enable adversaries to access
3475your local network, send spam, attack other systems from your Internet
3476connection and to other mischief that will appear to come from your
3477machine. This may or may not get you into legal trouble.
3478If you want to allow IPv4 or IPv6-exit functionality, you should strongly
3479consider adding additional firewall rules manually to protect your local
3480network and to restrict outgoing TCP traffic (i.e. by not allowing access
3481to port 25). While we plan to improve exit-filtering in the future,
3482you're currently on your own here.
3483Essentially, be prepared for any kind of IP-traffic to exit the respective
3484TUN interface (and GNUnet will enable IP-forwarding and NAT for the
3485interface automatically).
3486
3487Additional configuration options of the exit as shown by the gnunet-setup
3488tool are:
3489
3490@node IP Address of external DNS resolver
3491@subsubsection IP Address of external DNS resolver
3492
3493If DNS traffic is to exit your machine, it will be send to this DNS
3494resolver. You can specify an IPv4 or IPv6 address.
3495
3496@node IPv4 address for Exit interface
3497@subsubsection IPv4 address for Exit interface
3498
3499This is the IPv4 address the Interface will get. Make the mask of the
3500address big enough (255.255.0.0 or, even better, 255.0.0.0) to allow more
3501mappings of IP addresses into this range. As for the VPN interface, any
3502unused, private IPv4 address range will do.
3503
3504@node IPv6 address for Exit interface
3505@subsubsection IPv6 address for Exit interface
3506
3507The public IPv6 address the interface will get. If your kernel is not a
3508very recent kernel and you are willing to manually enable IPv6-NAT, the
3509IPv6 address you specify here must be a globally routed IPv6 address of
3510your host.
3511
3512Suppose your host has the address @code{2001:4ca0::1234/64}, then
3513using @code{2001:4ca0::1:0/112} would be fine (keep the first 64 bits,
3514then change at least one bit in the range before the bitmask, in the
3515example above we changed bit 111 from 0 to 1).
3516
3517You may also have to configure your router to route traffic for the entire
3518subnet (@code{2001:4ca0::1:0/112} for example) through your computer (this
3519should be automatic with IPv6, but obviously anything can be
3520disabled).
3521
3522@node Bandwidth Configuration
3523@subsection Bandwidth Configuration
3524
3525You can specify how many bandwidth GNUnet is allowed to use to receive
3526and send data. This is important for users with limited bandwidth or
3527traffic volume.
3528
3529@node Configuring NAT
3530@subsection Configuring NAT
3531
3532Most hosts today do not have a normal global IP address but instead are
3533behind a router performing Network Address Translation (NAT) which assigns
3534each host in the local network a private IP address.
3535As a result, these machines cannot trivially receive inbound connections
3536from the Internet. GNUnet supports NAT traversal to enable these machines
3537to receive incoming connections from other peers despite their
3538limitations.
3539
3540In an ideal world, you can press the "Attempt automatic configuration"
3541button in gnunet-setup to automatically configure your peer correctly.
3542Alternatively, your distribution might have already triggered this
3543automatic configuration during the installation process.
3544However, automatic configuration can fail to determine the optimal
3545settings, resulting in your peer either not receiving as many connections
3546as possible, or in the worst case it not connecting to the network at all.
3547
3548To manually configure the peer, you need to know a few things about your
3549network setup. First, determine if you are behind a NAT in the first
3550place.
3551This is always the case if your IP address starts with "10.*" or
3552"192.168.*". Next, if you have control over your NAT router, you may
3553choose to manually configure it to allow GNUnet traffic to your host.
3554If you have configured your NAT to forward traffic on ports 2086 (and
3555possibly 1080) to your host, you can check the "NAT ports have been opened
3556manually" option, which corresponds to the "PUNCHED_NAT" option in the
3557configuration file. If you did not punch your NAT box, it may still be
3558configured to support UPnP, which allows GNUnet to automatically
3559configure it. In that case, you need to install the "upnpc" command,
3560enable UPnP (or PMP) on your NAT box and set the "Enable NAT traversal
3561via UPnP or PMP" option (corresponding to "ENABLE_UPNP" in the
3562configuration file).
3563
3564Some NAT boxes can be traversed using the autonomous NAT traversal method.
3565This requires certain GNUnet components to be installed with "SUID"
3566prividledges on your system (so if you're installing on a system you do
3567not have administrative rights to, this will not work).
3568If you installed as 'root', you can enable autonomous NAT traversal by
3569checking the "Enable NAT traversal using ICMP method".
3570The ICMP method requires a way to determine your NAT's external (global)
3571IP address. This can be done using either UPnP, DynDNS, or by manual
3572configuration. If you have a DynDNS name or know your external IP address,
3573you should enter that name under "External (public) IPv4 address" (which
3574corresponds to the "EXTERNAL_ADDRESS" option in the configuration file).
3575If you leave the option empty, GNUnet will try to determine your external
3576IP address automatically (which may fail, in which case autonomous
3577NAT traversal will then not work).
3578
3579Finally, if you yourself are not behind NAT but want to be able to
3580connect to NATed peers using autonomous NAT traversal, you need to check
3581the "Enable connecting to NATed peers using ICMP method" box.
3582
3583
3584@node Peer configuration for distributions
3585@subsection Peer configuration for distributions
3586
3587The "GNUNET_DATA_HOME" in "[path]" in @file{/etc/gnunet.conf} should be
3588manually set to "/var/lib/gnunet/data/" as the default
3589"~/.local/share/gnunet/" is probably not that appropriate in this case.
3590Similarly, distributions may consider pointing "GNUNET_RUNTIME_DIR" to
3591"/var/run/gnunet/" and "GNUNET_HOME" to "/var/lib/gnunet/". Also, should a
3592distribution decide to override system defaults, all of these changes
3593should be done in a custom @file{/etc/gnunet.conf} and not in the files
3594in the @file{config.d/} directory.
3595
3596Given the proposed access permissions, the "gnunet-setup" tool must be
3597run as use "gnunet" (and with option "-c /etc/gnunet.conf" so that it
3598modifies the system configuration). As always, gnunet-setup should be run
3599after the GNUnet peer was stopped using "gnunet-arm -e". Distributions
3600might want to include a wrapper for gnunet-setup that allows the
3601desktop-user to "sudo" (i.e. using gtksudo) to the "gnunet" user account
3602and then runs "gnunet-arm -e", "gnunet-setup" and "gnunet-arm -s" in
3603sequence.
3604
3605@node How to start and stop a GNUnet peer
3606@section How to start and stop a GNUnet peer
3607
3608This section describes how to start a GNUnet peer. It assumes that you
3609have already compiled and installed GNUnet and its' dependencies.
3610Before you start a GNUnet peer, you may want to create a configuration
3611file using gnunet-setup (but you do not have to).
3612Sane defaults should exist in your
3613@file{$GNUNET_PREFIX/share/gnunet/config.d/} directory, so in practice
3614you could simply start without any configuration. If you want to
3615configure your peer later, you need to stop it before invoking the
3616@code{gnunet-setup} tool to customize further and to test your
3617configuration (@code{gnunet-setup} has build-in test functions).
3618
3619The most important option you might have to still set by hand is in
3620[PATHS]. Here, you use the option "GNUNET_HOME" to specify the path where
3621GNUnet should store its data.
3622It defaults to @code{$HOME/}, which again should work for most users.
3623Make sure that the directory specified as GNUNET_HOME is writable to
3624the user that you will use to run GNUnet (note that you can run frontends
3625using other users, GNUNET_HOME must only be accessible to the user used to
3626run the background processes).
3627
3628You will also need to make one central decision: should all of GNUnet be
3629run under your normal UID, or do you want distinguish between system-wide
3630(user-independent) GNUnet services and personal GNUnet services. The
3631multi-user setup is slightly more complicated, but also more secure and
3632generally recommended.
3633
3634@menu
3635* The Single-User Setup::
3636* The Multi-User Setup::
3637* Killing GNUnet services::
3638* Access Control for GNUnet::
3639@end menu
3640
3641@node The Single-User Setup
3642@subsection The Single-User Setup
3643
3644For the single-user setup, you do not need to do anything special and can
3645just start the GNUnet background processes using @code{gnunet-arm}.
3646By default, GNUnet looks in @file{~/.config/gnunet.conf} for a
3647configuration (or @code{$XDG_CONFIG_HOME/gnunet.conf} if@
3648@code{$XDG_CONFIG_HOME} is defined). If your configuration lives
3649elsewhere, you need to pass the @code{-c FILENAME} option to all GNUnet
3650commands.
3651
3652Assuming the configuration file is called @file{~/.config/gnunet.conf},
3653you start your peer using the @code{gnunet-arm} command (say as user
3654@code{gnunet}) using:
3655
3656@example
3657gnunet-arm -c ~/.config/gnunet.conf -s
3658@end example
3659
3660@noindent
3661The "-s" option here is for "start". The command should return almost
3662instantly. If you want to stop GNUnet, you can use:
3663
3664@example
3665gnunet-arm -c ~/.config/gnunet.conf -e
3666@end example
3667
3668@noindent
3669The "-e" option here is for "end".
3670
3671Note that this will only start the basic peer, no actual applications
3672will be available.
3673If you want to start the file-sharing service, use (after starting
3674GNUnet):
3675
3676@example
3677gnunet-arm -c ~/.config/gnunet.conf -i fs
3678@end example
3679
3680@noindent
3681The "-i fs" option here is for "initialize" the "fs" (file-sharing)
3682application. You can also selectively kill only file-sharing support using
3683
3684@example
3685gnunet-arm -c ~/.config/gnunet.conf -k fs
3686@end example
3687
3688@noindent
3689Assuming that you want certain services (like file-sharing) to be always
3690automatically started whenever you start GNUnet, you can activate them by
3691setting "FORCESTART=YES" in the respective section of the configuration
3692file (for example, "[fs]"). Then GNUnet with file-sharing support would
3693be started whenever you@ enter:
3694
3695@example
3696gnunet-arm -c ~/.config/gnunet.conf -s
3697@end example
3698
3699@noindent
3700Alternatively, you can combine the two options:
3701
3702@example
3703gnunet-arm -c ~/.config/gnunet.conf -s -i fs
3704@end example
3705
3706@noindent
3707Using @code{gnunet-arm} is also the preferred method for initializing
3708GNUnet from @code{init}.
3709
3710Finally, you should edit your @code{crontab} (using the @code{crontab}
3711command) and insert a line@
3712
3713@example
3714@@reboot gnunet-arm -c ~/.config/gnunet.conf -s
3715@end example
3716
3717to automatically start your peer whenever your system boots.
3718
3719@node The Multi-User Setup
3720@subsection The Multi-User Setup
3721
3722This requires you to create a user @code{gnunet} and an additional group
3723@code{gnunetdns}, prior to running @code{make install} during
3724installation.
3725Then, you create a configuration file @file{/etc/gnunet.conf} which should
3726contain the lines:@
3727
3728@example
3729[arm]
3730SYSTEM_ONLY = YES
3731USER_ONLY = NO
3732@end example
3733
3734@noindent
3735Then, perform the same steps to run GNUnet as in the per-user
3736configuration, except as user @code{gnunet} (including the
3737@code{crontab} installation).
3738You may also want to run @code{gnunet-setup} to configure your peer
3739(databases, etc.).
3740Make sure to pass @code{-c /etc/gnunet.conf} to all commands. If you
3741run @code{gnunet-setup} as user @code{gnunet}, you might need to change
3742permissions on @file{/etc/gnunet.conf} so that the @code{gnunet} user can
3743write to the file (during setup).
3744
3745Afterwards, you need to perform another setup step for each normal user
3746account from which you want to access GNUnet. First, grant the normal user
3747(@code{$USER}) permission to the group gnunet:
3748
3749@example
3750# adduser $USER gnunet
3751@end example
3752
3753@noindent
3754Then, create a configuration file in @file{~/.config/gnunet.conf} for the
3755$USER with the lines:
3756
3757@example
3758[arm]
3759SYSTEM_ONLY = NO
3760USER_ONLY = YES
3761@end example
3762
3763@noindent
3764This will ensure that @code{gnunet-arm} when started by the normal user
3765will only run services that are per-user, and otherwise rely on the
3766system-wide services.
3767Note that the normal user may run gnunet-setup, but the
3768configuration would be ineffective as the system-wide services will use
3769@file{/etc/gnunet.conf} and ignore options set by individual users.
3770
3771Again, each user should then start the peer using
3772@file{gnunet-arm -s} --- and strongly consider adding logic to start
3773the peer automatically to their crontab.
3774
3775Afterwards, you should see two (or more, if you have more than one USER)
3776@code{gnunet-service-arm} processes running in your system.
3777
3778@node Killing GNUnet services
3779@subsection Killing GNUnet services
3780
3781It is not necessary to stop GNUnet services explicitly when shutting
3782down your computer.
3783
3784It should be noted that manually killing "most" of the
3785@code{gnunet-service} processes is generally not a successful method for
3786stopping a peer (since @code{gnunet-service-arm} will instantly restart
3787them). The best way to explicitly stop a peer is using
3788@code{gnunet-arm -e}; note that the per-user services may need to be
3789terminated before the system-wide services will terminate normally.
3790
3791@node Access Control for GNUnet
3792@subsection Access Control for GNUnet
3793
3794This chapter documents how we plan to make access control work within the
3795GNUnet system for a typical peer. It should be read as a best-practice
3796installation guide for advanced users and builders of binary
3797distributions. The recommendations in this guide apply to POSIX-systems
3798with full support for UNIX domain sockets only.
3799
3800Note that this is an advanced topic. The discussion presumes a very good
3801understanding of users, groups and file permissions. Normal users on
3802hosts with just a single user can just install GNUnet under their own
3803account (and possibly allow the installer to use SUDO to grant additional
3804permissions for special GNUnet tools that need additional rights).
3805The discussion below largely applies to installations where multiple users
3806share a system and to installations where the best possible security is
3807paramount.
3808
3809A typical GNUnet system consists of components that fall into four
3810categories:
3811
3812@table @asis
3813
3814@item User interfaces
3815User interfaces are not security sensitive and are supposed to be run and
3816used by normal system users.
3817The GTK GUIs and most command-line programs fall into this category.
3818Some command-line tools (like gnunet-transport) should be excluded as they
3819offer low-level access that normal users should not need.
3820@item System services and support tools
3821System services should always run and offer services that can then be
3822accessed by the normal users.
3823System services do not require special permissions, but as they are not
3824specific to a particular user, they probably should not run as a
3825particular user. Also, there should typically only be one GNUnet peer per
3826host. System services include the gnunet-service and gnunet-daemon
3827programs; support tools include command-line programs such as gnunet-arm.
3828@item Priviledged helpers
3829Some GNUnet components require root rights to open raw sockets or perform
3830other special operations. These gnunet-helper binaries are typically
3831installed SUID and run from services or daemons.
3832@item Critical services
3833Some GNUnet services (such as the DNS service) can manipulate the service
3834in deep and possibly highly security sensitive ways. For example, the DNS
3835service can be used to intercept and alter any DNS query originating from
3836the local machine. Access to the APIs of these critical services and their
3837priviledged helpers must be tightly controlled.
3838@end table
3839
3840@c FIXME: The titles of these chapters are too long in the index.
3841
3842@menu
3843* Recommendation - Disable access to services via TCP::
3844* Recommendation - Run most services as system user "gnunet"::
3845* Recommendation - Control access to services using group "gnunet"::
3846* Recommendation - Limit access to certain SUID binaries by group "gnunet"::
3847* Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"::
3848* Differences between "make install" and these recommendations::
3849@end menu
3850
3851@node Recommendation - Disable access to services via TCP
3852@subsubsection Recommendation - Disable access to services via TCP
3853
3854GNUnet services allow two types of access: via TCP socket or via UNIX
3855domain socket.
3856If the service is available via TCP, access control can only be
3857implemented by restricting connections to a particular range of IP
3858addresses.
3859This is acceptable for non-critical services that are supposed to be
3860available to all users on the local system or local network.
3861However, as TCP is generally less efficient and it is rarely the case
3862that a single GNUnet peer is supposed to serve an entire local network,
3863the default configuration should disable TCP access to all GNUnet
3864services on systems with support for UNIX domain sockets.
3865As of GNUnet 0.9.2, configuration files with TCP access disabled should be
3866generated by default. Users can re-enable TCP access to particular
3867services simply by specifying a non-zero port number in the section of
3868the respective service.
3869
3870
3871@node Recommendation - Run most services as system user "gnunet"
3872@subsubsection Recommendation - Run most services as system user "gnunet"
3873
3874GNUnet's main services should be run as a separate user "gnunet" in a
3875special group "gnunet".
3876The user "gnunet" should start the peer using "gnunet-arm -s" during
3877system startup. The home directory for this user should be
3878@file{/var/lib/gnunet} and the configuration file should be
3879@file{/etc/gnunet.conf}.
3880Only the @code{gnunet} user should have the right to access
3881@file{/var/lib/gnunet} (@emph{mode: 700}).
3882
3883@node Recommendation - Control access to services using group "gnunet"
3884@subsubsection Recommendation - Control access to services using group "gnunet"
3885
3886Users that should be allowed to use the GNUnet peer should be added to the
3887group "gnunet". Using GNUnet's access control mechanism for UNIX domain
3888sockets, those services that are considered useful to ordinary users
3889should be made available by setting "UNIX_MATCH_GID=YES" for those
3890services.
3891Again, as shipped, GNUnet provides reasonable defaults.
3892Permissions to access the transport and core subsystems might additionally
3893be granted without necessarily causing security concerns.
3894Some services, such as DNS, must NOT be made accessible to the "gnunet"
3895group (and should thus only be accessible to the "gnunet" user and
3896services running with this UID).
3897
3898@node Recommendation - Limit access to certain SUID binaries by group "gnunet"
3899@subsubsection Recommendation - Limit access to certain SUID binaries by group "gnunet"
3900
3901Most of GNUnet's SUID binaries should be safe even if executed by normal
3902users. However, it is possible to reduce the risk a little bit more by
3903making these binaries owned by the group "gnunet" and restricting their
3904execution to user of the group "gnunet" as well (4750).
3905
3906@node Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"
3907@subsubsection Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"
3908
3909A special group "gnunetdns" should be created for controlling access to
3910the "gnunet-helper-dns".
3911The binary should then be owned by root and be in group "gnunetdns" and
3912be installed SUID and only be group-executable (2750).
3913@b{Note that the group "gnunetdns" should have no users in it at all,
3914ever.}
3915The "gnunet-service-dns" program should be executed by user "gnunet" (via
3916gnunet-service-arm) with the binary owned by the user "root" and the group
3917"gnunetdns" and be SGID (2700). This way, @strong{only}
3918"gnunet-service-dns" can change its group to "gnunetdns" and execute the
3919helper, and the helper can then run as root (as per SUID).
3920Access to the API offered by "gnunet-service-dns" is in turn restricted
3921to the user "gnunet" (not the group!), which means that only
3922"benign" services can manipulate DNS queries using "gnunet-service-dns".
3923
3924@node Differences between "make install" and these recommendations
3925@subsubsection Differences between "make install" and these recommendations
3926
3927The current build system does not set all permissions automatically based
3928on the recommendations above. In particular, it does not use the group
3929"gnunet" at all (so setting gnunet-helpers other than the
3930gnunet-helper-dns to be owned by group "gnunet" must be done manually).
3931Furthermore, 'make install' will silently fail to set the DNS binaries to
3932be owned by group "gnunetdns" unless that group already exists (!).
3933An alternative name for the "gnunetdns" group can be specified using the
3934@code{--with-gnunetdns=GRPNAME} configure option.
diff --git a/doc/documentation/gnunet.texi b/doc/documentation/gnunet.texi
index 13c3aa9c8..618915501 100644
--- a/doc/documentation/gnunet.texi
+++ b/doc/documentation/gnunet.texi
@@ -123,6 +123,8 @@ Using GNUnet
123* File-sharing:: 123* File-sharing::
124* The GNU Name System:: 124* The GNU Name System::
125* Using the Virtual Public Network:: 125* Using the Virtual Public Network::
126* The graphical configuration interface::
127* How to start and stop a GNUnet peer::
126 128
127GNUnet Contributors Handbook 129GNUnet Contributors Handbook
128 130
@@ -183,20 +185,10 @@ GNUnet Developer Handbook
183@include chapters/philosophy.texi 185@include chapters/philosophy.texi
184@c ********************************************************************* 186@c *********************************************************************
185 187
186@c WIP:
187@c @include chapters/vocabulary.texi
188
189@c *********************************************************************
190@include chapters/installation.texi
191@c *********************************************************************
192
193@c ********************************************************************* 188@c *********************************************************************
194@include chapters/user.texi 189@include chapters/user.texi
195@c ********************************************************************* 190@c *********************************************************************
196 191
197@c WIP:
198@c @include chapters/configuration.texi
199
200@include chapters/contributing.texi 192@include chapters/contributing.texi
201 193
202@c ********************************************************************* 194@c *********************************************************************