mailu

by fastlorenzo

Helm chartv1.0.0-beta.9App 1.9Verified publisher

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 VersionMailu Version
0.0.x, 0.1.x, 0.2.x1.8
0.3.x, 1.0.x1.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).
RepositoryNameVersion
https://charts.bitnami.com/bitnamicommon2.0.3
https://charts.bitnami.com/bitnamimariadb11.3.*
https://charts.bitnami.com/bitnamipostgresql11.9.*
https://charts.bitnami.com/bitnamiredis17.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

NameDescriptionValue
global.imageRegistryGlobal container image registry""
global.imagePullSecretsGlobal container image pull secret[]
global.storageClassGlobal storageClass to use for persistent volumes""
global.database.roundcube.databaseName of the roundcube databaseroundcube
global.database.roundcube.usernameUsername to use for the roundcube databaseroundcube
global.database.roundcube.passwordPassword to use for the roundcube database""
global.database.roundcube.existingSecretName of an existing secret to use for the roundcube database""
global.database.roundcube.existingSecretPasswordKeyName of the key in the existing secret to use for the roundcube database password""

Common parameters

NameDescriptionValue
kubeVersionForce target Kubernetes version (using Helm capabilities if not set)""
nameOverrideString to partially override mailu.fullname include (will maintain the release name)""
fullnameOverrideString to fully override mailu.fullname template""
commonLabelsAdd labels to all the deployed resources{}
commonAnnotationsAdd annotations to all the deployed resources{}

Mailu parameters

NameDescriptionValue
hostnamesList of hostnames to generate certificates and ingresses for. The first will be used as primary mail hostname.[]
domainMail domain name. See https://github.com/Mailu/Mailu/blob/master/docs/faq.rst#what-is-the-difference-between-domain-and-hostnames""
secretKeyThe secret key is required for protecting authentication cookies and must be set individually for each deployment""
existingSecretName of the existing secret to retrieve the secretKey.""
initialAccount.enabledEnable the creation of the initial accountfalse
initialAccount.usernameUsername of the initial account""
initialAccount.domainDomain of the initial account""
initialAccount.passwordPassword of the initial account; ignored if using existing secret; if empty, a random password will be generated and saved in a secret""
initialAccount.existingSecretName of the existing secret to retrieve the initial account's password""
initialAccount.existingSecretPasswordKeyName of the key in the existing secret to use for the initial account's password""
initialAccount.modeHow to treat the creationg of the initial account. Possible values: "create", "update" or "ifmissing"update
subnetChange this if you're using different address ranges for pods10.42.0.0/16
mailuVersionVersion/tag of mailu images - must be master or a version >= 1.91.9.26
logLeveldefault log level. can be overridden globally or per serviceWARNING
postmasterlocal part of the postmaster email address (Mailu will use @$DOMAIN as domain part)postmaster
limits.messageSizeLimitInMegabytesMaximum size of an email in megabytes50
limits.authRatelimit.ipSets the AUTH_RATELIMIT_IP environment variable in the admin pod60/hour
limits.authRatelimit.ipv4MaskSets the AUTH_RATELIMIT_IP_V4_MASK environment variable in the admin pod24
limits.authRatelimit.ipv6MaskSets the AUTH_RATELIMIT_IP_V6_MASK environment variable in the admin pod56
limits.authRatelimit.userSets the AUTH_RATELIMIT_USER environment variable in the admin pod100/day
limits.authRatelimit.exemptionLengthSets the AUTH_RATELIMIT_EXEMPTION_LENGTH environment variable in the admin pod86400
limits.authRatelimit.exemptionSets the AUTH_RATELIMIT_EXEMPTION environment variable in the admin pod""
limits.messageRatelimit.valueSets the MESSAGE_RATELIMIT environment variable in the admin pod200/day
limits.messageRatelimit.exemptionSets the MESSAGE_RATELIMIT_EXEMPTION environment variable in the admin pod""
external_relay.hostHostname of the external relay""
external_relay.usernameUsername for the external relay""
external_relay.passwordPassword for the external relay""
external_relay.secretNameName of the secret containing the username and password for the external relay; if set, username and password will be ignored""
external_relay.usernameKeyKey in the secret containing the username for the external relayrelay-username
external_relay.passwordKeyKey in the secret containing the password for the external relayrelay-password
clusterDomainKubernetes cluster domain namecluster.local
credentialRoundsNumber of rounds to use for password hashing12
`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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartmailu is pinned at v1.0.0-beta.9 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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