gnunet-handbook

The GNUnet Handbook
Log | Files | Refs

configuration.rst (51631B)


      1 Advanced Configuration
      2 ----------------------
      3 
      4 
      5 .. _Config-file-format:
      6 
      7 Config file format
      8 ~~~~~~~~~~~~~~~~~~
      9 
     10 In GNUnet realm, all components obey the same pattern to get
     11 configuration values. According to this pattern, once the component has
     12 been installed, the installation deploys default values in
     13 ``$prefix/share/gnunet/config.d/``, in ``.conf`` files. In order to
     14 override these defaults, the user can write a custom ``.conf`` file and
     15 either pass it to the component at execution time, or name it
     16 ``gnunet.conf`` and place it under ``$HOME/.config/``.
     17 
     18 A config file is a text file containing sections, and each section
     19 contains its values. The right format follows:
     20 
     21 .. code-block:: text
     22 
     23    [section1]
     24    value1 = string
     25    value2 = 23
     26 
     27    [section2]
     28    value21 = string
     29    value22 = /path22
     30 
     31 Throughout any configuration file, it is possible to use ``$``-prefixed
     32 variables, like ``$VAR``, especially when they represent filenames in in
     33 the filesystem. It is also possible to provide defaults values for those
     34 variables that are unset, by using the following syntax:
     35 
     36 .. code-block:: text
     37 
     38    ${VAR:-default}
     39 
     40 However, there are two ways a user can set ``$``-prefixable variables:
     41 (a) by defining them under a ``[paths]`` section
     42 
     43 .. code-block:: text
     44 
     45    [paths]
     46    GNUNET_DEPLOYMENT_SHARED = ${HOME}/shared-data
     47    ..
     48    [section-x]
     49    path-x = ${GNUNET_DEPLOYMENT_SHARED}/x
     50 
     51 or (b) by setting them in the environment
     52 
     53 .. code-block:: text
     54 
     55    $ export VAR=/x
     56 
     57 The configuration loader will give precedence to variables set under
     58 ``[path]``, though.
     59 
     60 The utility '\ ``gnunet-config``\ ', which gets installed along with
     61 GNUnet, serves to get and set configuration values without directly
     62 editing the ``.conf`` file. The option '\ ``-f``\ ' is particularly
     63 useful to resolve filenames, when they use several levels of
     64 ``$``-expanded variables. See '\ ``gnunet-config --help``\ '.
     65 
     66 Note that, in this stage of development, the file
     67 ``$HOME/.config/gnunet.conf`` can contain sections for **all** the
     68 components.
     69 .. _The-Single_002dUser-Setup:
     70 
     71 The Single-User Setup
     72 ~~~~~~~~~~~~~~~~~~~~~
     73 
     74 For the single-user setup, you do not need to do anything special and
     75 can just start the GNUnet background processes using ``gnunet-arm``. By
     76 default, GNUnet looks in ``~/.config/gnunet.conf`` for a configuration
     77 (or ``$XDG_CONFIG_HOME/gnunet.conf`` if ``$XDG_CONFIG_HOME`` is
     78 defined). If your configuration lives elsewhere, you need to pass the
     79 ``-c FILENAME`` option to all GNUnet commands.
     80 
     81 Assuming the configuration file is called ``~/.config/gnunet.conf``, you
     82 start your peer using the ``gnunet-arm`` command (say as user
     83 ``gnunet``) using:
     84 
     85 
     86 .. code-block:: text
     87 
     88    gnunet-arm -c ~/.config/gnunet.conf -s
     89 
     90 The \"-s\" option here is for \"start\". The command should return
     91 almost instantly. If you want to stop GNUnet, you can use:
     92 
     93 .. code-block:: text
     94 
     95    gnunet-arm -c ~/.config/gnunet.conf -e
     96 
     97 The \"-e\" option here is for \"end\".
     98 
     99 Note that this will only start the basic peer, no actual applications
    100 will be available. If you want to start the file-sharing service, use
    101 (after starting GNUnet):
    102 
    103 .. code-block:: text
    104 
    105    gnunet-arm -c ~/.config/gnunet.conf -i fs
    106 
    107 The \"-i fs\" option here is for \"initialize\" the \"fs\"
    108 (file-sharing) application. You can also selectively kill only
    109 file-sharing support using
    110 
    111 .. code-block:: text
    112 
    113    gnunet-arm -c ~/.config/gnunet.conf -k fs
    114 
    115 Assuming that you want certain services (like file-sharing) to be always
    116 automatically started whenever you start GNUnet, you can activate them
    117 by setting \"IMMEDIATE_START=YES\" in the respective section of the
    118 configuration file (for example, \"[fs]\"). Then GNUnet with
    119 file-sharing support would be started whenever you enter:
    120 
    121 .. code-block:: text
    122 
    123    gnunet-arm -c ~/.config/gnunet.conf -s
    124 
    125 Alternatively, you can combine the two options:
    126 
    127 .. code-block:: text
    128 
    129    gnunet-arm -c ~/.config/gnunet.conf -s -i fs
    130 
    131 Using ``gnunet-arm`` is also the preferred method for initializing
    132 GNUnet from ``init``.
    133 
    134 Finally, you should edit your ``crontab`` (using the ``crontab``
    135 command) and insert a line 
    136 
    137 .. code-block:: text
    138 
    139    @reboot gnunet-arm -c ~/.config/gnunet.conf -s
    140 
    141 to automatically start your peer whenever your system boots.
    142 
    143 .. _The-Multi_002dUser-Setup:
    144 
    145 The Multi-User Setup
    146 ~~~~~~~~~~~~~~~~~~~~
    147 
    148 This requires you to create a user ``gnunet`` and an additional group
    149 ``gnunetdns``, prior to running ``make install`` during installation.
    150 Then, you create a configuration file ``/etc/gnunet.conf`` which should
    151 contain the lines: 
    152 
    153 .. code-block:: text
    154 
    155    [arm]
    156    START_SYSTEM_SERVICES = YES
    157    START_USER_SERVICES = NO
    158 
    159 Then, perform the same steps to run GNUnet as in the per-user
    160 configuration, except as user ``gnunet`` (including the ``crontab``
    161 installation). You may also want to run ``gnunet-setup`` to configure
    162 your peer (databases, etc.). Make sure to pass ``-c /etc/gnunet.conf``
    163 to all commands. If you run ``gnunet-setup`` as user ``gnunet``, you
    164 might need to change permissions on ``/etc/gnunet.conf`` so that the
    165 ``gnunet`` user can write to the file (during setup).
    166 
    167 Afterwards, you need to perform another setup step for each normal user
    168 account from which you want to access GNUnet. First, grant the normal
    169 user (``$USER``) permission to the group gnunet:
    170 
    171 .. code-block:: text
    172 
    173    # adduser $USER gnunet
    174 
    175 Then, create a configuration file in ``~/.config/gnunet.conf`` for the
    176 $USER with the lines:
    177 
    178 .. code-block:: text
    179 
    180    [arm]
    181    START_SYSTEM_SERVICES = NO
    182    START_USER_SERVICES = YES
    183 
    184 This will ensure that ``gnunet-arm`` when started by the normal user
    185 will only run services that are per-user, and otherwise rely on the
    186 system-wide services. Note that the normal user may run gnunet-setup,
    187 but the configuration would be ineffective as the system-wide services
    188 will use ``/etc/gnunet.conf`` and ignore options set by individual
    189 users.
    190 
    191 Again, each user should then start the peer using ``gnunet-arm -s`` ---
    192 and strongly consider adding logic to start the peer automatically to
    193 their crontab.
    194 
    195 Afterwards, you should see two (or more, if you have more than one USER)
    196 ``gnunet-service-arm`` processes running in your system.
    197 
    198 .. _Access-Control-for-GNUnet:
    199 
    200 Access Control for GNUnet
    201 ~~~~~~~~~~~~~~~~~~~~~~~~~
    202 
    203 This chapter documents how we plan to make access control work within
    204 the GNUnet system for a typical peer. It should be read as a
    205 best-practice installation guide for advanced users and builders of
    206 binary distributions. The recommendations in this guide apply to
    207 POSIX-systems with full support for UNIX domain sockets only.
    208 
    209 Note that this is an advanced topic. The discussion presumes a very good
    210 understanding of users, groups and file permissions. Normal users on
    211 hosts with just a single user can just install GNUnet under their own
    212 account (and possibly allow the installer to use SUDO to grant
    213 additional permissions for special GNUnet tools that need additional
    214 rights). The discussion below largely applies to installations where
    215 multiple users share a system and to installations where the best
    216 possible security is paramount.
    217 
    218 A typical GNUnet system consists of components that fall into four
    219 categories:
    220 
    221 User interfaces
    222    User interfaces are not security sensitive and are supposed to be run
    223    and used by normal system users. The GTK GUIs and most command-line
    224    programs fall into this category. Some command-line tools (like
    225    gnunet-transport) should be excluded as they offer low-level access
    226    that normal users should not need.
    227 
    228 System services and support tools
    229    System services should always run and offer services that can then be
    230    accessed by the normal users. System services do not require special
    231    permissions, but as they are not specific to a particular user, they
    232    probably should not run as a particular user. Also, there should
    233    typically only be one GNUnet peer per host. System services include
    234    the gnunet-service and gnunet-daemon programs; support tools include
    235    command-line programs such as gnunet-arm.
    236 
    237 Privileged helpers
    238    Some GNUnet components require root rights to open raw sockets or
    239    perform other special operations. These gnunet-helper binaries are
    240    typically installed SUID and run from services or daemons.
    241 
    242 Critical services
    243    Some GNUnet services (such as the DNS service) can manipulate the
    244    service in deep and possibly highly security sensitive ways. For
    245    example, the DNS service can be used to intercept and alter any DNS
    246    query originating from the local machine. Access to the APIs of these
    247    critical services and their privileged helpers must be tightly
    248    controlled.
    249 
    250 .. todo:: Shorten these subsection titles
    251 
    252 .. _Recommendation-_002d-Disable-access-to-services-via-TCP:
    253 
    254 Recommendation - Disable access to services via TCP
    255 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    256 
    257 GNUnet services allow two types of access: via TCP socket or via UNIX
    258 domain socket. If the service is available via TCP, access control can
    259 only be implemented by restricting connections to a particular range of
    260 IP addresses. This is acceptable for non-critical services that are
    261 supposed to be available to all users on the local system or local
    262 network. However, as TCP is generally less efficient and it is rarely
    263 the case that a single GNUnet peer is supposed to serve an entire local
    264 network, the default configuration should disable TCP access to all
    265 GNUnet services on systems with support for UNIX domain sockets. Since
    266 GNUnet 0.9.2, configuration files with TCP access disabled should be
    267 generated by default. Users can re-enable TCP access to particular
    268 services simply by specifying a non-zero port number in the section of
    269 the respective service.
    270 
    271 .. _Recommendation-_002d-Run-most-services-as-system-user-_0022gnunet_0022:
    272 
    273 Recommendation - Run most services as system user \"gnunet\"
    274 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    275 
    276 GNUnet's main services should be run as a separate user \"gnunet\" in a
    277 special group \"gnunet\". The user \"gnunet\" should start the peer
    278 using \"gnunet-arm -s\" during system startup. The home directory for
    279 this user should be ``/var/lib/gnunet`` and the configuration file
    280 should be ``/etc/gnunet.conf``. Only the ``gnunet`` user should have the
    281 right to access ``/var/lib/gnunet`` (*mode: 700*).
    282 
    283 .. _Recommendation-_002d-Control-access-to-services-using-group-_0022gnunet_0022:
    284 
    285 Recommendation - Control access to services using group \"gnunet\"
    286 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    287 
    288 Users that should be allowed to use the GNUnet peer should be added to
    289 the group \"gnunet\". Using GNUnet's access control mechanism for UNIX
    290 domain sockets, those services that are considered useful to ordinary
    291 users should be made available by setting \"UNIX_MATCH_GID=YES\" for
    292 those services. Again, as shipped, GNUnet provides reasonable defaults.
    293 Permissions to access the transport and core subsystems might
    294 additionally be granted without necessarily causing security concerns.
    295 Some services, such as DNS, must NOT be made accessible to the
    296 \"gnunet\" group (and should thus only be accessible to the \"gnunet\"
    297 user and services running with this UID).
    298 
    299 .. _Recommendation-_002d-Limit-access-to-certain-SUID-binaries-by-group-_0022gnunet_0022:
    300 
    301 Recommendation - Limit access to certain SUID binaries by group \"gnunet\"
    302 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    303 
    304 Most of GNUnet's SUID binaries should be safe even if executed by normal
    305 users. However, it is possible to reduce the risk a little bit more by
    306 making these binaries owned by the group \"gnunet\" and restricting
    307 their execution to user of the group \"gnunet\" as well (4750).
    308 
    309 .. _Recommendation-_002d-Limit-access-to-critical-gnunet_002dhelper_002ddns-to-group-_0022gnunetdns_0022:
    310 
    311 Recommendation - Limit access to critical gnunet-helper-dns to group \"gnunetdns\"
    312 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    313 
    314 A special group \"gnunetdns\" should be created for controlling access
    315 to the \"gnunet-helper-dns\". The binary should then be owned by root
    316 and be in group \"gnunetdns\" and be installed SUID and only be
    317 group-executable (2750). **Note that the group \"gnunetdns\" should have
    318 no users in it at all, ever.** The \"gnunet-service-dns\" program should
    319 be executed by user \"gnunet\" (via gnunet-service-arm) with the binary
    320 owned by the user \"root\" and the group \"gnunetdns\" and be SGID
    321 (2700). This way, **only** \"gnunet-service-dns\" can change its group
    322 to \"gnunetdns\" and execute the helper, and the helper can then run as
    323 root (as per SUID). Access to the API offered by \"gnunet-service-dns\"
    324 is in turn restricted to the user \"gnunet\" (not the group!), which
    325 means that only \"benign\" services can manipulate DNS queries using
    326 \"gnunet-service-dns\".
    327 
    328 .. _Differences-between-_0022make-install_0022-and-these-recommendations:
    329 
    330 Differences between \"make install\" and these recommendations
    331 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    332 
    333 The current build system does not set all permissions automatically
    334 based on the recommendations above. In particular, it does not use the
    335 group \"gnunet\" at all (so setting gnunet-helpers other than the
    336 gnunet-helper-dns to be owned by group \"gnunet\" must be done
    337 manually). Furthermore, 'make install' will silently fail to set the DNS
    338 binaries to be owned by group \"gnunetdns\" unless that group already
    339 exists (!). An alternative name for the \"gnunetdns\" group can be
    340 specified using the ``--with-gnunetdns=GRPNAME`` configure option.
    341 
    342 
    343 
    344 .. _Configuring-the-hostlist-to-bootstrap:
    345 
    346 Configuring the hostlist to bootstrap
    347 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    348 
    349 After installing the software you need to get connected to the GNUnet
    350 network. The configuration file included in your download is already
    351 configured to connect you to the GNUnet network. In this section the
    352 relevant configuration settings are explained.
    353 
    354 To get an initial connection to the GNUnet network and to get to know
    355 peers already connected to the network you can use the so called
    356 \"bootstrap servers\". These servers can give you a list of peers
    357 connected to the network. To use these bootstrap servers you have to
    358 configure the hostlist daemon to activate bootstrapping.
    359 
    360 To activate bootstrapping, edit the ``[hostlist]``-section in your
    361 configuration file. You have to set the argument ``-b`` in the options
    362 line:
    363 
    364 .. code-block:: text
    365 
    366    [hostlist]
    367    OPTIONS = -b
    368 
    369 Additionally you have to specify which server you want to use. The
    370 default bootstrapping server is \"http://v10.gnunet.org/hostlist\". [^]
    371 To set the server you have to edit the line \"SERVERS\" in the hostlist
    372 section. To use the default server you should set the lines to
    373 
    374 .. code-block:: text
    375 
    376    SERVERS = http://v10.gnunet.org/hostlist [^]
    377 
    378 To use bootstrapping your configuration file should include these lines:
    379 
    380 .. code-block:: text
    381 
    382    [hostlist]
    383    OPTIONS = -b
    384    SERVERS = http://v10.gnunet.org/hostlist [^]
    385 
    386 Besides using bootstrap servers you can configure your GNUnet peer to
    387 receive hostlist advertisements. Peers offering hostlists to other peers
    388 can send advertisement messages to peers that connect to them. If you
    389 configure your peer to receive these messages, your peer can download
    390 these lists and connect to the peers included. These lists are
    391 persistent, which means that they are saved to your hard disk regularly
    392 and are loaded during startup.
    393 
    394 To activate hostlist learning you have to add the ``-e`` switch to the
    395 ``OPTIONS`` line in the hostlist section:
    396 
    397 .. code-block:: text
    398 
    399    [hostlist]
    400    OPTIONS = -b -e
    401 
    402 Furthermore you can specify in which file the lists are saved. To save
    403 the lists in the file ``hostlists.file`` just add the line:
    404 
    405 .. code-block:: text
    406 
    407    HOSTLISTFILE = hostlists.file
    408 
    409 Best practice is to activate both bootstrapping and hostlist learning.
    410 So your configuration file should include these lines:
    411 
    412 .. code-block:: text
    413 
    414    [hostlist]
    415    OPTIONS = -b -e
    416    HTTPPORT = 8080
    417    SERVERS = http://v10.gnunet.org/hostlist [^]
    418    HOSTLISTFILE = $SERVICEHOME/hostlists.file
    419 
    420 
    421 .. _Disable_default_bootstrap:
    422 
    423 Disable default bootstrap (private network)
    424 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    425 
    426 A public node will, by default, connect to a gnunet.org peer to learn
    427 of other peers to bootstrap the network.
    428 
    429 To avoid this behavior, either:
    430 
    431 - before build, remove the peer entry in ``$REPO/contrib/hellos``
    432 
    433 - after build, remove the peer entry in ``$PREFIX/share/gnunet/hellos``
    434 
    435 Conversely, any public keys added to the same directories will make the
    436 node *always* make explicit connections to those corresponding peers.
    437 
    438 The use of the HELLOs in this folder can be controlled with the configuration
    439 setting ``USE_INCLUDED_HELLOS`` of the ``peerstore`` service:
    440 
    441 .. code-block:: text
    442 
    443    $ gnunet-config -s peerstore -o USE_INCLUDED_HELLOS
    444 
    445 Note, however, that once the included HELLOs have been parsed, the ``peerstore``
    446 will cache them locally in its databse. To purge included HELLOs in this case,
    447 the database will have to be deleted.
    448 
    449 Unless you want to establish a private network, you should not have to touch
    450 this option.
    451 
    452 .. _Manually-connecting-peers:
    453 
    454 Manually connecting peers
    455 ~~~~~~~~~~~~~~~~~~~~~~~~~
    456 
    457 A gnunet node will learn peers to connect to from hostlist servers and/or
    458 gossip from connected peers. It will however only connect to a selection
    459 of peers on the network.
    460 
    461 If you wish to connect to a specific peer apart from the automatically
    462 negotiated connections, you can use the ``hello`` URI of the peer. The
    463 URI is returned by the following command to *peer to be connected to*:
    464 
    465 .. code-block:: text
    466 
    467    $ gnunet-hello --export-hello
    468 
    469 The URI output is passed to the ``gnunet-hello`` command of *peer
    470 that is connecting*:
    471 
    472 .. code-block:: text
    473 
    474    $ echo "gnunet://hello/..." | gnunet-hello --import-hello
    475 
    476 
    477 .. _Configuration-of-the-HOSTLIST-proxy-settings-cli:
    478 
    479 Configuration of the HOSTLIST proxy settings
    480 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    481 
    482 The hostlist client can be configured to use a proxy to connect to the
    483 hostlist server.
    484 
    485 The hostlist client supports the following proxy types at the moment:
    486 
    487 -  HTTP and HTTP 1.0 only proxy
    488 
    489 -  SOCKS 4/4a/5/5 with hostname
    490 
    491 In addition authentication at the proxy with username and password can
    492 be configured.
    493 
    494 To provide these options directly in the configuration, you can enter
    495 the following settings in the ``[hostlist]`` section of the
    496 configuration:
    497 
    498 .. code-block:: text
    499 
    500    # Type of proxy server,
    501    # Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
    502    # Default: HTTP
    503    # PROXY_TYPE = HTTP
    504 
    505    # Hostname or IP of proxy server
    506    # PROXY =
    507    # User name for proxy server
    508    # PROXY_USERNAME =
    509    # User password for proxy server
    510    # PROXY_PASSWORD =
    511 
    512 .. _Configuring-your-peer-to-provide-a-hostlist:
    513 
    514 Configuring your peer to provide a hostlist
    515 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    516 
    517 If you operate a peer permanently connected to GNUnet you can configure
    518 your peer to act as a hostlist server, providing other peers the list of
    519 peers known to him.
    520 
    521 Your server can act as a bootstrap server and peers needing to obtain a
    522 list of peers can contact it to download this list. To download this
    523 hostlist the peer uses HTTP. For this reason you have to build your peer
    524 with libgnurl (or libcurl) and microhttpd support.
    525 
    526 To configure your peer to act as a bootstrap server you have to add the
    527 ``-p`` option to ``OPTIONS`` in the ``[hostlist]`` section of your
    528 configuration file. Besides that you have to specify a port number for
    529 the http server. In conclusion you have to add the following lines:
    530 
    531 .. code-block:: text
    532 
    533    [hostlist]
    534    HTTPPORT = 12980
    535    OPTIONS = -p
    536 
    537 If your peer acts as a bootstrap server other peers should know about
    538 that. You can advertise the hostlist your are providing to other peers.
    539 Peers connecting to your peer will get a message containing an
    540 advertisement for your hostlist and the URL where it can be downloaded.
    541 If this peer is in learning mode, it will test the hostlist and, in the
    542 case it can obtain the list successfully, it will save it for
    543 bootstrapping.
    544 
    545 To activate hostlist advertisement on your peer, you have to set the
    546 following lines in your configuration file:
    547 
    548 .. code-block:: text
    549 
    550    [hostlist]
    551    EXTERNAL_DNS_NAME = example.org
    552    HTTPPORT = 12981
    553    OPTIONS = -p -a
    554 
    555 With this configuration your peer will a act as a bootstrap server and
    556 advertise this hostlist to other peers connecting to it. The URL used to
    557 download the list will be ``http://example.org:12981/``.
    558 
    559 Please notice:
    560 
    561 -  The hostlist is **not** human readable, so you should not try to
    562    download it using your webbrowser. Just point your GNUnet peer to the
    563    address!
    564 
    565 -  Advertising without providing a hostlist does not make sense and will
    566    not work.
    567 
    568 .. _Configuring-the-datastore:
    569 
    570 Configuring the datastore
    571 ~~~~~~~~~~~~~~~~~~~~~~~~~
    572 
    573 The datastore is what GNUnet uses for long-term storage of file-sharing
    574 data. Note that long-term does not mean 'forever' since content does
    575 have an expiration date, and of course storage space is finite (and
    576 hence sometimes content may have to be discarded).
    577 
    578 Use the ``QUOTA`` option to specify how many bytes of storage space you
    579 are willing to dedicate to GNUnet.
    580 
    581 In addition to specifying the maximum space GNUnet is allowed to use for
    582 the datastore, you need to specify which database GNUnet should use to
    583 do so. Currently, you have the choice between sqlite and
    584 Postgres.
    585 
    586 .. _Configuring-the-Postgres-database:
    587 
    588 Configuring the Postgres database
    589 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    590 
    591 This text describes how to setup the Postgres database for GNUnet.
    592 
    593 This Postgres plugin was developed for Postgres 8.3 but might work for
    594 earlier versions as well.
    595 
    596 .. _Reasons-to-use-Postgres:
    597 
    598 Reasons to use Postgres
    599 ~~~~~~~~~~~~~~~~~~~~~~~
    600 
    601 -  Easier to setup than MySQL
    602 
    603 -  Real database
    604 
    605 .. _Reasons-not-to-use-Postgres:
    606 
    607 Reasons not to use Postgres
    608 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    609 
    610 -  Quite slow
    611 
    612 -  Still some manual setup required
    613 
    614 .. _Manual-setup-instructions:
    615 
    616 Manual setup instructions
    617 ~~~~~~~~~~~~~~~~~~~~~~~~~
    618 
    619 -  In ``gnunet.conf`` set in section ``DATASTORE`` the value for
    620    ``DATABASE`` to ``postgres``.
    621 
    622 -  Access Postgres to create a user:
    623 
    624    with Postgres 8.x, use:
    625       ::
    626 
    627          # su - postgres
    628          $ createuser
    629 
    630       and enter the name of the user running GNUnet for the role
    631       interactively. Then, when prompted, do not set it to superuser,
    632       allow the creation of databases, and do not allow the creation of
    633       new roles.
    634 
    635    with Postgres 9.x, use:
    636       ::
    637 
    638          # su - postgres
    639          $ createuser -d $GNUNET_USER
    640 
    641       where $GNUNET_USER is the name of the user running GNUnet.
    642 
    643 -  As that user (so typically as user \"gnunet\"), create a database (or
    644    two):
    645 
    646    ::
    647 
    648       $ createdb gnunet
    649       # this way you can run "make check"
    650       $ createdb gnunetcheck
    651 
    652 Now you should be able to start ``gnunet-arm``.
    653 
    654 .. _Testing-the-setup-manually:
    655 
    656 Testing the setup manually
    657 ~~~~~~~~~~~~~~~~~~~~~~~~~~
    658 
    659 You may want to try if the database connection works. First, again login
    660 as the user who will run ``gnunet-arm``. Then use:
    661 
    662 .. code-block:: psql
    663 
    664    $ psql gnunet # or gnunetcheck
    665    gnunet=> \dt
    666 
    667 If, after you have started ``gnunet-arm`` at least once, you get a
    668 ``gn090`` table here, it probably works.
    669 
    670 .. _Configuring-the-datacache:
    671 
    672 Configuring the datacache
    673 ~~~~~~~~~~~~~~~~~~~~~~~~~
    674 
    675 The datacache is what GNUnet uses for storing temporary data. This data
    676 is expected to be wiped completely each time GNUnet is restarted (or the
    677 system is rebooted).
    678 
    679 You need to specify how many bytes GNUnet is allowed to use for the
    680 datacache using the ``QUOTA`` option in the section ``[dhtcache]``.
    681 Furthermore, you need to specify which database backend should be used
    682 to store the data. Currently, you have the choice between sqLite, MySQL
    683 and Postgres.
    684 
    685 .. _Configuring-the-file_002dsharing-service:
    686 
    687 Configuring the file-sharing service
    688 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    689 
    690 In order to use GNUnet for file-sharing, you first need to make sure
    691 that the file-sharing service is loaded. This is done by setting the
    692 ``START_ON_DEMAND`` option in section ``[fs]`` to \"YES\".
    693 Alternatively, you can run
    694 
    695 .. code-block:: text
    696 
    697    $ gnunet-arm -i fs
    698 
    699 to start the file-sharing service by hand.
    700 
    701 Except for configuring the database and the datacache the only important
    702 option for file-sharing is content migration.
    703 
    704 Content migration allows your peer to cache content from other peers as
    705 well as send out content stored on your system without explicit
    706 requests. This content replication has positive and negative impacts on
    707 both system performance and privacy.
    708 
    709 FIXME: discuss the trade-offs. Here is some older text about it\...
    710 
    711 Setting this option to YES allows gnunetd to migrate data to the local
    712 machine. Setting this option to YES is highly recommended for
    713 efficiency. Its also the default. If you set this value to YES, GNUnet
    714 will store content on your machine that you cannot decrypt. While this
    715 may protect you from liability if the judge is sane, it may not (IANAL).
    716 If you put illegal content on your machine yourself, setting this option
    717 to YES will probably increase your chances to get away with it since you
    718 can plausibly deny that you inserted the content. Note that in either
    719 case, your anonymity would have to be broken first (which may be
    720 possible depending on the size of the GNUnet network and the strength of
    721 the adversary).
    722 
    723 .. _Configuring-logging:
    724 
    725 Configuring logging
    726 ~~~~~~~~~~~~~~~~~~~
    727 
    728 Since version 0.9.0, logging in GNUnet is controlled via the ``-L`` and
    729 ``-l`` options. Using ``-L``, a log level can be specified. With log
    730 level ``ERROR`` only serious errors are logged. The default log level is
    731 ``WARNING`` which causes anything of concern to be logged. Log level
    732 ``INFO`` can be used to log anything that might be interesting
    733 information whereas ``DEBUG`` can be used by developers to log debugging
    734 messages (but you need to run ``meson setup`` with
    735 ``-Dlogging=verbose`` to get them compiled). The ``-l`` option is
    736 used to specify the log file.
    737 
    738 Since most GNUnet services are managed by ``gnunet-arm``, using the
    739 ``-l`` or ``-L`` options directly is not possible. Instead, they can be
    740 specified using the ``OPTIONS`` configuration value in the respective
    741 section for the respective service. In order to enable logging globally
    742 without editing the ``OPTIONS`` values for each service, ``gnunet-arm``
    743 supports a ``GLOBAL_POSTFIX`` option. The value specified here is given
    744 as an extra option to all services for which the configuration does
    745 contain a service-specific ``OPTIONS`` field.
    746 
    747 ``GLOBAL_POSTFIX`` can contain the special sequence \"{}\" which is
    748 replaced by the name of the service that is being started. Furthermore,
    749 ``GLOBAL_POSTFIX`` is special in that sequences starting with \"$\"
    750 anywhere in the string are expanded (according to options in ``PATHS``);
    751 this expansion otherwise is only happening for filenames and then the
    752 \"$\" must be the first character in the option. Both of these
    753 restrictions do not apply to ``GLOBAL_POSTFIX``. Note that specifying
    754 ``%`` anywhere in the ``GLOBAL_POSTFIX`` disables both of these
    755 features.
    756 
    757 In summary, in order to get all services to log at level ``INFO`` to
    758 log-files called ``SERVICENAME-logs``, the following global prefix
    759 should be used:
    760 
    761 .. code-block:: text
    762 
    763    GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs -L INFO
    764 
    765 .. _Configuring-the-transport-service-and-plugins:
    766 
    767 Configuring the transport service and plugins
    768 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    769 
    770 The transport service in GNUnet is responsible to maintain basic
    771 connectivity to other peers. Besides initiating and keeping connections
    772 alive it is also responsible for address validation.
    773 
    774 The GNUnet transport supports more than one transport protocol. These
    775 protocols are configured together with the transport service.
    776 
    777 The configuration section for the transport service itself is quite
    778 similar to all the other services
    779 
    780 .. code-block:: text
    781 
    782    START_ON_DEMAND = YES
    783    @UNIXONLY@ PORT = 2091
    784    HOSTNAME = localhost
    785    HOME = $SERVICEHOME
    786    CONFIG = $DEFAULTCONFIG
    787    BINARY = gnunet-service-transport
    788    #PREFIX = valgrind
    789    NEIGHBOUR_LIMIT = 50
    790    ACCEPT_FROM = 127.0.0.1;
    791    ACCEPT_FROM6 = ::1;
    792    PLUGINS = tcp udp
    793    UNIXPATH = /tmp/gnunet-service-transport.sock
    794 
    795 Different are the settings for the plugins to load ``PLUGINS``. The
    796 first setting specifies which transport plugins to load.
    797 
    798 -  transport-unix A plugin for local only communication with UNIX domain
    799    sockets. Used for testing and available on unix systems only. Just
    800    set the port
    801 
    802    ::
    803 
    804       [transport-unix]
    805       PORT = 22086
    806       TESTING_IGNORE_KEYS = ACCEPT_FROM;
    807 
    808 -  transport-tcp A plugin for communication with TCP. Set port to 0 for
    809    client mode with outbound only connections
    810 
    811    ::
    812 
    813       [transport-tcp]
    814       # Use 0 to ONLY advertise as a peer behind NAT (no port binding)
    815       PORT = 2086
    816       ADVERTISED_PORT = 2086
    817       TESTING_IGNORE_KEYS = ACCEPT_FROM;
    818       # Maximum number of open TCP connections allowed
    819       MAX_CONNECTIONS = 128
    820 
    821 -  transport-udp A plugin for communication with UDP. Supports peer
    822    discovery using broadcasts.
    823 
    824    ::
    825 
    826       [transport-udp]
    827       PORT = 2086
    828       BROADCAST = YES
    829       BROADCAST_INTERVAL = 30 s
    830       MAX_BPS = 1000000
    831       TESTING_IGNORE_KEYS = ACCEPT_FROM;
    832 
    833 -  transport-http HTTP and HTTPS support is split in two part: a client
    834    plugin initiating outbound connections and a server part accepting
    835    connections from the client. The client plugin just takes the maximum
    836    number of connections as an argument.
    837 
    838    ::
    839 
    840       [transport-http_client]
    841       MAX_CONNECTIONS = 128
    842       TESTING_IGNORE_KEYS = ACCEPT_FROM;
    843 
    844    ::
    845 
    846       [transport-https_client]
    847       MAX_CONNECTIONS = 128
    848       TESTING_IGNORE_KEYS = ACCEPT_FROM;
    849 
    850    The server has a port configured and the maximum number of
    851    connections. The HTTPS part has two files with the certificate key
    852    and the certificate file.
    853 
    854    The server plugin supports reverse proxies, so a external hostname
    855    can be set using the ``EXTERNAL_HOSTNAME`` setting. The webserver
    856    under this address should forward the request to the peer and the
    857    configure port.
    858 
    859    ::
    860 
    861       [transport-http_server]
    862       EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de/gnunet
    863       PORT = 1080
    864       MAX_CONNECTIONS = 128
    865       TESTING_IGNORE_KEYS = ACCEPT_FROM;
    866 
    867    ::
    868 
    869       [transport-https_server]
    870       PORT = 4433
    871       CRYPTO_INIT = NORMAL
    872       KEY_FILE = https.key
    873       CERT_FILE = https.cert
    874       MAX_CONNECTIONS = 128
    875       TESTING_IGNORE_KEYS = ACCEPT_FROM;
    876 
    877 -  transport-wlan
    878 
    879    The next section describes how to setup the WLAN plugin, so here only
    880    the settings. Just specify the interface to use:
    881 
    882    ::
    883 
    884       [transport-wlan]
    885       # Name of the interface in monitor mode (typically monX)
    886       INTERFACE = mon0
    887       # Real hardware, no testing
    888       TESTMODE = 0
    889       TESTING_IGNORE_KEYS = ACCEPT_FROM;
    890 
    891 .. _Configuring-the-WLAN-transport-plugin:
    892 
    893 Configuring the WLAN transport plugin
    894 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    895 
    896 The wlan transport plugin enables GNUnet to send and to receive data on
    897 a wlan interface. It has not to be connected to a wlan network as long
    898 as sender and receiver are on the same channel. This enables you to get
    899 connection to GNUnet where no internet access is possible, for example
    900 during catastrophes or when censorship cuts you off from the internet.
    901 
    902 .. _Requirements-for-the-WLAN-plugin:
    903 
    904 Requirements for the WLAN plugin
    905 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    906 
    907 -  wlan network card with monitor support and packet injection (see
    908    `aircrack-ng.org <http://www.aircrack-ng.org/>`__)
    909 
    910 -  Linux kernel with mac80211 stack, introduced in 2.6.22, tested with
    911    2.6.35 and 2.6.38
    912 
    913 -  Wlantools to create the a monitor interface, tested with airmon-ng of
    914    the aircrack-ng package
    915 
    916 .. _Configuration:
    917 
    918 Configuration
    919 ^^^^^^^^^^^^^
    920 
    921 There are the following options for the wlan plugin (they should be like
    922 this in your default config file, you only need to adjust them if the
    923 values are incorrect for your system)
    924 
    925 .. code-block:: text
    926 
    927    # section for the wlan transport plugin
    928    [transport-wlan]
    929    # interface to use, more information in the
    930    # "Before starting GNUnet" section of the handbook.
    931    INTERFACE = mon0
    932    # testmode for developers:
    933    # 0 use wlan interface,
    934    #1 or 2 use loopback driver for tests 1 = server, 2 = client
    935    TESTMODE = 0
    936 
    937 .. _Before-starting-GNUnet:
    938 
    939 Before starting GNUnet
    940 ^^^^^^^^^^^^^^^^^^^^^^
    941 
    942 Before starting GNUnet, you have to make sure that your wlan interface
    943 is in monitor mode. One way to put the wlan interface into monitor mode
    944 (if your interface name is wlan0) is by executing:
    945 
    946 .. code-block:: text
    947 
    948    sudo airmon-ng start wlan0
    949 
    950 Here is an example what the result should look like:
    951 
    952 .. code-block:: text
    953 
    954    Interface Chipset Driver
    955    wlan0 Intel 4965 a/b/g/n iwl4965 - [phy0]
    956    (monitor mode enabled on mon0)
    957 
    958 The monitor interface is mon0 is the one that you have to put into the
    959 configuration file.
    960 
    961 .. _Limitations-and-known-bugs:
    962 
    963 Limitations and known bugs
    964 ^^^^^^^^^^^^^^^^^^^^^^^^^^
    965 
    966 Wlan speed is at the maximum of 1 Mbit/s because support for choosing
    967 the wlan speed with packet injection was removed in newer kernels.
    968 Please pester the kernel developers about fixing this.
    969 
    970 The interface channel depends on the wlan network that the card is
    971 connected to. If no connection has been made since the start of the
    972 computer, it is usually the first channel of the card. Peers will only
    973 find each other and communicate if they are on the same channel.
    974 Channels must be set manually, e.g. by using:
    975 
    976 .. code-block:: text
    977 
    978    iwconfig wlan0 channel 1
    979 
    980 .. _Configuring-HTTP_0028S_0029-reverse-proxy-functionality-using-Apache-or-nginx:
    981 
    982 Configuring HTTP(S) reverse proxy functionality using Apache or nginx
    983 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    984 
    985 The HTTP plugin supports data transfer using reverse proxies. A reverse
    986 proxy forwards the HTTP request he receives with a certain URL to
    987 another webserver, here a GNUnet peer.
    988 
    989 So if you have a running Apache or nginx webserver you can configure it
    990 to be a GNUnet reverse proxy. Especially if you have a well-known
    991 website this improves censorship resistance since it looks as normal
    992 surfing behaviour.
    993 
    994 To do so, you have to do two things:
    995 
    996 -  Configure your webserver to forward the GNUnet HTTP traffic
    997 
    998 -  Configure your GNUnet peer to announce the respective address
    999 
   1000 As an example we want to use GNUnet peer running:
   1001 
   1002 -  HTTP server plugin on ``gnunet.foo.org:1080``
   1003 
   1004 -  HTTPS server plugin on ``gnunet.foo.org:4433``
   1005 
   1006 -  A apache or nginx webserver on
   1007    `http://www.foo.org:80/ <http://www.foo.org/>`__
   1008 
   1009 -  A apache or nginx webserver on https://www.foo.org:443/
   1010 
   1011 And we want the webserver to accept GNUnet traffic under
   1012 ``http://www.foo.org/bar/``. The required steps are described here:
   1013 
   1014 .. _Reverse-Proxy-_002d-Configure-your-Apache2-HTTP-webserver:
   1015 
   1016 Reverse Proxy - Configure your Apache2 HTTP webserver
   1017 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1018 
   1019 First of all you need mod_proxy installed.
   1020 
   1021 Edit your webserver configuration. Edit ``/etc/apache2/apache2.conf`` or
   1022 the site-specific configuration file.
   1023 
   1024 In the respective ``server config``,\ ``virtual host`` or ``directory``
   1025 section add the following lines:
   1026 
   1027 .. code-block:: text
   1028 
   1029    ProxyTimeout 300
   1030    ProxyRequests Off
   1031    <Location /bar/ >
   1032    ProxyPass http://gnunet.foo.org:1080/
   1033    ProxyPassReverse http://gnunet.foo.org:1080/
   1034    </Location>
   1035 
   1036 .. _Reverse-Proxy-_002d-Configure-your-Apache2-HTTPS-webserver:
   1037 
   1038 Reverse Proxy - Configure your Apache2 HTTPS webserver
   1039 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1040 
   1041 We assume that you already have an HTTPS server running, if not please
   1042 check how to configure a HTTPS host. An uncomplicated to use example is
   1043 the example configuration file for Apache2/HTTPD provided in
   1044 ``apache2/sites-available/default-ssl``.
   1045 
   1046 In the respective HTTPS ``server config``,\ ``virtual host`` or
   1047 ``directory`` section add the following lines:
   1048 
   1049 .. code-block:: text
   1050 
   1051    SSLProxyEngine On
   1052    ProxyTimeout 300
   1053    ProxyRequests Off
   1054    <Location /bar/ >
   1055    ProxyPass https://gnunet.foo.org:4433/
   1056    ProxyPassReverse https://gnunet.foo.org:4433/
   1057    </Location>
   1058 
   1059 More information about the apache mod_proxy configuration can be found
   1060 in the `Apache
   1061 documentation <http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass>`__.
   1062 
   1063 .. _Reverse-Proxy-_002d-Configure-your-nginx-HTTPS-webserver:
   1064 
   1065 Reverse Proxy - Configure your nginx HTTPS webserver
   1066 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1067 
   1068 Since nginx does not support chunked encoding, you first of all have to
   1069 install the ``chunkin``
   1070 `module <http://wiki.nginx.org/HttpChunkinModule>`__.
   1071 
   1072 To enable chunkin add:
   1073 
   1074 .. code-block:: nginx
   1075 
   1076    chunkin on;
   1077    error_page 411 = @my_411_error;
   1078    location @my_411_error {
   1079    chunkin_resume;
   1080    }
   1081 
   1082 Edit your webserver configuration. Edit ``/etc/nginx/nginx.conf`` or the
   1083 site-specific configuration file.
   1084 
   1085 In the ``server`` section add:
   1086 
   1087 .. code-block:: nginx
   1088 
   1089    location /bar/ {
   1090    proxy_pass http://gnunet.foo.org:1080/;
   1091    proxy_buffering off;
   1092    proxy_connect_timeout 5; # more than http_server
   1093    proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
   1094    proxy_http_version 1.1; # 1.0 default
   1095    proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
   1096    }
   1097 
   1098 .. _Reverse-Proxy-_002d-Configure-your-nginx-HTTP-webserver:
   1099 
   1100 Reverse Proxy - Configure your nginx HTTP webserver
   1101 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1102 
   1103 Edit your webserver configuration. Edit ``/etc/nginx/nginx.conf`` or the
   1104 site-specific configuration file.
   1105 
   1106 In the ``server`` section add:
   1107 
   1108 .. code-block:: nginx
   1109 
   1110    ssl_session_timeout 6m;
   1111    location /bar/
   1112    {
   1113    proxy_pass https://gnunet.foo.org:4433/;
   1114    proxy_buffering off;
   1115    proxy_connect_timeout 5; # more than http_server
   1116    proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
   1117    proxy_http_version 1.1; # 1.0 default
   1118    proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
   1119    }
   1120 
   1121 .. _Reverse-Proxy-_002d-Configure-your-GNUnet-peer:
   1122 
   1123 Reverse Proxy - Configure your GNUnet peer
   1124 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1125 
   1126 To have your GNUnet peer announce the address, you have to specify the
   1127 ``EXTERNAL_HOSTNAME`` option in the ``[transport-http_server]`` section:
   1128 
   1129 .. code-block:: text
   1130 
   1131    [transport-http_server]
   1132    EXTERNAL_HOSTNAME = http://www.foo.org/bar/
   1133 
   1134 and/or ``[transport-https_server]`` section:
   1135 
   1136 .. code-block:: text
   1137 
   1138    [transport-https_server]
   1139    EXTERNAL_HOSTNAME = https://www.foo.org/bar/
   1140 
   1141 Now restart your webserver and your peer\...
   1142 
   1143 .. _Blacklisting-peers:
   1144 
   1145 Blacklisting peers
   1146 ~~~~~~~~~~~~~~~~~~
   1147 
   1148 Transport service supports to deny connecting to a specific peer of to a
   1149 specific peer with a specific transport plugin using the blacklisting
   1150 component of transport service. With blacklisting it is possible to deny
   1151 connections to specific peers of to use a specific plugin to a specific
   1152 peer. Peers can be blacklisted using the configuration or a blacklist
   1153 client can be asked.
   1154 
   1155 To blacklist peers using the configuration you have to add a section to
   1156 your configuration containing the peer id of the peer to blacklist and
   1157 the plugin if required.
   1158 
   1159 Examples:
   1160 
   1161 To blacklist connections to P565\... on peer AG2P\... using tcp add:
   1162 
   1163 .. todo:: too long?
   1164 .. todo:: verify whether these still produce errors in pdf output
   1165 
   1166 .. code-block:: text
   1167 
   1168    [transport-blacklist AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
   1169    P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = tcp
   1170 
   1171 To blacklist connections to P565\... on peer AG2P\... using all plugins
   1172 add:
   1173 
   1174 .. code-block:: text
   1175 
   1176    [transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
   1177    P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G =
   1178 
   1179 You can also add a blacklist client using the blacklist API. On a
   1180 blacklist check, blacklisting first checks internally if the peer is
   1181 blacklisted and if not, it asks the blacklisting clients. Clients are
   1182 asked if it is OK to connect to a peer ID, the plugin is omitted.
   1183 
   1184 On blacklist check for (peer, plugin)
   1185 
   1186 -  Do we have a local blacklist entry for this peer and this plugin?
   1187 
   1188 -  YES: disallow connection
   1189 
   1190 -  Do we have a local blacklist entry for this peer and all plugins?
   1191 
   1192 -  YES: disallow connection
   1193 
   1194 -  Does one of the clients disallow?
   1195 
   1196 -  YES: disallow connection
   1197 
   1198 .. _Configuration-of-the-HTTP-and-HTTPS-transport-plugins-cli:
   1199 
   1200 Configuration of the HTTP and HTTPS transport plugins
   1201 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1202 
   1203 The client parts of the http and https transport plugins can be
   1204 configured to use a proxy to connect to the hostlist server.
   1205 
   1206 Both the HTTP and HTTPS clients support the following proxy types at the
   1207 moment:
   1208 
   1209 -  HTTP 1.1 proxy
   1210 
   1211 -  SOCKS 4/4a/5/5 with hostname
   1212 
   1213 In addition authentication at the proxy with username and password can
   1214 be configured.
   1215 
   1216 To configure these options directly in the configuration, you can
   1217 configure the following settings in the ``[transport-http_client]`` and
   1218 ``[transport-https_client]`` section of the configuration:
   1219 
   1220 .. code-block:: text
   1221 
   1222    # Type of proxy server,
   1223    # Valid values: HTTP, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
   1224    # Default: HTTP
   1225    # PROXY_TYPE = HTTP
   1226 
   1227    # Hostname or IP of proxy server
   1228    # PROXY =
   1229    # User name for proxy server
   1230    # PROXY_USERNAME =
   1231    # User password for proxy server
   1232    # PROXY_PASSWORD =
   1233 
   1234 .. _Configuring-the-GNUnet-VPN:
   1235 
   1236 Configuring the GNUnet VPN
   1237 ~~~~~~~~~~~~~~~~~~~~~~~~~~
   1238 
   1239 Before configuring the GNUnet VPN, please make sure that system-wide DNS
   1240 interception is configured properly as described in the section on the
   1241 GNUnet DNS setup. see `Configuring the GNU Name
   1242 System <#Configuring-the-GNU-Name-System>`__, if you haven't done so
   1243 already.
   1244 
   1245 The default options for the GNUnet VPN are usually sufficient to use
   1246 GNUnet as a Layer 2 for your Internet connection. However, what you
   1247 always have to specify is which IP protocol you want to tunnel: IPv4,
   1248 IPv6 or both. Furthermore, if you tunnel both, you most likely should
   1249 also tunnel all of your DNS requests. You theoretically can tunnel
   1250 \"only\" your DNS traffic, but that usually makes little sense.
   1251 
   1252 The other options as shown on the gnunet-setup tool are:
   1253 
   1254 .. _IPv4-address-for-interface:
   1255 
   1256 IPv4 address for interface
   1257 ^^^^^^^^^^^^^^^^^^^^^^^^^^
   1258 
   1259 This is the IPv4 address the VPN interface will get. You should pick a
   1260 'private' IPv4 network that is not yet in use for you system. For
   1261 example, if you use ``10.0.0.1/255.255.0.0`` already, you might use
   1262 ``10.1.0.1/255.255.0.0``. If you use ``10.0.0.1/255.0.0.0`` already,
   1263 then you might use ``192.168.0.1/255.255.0.0``. If your system is not in
   1264 a private IP-network, using any of the above will work fine. You should
   1265 try to make the mask of the address big enough (``255.255.0.0`` or, even
   1266 better, ``255.0.0.0``) to allow more mappings of remote IP Addresses
   1267 into this range. However, even a ``255.255.255.0`` mask will suffice for
   1268 most users.
   1269 
   1270 .. _IPv6-address-for-interface:
   1271 
   1272 IPv6 address for interface
   1273 ^^^^^^^^^^^^^^^^^^^^^^^^^^
   1274 
   1275 The IPv6 address the VPN interface will get. Here you can specify any
   1276 non-link-local address (the address should not begin with ``fe80:``). A
   1277 subnet Unique Local Unicast (``fd00::/8`` prefix) that you are currently
   1278 not using would be a good choice.
   1279 
   1280 .. _Configuring-the-GNUnet-VPN-DNS:
   1281 
   1282 Configuring the GNUnet VPN DNS
   1283 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1284 
   1285 To resolve names for remote nodes, activate the DNS exit option.
   1286 
   1287 .. _Configuring-the-GNUnet-VPN-Exit-Service:
   1288 
   1289 Configuring the GNUnet VPN Exit Service
   1290 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1291 
   1292 If you want to allow other users to share your Internet connection (yes,
   1293 this may be dangerous, just as running a Tor exit node) or want to
   1294 provide access to services on your host (this should be less dangerous,
   1295 as long as those services are secure), you have to enable the GNUnet
   1296 exit daemon.
   1297 
   1298 You then get to specify which exit functions you want to provide. By
   1299 enabling the exit daemon, you will always automatically provide exit
   1300 functions for manually configured local services (this component of the
   1301 system is under development and not documented further at this time). As
   1302 for those services you explicitly specify the target IP address and
   1303 port, there is no significant security risk in doing so.
   1304 
   1305 Furthermore, you can serve as a DNS, IPv4 or IPv6 exit to the Internet.
   1306 Being a DNS exit is usually pretty harmless. However, enabling IPv4 or
   1307 IPv6-exit without further precautions may enable adversaries to access
   1308 your local network, send spam, attack other systems from your Internet
   1309 connection and do other mischiefs that will appear to come from your
   1310 machine. This may or may not get you into legal trouble. If you want to
   1311 allow IPv4 or IPv6-exit functionality, you should strongly consider
   1312 adding additional firewall rules manually to protect your local network
   1313 and to restrict outgoing TCP traffic (e.g. by not allowing access to
   1314 port 25). While we plan to improve exit-filtering in the future, you're
   1315 currently on your own here. Essentially, be prepared for any kind of
   1316 IP-traffic to exit the respective TUN interface (and GNUnet will enable
   1317 IP-forwarding and NAT for the interface automatically).
   1318 
   1319 Additional configuration options of the exit as shown by the
   1320 gnunet-setup tool are:
   1321 
   1322 .. _IP-Address-of-external-DNS-resolver:
   1323 
   1324 IP Address of external DNS resolver
   1325 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1326 
   1327 If DNS traffic is to exit your machine, it will be send to this DNS
   1328 resolver. You can specify an IPv4 or IPv6 address.
   1329 
   1330 .. _IPv4-address-for-Exit-interface:
   1331 
   1332 IPv4 address for Exit interface
   1333 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1334 
   1335 This is the IPv4 address the Interface will get. Make the mask of the
   1336 address big enough (255.255.0.0 or, even better, 255.0.0.0) to allow
   1337 more mappings of IP addresses into this range. As for the VPN interface,
   1338 any unused, private IPv4 address range will do.
   1339 
   1340 .. _IPv6-address-for-Exit-interface:
   1341 
   1342 IPv6 address for Exit interface
   1343 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   1344 
   1345 The public IPv6 address the interface will get. If your kernel is not a
   1346 very recent kernel and you are willing to manually enable IPv6-NAT, the
   1347 IPv6 address you specify here must be a globally routed IPv6 address of
   1348 your host.
   1349 
   1350 Suppose your host has the address ``2001:4ca0::1234/64``, then using
   1351 ``2001:4ca0::1:0/112`` would be fine (keep the first 64 bits, then
   1352 change at least one bit in the range before the bitmask, in the example
   1353 above we changed bit 111 from 0 to 1).
   1354 
   1355 You may also have to configure your router to route traffic for the
   1356 entire subnet (``2001:4ca0::1:0/112`` for example) through your computer
   1357 (this should be automatic with IPv6, but obviously anything can be
   1358 disabled).
   1359 
   1360 .. _Bandwidth-Configuration:
   1361 
   1362 Bandwidth Configuration
   1363 ~~~~~~~~~~~~~~~~~~~~~~~
   1364 
   1365 You can specify how many bandwidth GNUnet is allowed to use to receive
   1366 and send data. This is important for users with limited bandwidth or
   1367 traffic volume.
   1368 
   1369 .. _Configuring-NAT:
   1370 
   1371 Configuring NAT
   1372 ~~~~~~~~~~~~~~~
   1373 
   1374 Most hosts today do not have a normal global IP address but instead are
   1375 behind a router performing Network Address Translation (NAT) which
   1376 assigns each host in the local network a private IP address. As a
   1377 result, these machines cannot trivially receive inbound connections from
   1378 the Internet. GNUnet supports NAT traversal to enable these machines to
   1379 receive incoming connections from other peers despite their limitations.
   1380 
   1381 In an ideal world, you can press the \"Attempt automatic configuration\"
   1382 button in gnunet-setup to automatically configure your peer correctly.
   1383 Alternatively, your distribution might have already triggered this
   1384 automatic configuration during the installation process. However,
   1385 automatic configuration can fail to determine the optimal settings,
   1386 resulting in your peer either not receiving as many connections as
   1387 possible, or in the worst case it not connecting to the network at all.
   1388 
   1389 To manually configure the peer, you need to know a few things about your
   1390 network setup. First, determine if you are behind a NAT in the first
   1391 place. This is always the case if your IP address starts with \"10.*\"
   1392 or \"192.168.*\". Next, if you have control over your NAT router, you
   1393 may choose to manually configure it to allow GNUnet traffic to your
   1394 host. If you have configured your NAT to forward traffic on ports 2086
   1395 (and possibly 1080) to your host, you can check the \"NAT ports have
   1396 been opened manually\" option, which corresponds to the \"PUNCHED_NAT\"
   1397 option in the configuration file. If you did not punch your NAT box, it
   1398 may still be configured to support UPnP, which allows GNUnet to
   1399 automatically configure it. In that case, you need to install the
   1400 \"upnpc\" command, enable UPnP (or PMP) on your NAT box and set the
   1401 \"Enable NAT traversal via UPnP or PMP\" option (corresponding to
   1402 \"ENABLE_UPNP\" in the configuration file).
   1403 
   1404 Some NAT boxes can be traversed using the autonomous NAT traversal
   1405 method. This requires certain GNUnet components to be installed with
   1406 \"SUID\" privileges on your system (so if you're installing on a system
   1407 you do not have administrative rights to, this will not work). If you
   1408 installed as 'root', you can enable autonomous NAT traversal by checking
   1409 the \"Enable NAT traversal using ICMP method\". The ICMP method requires
   1410 a way to determine your NAT's external (global) IP address. This can be
   1411 done using either UPnP, DynDNS, or by manual configuration. If you have
   1412 a DynDNS name or know your external IP address, you should enter that
   1413 name under \"External (public) IPv4 address\" (which corresponds to the
   1414 \"EXTERNAL_ADDRESS\" option in the configuration file). If you leave the
   1415 option empty, GNUnet will try to determine your external IP address
   1416 automatically (which may fail, in which case autonomous NAT traversal
   1417 will then not work).
   1418 
   1419 Finally, if you yourself are not behind NAT but want to be able to
   1420 connect to NATed peers using autonomous NAT traversal, you need to check
   1421 the \"Enable connecting to NATed peers using ICMP method\" box.
   1422 
   1423 .. _Peer-configuration-for-distributors-_0028e_002eg_002e-Operating-Systems_0029:
   1424 
   1425 Peer configuration for distributors (e.g. Operating Systems)
   1426 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1427 
   1428 The \"GNUNET_DATA_HOME\" in \"[PATHS]\" in ``/etc/gnunet.conf`` should
   1429 be manually set to \"/var/lib/gnunet/data/\" as the default
   1430 \"~/.local/share/gnunet/\" is probably not that appropriate in this
   1431 case. Similarly, distributors may consider pointing
   1432 \"GNUNET_RUNTIME_DIR\" to \"/var/run/gnunet/\" and \"GNUNET_HOME\" to
   1433 \"/var/lib/gnunet/\". Also, should a distributor decide to override
   1434 system defaults, all of these changes should be done in a custom
   1435 ``/etc/gnunet.conf`` and not in the files in the ``config.d/``
   1436 directory.
   1437 
   1438 Given the proposed access permissions, the \"gnunet-setup\" tool must be
   1439 run as use \"gnunet\" (and with option \"-c /etc/gnunet.conf\" so that
   1440 it modifies the system configuration). As always, gnunet-setup should be
   1441 run after the GNUnet peer was stopped using \"gnunet-arm -e\".
   1442 Distributors might want to include a wrapper for gnunet-setup that
   1443 allows the desktop-user to \"sudo\" (e.g. using gtksudo) to the
   1444 \"gnunet\" user account and then runs \"gnunet-arm -e\",
   1445 \"gnunet-setup\" and \"gnunet-arm -s\" in sequence.