Files
Amicitia-Tabellarius/deploy/nixos/README.md
T
2026-11-16 11:40:21 +01:00

65 lines
2.9 KiB
Markdown

# Running the relay on NixOS
The relay listens on `127.0.0.1` only. Caddy sits in front with TLS from Let's Encrypt, and writes
no log that holds an address (`.agents/features/home-relay.md`).
## 1. Before
- A DNS name for the relay (an `A` and/or `AAAA` record) pointing at the machine.
- Ports **80** and **443** reachable from the internet. 80 is for Let's Encrypt's challenge; Caddy
redirects everything else on it to 443.
## 2. The configuration
In the machine's flake:
```nix
{
inputs.tabellarius.url = "git+https://gitea.marek-novak.cz/mnovak/Amicitia-Tabellarius?ref=main";
outputs = { nixpkgs, tabellarius, ... }: {
nixosConfigurations.home = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
tabellarius.nixosModules.default
{
services.tabellarius = {
enable = true;
domain = "relay.example.cz";
# Optional, the defaults shown:
# maxBytes = 1073741824; maxMailboxes = 100000; maxInvites = 10000;
};
}
./configuration.nix
];
};
};
}
```
Pin `tabellarius` in `flake.lock`, as for any input. Then `nixos-rebuild switch --flake .#home`.
## 3. What it sets up
| Part | What it does |
|:--|:--|
| `tabellarius.service` | `--listen 127.0.0.1:8470`, its database in `/var/lib/private/tabellarius`, a dynamic user, and a systemd sandbox. It may talk to localhost only (`IPAddressAllow=localhost`) |
| Caddy | one virtual host, `reverse_proxy` to the relay. No access log, no error log. `X-Forwarded-For`, `X-Real-IP` and `Forwarded` are removed, so the relay never learns who connected |
| Firewall | 80 and 443 open. `logRefusedConnections` off by default: a relay that keeps no address keeps no stranger's either |
## 4. Check it
- From another machine: `curl https://relay.example.cz/version` answers with the versions.
- On the server, after some use, the address of the machine you used must appear nowhere:
`journalctl -o verbose | grep -F <that address>` and `grep -rF <that address> /var/log` find
nothing.
- The same check runs automatically in a VM: `nix flake check` in this repository (Linux, KVM).
> **Not run yet (2026-11-16).** This module and its VM test were written on a machine without Nix
> and have never been evaluated. Until `nix flake check` passes on Linux, and the check above is
> done on the real server, *Caddy keeps no address* is the design, not a tested fact.
## 5. In the app
Settings → *Your message relay*: `https://relay.example.cz`. Until the app accepts `https://`
addresses (Amicitia F23), it takes a loopback address only.
## 6. What the operator still sees
Caddy and the relay keep nothing, but the machine's network still carries the connections while
they happen. A router or ISP log, or `tcpdump` on the server, would show addresses and timing
(`docs/PROTOCOL.md` §1). Turning Caddy's log on, even for a while, writes addresses. Do it only
knowing that.