gnunet-handbook

The GNUnet Handbook
Log | Files | Refs

gns.rst (36162B)


      1 The GNU Name System
      2 -------------------
      3 
      4 The GNU Name System (GNS) is secure and decentralized naming system. It
      5 allows its users to register names as top-level domains (TLDs) and
      6 resolve other namespaces within their TLDs.
      7 
      8 GNS is designed to provide:
      9 
     10 -  Censorship resistance
     11 -  Query privacy
     12 -  Secure name resolution
     13 -  Compatibility with DNS
     14 
     15 Unlike DNS, GNS does not rely on central root zones or authorities.
     16 Instead any user administers their own root and can can create arbitrary
     17 name value mappings. Furthermore users can delegate resolution to other
     18 users’ zones just like DNS NS records do. Zones are uniquely identified
     19 via public keys and resource records are signed using the corresponding
     20 public key. Delegation to another user’s zone is done using special delegation
     21 records and petnames. A petname is a name that can be freely chosen by
     22 the user. This results in non-unique name-value mappings as www.bob to
     23 one user might be www.friend for someone else.
     24 
     25 For a complete specification of the protocol, we refer to `LSD0001 <https://lsd.gnunet.org/lsd0001>`__.
     26 
     27 Start Zones
     28 ~~~~~~~~~~~
     29 
     30 In GNS you are the master of your own Root.
     31 This means that you are able (and encouraged!) to manage your own *Start Zones*.
     32 A *Start Zone* is a mapping from a name suffix (e.g. ``.gnunet.org``) to
     33 a GNS zone key.
     34 A user's configuration of *Start Zones* is the equivalent of DNS's `Root Zone <https://en.wikipedia.org/wiki/DNS_root_zone>`_.
     35 In other words, in GNS you can be your very own `ICANN <https://en.wikipedia.org/wiki/ICANN>`_.
     36 
     37 There are three types of *Start Zones*:
     38 
     39   1. Mappings to *remote* GNS zones.
     40   2. Mappings to your own *local* GNS zones.
     41   3. Explicit zone Top-Level-Domains (zTLDs)
     42 
     43 Remote
     44 """"""
     45 
     46 Your GNUnet installation ships with a default configuration of remote
     47 *Start Zones*.
     48 The first is ``.gnunet.org``, which points to the authoritative zone of the
     49 GNUnet project.
     50 This *Start Zone* allows you to resolve names ending with ``.gnunet.org``.
     51 It can be used to resolve, for example, ``www.gnunet.org``.
     52 
     53 You can try it out for yourself (if you are connected to the peer-to-peer network):
     54 
     55 ::
     56 
     57   $ gnunet-gns --lookup=www.gnunet.org
     58 
     59 
     60 Another *Start Zone* configured by default is ``.pin.gns.alt``.
     61 It points to a special zone also managed by the GNUnet project.
     62 Users may register subdomains on a first-come first-served-basis at https://fcfs.gnunet.org.
     63 
     64 Use ``gnunet-config -s gns`` to view the GNS configuration, including all
     65 configured external zones that are operated by other users.
     66 The respective configuration entry names start with a ``.``, e.g. ``.pin.gns.alt``.
     67 
     68 You can change this default configuration at any time and add *Start Zone* to the
     69 respective zones of your friends! For this, simply obtain the respective
     70 public key (you will learn how below) and extend the configuration:
     71 
     72 ::
     73 
     74    $ gnunet-config -s gns -o .myfriend -V PUBLIC_KEY
     75 
     76 Local
     77 """""
     78 
     79 In order to create a local GNS zone you have to create a so-called ``ego`` in GNUnet.
     80 Egos may correspond to pseudonyms or real-world identities.
     81 It is recommended to use separate egos for separate activities.
     82 All egos can potentially serve as a GNS zone, but you do not have to use
     83 all egos as GNS zones.
     84 All your local zones are used as *Start Zones*.
     85 
     86 Technically, an ego is first of all a public-private key pair, and thus
     87 egos also always correspond to a GNS zone. Egos are managed through the
     88 IDENTITY service and its tooling.
     89 The IDENTITY service is used to create and stores private keys with associated
     90 human-readable nicknames.
     91 Those mappings serve as local *Start Zones*.
     92 
     93 For example, you can create a new ego (or zone) with name *myzone* using the
     94 ``gnunet-identity`` tool using:
     95 
     96 ::
     97 
     98    $ gnunet-identity --create="myzone"
     99 
    100 Henceforth, on your system you control the TLD ``myzone``.
    101 You are able to resolve GNS names ending with ``.myzone``.
    102 However, the zone is still empty.
    103 We will look at local zone maintenance in the next section.
    104 Note that by default, this will create ECDSA key pairs.
    105 GNS also supports the use of EdDSA keys.
    106 In order to create a EdDSA zone, execute:
    107 
    108 ::
    109 
    110   $ gnunet-identity --create="myedzone" --eddsa
    111 
    112 All of your zones can be listed (displayed) using the gnunet-identity
    113 command line tool as well:
    114 
    115 ::
    116 
    117    $ gnunet-identity --display
    118 
    119 
    120 
    121 Zone Top-Level-Domains
    122 """"""""""""""""""""""
    123 
    124 If you know the public key of a GNS zone, you can resolve records in that zone
    125 without a *Start Zone* mapping.
    126 To do so, you must provide the string-representation of the zone key
    127 as Top-Level Domain. Consider the zone key of ``.gnunet.org`` in the default
    128 configuration. In order to resolve the same record as above using its respective
    129 zTLD, you can do so as follows:
    130 
    131 ::
    132 
    133   $ gnunet-gns --lookup=www.000G0047M3HN599H57MPXZK4VB59SWK4M9NRD68E1JQFY3RWAHDMKAPN30
    134 
    135 The use of zTLDs is mostly useful in the absence of a *Start Zone* configuration
    136 for that zone or when querying names programmatically.
    137 
    138 Local zone maintenance
    139 ~~~~~~~~~~~~~~~~~~~~~~
    140 
    141 So you are ready to maintain your own GNS zone? Great.
    142 First you should review and optionally configure your NAMESTORE database which
    143 will hold your zone's resource records.
    144 You have the choice between ``sqlite`` and ``postgres`` as databases.
    145 Most users will be served well with the ``sqlite`` backend and with its default
    146 configuration.
    147 To change the database backend of your NAMESTORE to ``postgres`` execute:
    148 
    149 ::
    150 
    151   $ gnunet-config -s namestore -o DATABASE -V postgres
    152 
    153 You can now configure the ``postgres`` database backend to find your database.
    154 See the ``namestore-postgres`` configuration section on possible options:
    155 
    156 ::
    157 
    158   $ gnunet-config -s namestore-postgres
    159 
    160 If you ever need to reset your zone database, you can use ``gnunet-namestore-dbtool``
    161 with the ``--reset`` option.
    162 **DANGER: This command will delete ALL of your records in all zones!**
    163 
    164 Orphaning
    165 """""""""
    166 
    167 It can happen that you accidentally or semi-accidentally delete your ego, e.g.
    168 using ``gnunet-identity --delete=myzone``.
    169 In this case the records stored in the zone are still in the database but the
    170 missing ego causes them to be *orphaned*.
    171 
    172 Orphaned records are still published in the DHT but access to them is limited.
    173 For example, managing records through the NAMESTORE API is not longer possible.
    174 
    175 You can check for orphaned records using:
    176 
    177 ::
    178 
    179   $ gnunet-namestore --list-orphans
    180 
    181 This will output any orphaned records in the format
    182 
    183 .. code-block:: text
    184 
    185   <$LABEL>.<$PRIVATE_KEY>:
    186   $RECORD_DATA
    187 
    188 In order to recover (and un-orphan) the records, you can re-add the ego by
    189 executing
    190 
    191 ::
    192 
    193   $ gnunet-identity --create=<myzone> --privkey=$PRIVATE_KEY
    194 
    195 If instead you should decide that you want to **purge** all orphaned records,
    196 you can execute
    197 
    198 ::
    199 
    200   $ gnunet-namestore --purge-orphans
    201 
    202 Records
    203 """""""
    204 
    205 At this point you can add (or edit, or remove) records in your GNS zone using the
    206 using the gnunet-namestore command-line tool.
    207 Your records will be stored in a database
    208 of the NAMESTORE service. Note that for multi-user setups, the NAMESTORE
    209 database will include the combined records of all users.
    210 However, users will not be able to see each other’s records if they are marked
    211 as private.
    212 
    213 To provide a short example for editing your own zone, suppose you have
    214 your own web server with the IP ``1.2.3.4``. Then you can put an A record (A
    215 records in DNS are for IPv4 IP addresses) into your local zone ``myzone``
    216 using the command:
    217 
    218 ::
    219 
    220    $ gnunet-namestore --zone=myzone \
    221                       --add \
    222                       --name=www \
    223                       --type=A \
    224                       --value=1.2.3.4 \
    225                       --expiration=1d
    226 
    227 Similar commands will work for other types of DNS and GNS records, the
    228 syntax largely depending on the type of the record. Naturally, most
    229 users may find editing the zones using the gnunet-namestore-gtk GUI to
    230 be easier.
    231 
    232 Note that by default, records are **private**. This means that they are not
    233 published and cannot be resolved by other users that may have configured your
    234 zone as one of their ``Start Zones``.
    235 In order to create a public record, provide the ``--public`` switch to the
    236 ``gnunet-namestore`` command above.
    237 
    238 You can now try to resolve your own GNS record. The method we found
    239 to be the most uncomplicated is to do this by explicitly resolving using
    240 ``gnunet-gns``.
    241 In the shell, type:
    242 
    243 ::
    244 
    245    $ gnunet-gns -u www.myzone
    246 
    247 You should receive the record as configured above.
    248 At this point, you can try addition additional records to ``www`` or add other
    249 names to your zone.
    250 
    251 Each zone in GNS has a public-private key. Usually, gnunet-namestore and
    252 gnunet-setup will access your private key as necessary, so you do not
    253 have to worry about those. What is important is your public key (or
    254 rather, the hash of your public key), as you will likely want to give it
    255 to others so that they can securely link to you.
    256 
    257 A central operation in GNS is the ability to securely delegate to other
    258 zones. Basically, by adding a delegation you make all of the names from
    259 the other zone available to yourself. This section describes how to
    260 create delegations.
    261 
    262 Suppose you have a friend who you call ’bob’ who also uses GNS. You can
    263 then delegate resolution of names to Bob’s zone by adding a PKEY record
    264 to their local zone:
    265 
    266 ::
    267 
    268    $ gnunet-namestore -a -n bob --type PKEY -V $BOBKEY -e 1d -z myzone
    269 
    270 Note that ``$BOBKEY`` in the command above must be replaced with the hash of
    271 Bob’s public key (the output your friend obtained using the
    272 gnunet-identity command from the previous section and told you, for
    273 example by giving you a business card containing this information as a
    274 QR code).
    275 
    276 Assuming Bob has an ``A`` record for their website under the name of ``www``
    277 in his zone, you can then access Bob’s website under ``www.bob.myzone`` -
    278 as well as any (public) GNS record that Bob has in their zone by
    279 replacing www with the respective name of the record in Bob’s zone.
    280 
    281 Furthermore, if Bob has themselves a (public) delegation to Carol’s zone
    282 under *carol*, you can access Carol’s records under
    283 *NAME.carol.bob.myzone* (where *NAME* is the name of Carol’s record you
    284 want to access).
    285 
    286 You can find more detailed information in available record types in the
    287 `Resource Records`_ section.
    288 
    289 Revocation
    290 """"""""""
    291 
    292 Now, in the situation of an attacker gaining access to the private key
    293 of one of your egos, the attacker can create records in the respective
    294 GNS zone and publish them as if you published them. Anyone resolving
    295 your domain will get these new records and when they verify they seem
    296 authentic because the attacker has signed them with your key.
    297 
    298 To address this potential security issue, you can pre-compute a
    299 revocation certificate corresponding to your ego. This certificate, when
    300 published on the P2P network, flags your private key as invalid, and all
    301 further resolutions or other checks involving the key will fail.
    302 
    303 A revocation certificate is thus a useful tool when things go out of
    304 control, but at the same time it should be stored securely. Generation
    305 of the revocation certificate for a zone can be done through
    306 ``gnunet-revocation``. For example, the following command (as unprivileged
    307 user) generates a revocation file ``revocation.dat`` for the zone ``myzone``:
    308 
    309 ::
    310 
    311   $ gnunet-revocation -f revocation.dat -R myzone
    312 
    313 The above command only pre-computes a revocation certificate. It does
    314 not revoke the given zone. Pre-computing a revocation certificate
    315 involves computing a proof-of-work and hence may take up to 4 to 5 days
    316 on a modern processor. Note that you can abort and resume the
    317 calculation at any time. Also, even if you did not finish the
    318 calculation, the resulting file will contain the signature, which is
    319 sufficient to complete the revocation process even without access to the
    320 private key. So instead of waiting for a few days, you can just abort
    321 with ``CTRL-C``, backup the revocation certificate and run the calculation
    322 only if your key actually was compromised. This has the disadvantage of
    323 revocation taking longer after the incident, but the advantage of saving
    324 a significant amount of energy. So unless you believe that a key
    325 compromise will need a rapid response, we urge you to wait with
    326 generating the revocation certificate. Also, the calculation is
    327 deliberately expensive, to deter people from doing this just for fun (as
    328 the actual revocation operation is expensive for the network, not for
    329 the peer performing the revocation).
    330 
    331 To avoid TL;DR ones from accidentally revoking their zones, we are not
    332 giving away the command, but it is uncomplicated: the actual revocation
    333 is performed by using the ``-p`` option of ``gnunet-revocation``.
    334 
    335 Backup
    336 """"""
    337 
    338 One should always backup their files, especially in these SSD days (our
    339 team has suffered 3 SSD crashes over a span of 2 weeks). Backing up peer
    340 identity and zones is achieved by copying the following files:
    341 
    342 The peer identity file can be found in
    343 ``~/.local/share/gnunet/private_key.ecc``.
    344 
    345 The private keys of your egos are stored in the directory
    346 ``~/.local/share/gnunet/identity/egos/``. They are stored in files whose
    347 filenames correspond to the zones’ ego names. These are probably the
    348 most important files you want to backup from a GNUnet installation.
    349 
    350 Note: All these files contain cryptographic keys and they are stored
    351 without any encryption. So it is advisable to backup encrypted copies of
    352 them.
    353 
    354 This does **NOT** backup your record data.
    355 Your record data is stored in the respective database backend, and hence
    356 you may want to backup the respective databases as well.
    357 
    358 
    359 Large Zones
    360 """""""""""
    361 
    362 Large zones in DNS such as Top-Level Domains can grow to millions of names.
    363 For example, the ``.fr`` DNS zone contained over 3.9 million entries in 2022.
    364 Such use cases require good performance and careful consideration of a couple
    365 of choices in GNS and NAMESTORE.
    366 
    367 The cryptographic operations of EdDSA are significantly faster than their
    368 ECDSA counterparts.
    369 Most users will be unable to observe this difference.
    370 But, if you plan on managing large zones, you may want to consider using EdDSA
    371 zones.
    372 
    373 For large zones, using the PostgreSQL NAMESTORE database backend is a must.
    374 Further, when importing large numbers of records at once, it is advised to make
    375 use of the bulk import functionality of the NAMESTORE API.
    376 There is a :ref:`C API for bulk imports <NAMESTORE-Subsystem>`.
    377 There is also a :ref:`REST API endpoint <namestore_rest_api>` which calls this API.
    378 
    379 Zones are published and signed by the ZONEMASTER service.
    380 In order to speed up this process for large zones, you can edit the number of
    381 spawned worker threads for the service:
    382 
    383 ::
    384 
    385   $ gnunet-config -s zonemaster -o WORKER_COUNT -V $COUNT
    386 
    387 It is reasonable to choose your number of CPUs as ``$COUNT``.
    388 
    389 Application integration
    390 ~~~~~~~~~~~~~~~~~~~~~~~
    391 
    392 Once you have verified that resolution of names using ``gnunet-gns`` works,
    393 we can start integrating GNS with applications.
    394 We can distinguish between two types of applications:
    395 
    396   1. **GNS-aware applications**: Such applications know what GNS is and how it
    397      can be used to resolve names. Examples are some of GNUnet's services such
    398      as `re:claimID <reclaimID-Identity-Provider>`_ or `Messenger <Using-the-GNUnet-Messenger>`_.
    399   2. **GNS-unaware applications**: Applications that implicitly assume the names
    400      are resolved through DNS. Such applications use OS-specific APIs or query
    401      configured DNS servers directly.
    402 
    403 In the following, we will discuss integration paths of GNS-unaware applications.
    404 
    405 Integration with Browsers (DNS2GNS service)
    406 """""""""""""""""""""""""""""""""""""""""""
    407 
    408 Most OSes allow you to either modify your ``/etc/resolv.conf`` directly
    409 or through ``resolvectl``. We are going to configure the dns2gns service
    410 in order to translate DNS name queries by applications to GNS name
    411 queries where applicable and else fall back to DNS.
    412 
    413 Optionally, you may want to configure your dns2gns service to run on a
    414 non-privileged port like 5353. But, in case you are going to edit
    415 ``/etc/resolv.conf`` directly, the dns2gns service MUST run on port 53
    416 as you cannot specify the port number. A ``$FALLBACK_DNS`` variable
    417 should be a DNS server you trust such as your local router:
    418 
    419 ::
    420 
    421    $ gnunet-config -s dns2gns -o OPTIONS -V "-d $FALLBACK_DNS -p 5252"
    422    $ gnunet-arm -i dns2gns
    423 
    424 If you edit your resolv.conf directly, it should contain and entry like
    425 this:
    426 
    427 ::
    428 
    429    nameserver 127.0.0.1
    430 
    431 In any case, it is very likely that the method of modification of your
    432 resolver is OS specific. Recently, the combination of NetworkManager and
    433 systemd-resolved is becoming increasingly popular.
    434 
    435 If you use resolvectl and systemd-resolved you can temporarily set the
    436 nameserver like this:
    437 
    438 ::
    439 
    440    $ resolvectl $INTERFACE 127.0.0.1:5353
    441 
    442 Where ``$INTERFACE`` is your network interface such as ``eth0``.
    443 
    444 In order to automatically set the DNS2GNS server if it is running
    445 already you can use NetworkManager-dispatcher. First, enable it:
    446 
    447 ::
    448 
    449    $ sudo systemctl enable NetworkManager-dispatcher.service
    450    $ sudo systemctl start NetworkManager-dispatcher.service
    451 
    452 Then, create a script ``/etc/NetworkManager/dispatch.h/10-dns2-gns.sh``:
    453 
    454 .. code-block:: bash
    455 
    456    #!/bin/sh
    457    interface=$1
    458    status=$2
    459 
    460    if [ "$interface" = "eth0" ]; then
    461      case $status in
    462        up)
    463          if nc -u -z 127.0.0.1 5353; then
    464          resolvectl dns $interface 127.0.0.1:5353
    465        fi
    466        ;;
    467        down)
    468        ;;
    469      esac
    470    fi
    471 
    472 Make sure the script is owned by root and executable:
    473 
    474 ::
    475 
    476    $ sudo root:root /etc/NetworkManager/dispatch.d/10-dns2gns.sh
    477    $ sudo +x /etc/NetworkManager/dispatch.d/10-dns2gns.sh
    478 
    479 You can test accessing this website using your browser or curl:
    480 
    481 ::
    482 
    483    $ curl www.gnunet.org
    484 
    485 Note that *gnunet.org* is a domain that also exists in DNS and for which
    486 the GNUnet project webservers can provide trusted TLS certificates. When
    487 using non-DNS names with GNS or aliases, this may result in issues when
    488 accessing HTTPS websites with browsers. In order learn how to provide
    489 relief for this issue, read on.
    490 
    491 Integration with Browsers (SOCKS proxy)
    492 """""""""""""""""""""""""""""""""""""""
    493 
    494 While we recommend integrating GNS using the DNS2GNS service or the
    495 NSSwitch plugin, you can also integrate GNS directly with your browser
    496 via the gnunet-gns-proxy. This method can have the advantage that the
    497 proxy can validate TLS/X.509 records and thus strengthen web security;
    498 however, the proxy is still a bit brittle, so expect subtle failures. We
    499 have had reasonable success with Chromium, and various frustrations with
    500 Firefox in this area recently.
    501 
    502 The first step is to start the proxy. As the proxy is (usually) not
    503 started by default, this is done as a unprivileged user using gnunet-arm
    504 -i gns-proxy. Use gnunet-arm -I as a unprivileged user to check that the
    505 proxy was actually started. (The most common error for why the proxy may
    506 fail to start is that you did not run gnunet-gns-proxy-setup-ca during
    507 installation.) The proxy is a SOCKS5 proxy running (by default) on port
    508 7777. Thus, you need to now configure your browser to use this proxy.
    509 With Chromium, you can do this by starting the browser as a unprivileged
    510 user using chromium –proxy-server=*socks5://localhost:7777* For Firefox
    511 (or Icecat), select *Edit-Preferences* in the menu, and then select the
    512 *Advanced* tab in the dialog and then *Network*:
    513 
    514 Here, select *Settings…* to open the proxy settings dialog. Select
    515 *Manual proxy configuration* and enter localhost with port 7777 under
    516 SOCKS Host. Furthermore, set the checkbox *Proxy DNS when using SOCKS
    517 v5* at the bottom of the dialog. Finally, push *OK*.
    518 
    519 You must also go to about:config and change the
    520 browser.fixup.alternate.enabled option to false, otherwise the browser
    521 will autoblunder an address like www.gnu to www.gnu.com. If you want to
    522 resolve @ in your own TLDs, you must additionally set
    523 browser.fixup.dns_first_use_for_single_words to true.
    524 
    525 After configuring your browser, you might want to first confirm that it
    526 continues to work as before. (The proxy is still experimental and if you
    527 experience *odd* failures with some webpages, you might want to disable
    528 it again temporarily.) Next, test if things work by typing
    529 *http://test.gnu/* into the URL bar of your browser. This currently
    530 fails with (my version of) Firefox as Firefox is super-smart and tries
    531 to resolve *http://www.test.gnu/* instead of *test.gnu*. Chromium can be
    532 convinced to comply if you explicitly include the *http://* prefix —
    533 otherwise a Google search might be attempted, which is not what you
    534 want. If successful, you should see a simple website.
    535 
    536 Note that while you can use GNS to access ordinary websites, this is
    537 more an experimental feature and not really our primary goal at this
    538 time. Still, it is a possible use-case and we welcome help with testing
    539 and development.
    540 
    541 NSS plugin
    542 """"""""""
    543 
    544 To activate the plugin, you need to edit your
    545 ``/etc/nsswitch.conf`` where you should find a line like this:
    546 
    547 ::
    548 
    549    hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
    550 
    551 The exact details may differ a bit, which is fine. Add the text
    552 ``gns [NOTFOUND=return]`` after ``files``:
    553 
    554 ::
    555 
    556    hosts: files gns [NOTFOUND=return] mdns4_minimal [NOTFOUND=return] dns mdns4
    557 
    558 Note that some systems, in particular those running systemd-resolvd, manual modification of ``/etc/nsswitch.conf`` is not possible as it is autogenerated.
    559 In such cases it is better to use the *DNS2GNS* service approach in combination with ``resolvectl`` as explained above.
    560 
    561 Zone dissemination
    562 ~~~~~~~~~~~~~~~~~~
    563 
    564 So you have decided to maintain and publish one or more GNS zones.
    565 You are probably asking yourself how your zone finds its way into the
    566 *Start Zone* configuration of other users.
    567 
    568 Below are pointers on how to make your zone known.
    569 
    570 The .pin zone
    571 """""""""""""
    572 
    573 First, you may want to visit https://fcfs.gnunet.org and register your zone(s)
    574 with the ``.pin.gns.alt`` top-level domain shipped by default with GNUnet.
    575 This will allow other GNUnet users to resolve your zone under the name you
    576 managed to acquire for yourself.
    577 
    578 The registration policy of PIN is "first-come, first-served".
    579 
    580 Be Social
    581 """""""""
    582 
    583 Next, you should print out your business card and be social. Find a
    584 friend, help them install GNUnet and exchange business cards with them.
    585 Or, if you’re a desperate loner, you might try the next step with your
    586 own card. Still, it’ll be hard to have a conversation with yourself
    587 later, so it would be better if you could find a friend. You might also
    588 want a camera attached to your computer, so you might need a trip to the
    589 store together.
    590 
    591 Before we get started, we need to tell gnunet-qr which zone it should
    592 import new records into. For this, run:
    593 
    594 ::
    595 
    596    $ gnunet-identity -s namestore -e NAME
    597 
    598 where NAME is the name of the zone you want to import records into. In
    599 our running example, this would be *gnu*.
    600 
    601 Henceforth, for every business card you collect, simply run:
    602 
    603 ::
    604 
    605    $ gnunet-qr
    606 
    607 to open a window showing whatever your camera points at. Hold up your
    608 friend’s business card and tilt it until the QR code is recognized. At
    609 that point, the window should automatically close. At that point, your
    610 friend’s NICKname and their public key should have been automatically
    611 imported into your zone.
    612 
    613 Assuming both of your peers are properly integrated in the GNUnet
    614 network at this time, you should thus be able to resolve your friends
    615 names. Suppose your friend’s nickname is *Bob*. Then, type
    616 
    617 ::
    618 
    619    $ gnunet-gns -u test.bob
    620 
    621 to check if your friend was as good at following instructions as you
    622 were.
    623 
    624 
    625 Creating a business card
    626 """"""""""""""""""""""""
    627 
    628 Before we can really use GNS, you should create a business card. Note
    629 that this requires having LaTeX installed on your system. If you are
    630 using a Debian GNU/Linux based operating system, the following command
    631 should install the required components. Keep in mind that this requires
    632 3GB of downloaded data and possibly even more when unpacked. On a GNU
    633 Guix based system texlive 2017 has returns a DAG size of 5032.4 MiB. The
    634 packages which are confirmed to be required are:
    635 
    636 -  texlive-units
    637 -  texlive-labels
    638 -  texlive-pst-barcode
    639 -  texlive-luatex85
    640 -  texlive-preview
    641 -  texlive-pdfcrop
    642 -  texlive-koma-script
    643 
    644 **We welcome any help in identifying the required components of the
    645 TexLive Distribution. This way we could just state the required
    646 components without pulling in the full distribution of TexLive.**
    647 
    648 ::
    649 
    650    apt-get install texlive-full
    651 
    652 Start creating a business card by clicking the *Copy* button in
    653 gnunet-namestore-gtk. Next, you should start the gnunet-bcd program (in
    654 the terminal, on the command-line). You do not need to pass any options,
    655 and please be not surprised if there is no output:
    656 
    657 ::
    658 
    659    $ gnunet-bcd
    660 
    661 Then, start a browser and point it to http://localhost:8888/ where
    662 gnunet-bcd is running a Web server!
    663 
    664 First, you might want to fill in the *GNS Public Key* field by
    665 right-clicking and selecting *Paste*, filling in the public key from the
    666 copy you made in gnunet-namestore-gtk. Then, fill in all of the other
    667 fields, including your GNS NICKname. Adding a GPG fingerprint is
    668 optional. Once finished, click *Submit Query*. If your LaTeX
    669 installation is incomplete, the result will be disappointing. Otherwise,
    670 you should get a PDF containing fancy 5x2 double-sided translated
    671 business cards with a QR code containing your public key and a GNUnet
    672 logo. We’ll explain how to use those a bit later. You can now go back to
    673 the shell running gnunet-bcd and press CTRL-C to shut down the Web
    674 server.
    675 
    676 The GNUnet default Start Zones
    677 """"""""""""""""""""""""""""""
    678 
    679 The GNUnet default *Start Zones* are managed through `GANA <https://gana.gnunet.org>`_ and
    680 follows a `restrictive registration policy <https://git.gnunet.org/gana.git/tree/gnu-name-system-default-tlds/POLICY>`_.
    681 
    682 The GNUnet GNS Registrar
    683 """"""""""""""""""""""""
    684 
    685 The GNUnet GNS Registrar is a standalone package availiable as download
    686 in the `GNU FTP Mirror <https://ftpmirror.gnu.org/gnunet>`_.
    687 
    688 You can compile it using
    689 
    690 ::
    691 
    692   $ ./configure && make
    693 
    694 To run it execute
    695 
    696 ::
    697 
    698   $ ./gnunet-gns-registrar
    699 
    700 The registrar requires configuration of a `GNU Taler Merchant <https://www.taler.net/en/>`_.
    701 You can look at the example configuration for possible options.
    702 https://fcfs.gnunet.org is running a GNS registrar instance connected to the GNU Taler
    703 demo exchanges with a merchant running on https://merchant.gnunet.org for testing purposes
    704 where you can exchange KUDOS (which you get for free upon registration at the GNU Taler Demo
    705 system).
    706 Consequently, while requiring KUDOS as payment to register, this is still effectively a
    707 first-come-first server service.
    708 
    709 Resource Records
    710 ~~~~~~~~~~~~~~~~
    711 
    712 GNS supports the majority of the DNS records as defined in `RFC
    713 1035 <http://www.ietf.org/rfc/rfc1035.txt>`_. Additionally, GNS defines
    714 some new record types the are unique to the GNS system. For example,
    715 GNS-specific resource records are used to give petnames for zone
    716 delegation, revoke zone keys and provide some compatibility features.
    717 
    718 For some DNS records, GNS does extended processing to increase their
    719 usefulness in GNS. In particular, GNS introduces special names referred
    720 to as *zone relative names*. Zone relative names are allowed in some
    721 resource record types (for example, in NS and CNAME records) and can
    722 also be used in links on webpages. Zone relative names end in `.+` which
    723 indicates that the name needs to be resolved relative to the current
    724 authoritative zone. The extended processing of those names will expand
    725 the `.+` with the correct delegation chain to the authoritative zone
    726 (replacing `.+` with the name of the location where the name was
    727 encountered) and hence generate a valid GNS name.
    728 
    729 The GNS currently supports the record types as defined in
    730 `GANA <https://git.gnunet.org/gana.git/tree/gnu-name-system-record-types/registry.rec>`__.
    731 In addition, GNS supports DNS record types, such as `A`, `AAAA` or `TXT`.
    732 
    733 For a complete description of the records, please refer to the
    734 specification at `LSD0001 <https://lsd.gnunet.org/lsd0001>`__.
    735 
    736 In the following, we discuss GNS records with specific behavior or
    737 special handling in GNUnet.
    738 
    739 
    740 VPN
    741 """
    742 
    743 GNS allows easy access to services provided by the GNUnet Virtual Public
    744 Network. When the GNS resolver encounters a VPN record it will contact
    745 the VPN service to try and allocate an IPv4/v6 address (if the queries
    746 record type is an IP address) that can be used to contact the service.
    747 
    748 **Example**
    749 
    750 I want to provide access to the VPN service *web.gnu.* on port 80 on
    751 peer ABC012: Name: www; RRType: VPN; Value: 80 ABC012 web.gnu.
    752 
    753 The peer ABC012 is configured to provide an exit point for the service
    754 *web.gnu.* on port 80 to it’s server running locally on port 8080 by
    755 having the following lines in the gnunet.conf configuration file:
    756 
    757 ::
    758 
    759    [web.gnunet.]
    760    TCP_REDIRECTS = 80:localhost4:8080
    761 
    762 DNS Migration
    763 ~~~~~~~~~~~~~
    764 
    765 The following tools facilitate DNS to GNS zone migrations.
    766 
    767 The Zoneimport mechanism through ``gnunet-zoneimport`` allows you to mirror delegations in a TLD. We provide an example for AFNIC's ``.fr``.
    768 Why would you do it this way instead of a zone transfer using AXFR?
    769 Because some TLD authorities, such as AFNIC, do not support AXFR and only publish a list
    770 of delegated names.
    771 In such cases, ``gnunet-zoneimport`` comes in handy. While not perfect in terms
    772 of mirroring record updates and expirations, it is better than not being able to
    773 mirror the ``.fr`` TLD at all.
    774 In general, if the naming authority supports AXFR, then you should consider using Ascension (see below).
    775 If you are the naming authority, then you should consider manually managing synchronization
    776 between DNS and GNS or use the ``gnunet-namestore-zonefile`` tool to import DNS zonefiles
    777 into GNS.
    778 
    779 Note that the namestore by default also populates the namecache. This
    780 pre-population is cryptographically expensive. Thus, on systems that
    781 only serve to import a large (millions of records) DNS zone and that do
    782 not have a local gns service in use, it is thus advisable to disable the
    783 namecache by setting the option *DISABLE* to *YES* in section
    784 *[namecache]*.
    785 
    786 
    787 Zoneimport
    788 """"""""""
    789 
    790 If you want to support GNS but the master database for a zone is only
    791 available and maintained in DNS, GNUnet includes the gnunet-zoneimport
    792 tool to monitor a DNS zone and automatically import records into GNS.
    793 Today, the tool does not yet support DNS AF(X)R, as we initially used it
    794 on the *.fr* zone which does not allow us to perform a DNS zone
    795 transfer. Instead, gnunet-zoneimport reads a list of DNS domain names
    796 from stdin, issues DNS queries for each, converts the obtained records
    797 (if possible) and stores the result in the namestore.
    798 
    799 The zonemaster service then takes the records from the namestore,
    800 publishes them into the DHT which makes the result available to the GNS
    801 resolver. In the GNS configuration, non-local zones can be configured to
    802 be intercepted by specifying *.tld = PUBLICKEY* in the configuration
    803 file in the *[gns]* section.
    804 
    805 For example, assuming you have the AFNIC NomsDeDomainEnPointFr CSV file you can execute:
    806 
    807 ::
    808 
    809     $ cat OPENDATA_A-NomsDeDomaineEnPointFr.csv | cut -d';' -f 1 | tail -n+2 | gnunet-zoneimport 194.0.9.1
    810 
    811 This reads the first value of each line in the CSV as the domain name to import.
    812 The first line is skipped because it (usually) is a header, not an entry.
    813 The authoritative DNS server for ``fr`` is provided as IP.
    814 Note that you need to provide authoritative DNS servers.
    815 
    816 Zonefile
    817 """"""""
    818 
    819 In order to import DNS zones which are already defined in a
    820 `zone file <https://en.wikipedia.org/wiki/Zone_file>`_ in use
    821 with existing DNS daemons such as BIND you may try to import your DNS zones
    822 into DNS using ``gnunet-namestore-zonefile``.
    823 Assuming your zonefile is called ``myzonefile``, execute:
    824 
    825 ::
    826 
    827   $ gnunet-namestore-zonefile < myzonefile
    828 
    829 As you can see, the program reads the zonefile from standard input.
    830 Upon encountering an ``$ORIGIN`` directive a new ego will be created with that
    831 name unless it already exists.
    832 Note that ``$ORIGIN`` is a FQDN and ends with a ``.``, e.g. ``example.com.``.
    833 The ego will be called ``example.com`` (without the ``.``).
    834 All records following the directive will be imported into the zone identified by
    835 this origin.
    836 Multiple ``$ORIGIN`` directives within the same zone file are supported and
    837 egos will be created accordingly.
    838 If no ``$ORIGIN`` is explicitly specified in the beginning of the file
    839 (as is sometimes the case in BIND setups) or if you want to override the (first)
    840 occurence, you can provide an ego to use:
    841 
    842 ::
    843 
    844   $ gnunet-namestore-zonefile -z myorigin < myzonefile
    845 
    846 Note that in the conversion process some information found in the zone file
    847 is lost and other information is less precise than in GNS.
    848 For example, records stored in the ``$ORIGIN`` can be specified in multiple
    849 ways:
    850 
    851 .. code-block:: text
    852 
    853   $ORIGIN example.com.
    854   $TTL 3600
    855   example.com.    IN  MX    10 mail.example.com.  ; mail.example.com is the mailserver for example.com
    856   @               IN  MX    20 mail2.example.com. ; equivalent to above line, "@" represents zone origin
    857 
    858 GNS will map the origin ``example.com.`` to the empty label ``@`` whenever possible.
    859 Further, ``$TTL`` is given in seconds. GNS record expirations are defined in
    860 microseconds. The seconds will be converted to their equivalent in microseconds.
    861 Note how this means that conversion of GNS records (in particular their expirations)
    862 to a DNS zone file cannot be done without loss of information.
    863 This also means that converting the GNS zone back into a zone file (a function
    864 currently not implemented) would not yield the same zone file that was imported.
    865 
    866 Ascension
    867 """""""""
    868 
    869 Ascension is a tool to migrate existing DNS zones into GNS.
    870 
    871 Compared to the gnunet-zoneimport tool it strictly uses AXFR or IXFR
    872 depending on whether or not there exists a SOA record for the zone. If
    873 that is the case it will take the serial as a reference point and
    874 request the zone. The server will either answer the IXFR request with a
    875 correct incremental zone or with the entire zone, which depends on the
    876 server configuration.
    877 
    878 Before you can migrate any zone though, you need to start a local GNUnet
    879 peer. To migrate the Syrian top level domain - one of the few top level
    880 domains that support zone transfers - into GNS use the following
    881 command:
    882 
    883 ::
    884 
    885    $ ascension sy. -n ns1.tld.sy. -p
    886 
    887 The -p flag will tell GNS to put these records on the DHT so that other
    888 users may resolve these records by using the public key of the zone.
    889 
    890 Once the zone is migrated, Ascension will output a message telling you,
    891 that it will refresh the zone after the time has elapsed. You can
    892 resolve the names in the zone directly using GNS or if you want to use
    893 it with your browser, check out the GNS manual section. Configuring the
    894 GNU Name System. To resolve the records from another system you need the
    895 respective zones PKEY. To get the zones public key, you can run the
    896 following command:
    897 
    898 ::
    899 
    900    $ gnunet-identity -dqe sy
    901 
    902 Where *sy* is the name of the zone you want to migrate.
    903 
    904 You can share the PKEY of the zone with your friends. They can then
    905 resolve records in the zone by doing a lookup replacing the zone label
    906 with your PKEY:
    907 
    908 ::
    909 
    910    $ gnunet-gns -t SOA -u "$PKEY"
    911 
    912 The program will continue to run as a daemon and update once the refresh
    913 time specified in the zones SOA record has elapsed.
    914 
    915 DNSCurve style records are supported in the latest release and they are
    916 added as a PKEY record to be referred to the respective GNS public key.
    917 Key distribution is still a problem but provided someone else has a
    918 public key under a given label it can be looked up.
    919 
    920 There is an unofficial Debian package called python3-ascension that adds
    921 a system user ascension and runs a GNUnet peer in the background.
    922 
    923 Ascension-bind is also an unofficial Debian package that on installation
    924 checks for running DNS zones and whether or not they are transferable
    925 using DNS zone transfer (AXFR). It asks the administrator which zones to
    926 migrate into GNS and installs a systemd unit file to keep the zone up to
    927 date. If you want to migrate different zones you might want to check the
    928 unit file from the package as a guide.