Run your own servers
A relay is a FreeSpeech server that relays messages: it passes them from one device to another without keeping any of them. Setting one up is simple, and administering it requires neither a web interface nor a restart: a few command lines are enough.
Four roles
| Role | What it does | Who can connect |
|---|---|---|
| Public relay | Relays messages between connected devices. It can work with other public relays through a shared secret; each administrator manually maintains the list of relays they accept. | Everybody, except banned identities. |
| Private relay | For a family, an association, a company. It is not listed anywhere and refuses all communication with other servers. | Only identities the administrator allowed or invited. |
| Push gateway | Wakes the app of an offline device so that it shows a notification. It never receives content, only a token identifying the device. | The relays to which the operator has assigned a key. |
| Directory | On its first connection, a new app asks it for the address of a few relays accepting new accounts; it answers with a signed list. It keeps no information about clients and sees no message. | Only the first connection of a new identity. The relays it lists are the ones both administrators have accepted. |
One device can use as many relays, public or private, as it likes: the identity depends on no server.
Getting started
The relay is an ASP.NET Core 10 application that runs wherever .NET 10 is available (Linux, Windows, macOS…). Our reference server runs on Ubuntu 26.04. The relay sits behind a web server that provides the secure connection (HTTPS) with users. We use nginx, but any HTTPS server that can forward requests to it will do. The relay itself only listens on the local machine:
Admin__Secret="a long secret value" \
dotnet FreeSpeech.Relay.dll --urls http://127.0.0.1:5290
The first line sets the secret that protects the administration; the second starts the relay, listening on the local machine only. This syntax is that of a Linux or macOS terminal; on Windows, set the Admin__Secret environment variable instead (for example $env:Admin__Secret="…" in PowerShell).
The step-by-step guide (written for Ubuntu with nginx and systemd: certificate, firewall, updates) is available in the repository: sources/doc/en/INSTALL_RELAY.en.md (relay) and sources/doc/en/INSTALL_PUSH.en.md (push gateway). The server archives (relay, push gateway, directory), with an installation script, are in the releases of the repository.
Command-line administration free
The admin command addresses the admin API of the running relay. Settings take effect immediately, without restarting the server.
# Private relay: accept invited people only
dotnet FreeSpeech.Relay.dll admin access allowlist
dotnet FreeSpeech.Relay.dll admin invite "Anna" --days 7 # single-use token, shown once
dotnet FreeSpeech.Relay.dll admin clients # allowed, banned, invitations
dotnet FreeSpeech.Relay.dll admin ban <identifier> "reason" # also cuts its live connections
# Public relay: sibling relays and push gateways (the other administrator must accept)
dotnet FreeSpeech.Relay.dll admin add relay https://other.example.net
dotnet FreeSpeech.Relay.dll admin add push https://push.example.net
dotnet FreeSpeech.Relay.dll admin server-ban https://bad.example.net "abuse"
dotnet FreeSpeech.Relay.dll admin drain 50 # invite 50 clients to move to a sibling relay before maintenance
# Push gateway: accept the relays that ask
dotnet FreeSpeech.Push.dll admin requests # requests received, with the relay's fingerprint
dotnet FreeSpeech.Push.dll admin accept <id>
dotnet FreeSpeech.Push.dll admin ban <id>
dotnet FreeSpeech.Push.dll admin maintenance on # answers "busy": relays use another gateway
On the user side, it is enough to add the server's address in Settings → Servers. The server tells the app whether it is private; the app then offers to enter an invitation or request access.
Logs and tracing
dotnet FreeSpeech.Relay.dll admin log level relay debug # more detail, right now
dotnet FreeSpeech.Relay.dll admin log tail -f # live stream
dotnet FreeSpeech.Relay.dll admin trace 3fa9c1d2e4 --minutes 15 # follow one identity, stops by itself
dotnet FreeSpeech.Relay.dll admin log reset
Privacy rule: a log holds technical metadata only: never message content, never a key, never a device token, and identifiers are truncated to 8 characters. At the normal level, who writes to whom does not appear; a precise trace must be explicitly requested, is limited to one hour and leaves a trace in the log.
Administration kept out of sight
- The admin API only accepts calls coming from the machine itself, with the secret. The web server in front (nginx in our case) does not expose it: you reach it over SSH or a VPN.
- Secrets are write-only: once entered, they are never displayed again. Whenever possible, only their fingerprint is kept.
- If the access file is unreadable, the server shuts down instead of opening up to everyone.
FreeSpeech