mailu
by fastlorenzo
This chart installs the Mailu mail system on kubernetes
About this chart
mailu
This chart installs the Mailu mail system on kubernetes
Homepage: https://mailu.io
Compatibility
| Chart Version | Mailu Version |
|---|---|
| 0.0.x, 0.1.x, 0.2.x | 1.8 |
| 0.3.x, 1.0.x | 1.9.x |
Active development of this chart is only for the latest supported Mailu version (currently 1.9.x). Branches exists for older mailu versions (e.g. old/mailu-1.8).
Prerequisites
- ⚠️Starting with version 1.9, you need a validating DNSSEC compatible resolver in order to run Mailu.
- a working HTTP/HTTPS ingress controller such as nginx or traefik
- cert-manager v0.12 or higher installed and configured (including a working cert issuer). Otherwise you will need to handle it by yourself and provide the secret to Mailu.
- A node which has a public reachable IP, static address because mail service binds directly to the node's IP
- A hosting service that allows inbound and outbound traffic on port 25.
- Helm 3 (helm 2 support is dropped with release 0.3.0).
| Repository | Name | Version |
|---|---|---|
| https://charts.bitnami.com/bitnami | common | 2.0.3 |
| https://charts.bitnami.com/bitnami | mariadb | 11.3.* |
| https://charts.bitnami.com/bitnami | postgresql | 11.9.* |
| https://charts.bitnami.com/bitnami | redis | 17.3.* |
Warning about open relays
One of the biggest mistakes when running a mail server is a so called "Open Relay". This kind of misconfiguration is in most cases caused by a badly configured load balancer which hides the originating IP address of an email which makes Mailu think, the email comes from an internal address and ommits authentification and other checks. In the result, your mail server can be abused to spread spam and will get blacklisted within hours.
It is very important that you check your setup for open relay at least:
- after installation
- at any time you change network settings or load balancer configuration
The check is quite simple:
- watch the logs for the "mailu-front" POD
- browse to an open relay checker like https://mxtoolbox.com/diagnostic.aspx
- enter the hostname or IP address of your mail server and start the test
In the logs, you should see some message like
2021/10/26 21:23:25 [info] 12#12: *25691 client 18.205.72.90:56741 connected to 0.0.0.0:25
It is very important that the IP address shown here is an external public IP address, not an internal like 10.x.x.x, 192.168.x.x or 172.x.x.x.
Also verify that the result of the check confirms that there is no open relay:
SMTP Open Relay OK - Not an open relay.
Warning, this will not work on most cloud providers
- Google cloud does not allow outgoing connections to connect to port 25. You will not be able to send mails with mailu on google cloud (https://googlecloudplatform.uservoice.com/forums/302595-compute-engine/suggestions/12422808-please-unblock-port-25-allow-outbound-mail-connec)
- Many cloud providers don't allow to assign fixed IPs directly to nodes. They use proxies or load balancers instead. While this works well with HTTP/HTTPs, on raw TCP connections (such as mail protocol connections) the originating IP get's lost. There's a so called "proxy protocol" as a solution for this limitation but that's not yet supported by mailu (due the lack of support in the nginx mail modules). Without the original IP information, a mail server will not work properly, or worse, will be an open relay.
- If you'd like to run mailu on kubernetes, consider to rent a cheap VPS and run kuberneres on it (e.g. using rancher2). A good option is to use hetzner cloud VPS (author's personal opinion).
- Please don't open issues in the bug tracker if your mail server is not working because your cloud provider blocks port 25 or hides source ip addresses behind a load balancer.
Installation
- Add the repository via:
helm repo add mailu https://mailu.github.io/helm-charts/
- create a local values file:
helm show values mailu/mailu > my-values-file.yaml
Edit the my-values-file.yaml to reflect your environment.
- deploy the helm-chart with:
helm install mailu mailu/mailu -n mailu-mailserver --values my-values-file.yaml
- Uninstall the helm-chart with:
helm uninstall mailu --namespace=mailu-mailserver
Check that the deployed pods are all running.
Parameters
Global parameters
| Name | Description | Value |
|---|---|---|
global.imageRegistry | Global container image registry | "" |
global.imagePullSecrets | Global container image pull secret | [] |
global.storageClass | Global storageClass to use for persistent volumes | "" |
global.database.roundcube.database | Name of the roundcube database | roundcube |
global.database.roundcube.username | Username to use for the roundcube database | roundcube |
global.database.roundcube.password | Password to use for the roundcube database | "" |
global.database.roundcube.existingSecret | Name of an existing secret to use for the roundcube database | "" |
global.database.roundcube.existingSecretPasswordKey | Name of the key in the existing secret to use for the roundcube database password | "" |
Common parameters
| Name | Description | Value |
|---|---|---|
kubeVersion | Force target Kubernetes version (using Helm capabilities if not set) | "" |
nameOverride | String to partially override mailu.fullname include (will maintain the release name) | "" |
fullnameOverride | String to fully override mailu.fullname template | "" |
commonLabels | Add labels to all the deployed resources | {} |
commonAnnotations | Add annotations to all the deployed resources | {} |
Mailu parameters
| Name | Description | Value |
|---|---|---|
hostnames | List of hostnames to generate certificates and ingresses for. The first will be used as primary mail hostname. | [] |
domain | Mail domain name. See https://github.com/Mailu/Mailu/blob/master/docs/faq.rst#what-is-the-difference-between-domain-and-hostnames | "" |
secretKey | The secret key is required for protecting authentication cookies and must be set individually for each deployment | "" |
existingSecret | Name of the existing secret to retrieve the secretKey. | "" |
initialAccount.enabled | Enable the creation of the initial account | false |
initialAccount.username | Username of the initial account | "" |
initialAccount.domain | Domain of the initial account | "" |
initialAccount.password | Password of the initial account; ignored if using existing secret; if empty, a random password will be generated and saved in a secret | "" |
initialAccount.existingSecret | Name of the existing secret to retrieve the initial account's password | "" |
initialAccount.existingSecretPasswordKey | Name of the key in the existing secret to use for the initial account's password | "" |
initialAccount.mode | How to treat the creationg of the initial account. Possible values: "create", "update" or "ifmissing" | update |
subnet | Change this if you're using different address ranges for pods | 10.42.0.0/16 |
mailuVersion | Version/tag of mailu images - must be master or a version >= 1.9 | 1.9.26 |
logLevel | default log level. can be overridden globally or per service | WARNING |
postmaster | local part of the postmaster email address (Mailu will use @$DOMAIN as domain part) | postmaster |
limits.messageSizeLimitInMegabytes | Maximum size of an email in megabytes | 50 |
limits.authRatelimit.ip | Sets the AUTH_RATELIMIT_IP environment variable in the admin pod | 60/hour |
limits.authRatelimit.ipv4Mask | Sets the AUTH_RATELIMIT_IP_V4_MASK environment variable in the admin pod | 24 |
limits.authRatelimit.ipv6Mask | Sets the AUTH_RATELIMIT_IP_V6_MASK environment variable in the admin pod | 56 |
limits.authRatelimit.user | Sets the AUTH_RATELIMIT_USER environment variable in the admin pod | 100/day |
limits.authRatelimit.exemptionLength | Sets the AUTH_RATELIMIT_EXEMPTION_LENGTH environment variable in the admin pod | 86400 |
limits.authRatelimit.exemption | Sets the AUTH_RATELIMIT_EXEMPTION environment variable in the admin pod | "" |
limits.messageRatelimit.value | Sets the MESSAGE_RATELIMIT environment variable in the admin pod | 200/day |
limits.messageRatelimit.exemption | Sets the MESSAGE_RATELIMIT_EXEMPTION environment variable in the admin pod | "" |
external_relay.host | Hostname of the external relay | "" |
external_relay.username | Username for the external relay | "" |
external_relay.password | Password for the external relay | "" |
external_relay.secretName | Name of the secret containing the username and password for the external relay; if set, username and password will be ignored | "" |
external_relay.usernameKey | Key in the secret containing the username for the external relay | relay-username |
external_relay.passwordKey | Key in the secret containing the password for the external relay | relay-password |
clusterDomain | Kubernetes cluster domain name | cluster.local |
credentialRounds | Number of rounds to use for password hashing | 12 |
| `sessionCookieSec |
Deploy mailu with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has mailu on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartmailu is pinned at v1.0.0-beta.9 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply