PROXY protocol copies of the mail listeners, from the environment #475

Merged
jcoffey-dev merged 1 commits from feat/mail-proxy-listeners into main 2026-11-19 06:19:25 +00:00
Owner

For the chart's mail-in modes (K-C6, inbuxa/inbuxa-charts#6).

Behind a load balancer that sends PROXY v2, the server needs listeners that take the client's address from the header, and believe it only from the load balancer. In Kubernetes the chart can't add listeners to a store. The store-wide trusted networks don't fit either: they would make every listener expect a header from the pod network, HTTP included. Spike S6 showed that trusting the node or pod ranges lets anyone forge a client address.

INBUXA_MAIL_PROXY_LISTENERS=smtp=10025,imaps=10993 gives each named mail listener a copy on that port, with the same protocol and TLS. The copy trusts PROXY headers only from INBUXA_MAIL_PROXY_TRUSTED_NETWORKS. The copies aren't stored, and the listeners they copy are unchanged. These are refused: one variable without the other, an unknown listener, a port given twice, and a network wider than /8.

The load balancer has to listen on the standard ports. The server tells internet mail by local port 25, and with PROXY it reads that port from the header's destination. HAProxy on 2525 got the sender refused as an unauthenticated submission.

Tested with the release build on kind (inbuxa-k8s-lab mailin-test.sh):

  • Mail through an HAProxy that sends PROXY v2 and is the only trusted address shows the client's address in Received, not HAProxy's.
  • A forged header from an untrusted client isn't believed.
  • Local mode still gives the client's own address.

Unit tests cover the parsing. Docs: inbuxa/inbuxa.org#174, held for rc.32.

For the chart's mail-in modes (K-C6, inbuxa/inbuxa-charts#6). Behind a load balancer that sends PROXY v2, the server needs listeners that take the client's address from the header, and believe it only from the load balancer. In Kubernetes the chart can't add listeners to a store. The store-wide trusted networks don't fit either: they would make every listener expect a header from the pod network, HTTP included. Spike S6 showed that trusting the node or pod ranges lets anyone forge a client address. `INBUXA_MAIL_PROXY_LISTENERS=smtp=10025,imaps=10993` gives each named mail listener a copy on that port, with the same protocol and TLS. The copy trusts PROXY headers only from `INBUXA_MAIL_PROXY_TRUSTED_NETWORKS`. The copies aren't stored, and the listeners they copy are unchanged. These are refused: one variable without the other, an unknown listener, a port given twice, and a network wider than /8. The load balancer has to listen on the standard ports. The server tells internet mail by local port 25, and with PROXY it reads that port from the header's destination. HAProxy on 2525 got the sender refused as an unauthenticated submission. Tested with the release build on kind (inbuxa-k8s-lab `mailin-test.sh`): - Mail through an HAProxy that sends PROXY v2 and is the only trusted address shows the client's address in Received, not HAProxy's. - A forged header from an untrusted client isn't believed. - Local mode still gives the client's own address. Unit tests cover the parsing. Docs: inbuxa/inbuxa.org#174, held for rc.32.
jcoffey-dev added 1 commit 2026-11-19 06:08:09 +00:00
PROXY protocol copies of the mail listeners, from the environment
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 11m7s
ed1eaf8adf
Behind a load balancer that sends PROXY v2, the server needs listeners
that take the client's address from the header, believed from the load
balancer only. In Kubernetes the chart can't add listeners to a store, and
the store-wide trusted networks would make every listener, HTTP included,
expect a header from the pod network.

INBUXA_MAIL_PROXY_LISTENERS=smtp=10025,imaps=10993 gives each named mail
listener a copy on that port, with the same protocol and TLS, that trusts
PROXY headers from INBUXA_MAIL_PROXY_TRUSTED_NETWORKS only. The copies
aren't stored; the listeners they copy are unchanged. Each variable without
the other, an unknown listener, a port given twice and a network wider
than /8 are refused. K-C6.
jcoffey-dev merged commit b22e377a34 into main 2026-11-19 06:19:25 +00:00
jcoffey-dev deleted branch feat/mail-proxy-listeners 2026-11-19 06:19:25 +00:00
Sign in to join this conversation.