Skip to content

Commit 0dc44c1

Browse files
committed
README: adds info on configuring use of the PROXY Protocol, to avoid security holes
1 parent c145a50 commit 0dc44c1

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

charts/docker-mailserver/README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ cat /tmp/docker-mailserver/postfix-accounts.cf
117117

118118
This path is [mapped](#persistence) to a Kubernetes Volume.
119119

120+
Optionally (but reccomended), create a [`NetworkPolicy`](https://kubernetes.io/docs/concepts/services-networking/network-policies/) that only allows appropriate pods to connect to the DMS pod.
121+
120122
## Configuration
121123

122124
Assuming you still have a command prompt [open](#getting-started) in the running container, run the setup command to see additional configuration options:
@@ -206,16 +208,20 @@ proxyProtocol:
206208
trustedNetworks: "10.0.0.0/8 192.168.0.0/16 172.16.0.0/12"
207209
```
208210

211+
For security, you should narrow this to the actual range of IP addresses used by your ingress controller pods, and be certain to exclude any IP ranges gatewayed from IPv6 to v4 or vice versa.
212+
Also note that any compromised container in the cluster could use the PROXY protocol to evade some security measures, so set a `NetworkPolicy` that only allows the appropriate pods to connect to the DMS pod.
213+
209214
Enabling the PROXY protocol will create an additional port for each protocol (by adding 10,000 to the standard port value) that is configured to understand the PROXY protocol. Thus:
210215

211-
| Protocol | Port | PROXY Port |
212-
| ---------- | ------- | ----------- |
213-
| submissions | 465 | 10465 |
214-
| submission | 587 | 10587 |
215-
| imap | 143 | 10143 |
216-
| imaps | 993 | 10993 |
217-
| pop3 | 110 | 10110 |
218-
| pop3s | 995 | 10995 |
216+
| Protocol | Regular Port | PROXY Protocol Port |
217+
| ---------- |--------------|---------------------|
218+
| smtp | 25 | 12525 |
219+
| submissions | 465 | 10465 |
220+
| submission | 587 | 10587 |
221+
| imap | 143 | 10143 |
222+
| imaps | 993 | 10993 |
223+
| pop3 | 110 | 10110 |
224+
| pop3s | 995 | 10995 |
219225

220226
If you do not enable the PROXY protocol and your mail server is not exposed using a load-balancer service with an external traffic policy in "Local" mode, then all incoming mail traffic will look like it comes from a local Kubernetes cluster IP.
221227

charts/docker-mailserver/tests/__snapshot__/configmap_test.yaml.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ manifest should match snapshot:
5151
data:
5252
user-patches.sh: |
5353
#!/bin/bash
54+
# NOTE: Keep in sync with upstream advice:
55+
# https://github.com/docker-mailserver/docker-mailserver/blob/v15.0.0/docs/content/examples/tutorials/mailserver-behind-proxy.md?plain=1#L238-L268
56+
5457
# Duplicate the config for the submission(s) service ports (587 / 465) with adjustments for the PROXY ports (10587 / 10465) and `syslog_name` setting:
5558
postconf -Mf submission/inet | sed -e s/^submission/10587/ -e 's/submission/submission-proxyprotocol/' >> /etc/postfix/master.cf
5659
postconf -Mf submissions/inet | sed -e s/^submissions/10465/ -e 's/submissions/submissions-proxyprotocol/' >> /etc/postfix/master.cf

0 commit comments

Comments
 (0)