[relay] F23: quotas (507), a NixOS module behind Caddy with TLS and no logs, and a VM test that no address is kept
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
# 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).
|
||||
|
||||
## 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.
|
||||
Reference in New Issue
Block a user