Server: count clients by the address the proxies pass on #22

Merged
jcoffey-dev merged 1 commits from feat/server-use-forwarded into main 2026-11-19 03:00:34 +00:00
6 changed files with 50 additions and 0 deletions

No files matched your search

+6
View File
@@ -45,6 +45,12 @@ runs, pinned by digest.
clients.
- `routes`: the server's, the webmail's and the console's public addresses,
each by host name, as Gateway API HTTPRoutes or one Ingress.
- The server counts clients by the address the ingress or gateway and the
webmail pass on (`INBUXA_HTTP_USE_FORWARDED`), so failed sign-ins and
anonymous requests aren't charged to the proxy: without it, enough wrong
passwords between all users would ban the ingress for everyone.
`server.trustedProxies` lists the proxies when the pod network isn't a
private range. Needs server 27.1-rc.32; older servers ignore it.
- `networkPolicy`, on by default: every pod starts from deny all, in and
out, and gets only what it needs. The server takes mail on its listeners
from anywhere and connects anywhere; `networkPolicy.httpFrom` and
+1
View File
@@ -19,6 +19,7 @@ server:
- secretName: inbuxa-s3
items: [{key: secret-key, path: s3-secret-key}]
publicUrl: https://mail.example.org
trustedProxies: [10.0.0.0/8, 100.64.0.0/10]
listeners:
pop3s: 995
groups:
@@ -144,6 +144,15 @@ spec:
{{- end }}
- name: INBUXA_LISTENER_PORTS
value: {{ include "inbuxa.server.listenerPorts" $root | quote }}
# Reached only through the ingress or gateway and the webmail:
# count each client by the address they pass on, so failed
# sign-ins and anonymous requests aren't charged to the proxy
- name: INBUXA_HTTP_USE_FORWARDED
value: "true"
{{- with $server.trustedProxies }}
- name: INBUXA_HTTP_TRUSTED_PROXIES
value: {{ join "," . | quote }}
{{- end }}
{{- /* The front ends, registered as OAuth clients on every start */}}
{{- with $root.Values.webmail }}
{{- if .enabled }}
+20
View File
@@ -236,3 +236,23 @@ tests:
template: server/deployment.yaml
asserts:
- failedTemplate: {}
- it: counts clients by the address the proxies pass on
template: server/deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content: {name: INBUXA_HTTP_USE_FORWARDED, value: "true"}
- notContains:
path: spec.template.spec.containers[0].env
content: {name: INBUXA_HTTP_TRUSTED_PROXIES}
any: true
- it: trusts the proxies it's given instead of the private ranges
template: server/deployment.yaml
set:
server.trustedProxies: [100.64.0.0/10, 10.0.0.0/8]
asserts:
- contains:
path: spec.template.spec.containers[0].env
content: {name: INBUXA_HTTP_TRUSTED_PROXIES, value: "100.64.0.0/10,10.0.0.0/8"}
+6
View File
@@ -263,6 +263,12 @@
"type": "string",
"pattern": "^(https?://[^/\\s]+)?$"
},
"trustedProxies": {
"type": "array",
"items": {
"type": "string"
}
},
"listeners": {
"type": "object",
"additionalProperties": false,
+8
View File
@@ -80,6 +80,14 @@ server:
# pages and OAuth metadata name it.
publicUrl: ""
# The proxies whose X-Forwarded-For the server believes, as CIDRs: the
# ingress or gateway, and the webmail. The server reads the header so that
# its limits and bans for failed sign-ins count each client, not the proxy.
# Empty: loopback and the private ranges, which covers pods on most
# clusters. List your pod network here if it isn't private (100.64.0.0/10,
# say).
trustedProxies: []
# The port in the pod of each listener a new store gets, which is what
# the Services send traffic to. 0 leaves that listener out. The pods may
# listen below 1024 without any privilege: they set the namespaced sysctl