Image runs with every capability dropped; INBUXA_LISTENER_PORTS #443

Merged
jcoffey-dev merged 1 commits from feat/no-file-caps into main 2026-11-18 15:55:44 +00:00
Owner

Closes #424 (K-S1).

Kubernetes' restricted pods drop every capability. The binary carried cap_net_bind_service as a file capability, and exec of such a binary fails outright when the capability isn't in the bounding set (exec /usr/local/bin/inbuxa: operation not permitted with rc.27 under --cap-drop ALL).

What changes

  • Dockerfile, Dockerfile.build (both stages), Dockerfile.fdb: no setcap, and no libcap package to run it.
  • INBUXA_LISTENER_PORTS moves the default listeners a new store gets, or leaves some out: smtp=2525,submissions=4465,imaps=9993,pop3s=off,https=8443. Names: smtp, submissions, imaps, pop3s, sieve, https, http. It's checked on every start, and a mistake (unknown name, bad port, a name twice, two listeners on one port) stops the server with a clear message. It's used only when the store has no listeners yet; after that the registry holds them, as before.
  • A bind refused on a port below 1024 now names what would allow it (CAP_NET_BIND_SERVICE, the sysctl, or a higher port).

Docker users: unchanged. Docker sets net.ipv4.ip_unprivileged_port_start=0 in a container's own network namespace, so the unprivileged server still binds 25/443/465/993. Not so under podman or --network host.

Tested

  • Unit tests for the parser (3).
  • rc.27 with its capability stripped, --cap-drop ALL --security-opt no-new-privileges, Docker bridge, fresh store: all seven default ports bound, CapEff 0.
  • This branch's binary, all caps dropped and ip_unprivileged_port_start=1024 (what a pod gets):
    • no variable: 25/443/465 refused with the new hint, 4190/8080 up;
    • the variable above: 2525/4465/9993/8443/4190/8080, no POP3;
    • imap=143: exits 1, there is no default listener 'imap'; they are smtp, ....
  • fmt, workspace --no-run, fork checks, changelog check: ok.

For the release notes (Before you upgrade)
The image no longer carries the capability to bind ports below 1024. Docker on its default or a user-defined network: nothing to do. Podman: add --sysctl net.ipv4.ip_unprivileged_port_start=0 (the installer's compose file sets it, inbuxa/inbuxa-installer PR linked below). --network host: add --cap-add NET_BIND_SERVICE. The binary releases and the systemd unit (AmbientCapabilities) are unaffected.

Companion PRs: installer (sysctl in compose), docs (install/server page; merge after the release).

Not touched: Dockerfile.relay; inbuxa-relay isn't part of the Kubernetes recipe.

Closes #424 (K-S1). Kubernetes' restricted pods drop every capability. The binary carried `cap_net_bind_service` as a file capability, and exec of such a binary fails outright when the capability isn't in the bounding set (`exec /usr/local/bin/inbuxa: operation not permitted` with rc.27 under `--cap-drop ALL`). **What changes** - `Dockerfile`, `Dockerfile.build` (both stages), `Dockerfile.fdb`: no `setcap`, and no libcap package to run it. - `INBUXA_LISTENER_PORTS` moves the default listeners a new store gets, or leaves some out: `smtp=2525,submissions=4465,imaps=9993,pop3s=off,https=8443`. Names: smtp, submissions, imaps, pop3s, sieve, https, http. It's checked on every start, and a mistake (unknown name, bad port, a name twice, two listeners on one port) stops the server with a clear message. It's *used* only when the store has no listeners yet; after that the registry holds them, as before. - A bind refused on a port below 1024 now names what would allow it (CAP_NET_BIND_SERVICE, the sysctl, or a higher port). **Docker users: unchanged.** Docker sets `net.ipv4.ip_unprivileged_port_start=0` in a container's own network namespace, so the unprivileged server still binds 25/443/465/993. Not so under podman or `--network host`. **Tested** - Unit tests for the parser (3). - rc.27 with its capability stripped, `--cap-drop ALL --security-opt no-new-privileges`, Docker bridge, fresh store: all seven default ports bound, CapEff 0. - This branch's binary, all caps dropped and `ip_unprivileged_port_start=1024` (what a pod gets): - no variable: 25/443/465 refused with the new hint, 4190/8080 up; - the variable above: 2525/4465/9993/8443/4190/8080, no POP3; - `imap=143`: exits 1, `there is no default listener 'imap'; they are smtp, ...`. - fmt, workspace `--no-run`, fork checks, changelog check: ok. **For the release notes (Before you upgrade)** The image no longer carries the capability to bind ports below 1024. Docker on its default or a user-defined network: nothing to do. Podman: add `--sysctl net.ipv4.ip_unprivileged_port_start=0` (the installer's compose file sets it, inbuxa/inbuxa-installer PR linked below). `--network host`: add `--cap-add NET_BIND_SERVICE`. The binary releases and the systemd unit (AmbientCapabilities) are unaffected. Companion PRs: installer (sysctl in compose), docs (install/server page; merge after the release). Not touched: `Dockerfile.relay`; inbuxa-relay isn't part of the Kubernetes recipe.
jcoffey-dev added this to the 27.1 milestone 2026-11-18 14:08:54 +00:00
jcoffey-dev added 1 commit 2026-11-18 14:08:54 +00:00
Image runs with every capability dropped; INBUXA_LISTENER_PORTS
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 13m7s
57eee17522
The binary carried cap_net_bind_service as a file capability, so exec
failed outright wherever the capability isn't in the bounding set, as in a
Kubernetes pod with every capability dropped. The images no longer set it
(or install libcap to set it).

Docker users are unaffected: Docker sets ip_unprivileged_port_start=0 in a
container's own network namespace, so the server still listens on 25, 443,
465 and 993 unprivileged. Under podman or --network host, grant the sysctl
or CAP_NET_BIND_SERVICE.

INBUXA_LISTENER_PORTS moves the default listeners a new store gets, or
leaves some out (smtp=2525,pop3s=off,...). It is checked on every start
and a mistake stops the server, but only used when the store has no
listeners yet; after that the registry holds them.

A bind refused on a port below 1024 now says what would allow it.

Closes #424
jcoffey-dev merged commit 5bc3952f73 into main 2026-11-18 15:55:44 +00:00
jcoffey-dev deleted branch feat/no-file-caps 2026-11-18 15:55:44 +00:00
Sign in to join this conversation.