Docs

Mail server

The federation's own mail server (Stalwart), so people get name@your-domain addresses.

A federation can give people addresses name@<mail domain>. For that the bundled Stalwart mail server runs beside it, and the federation creates the mailboxes on it itself. People need no mailbox password: Comon connects to the mailbox on its own, and other mail apps use app passwords the person makes. If your domain's mail already runs on a server of yours, you need nothing on this page: name its IMAP and SMTP in Administration → Modules → Mail → Own mail server.

The full operator procedure is in the mail server runbook.

Ports

PortPublishedWhat
25yesSMTP: mail from other servers
465yessubmission over TLS
993yesIMAP over TLS
8080noweb administration and the management API

The management API is never published: only the federation reaches it, on the stack's internal network.

Starting it

  1. Copy compose.mail.yaml from deploy/hosted (or deploy/mvp) into the state directory and add COMON_MAIL_HOST=mail.example.org to stack.env.
  2. Start the stack (prepare-hosted-stack.py up or mvp-stack.py up). Stalwart starts in setup mode and prints a temporary administrator in its log.
  3. Open /admin through an SSH tunnel to port 8080 (never a public address), finish the setup and keep the permanent administrator in secrets/.
  4. Create an API key for the federation with the administrator's permissions and keep it as secrets/mail/api-key (mode 0600).
  5. Add COMON_MAIL_SERVER and COMON_MAIL_SERVER_KEY_FILE to stack.env and run up again.
  6. In the federation's mail settings, choose the bundled server and the mail domain.

People whose role holds «Federation mail address» can then claim <username>@<domain>.

DNS and TLS

  • The domain's MX points to COMON_MAIL_HOST, which has A/AAAA records.
  • SPF (v=spf1 mx -all), DKIM at the selector Stalwart generated, and _dmarc (start with p=none).
  • The server address's reverse DNS (PTR) is COMON_MAIL_HOST. Without it, mail is often rejected.
  • Many hosting providers block outbound port 25 by default: ask them to open it in advance.

The stack's reverse proxy holds ports 80 and 443, so get the certificate for COMON_MAIL_HOST with ACME DNS-01 in Stalwart itself, or mount certificate files. The federation verifies the mail server's certificate, so it must be in place before people claim addresses.

Letters from the federation

The federation sends its own letters (such as invitations to guests by e-mail) from a noreply@ sender. With the bundled server it is noreply@<domain>; another server can be named with the --mail-noreply-* flags (reference). An administrator turns the letters on in the federation's mail settings and can send a test letter there.

Backups and upgrades

The mail volume is the whole mail server. prepare-hosted-stack.py backup archives it with the rest (backups). Letters that arrive while the server is down wait at the senders' servers and come later. Change the Stalwart version in both compose.mail.yaml files at once, after reading its upgrade notes and taking a backup.

On this page