Install the mail server on the host: release binary, its own user, a systemd unit #15

Merged
jcoffey-dev merged 1 commits from feat/server-on-host into main 2026-10-12 13:23:16 +00:00
Owner

Stacked on #14 (the image bump); this branch includes its commit, so merge #14 first.

--server host now installs the mail server on the host instead of refusing.

What it does

  • Fetches the inbuxa-server release binary for this machine's architecture and checks it against a SHA-256 pinned in internal/release (2026.10.10.1, amd64 + arm64). Runs --version on it before installing, so a binary that can't load on this machine's glibc is caught early. Installs it as /usr/local/bin/inbuxa-server, so it doesn't collide with the installer's own inbuxa.
  • Creates an inbuxa system user. Configuration and data go in <dir>/server, the environment in <dir>/server.env (0600), and the unit is inbuxa-server.service (AmbientCapabilities, NoNewPrivileges, ProtectSystem=full).
  • First boot follows the same sequence as a container install. During setup, a drop-in under /run (IPAddressAllow=localhost, IPAddressDeny=any) keeps the server reachable from this machine only, and the setup credential sits in a root-only file.
  • Then the listeners are fitted to the host: plain HTTP moves to 127.0.0.1:8081, the server's own 443 listener is removed (the proxy owns 443), and on --local every listener moves to loopback.
  • The finished unit has ConditionPathExists on config.json, so a server that loses its config stays down rather than coming back in bootstrap mode.
  • The console and webmail stay containers. With a host server, the webmail and Caddy use the host network and reach the server on loopback; the console stays on the project network. A container install renders byte-identical files to before.
  • status and export report the server as host. A re-run converges. Moving a server between container and host is refused with the reason (not built yet).

Tests

  • New unit tests: listener fitting, the bootstrap data path, both compose shapes, and secrets surviving a rewrite. All five rendered shapes pass docker compose config.
  • New e2e/cases/install-host.sh: 43/43 on Debian 13. It covers the binary, user, unit and capabilities; that no setup leftovers remain; the listeners; webmail sign-in as the first mailbox; status/export; converge and the refused shape change; and that a server with config.json moved away doesn't start.
  • install-local 26/26, install-public 20/20, status-export and topology (28/28) all pass unchanged.

Not in this PR

  • Host installs of the console and webmail, join, the TUI, upgrade/uninstall.
  • Moving a server between shapes.
  • The docs page for the installer (install/fresh.md still says host isn't built); that follows once this is released.
**Stacked on #14** (the image bump); this branch includes its commit, so merge #14 first. `--server host` now installs the mail server on the host instead of refusing. **What it does** - Fetches the inbuxa-server release binary for this machine's architecture and checks it against a SHA-256 pinned in `internal/release` (2026.10.10.1, amd64 + arm64). Runs `--version` on it before installing, so a binary that can't load on this machine's glibc is caught early. Installs it as `/usr/local/bin/inbuxa-server`, so it doesn't collide with the installer's own `inbuxa`. - Creates an `inbuxa` system user. Configuration and data go in `<dir>/server`, the environment in `<dir>/server.env` (0600), and the unit is `inbuxa-server.service` (AmbientCapabilities, NoNewPrivileges, ProtectSystem=full). - First boot follows the same sequence as a container install. During setup, a drop-in under `/run` (IPAddressAllow=localhost, IPAddressDeny=any) keeps the server reachable from this machine only, and the setup credential sits in a root-only file. - Then the listeners are fitted to the host: plain HTTP moves to 127.0.0.1:8081, the server's own 443 listener is removed (the proxy owns 443), and on `--local` every listener moves to loopback. - The finished unit has `ConditionPathExists` on config.json, so a server that loses its config stays down rather than coming back in bootstrap mode. - The console and webmail stay containers. With a host server, the webmail and Caddy use the host network and reach the server on loopback; the console stays on the project network. A container install renders byte-identical files to before. - `status` and `export` report the server as host. A re-run converges. Moving a server between container and host is refused with the reason (not built yet). **Tests** - New unit tests: listener fitting, the bootstrap data path, both compose shapes, and secrets surviving a rewrite. All five rendered shapes pass `docker compose config`. - New `e2e/cases/install-host.sh`: 43/43 on Debian 13. It covers the binary, user, unit and capabilities; that no setup leftovers remain; the listeners; webmail sign-in as the first mailbox; status/export; converge and the refused shape change; and that a server with config.json moved away doesn't start. - install-local 26/26, install-public 20/20, status-export and topology (28/28) all pass unchanged. **Not in this PR** - Host installs of the console and webmail, `join`, the TUI, `upgrade`/`uninstall`. - Moving a server between shapes. - The docs page for the installer (`install/fresh.md` still says host isn't built); that follows once this is released.
jcoffey-dev added 2 commits 2026-10-12 05:33:10 +00:00
The defaults were still server 2026.9.30.2, so a fresh install came up
without the fix for GHSA-m992-gp7g-wc2j. Console and webmail move to their
newest releases with it.

The plan also said each image was pinned by digest; they are pinned to a
release tag, as the comment beside the defaults explains, so it says that.
--server host now installs instead of refusing. The server is the release
binary for this machine's architecture, checked against a SHA-256 written
into the source (internal/release), run once with --version before it is
put in place, and installed as /usr/local/bin/inbuxa-server so it does not
collide with this program. It gets a system user, its configuration and
data in <dir>/server, its environment in <dir>/server.env (0600), and
inbuxa-server.service.

First boot is the container sequence. During setup a drop-in under /run
lets the server reach loopback and nothing else, and the step's credential
is in a root-only file rather than the unit. Then the listeners are fitted
to the host: plain HTTP to 127.0.0.1:8081, where a container install
publishes it; the server's own 443 listener removed, since the proxy holds
443; on --local every listener on loopback. The finished unit has
ConditionPathExists on the configuration, so a server that loses it stays
down instead of coming back in bootstrap mode.

The console and the webmail stay containers. Beside a host server the
webmail and Caddy share the host's network and reach it on loopback; the
console keeps the project network. A container install renders the same
files as before.

status and export report the server as host. A re-run converges; moving the
server between a container and the host is refused, not built yet.

e2e/cases/install-host.sh: 43 checks on Debian 13. install-local,
install-public, status-export and topology pass unchanged.
jcoffey-dev merged commit af9f75b839 into main 2026-10-12 13:23:16 +00:00
jcoffey-dev deleted branch feat/server-on-host 2026-10-12 13:23:16 +00:00
Sign in to join this conversation.