Spike: real client IPs on every mail port behind a load balancer #6

Closed
opened 2026-11-18 05:14:37 +00:00 by jcoffey-dev · 2 comments
Owner

S6 · size S · part of inbuxa for Kubernetes (tracking issue in inbuxa-charts)

PROXY protocol v2 from MetalLB/HAProxy, and externalTrafficPolicy: Local, on 25, 465, 587, 143, 993, 110, 995 and 4190.

Done when

  • The server logs the real client IP on every port, in both modes
  • Config needed is written up for K-C6
**S6** · size S · part of inbuxa for Kubernetes (tracking issue in inbuxa-charts) PROXY protocol v2 from MetalLB/HAProxy, and `externalTrafficPolicy: Local`, on 25, 465, 587, 143, 993, 110, 995 and 4190. **Done when** - The server logs the real client IP on every port, in both modes - Config needed is written up for K-C6
jcoffey-dev added this to the 27.1 milestone 2026-11-18 05:14:37 +00:00
jcoffey-dev added the enhancement label 2026-11-18 05:14:37 +00:00
jcoffey-dev self-assigned this 2026-11-18 06:28:54 +00:00
jcoffey-dev added the
priority
p2
label 2026-11-18 06:28:54 +00:00
Author
Owner

Folded into the checklist on inbuxa/inbuxa-charts#14 to keep the issue list short. The details stay here; reopen this when work on it starts.

Folded into the checklist on inbuxa/inbuxa-charts#14 to keep the issue list short. The details stay here; reopen this when work on it starts.
Author
Owner

Answer (lab, 2026-11-18): real client IPs work in both modes, and PROXY mode has one rule that must be enforced.

Setup: kind, MetalLB (L2), one server pod; clients in their own containers on the kind network.

Test Server logged remoteIp Result
A: LoadBalancer externalTrafficPolicy: Local → port 25 172.19.0.7 (the client) pass
B: client → HAProxy send-proxy-v2 → LoadBalancer (Cluster policy) → PROXY-only listener 10025 trusting node + pod ranges 172.19.0.8 (the client) pass
B, no PROXY header, direct to 10025 refused, invalid proxy header pass
B, forged PROXY TCP4 203.0.113.66 … sent directly to 10025 203.0.113.66 spoofed
B': same but externalTrafficPolicy: Local and trusted networks = the load balancer's own address only through LB: 172.19.0.8; forged direct: header ignored (500 Invalid command), logged 172.19.0.8 pass

Why the spoof worked. With the Cluster policy, SNAT makes every peer look like a node, so a listener that trusts nodes trusts anyone who can reach the port. Not a server bug: PROXY protocol trusts whatever its trusted peers send.

Rules for the chart (K-C6):

  1. PROXY goes to dedicated listeners (high ports, e.g. 10025), never the plain ones, so in-cluster clients and mode A keep working.
  2. Those listeners' overrideProxyTrustedNetworks = the load balancer's source addresses only (a required value in PROXY mode). Never pod or node ranges; the schema refuses them.
  3. The PROXY Service uses externalTrafficPolicy: Local (so the LB's address is what the pod sees) plus loadBalancerSourceRanges where the platform supports it.
  4. Listener changes take effect on restart, not on reload: the chart rolls the server pods when listener values change.

Also confirmed: the default listener set on a fresh store is 25, 443, 465, 993, 995, 4190, 8080 (no 587, 143 or 110 until added).

**Answer (lab, 2026-11-18): real client IPs work in both modes, and PROXY mode has one rule that must be enforced.** Setup: kind, MetalLB (L2), one server pod; clients in their own containers on the kind network. | Test | Server logged `remoteIp` | Result | |---|---|---| | A: LoadBalancer `externalTrafficPolicy: Local` → port 25 | 172.19.0.7 (the client) | pass | | B: client → HAProxy `send-proxy-v2` → LoadBalancer (Cluster policy) → PROXY-only listener 10025 trusting node + pod ranges | 172.19.0.8 (the client) | pass | | B, no PROXY header, direct to 10025 | refused, `invalid proxy header` | pass | | **B, forged `PROXY TCP4 203.0.113.66 …` sent directly to 10025** | **203.0.113.66** | **spoofed** | | B': same but `externalTrafficPolicy: Local` and trusted networks = the load balancer's own address only | through LB: 172.19.0.8; forged direct: header ignored (`500 Invalid command`), logged 172.19.0.8 | pass | **Why the spoof worked.** With the Cluster policy, SNAT makes every peer look like a node, so a listener that trusts nodes trusts anyone who can reach the port. Not a server bug: PROXY protocol trusts whatever its trusted peers send. **Rules for the chart (K-C6):** 1. PROXY goes to dedicated listeners (high ports, e.g. 10025), never the plain ones, so in-cluster clients and mode A keep working. 2. Those listeners' `overrideProxyTrustedNetworks` = the load balancer's source addresses only (a required value in PROXY mode). Never pod or node ranges; the schema refuses them. 3. The PROXY Service uses `externalTrafficPolicy: Local` (so the LB's address is what the pod sees) plus `loadBalancerSourceRanges` where the platform supports it. 4. Listener changes take effect on restart, not on reload: the chart rolls the server pods when listener values change. Also confirmed: the default listener set on a fresh store is 25, 443, 465, 993, 995, 4190, 8080 (no 587, 143 or 110 until added).
Sign in to join this conversation.