deployment on aletheia and farewell #
these files are templates to review and install; nothing in this directory changes the running system automatically. keep the old images/configuration available for rollback, but do not restore the vulnerable public invite route.
configure #
create a managed Turnstile widget for pds.madoka.systems. Turnstile works
without Cloudflare proxying. its action is invite; the app supplies the
session binding automatically. use real keys in production, not the published
testing keys. there is no skip-verification switch.
as nadia on aletheia:
mkdir -p ~/.config/tea-party
cp .env.issuer.example ~/.config/tea-party/issuer.env
cp .env.directory.example ~/.config/tea-party/directory.env
cp .env.refill.example ~/.config/tea-party/refill.env
chmod 600 ~/.config/tea-party/*.env
create the two Turnstile secrets in nadia's rootless Podman store:
bash deploy/set-turnstile-secrets.sh
the script prompts without echoing either value and passes them through stdin,
so they do not enter shell history or command arguments. it refuses to replace
existing secrets. the issuer Quadlet injects tea_turnstile_site_key and
tea_turnstile_secret_key as TURNSTILE_SITE_KEY and TURNSTILE_SECRET_KEY.
the site key is public, but keeping the pair together simplifies setup. neither
value belongs in issuer.env or the public frontend container. turnstile.env
from the earlier setup is not used. secrets created as root are not available
to nadia's containers.
fill in the PDS admin password in refill.env only, and independently generated
32-byte hex values for PROXY_SECRET and SESSION_SECRET (openssl rand -hex 32).
retain the session secret across restarts; changing it invalidates sessions and
the HMAC identity buckets. Podman Secrets keep the Turnstile secret out of env
files and image layers; the issuer still receives it in its process environment.
when rotating a secret, replace it in Podman and recreate the issuer container
through its systemd unit before testing the new credentials.
review the default limits before starting: 3/IP/day, 3/session/day, 6/IPv6 /64/day, 10 globally/hour, 30 globally/day. the separate refiller stops at 10 unused codes and 30 mint attempts/day, including ambiguous failures.
mkdir -p ~/.local/share/tea-party/{run,pool,public,mint-private}
podman unshare chown 1000:1000 ~/.local/share/tea-party/{run,pool,public,mint-private}
podman unshare chmod 700 ~/.local/share/tea-party/{run,pool,public,mint-private}
keep mint-private mounted only into the refill job. its ledger must not be
the shared pool database. back up both SQLite databases consistently, together
with the session secret. do not erase or restore old quota state as an update
step. HMAC keys and quotas are part of the security state.
build #
podman build --format docker --target public -t localhost/tea-party:hardened-public .
podman build --format docker --target issuer -t localhost/tea-party:hardened-issuer .
podman build --format docker --target worker -t localhost/tea-party:hardened-worker .
install the services #
copy the two .container templates into ~/.config/containers/systemd/ and
the two job .service/.timer pairs into ~/.config/systemd/user/.
before starting, remove or replace the old tea-party Node health-check
drop-in, and retire/update the emergency build-service override and old build
timer so they cannot rebuild or restart the old image over this deployment.
the new public image has its own Caddy health check and contains no Node.
update any build automation to build all three reviewed targets together.
these examples use the existing pds.pod / systemd-pds pod for the static
frontend and offline jobs. the issuer has its own network namespace and no
published TCP port. it needs outbound HTTPS for Turnstile. its only listener
is the shared Unix socket. the issuer unit owns and removes the previous
socket before restart; do not start a second issuer manually on that path.
run the directory and refill jobs once to initialize the snapshot and finite
pool, then start the issuer and static frontend. enable their timers after
checking the first runs. the existing inner caddy-pds fallback can retain its
http://tea-party:4269 upstream. no changes to PDS account/database schemas are
needed. do not mount the old frontend .env into any public container.
authenticate the public proxy #
on farewell, store the issuer's PROXY_SECRET as a Podman secret named
tea_proxy_secret. the drop-in below supplies it to Caddy.
farewell's existing rootless bridge uses rootlessport, which hides the original client address. keep the bridge and its monitoring connections, but let a scoped pasta service forward only TCP 80/443 and UDP 443. its separate tap interface preserves external IPv4/IPv6 source addresses. the service follows Caddy restarts; it does not change host networking or require a reboot.
install -Dm700 deploy/farewell-ingress-port-forward ~/.local/bin/ingress-port-forward
install -Dm600 deploy/farewell-ingress-port-forward.service ~/.config/systemd/user/ingress-port-forward.service
install -Dm600 deploy/farewell-ingress-caddy.conf ~/.config/containers/systemd/ingress-caddy.container.d/70-tea-party.conf
validate the combined Quadlet and Caddy configuration before activation. then
reload the user systemd manager, enable ingress-port-forward.service, restart
ingress-caddy.service, and ensure both the forwarder and
ingress-tailscale.service are active. this briefly restarts the shared proxy.
verify HTTPS, PDS routes and source addresses over both address families.
replace only the existing pds.madoka.systems host block with
farewell.caddy, retaining the existing tailscale_transport definition.
validate before reloading. the proxy overwrites the verified address and key
for the two invite API paths, and strips them from other routes. redact these
headers from any access/debug logs. confirm that the forwarder preserves actual client source addresses; do not
substitute a visitor-supplied header if it does not.
all alternate paths, including a directly exposed Cloudflare Tunnel, will
fail closed for invites until they implement the same authenticated address
contract. do not mint the shared proxy key into all tailnet peers or trust all
of 100.64.0.0/10 as an equivalent identity proof.
verify and roll back #
check HTTPS page/assets, directory snapshot, the Turnstile widget and one explicitly approved real invite. confirm that forgeable CF/XFF headers do not change the quota, an invalid proxy key is denied, and restart retains limits. confirm actual container users, memory limits, read-only mounts and absence of the PDS key in public/issuer environments. test the global budget locally with mocks rather than consuming the real site's allowance. keep clocks synced: challenge freshness and rolling windows depend on host time.
if verification fails, stop invite API access while retaining the static page and existing PDS routes. do not fall back to the old unbounded invite handler. review this deployment as a coordinated release; source updates alone do not fix farewell's proxy contract.
refill timeouts intentionally leave pending reservations and do not retry writes. inspect the PDS's administrative invite inventory privately before resolving an ambiguous mint; never print codes or passwords into shared logs.
legacy maintenance #
when migrating this host, exclude Tea Party from the old SSR-only builder and its PDS deployment group, while retaining maintenance for the other containers. that recipe changes dependencies and expects a Node SSR entry point; it must never overwrite these three release targets. do not re-enable the old build timer. release subsequent reviewed source changes by building, scanning and validating all three targets together. keep pinned runtime versions current.