You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: TESTING.md
-3Lines changed: 0 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,9 +34,6 @@ To run locally:
34
34
35
35
*ct* can also test a chart by deploying it to a temporary namespace in a Kubernetes cluster, and waiting for indications that the deployment has been successful. This is a good way to test how the deployment behaves "for real".
36
36
37
-
38
-
39
-
40
37
ct lint --config=.ci/ct-config.yaml
41
38
42
39
Create a KinD cluster, by running `kind create cluster`:
Copy file name to clipboardExpand all lines: charts/docker-mailserver/README.md
+82-17Lines changed: 82 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,17 +37,68 @@ Kubernetes cluster. docker-mailserver is a production-ready, fullstack mail serv
37
37
- A [Kubernetes](https://kubernetes.io/releases/) cluster with persistent storage and access to email [ports](https://docker-mailserver.github.io/docker-mailserver/latest/config/security/understanding-the-ports/#overview-of-email-ports)
-[Cert Manager](https://cert-manager.io/docs/) or a similar tool to create and renew TLS certificates
40
41
41
42
## Getting Started
42
43
43
44
Setting up docker-mailserver requires generating a number of configuration [files](https://docker-mailserver.github.io/docker-mailserver/latest/config/advanced/optional-config/). To make this easier, docker-mailserver includes a `setup` command that can generate these files.
44
45
45
-
To get started, first add the helm repo and install docker-mailserver:
46
+
To get started, first configure the firewall on your cluster to allow connections to ports 25 (imap), 465 (submissions), 587 (submission) and 993 (imaps) from any IP address.
46
47
48
+
If you have a LoadBalancer service routing traffic to your ingress controller, configure it to pass through the mail ports.
49
+
50
+
Then, configure your ingress controller (or Gateway) to [pass through the email ports](https://docker-mailserver.github.io/docker-mailserver/latest/config/advanced/kubernetes/#using-the-proxy-protocol).
51
+
52
+
Next, manually create a TLS Certificate, setting `metadata.name` and `spec.secretName` to the same value. Also set the fully-qualified domain name for your mail server in `spec.dnsNames` and `spec.issuerRef.name` to the name of an Issuer or ClusterIssuer, and `spec.issuerRef.kind` to `Issuer` or `ClusterIssuer`.
53
+
```yaml
54
+
apiVersion: cert-manager.io/v1
55
+
kind: Certificate
56
+
57
+
metadata:
58
+
name: mail-tls-certificate-rsa
59
+
60
+
spec:
61
+
secretName: mail-tls-certificate-rsa
62
+
isCA: false
63
+
privateKey:
64
+
algorithm: RSA
65
+
encoding: PKCS1
66
+
size: 2048
67
+
dnsNames: [mail.example.com]
68
+
issuerRef:
69
+
name: letsencrypt-production
70
+
kind: Issuer
71
+
```
72
+
```console
73
+
kubectl apply -f certificate.yaml --namespace mail
Create a Helm values file. See the comments in [values.yaml](https://github.com/docker-mailserver/docker-mailserver-helm/blob/master/charts/docker-mailserver/values.yaml) to understand all the options, or create a minimal file like this (where `mail-tls-certificate-rsa` is the name of the certificate you previously created and `example.com` is the name of your domain):
82
+
```yaml
83
+
## Specify the name of a TLS secret that contains a certificate and private key for your email domain.
84
+
## See https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets
85
+
certificate: mail-tls-certificate-rsa
49
86
50
-
helm upgrade --install docker-mailserver docker-mailserver/docker-mailserver --namespace mail --create-namespace
87
+
deployment:
88
+
env:
89
+
OVERRIDE_HOSTNAME: example.com # You must OVERRIDE this!
90
+
```
91
+
If you're using the HAProxy ingress controller, configure it to send PROXY Protocol to the docker-mailserver ports, by appending this to your values file:
92
+
```yaml
93
+
service:
94
+
annotations:
95
+
haproxy.org/send-proxy-protocol: proxy-v2
96
+
```
97
+
98
+
Then install docker-mailserver using the values file:
99
+
100
+
```console
101
+
helm upgrade --install docker-mailserver docker-mailserver/docker-mailserver --namespace mail --create-namespace -f values.yaml
51
102
```
52
103
53
104
Next open a command prompt to the running container.
This path is [mapped](#persistence) to a Kubernetes Volume.
80
131
132
+
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.
133
+
81
134
## Configuration
82
135
83
136
Assuming you still have a command prompt [open](#getting-started) in the running container, run the setup command to see additional configuration options:
@@ -148,38 +201,50 @@ Once you acquire a certificate, you will need to store it in a TLS secret in the
148
201
certificate: my-certificate-secret
149
202
```
150
203
151
-
The chart will then automatically copy the certificate and private key to the `/tmp/dms/custom-certs` director in the container and correctly set the `SSL_CERT_PATH` and `SSL_KEY_PATH` environment variables.
204
+
The chart will then automatically copy the certificate and private key to the `/tmp/dms/custom-certs` directory in the container and correctly set the `SSL_CERT_PATH` and `SSL_KEY_PATH` environment variables.
152
205
153
206
## Ports
154
207
155
-
If you are running on a bare-metal Kubernetes cluster, you will have to expose ports to the internet to receive and send emails. In addition, you need to make sure that `docker-mailserver`` receives the correct client IP address so that spam filtering works.
208
+
If you are running on a bare-metal Kubernetes cluster, you will have to expose ports to the internet to receive and send emails. In addition, you need to make sure that `docker-mailserver` receives the correct client IP address so that spam filtering works.
156
209
157
-
This can get a bit complicated, as explained in the `docker-mailserver` [documentation](https://docker-mailserver.github.io/docker-mailserver/latest/config/advanced/kubernetes/#exposing-your-mail-server-to-the-outside-world).
210
+
This can get a bit complicated, as explained in the `docker-mailserver` [documentation][dms-docs::k8s::network-config].
158
211
159
-
One approach to preserving the client IP address is to use the PROXY protocol, which is explained in the [documentation](https://docker-mailserver.github.io/docker-mailserver/latest/config/advanced/kubernetes/#proxy-port-to-service-via-proxy-protocol).
212
+
One approach to preserving the client IP address is to [use the PROXY protocol][dms-docs::k8s::proxy-protocol].
160
213
161
-
The Helm chart supports the use of the proxy protocol via the `proxyProtocol` key. To enable it set the `proxyProtocol.enable` key to true. You will also want to set the `trustedNetworks` key.
214
+
The Helm chart supports the use of the proxy protocol via the `proxyProtocol` key. By default `proxyProtocol.enable` is true, and `trustedNetworks` is set to the private IP network ranges, as are typically used inside a cluster.
162
215
163
216
```yaml
164
217
proxyProtocol:
165
218
enabled: true
166
219
# List of sources (in CIDR format, space-separated) to permit PROXY protocol from
Additionally, you will need to enable `proxyProtocol` for your loadbalancer.
224
+
- If you are using a cloud service they will most likely have documentation on how to do this for their loadbalancer.
225
+
- If you are using k3s then this is [currently impossible][k3s-klipperlb-pp] with the default components.
226
+
227
+
For security, you should narrow `trustedNetworks` 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.
228
+
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.
229
+
170
230
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:
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.
Docker-mailserver assumes there are [four](https://docker-mailserver.github.io/docker-mailserver/latest/config/advanced/optional-config/#volumes) mounted volumes:
@@ -231,7 +296,7 @@ DMS utilizes neither group-only chown as nfsnobody/root, fsGroup applied to all
231
296
Quirks from the generic section also apply to NFS-backed PersistentVolumes.
232
297
233
298
## Upgrading to Version 5
234
-
Version 5.0 upgrades docker-mailserver to version 15. This version of the chart *does* include backwards incompatible changes
299
+
Version 5.0 of the chart *does* include backwards incompatible changes.
0 commit comments