web/website/ops/LOCAL-MAIL.md

68 lines
3.8 KiB
Markdown

# Local DuneRealms mailbox transport
Both named-account provisioning and internal mailbox operations use
`node/mail-broker-transport.mjs`. The existing validation, permissions, metadata
cache and JSON broker protocol are unchanged. Mail content is stored by Dovecot
on the website host; internal read/write/send operations no longer open SSH
connections to the controller.
## Settings
The administrator-owned `/etc/dune-mail-broker/settings.json` is the single
local configuration file. `DUNE_MAIL_BROKER_SETTINGS` can select another file.
Use `mail-broker-settings.example.json` as the schema reference. Preserve an
existing settings file; update only the intended values. Missing or invalid
settings fail closed rather than silently selecting an old host.
- `transport.mode`: `local` or `ssh`.
- `transport.local`: absolute broker command and whether to use `sudo -n`.
- `transport.ssh`: pinned host, identity file and known-hosts file for rollback.
- `mail`: IMAP/SMTP host and ports used by the installed Python internal broker,
plus the existing public webmail URL.
- `delivery`: controller address/port, loopback address and website address used
to configure Postfix, TLS and the restricted backend listeners.
The settings file contains no passwords and is root-owned, readable by the
application group. Database credentials, encrypted generated-mailbox credentials,
password hashes and TLS private keys remain root-private. The application can
run only `/usr/local/sbin/dune-mail-broker` through its dedicated sudo rule.
The controller keeps its non-secret domain routing settings separately at
`/etc/dune-mail-router/settings.json`. Other domains retain their existing
configuration. Its Dovecot authenticates Dune logins against the backend over
verified TLS; SMTP SASL also checks the backend password. Postfix routes the
Dune domain to the backend and verifies recipients there. Controller SMTP
trust is restricted to the website source. The local submission policy rejects
external recipients from internal identities before approved alias forwarding.
The JSON broker reads settings for each invocation. After changing delivery
addresses or ports, regenerate the affected service configuration/firewall/TLS
certificate and reload those services; editing JSON alone does not reconfigure
Postfix or Dovecot. The Node consumers require a process reload only when code
changes. Do not change unrelated integration settings.
## Installed operation, 19 November 2026
The owner authorized direct live installation before committing this change.
Two active personal named accounts were copied with their existing password
hashes and central identity mappings. No message migration was requested;
automatic/shared mailboxes regenerate through the existing reconciliation.
Old controller mailbox data was retained for rollback.
Storage: `/var/vmail` points to
`/mnt/HC_Volume_107481500/dunegit/mail/vmail`. Managed internal mailboxes retain
the existing 100 MB quota and 30-day purge through
`dune-internal-mail-purge.timer`. Backend IMAPS/SMTP listeners are restricted to
loopback and the controller by `dune-mail-firewall.service`; submission is
loopback-only. No public backend mail credentials were introduced.
Verification: both personal password hashes matched the source; local internal
provision/list/send/read/Sent succeeded; the unchanged public IMAP endpoint
reached the backend and rejected an incorrect password; internal external-compose
was rejected at SMTP RCPT. Verification messages were removed. No external
test message was sent. No full website rebuild was used for these live checks.
Rollback is an operator procedure: select the restricted SSH transport, restore
the controller domain routing/configuration from its root-private `before`
directory, and reload services. Reconcile messages created after cutover before
rolling storage back; switching transport alone does not move those messages.