Introduction

Reticulum 1 est une suite logicielle permettant d’interconnecter divers systèmes utilisant divers moyens de connexion. Basée sur le langage Python, elle redéfinit de bout en bout un protocole de communication point-à-point chiffré. Voici décrite ici la mise en place d’un relai TCP auquel divers clients TCP peuvent se connecter et échanger des messages. On utilisera les logiciels reticulum-meshchat2 et nomadnet 3 pour discuter au travers de ce relai. Les versions respectives sont ci-dessous.

LogicielVersion
Reticulum-meshchatv1.21.0
NomadNet0.6.2
RNS (sur le serveur)0.9.4

Mise en place du relai

Se basant sur Docker, avec le Dockerfile suivant on lance directement l’outil rnsd.

FROM python:3.11-bookworm

ENV TCP_SERVER_LISTEN_IP="0.0.0.0"
ENV TCP_SERVER_LISTEN_PORT=85732
ENV CONFIG_FILE_PATH=".reticulum/config"

RUN apt-get update \
    && apt-get install -y sudo pipx build-essential \
    && apt-get clean \ 
    && rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash runner
RUN usermod -aG sudo runner

COPY --chmod=0755 entrypoint.sh /entrypoint.sh

USER runner
WORKDIR /home/runner

RUN mkdir -p .reticulum/
COPY config $CONFIG_FILE_PATH

RUN pipx install rns \
      && pipx ensurepath

ENTRYPOINT ["/entrypoint.sh"]
CMD ["rnsd", "-v"]

La configuration de l’interface paramètrera l’instanciation du server tcp sur le relai4 : via une interface et un port. Par défaut sur toutes les interfaces et le port 85732.

 [[TCPServer Interface]]
  type = TCPServerInterface
  enabled = yes
  mode = gateway
  listen_ip = 0.0.0.0
  listen_port = 85732

Dans la mesure où rnsd est lancé dans un conteneur Docker, on pensera bien à ouvrir un port externe de la machine hôte. On supposera le relai accessible à l’adresse factice my-relai.org.

Connexion clients

Maintenant que le relai est lancé, on peut configurer les clients et s’y connecter.

Meshchat

On ajoutera facilement le relai dans la liste des interfaces.

Interface client

NomadNet

Puis il faudra également adapter la configuration de Nomadnet, qui lui sera lancé en ligne de commande.

# This is the default Reticulum config file.
# You should probably edit it to include any additional,
# interfaces and settings you might need.

# Only the most basic options are included in this default
# configuration. To see a more verbose, and much longer,
# configuration example, you can run the command:
# rnsd --exampleconfig


[reticulum]
  
  # If you enable Transport, your system will route traffic
  # for other peers, pass announces and serve path requests.
  # This should only be done for systems that are suited to
  # act as transport nodes, ie. if they are stationary and
  # always-on. This directive is optional and can be removed
  # for brevity.
  
  enable_transport = False
  
  
  # By default, the first program to launch the Reticulum
  # Network Stack will create a shared instance, that other
  # programs can communicate with. Only the shared instance
  # opens all the configured interfaces directly, and other
  # local programs communicate with the shared instance over
  # a local socket. This is completely transparent to the
  # user, and should generally be turned on. This directive
  # is optional and can be removed for brevity.
  
  share_instance = No
  
  
  # If you want to run multiple *different* shared instances
  # on the same system, you will need to specify different
  # shared instance ports for each. The defaults are given
  # below, and again, these options can be left out if you
  # don't need them.
  
  shared_instance_port = 37428
  instance_control_port = 37429
  
  
  # You can configure Reticulum to panic and forcibly close
  # if an unrecoverable interface error occurs, such as the
  # hardware device for an interface disappearing. This is
  # an optional directive, and can be left out for brevity.
  # This behaviour is disabled by default.
  
  panic_on_interface_error = No


[logging]
  # Valid log levels are 0 through 7:
  #   0: Log only critical information
  #   1: Log errors and lower log levels
  #   2: Log warnings and lower log levels
  #   3: Log notices and lower log levels
  #   4: Log info and lower (this is the default)
  #   5: Verbose logging
  #   6: Debug logging
  #   7: Extreme logging
  
  loglevel = 4


# The interfaces section defines the physical and virtual
# interfaces Reticulum will use to communicate on. This
# section will contain examples for a variety of interface
# types. You can modify these or use them as a basis for
# your own config, or simply remove the unused ones.

[interfaces]
  
  # This interface enables communication with other
  # link-local Reticulum nodes over UDP. It does not
  # need any functional IP infrastructure like routers
  # or DHCP servers, but will require that at least link-
  # local IPv6 is enabled in your operating system, which
  # should be enabled by default in almost any OS. See
  # the Reticulum Manual for more configuration options.
  
  [[Default Interface]]
    type = AutoInterface
    enabled = false
  
  # [[RNS Testnet Dublin]]
  #   type = TCPClientInterface
  #   enabled = yes
  #   target_host = dublin.connect.reticulum.network
  #   target_port = 4965
  
  [[TCP Client Interface]]
    type = TCPClientInterface
    enabled = yes
    target_host = my-relai.org
    target_port = 85732

Ayant placé ce fichier dans un répertoire arbitraire (ici ~/nomadnet), on pourra invoquer la ligne de commande suivante pour lancer NomadNet.

$ docker run -it -v $HOME/nomadnet/:/root/.reticulum/ --network host ghcr.io/markqvist/nomadnet:master --textui

NomadNet sera lancé dans un conteneur Docker, en mode texte via l’image Docker publiquement accessible sur ghcr.io.

Visualisation

Les deux noeuds meshchat (nommé Meshchat_antlas2) et nomadnet (nommé NomadNet_antlas1) se voient après avoir envoyé leurs announces respectives.

Voici ce que NomadNet liste comme peer, comme noeuds identifiés. On remarque bien le nom Meshchat_antlas2 dans l’ Annouce Data. Nomadnet discovery

De son côté l’application Meshchat propose un graphe réseau — on notera l’insertion du nom de domaine factice dans l’image. Le noeud NomadNet_antlas1 est bien découvert via le relai TCP my-relai.org. Meshchat network

Discussion

S’étant mutuellement détectés, et les deux logiciels étant compatibles avec le protocole LXMF 5 notamment dédié à l’envoi de messages, tentons de communiquer par texte. Les adresses LXMF sont les suivantes.

NoeudIdentity hashAdresse LXMF
NomadNet_antlas15a1c6...109f2...
Meshchat_antlas20a9b5...e344a...

Avec Meshchat on initie la conversation, en retrouvant l’adresse LXMF de NomadNet_antlas1: 109f2.... Meshchat messages

Puis on répond via Nomadnet à l’adresse LXMF de Meshchat_antlas2 : e344a....

Nomadnet messages

Conclusion

Malgré une complexité significative des outils et la nécessité d’une configuration minutieuse, ce modèle de communication permet d’échanger des informations chiffrées via une infrastructure totalement maitrisée. On a passé sous silence quelques vrais atouts de cette solution, notamment le routage pair-à-pair et le fonctionnement avec des connexions bas-débit… L’encapsulation Docker est disponible ici 6.