Security hardening

The defaults are already careful: the app port listens on loopback only, the database and storage are never published, secrets are generated for you. This page is the rest of the list, and what to do when a secret leaks.

The network

  • Only three things from the internet: TCP 443 (and 80 for certificates), UDP 50000–50050 and 3479. 8080, 5432 and 8333 stay closed. The compose file publishes the app port on 127.0.0.1 only; change PUBLISH_ADDR only when the proxy runs elsewhere, and then keep that port off the router.
  • Trust exactly your proxy. TRUSTED_PROXY_CIDRS decides whose X-Forwarded-For the server believes, which matters for rate limits and lockouts. Set the proxy's address that Admin > Status names, not a broad range: production refuses to start with an entry wider than an IPv4 /24 or an IPv6 /64 while the listener is not loopback.
  • HTTPS only. With a PUBLIC_URL that starts with https://, session cookies are Secure. A plain-http:// server starts with a warning, and browsers will not give it a microphone.

The Owner and the admins

  • Change the initial password and delete ADMIN_INITIAL_PASSWORD from .env.
  • Switch on two-factor sign-in for the Owner and every Administrator (Settings, with an authenticator app and recovery codes).
  • Give Administrator sparingly: it skips channel overwrites. Moderators usually need only Manage reports, Timeout members and Kick members.
  • Lost the Owner's authenticator and recovery codes? Whoever can run commands on the host can reset it: docker exec mnema-talk /usr/local/bin/mnema-talk reset-2fa OWNER_NAME.

Secrets

  • .env holds every secret. Keep it readable by you only (chmod 600 .env), out of git, and remember that backups contain it.
  • Two secrets protect accounts: JWT_SECRET (sessions) and DATA_KEY (authenticator secrets and recovery codes). Set a DATA_KEY if you want to be able to replace the session secret on its own.

A secret has leaked

  1. Move the leaked value to JWT_SECRET_PREVIOUS (or DATA_KEY_PREVIOUS) and put a new one (openssl rand -hex 32) into JWT_SECRET (or DATA_KEY).
  2. Run docker compose up -d.
  3. Run the rotation and check that its output lists the previous variable and ends without an error:
docker exec mnema-talk /usr/local/bin/mnema-talk rotate-keys
  1. Remove the previous value from .env right away and run docker compose up -d again. The start log must not contain AUTHENTICATOR SECRETS CANNOT BE READ.

For the session secret, step 4 signs everyone out, which is the point. The full procedure, including planned rotation: Rotating keys.

Images you can check

Release images are signed keylessly with cosign by the release workflow and carry build provenance and an SBOM. Check a pulled image before you run it:

cosign verify ghcr.io/mnema-xyz/mnema-talk:latest \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  --certificate-identity-regexp '^https://github\.com/(mnema-xyz/talk|msch128/mnema-talk)/\.github/workflows/release\.yml@refs/heads/main$'

Pin the digest in MNEMA_IMAGE (ghcr.io/mnema-xyz/mnema-talk@sha256:…) to keep a verified image from changing under a tag. The Update now button runs this check for you before every update.

The update sidecar

It is off by default. It holds the Docker socket, which is root on the host; it is locked down, but if you update by hand anyway, leave the autoupdate profile off. What it can and cannot do.

Backups and data

  • Encrypt offsite copies with BACKUP_AGE_RECIPIENT; keep the private key off the server (Backups).
  • Text messages and attachments are not end-to-end encrypted: whoever runs the server can technically read them. Calls are. Be clear about this with your crew; the security page draws the line.
  • Members export and delete their own data themselves, on each server.

Know what the server does by itself

No telemetry. The server's own outgoing calls (a STUN lookup, a clock check, the release check) can each be turned off: Ports and firewall. Security reviews, the threat model and how to report a vulnerability: SECURITY.md.

Something wrong on this page? Tell us.