Files
wanderbooks/deploy/relay/wanderbooks-relay.service
T
swaitsandClaude Fable 5.2 975a4d0452 feat(relay): a setup kit for a real machine; the relay's own name answers CAA so its certificate can renew
The apex CAA set allows issuance by DNS-01 only, and the relay
publishes challenge records only for apps' names, so no authority
could issue or renew the relay's own certificate. The relay now
answers CAA at its own host name with the same authorities and no
method restriction; every other name still climbs to the apex.
deploy/relay holds the service unit, settings and certbot hook, and
docs/relay-deploy.md the steps.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 09:47:50 -07:00

71 lines
2.3 KiB
Desktop File

# The relay for wanderbooks.link (plan P15, unit B2; docs/relay-deploy.md).
#
# One process, one account, two jobs: it routes an assistant's TLS
# connection down the line an app holds open (TCP 443), and it is the
# domain's DNS server (UDP and TCP 53). It runs as its own account with no
# shell, and the only file it writes is its registry, in its state folder.
#
# Install: the binary is /usr/local/bin/wanderbooks-relay (the `relay`
# program from `cargo build --release -p relay`), the settings are
# /etc/wanderbooks-relay/relay.toml and the certificate files that file
# names sit beside it. See docs/relay-deploy.md for every step.
[Unit]
Description=wanderbooks relay: routes web assistants to apps, and is the DNS of wanderbooks.link
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=wanderbooks-relay
Group=wanderbooks-relay
DynamicUser=no
# Makes /var/lib/wanderbooks-relay, owned by the account, and is the only
# writable place (the registry lives there).
StateDirectory=wanderbooks-relay
StateDirectoryMode=0700
WorkingDirectory=/var/lib/wanderbooks-relay
ExecStart=/usr/local/bin/wanderbooks-relay /etc/wanderbooks-relay/relay.toml
# The relay shuts down cleanly on SIGINT (Ctrl-C) and on nothing else: a
# SIGTERM would end it at once. So systemd stops it with SIGINT.
KillSignal=SIGINT
TimeoutStopSec=30
Restart=on-failure
RestartSec=2s
# The relay writes its log lines to standard error; the journal keeps them.
# One line a minute carries the counters (lines, routed, shed, ...).
StandardOutput=journal
StandardError=journal
# Ports 53 and 443 are below 1024. This one capability lets the account
# bind them and nothing more.
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
# Each idle app is one open socket, and each caller in flight is another.
# 262144 is far above what a small machine can hold in memory.
LimitNOFILE=262144
# The account and the filesystem.
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
PrivateDevices=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectControlGroups=yes
ProtectClock=yes
ProtectHostname=yes
LockPersonality=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
RestrictNamespaces=yes
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
SystemCallArchitectures=native
UMask=0077
[Install]
WantedBy=multi-user.target