[relay] Wake-up: a push endpoint per mailbox, and a constant wake to it when a blob arrives
ci / check (pull_request) Has been cancelled
ci / check (pull_request) Has been cancelled
This commit is contained in:
@@ -38,7 +38,7 @@ Pin `tabellarius` in `flake.lock`, as for any input. Then `nixos-rebuild switch
|
||||
## 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`) |
|
||||
| `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, and with `wake = true` (the default) to global addresses only, for the wakes of `PROTOCOL.md` §6; every non-global range is denied (`IPAddressDeny`). `wake = false`: localhost only |
|
||||
| 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 |
|
||||
|
||||
|
||||
+24
-3
@@ -52,6 +52,18 @@ in
|
||||
description = "Unclaimed invites the relay holds before it answers 507.";
|
||||
};
|
||||
|
||||
wake = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Wake apps whose owners gave a push endpoint (PROTOCOL.md section 6): the relay may then
|
||||
connect out to global addresses, and only to those; every private, loopback-other-than-Caddy,
|
||||
link-local and reserved range stays denied here as well as in the relay. Names are looked up
|
||||
through the system's resolver (nscd on NixOS), so local sockets are allowed. Off: the relay
|
||||
talks to Caddy on loopback and to nothing else.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
@@ -79,10 +91,19 @@ in
|
||||
StateDirectoryMode = "0700";
|
||||
UMask = "0077";
|
||||
|
||||
# It talks to Caddy on loopback and to nothing else, even if it had a bug.
|
||||
IPAddressDeny = "any";
|
||||
# Without wakes it talks to Caddy on loopback and to nothing else, even if it had a bug. With
|
||||
# wakes it may also reach global addresses: the non-global ranges stay denied here, a second
|
||||
# wall behind the relay's own check (crates/relay/src/wake.rs). An address in both lists is
|
||||
# allowed, so localhost (Caddy) stays reachable.
|
||||
IPAddressAllow = "localhost";
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
|
||||
IPAddressDeny =
|
||||
if cfg.wake then [
|
||||
"0.0.0.0/8" "10.0.0.0/8" "100.64.0.0/10" "169.254.0.0/16" "172.16.0.0/12"
|
||||
"192.0.0.0/24" "192.0.2.0/24" "192.168.0.0/16" "198.18.0.0/15" "198.51.100.0/24"
|
||||
"203.0.113.0/24" "224.0.0.0/3" "::/96" "::ffff:0:0/96" "64:ff9b::/96" "100::/64"
|
||||
"2001::/32" "2001:db8::/32" "2002::/16" "fc00::/7" "fe80::/10" "fec0::/10" "ff00::/8"
|
||||
] else "any";
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ] ++ lib.optional cfg.wake "AF_UNIX";
|
||||
|
||||
CapabilityBoundingSet = "";
|
||||
NoNewPrivileges = true;
|
||||
|
||||
Reference in New Issue
Block a user