2024-07-16 What's the minimal NNCP setup to get started?

This page is for you if you are curious about NNCP and you don't know how to get started. It contains instructions on how to set up your laptop such that it can exchange files with my laptop (melanobombus) via my server (sibirocobombus).

Before testing it, you need to send me an email with some info but we'll get to that.

First, switch to the root user. Everything will be easier that way.

sudo su

The instructions are going to assume a Debian system.

Begin by installing the `nncp` package.

apt install nncp

Generate a new `/etc/nncp.hjson` file and secure it:

nncp-cfgnew > /etc/nncp.hjson
chown nncp:nncp /etc/nncp.hjson
chmod 660 /etc/nncp.hjson

You need to add my server to your `/etc/nncp.hjson` file, in the `neigh` section.

    sibirocobombus: {
      id:       CCAIPFSAZWYICBQ5BIURX4UMEJIXVSZFIING7HRUFTDOFV5XISVQ
      exchpub:  NGEIDPDVZ2I6CTRKCBT734VV4W2YFVTV6YFBU5UGB6IHBA3QDJUQ
      signpub:  VXBMWXS74IGAYQCLJY4UPAXXQXPT3K53QI5XCFHOAKL4I2FQNLKQ
      noisepub: MGGBAOHRHEWEC6CGT47GA2DOQXQFZUAKJ66PD734Y5WNWP364UXQ
      addrs: {
        internet: "alexschroeder.ch:5400"
      }
      calls: [
        {
          cron: "@daily"
        }
      ]
    }

What does it mean?

1. you know how to contact my server via the `.addrs.internet` key – you need this, but you can specify `campaignwiki.org` instead, if your prefer

2. you connect to my server every now and then via the `calls[0].cron` entry – this is not necessary if you don't mind using `nncp-call` every now and then

My laptop can only be reached via my server. You need to add it as well.

As far as the `melanobombus.incoming` key goes, pick a suitable directory that your regular account has access to.

    melanobombus: {
      id:       R23WEIHB52TMA4EKGJPKUDBFSYP2HG4HHW2HGJ3RJATCCRLYDUZQ
      exchpub:  EGP2MMLQJQUKWTHI22JTIRMR2UV3BA2ATE3AYLVOFODMTNRGAMEA
      signpub:  YO6SZXVEIU77OQQRKMAUFUT4V3NJER4U7LQE5JI7JORJXKXY5FBA
      noisepub: 6ECO4WXJNDED6WHJ6SM2HGRQMUO75X65ALT2YRKZ3YGGBDXRNV4A
      via:      ["sibirocobombus"]
      incoming: "/home/alex/incoming/melanobombus"
      exec: {
        rsmtp:  ["/usr/sbin/sendmail", "-bS"]
      }
    }

What does it mean?

1. you know how to contact my laptop via my server using the `.via[0]` key – you need this and the name needs to match the name you used for my server

2. you allow my laptop to save incoming files in a directory via the `.incoming` key – you only need this if you want to receive files (the directory must exist and the `nncp` group must be allowed to write to it)

3. you allow my laptop to send mail to local users via the `.exec.rsmtp` key – this is not necessary if you don't want to receive mail

You would create the incoming directory as follows, as your regular user:

mkdir --parents ~/incoming/melanobombus
sudo chgrp nncp ~/incoming/melanobombus
sudo chmod g+w ~/incoming/melanobombus

You need to send me your system's public keys from the `/etc/nncp.hjson` file so that I can set up similar entries on my laptop and my server.

Once I've added your public keys (and an `incoming` key) to my server, we can test it. If I forget the `incoming` key, the logs will show "freqing is not allowed".

My server will not call you, since it doesn't know your Internet address. It waits for you to call it both when you want to send or when you want to receive something. You would do this as follows:

sudo -u nncp nncp-call sibirocobombus

Otherwise, the `@daily` entry in the `sibirocobombus.cron[0]` entry of your `/etc/nncp.hjson` file will call my server once a day, at midnight.

To send me a README file, you'd run:

sudo -u nncp nncp-file README melanobombus:
2024-07-12T18:12:15Z Tx README 486 B/486 B 100% (73 KiB/sec)
2024-07-12T18:12:15Z File README (282 B) is sent to melanobombus:README

At this point, the file is in the queue.

To examine the queue:

sudo -u nncp nncp-stat

You need to to call my server using `sudo -u nncp nncp-call sibirocobombus` to actually send the files or you'll have to wait for the cron job. My server will receive the packets encrypted and addressed to my laptop and enqueue them again. The next time my laptop calls my server, it'll get them.

You probably want to let me know about the file via another channel. But soon enough we can set up mail via NNCP. 😁

another channel

​#Administration ​#NNCP

NNCP setup automation