Business mail on our own cluster, with a new domain set up by one command

Every order confirmation a Tagfalter shop sends, every password reset from a community site or a Nextcloud, and every mailbox of a mail customer runs through one mail system on our Kubernetes cluster in Tyrol. Mail is received, filtered, signed and stored here, and the mailboxes are copied out of the cluster every hour. When a new customer wants mail for their domain, I run one command. What remains for the customer is to publish a handful of DNS records at their registrar.

I built it this way because the mail of our customers should not sit at a US provider, and because I run this platform alone. Mail has to keep flowing when one machine is down and when I am not at a keyboard. So every part that carries load runs several times, and the setup of a domain is one command that does the same thing every time.

What happens to a mail

The system is built from open source parts in our own container images. Postfix receives mail from the internet and sends mail out. Dovecot serves the mailboxes to the mail clients. Amavis runs every incoming and every submitted mail through SpamAssassin for spam and ClamAV for viruses before it is delivered or sent on. OpenDKIM signs outgoing mail with the key of the sending domain, so the receiving server can verify that it really came from us. OpenDMARC checks incoming mail against the policy the sender's domain publishes. Users, domains and aliases live in one LDAP directory that all parts read.

The sending and receiving part runs three times, the mailbox part runs three times, and both scale up to ten copies under load. The signing and the checking part run at least twice. If a machine fails, the copies on the other machines carry on and the cluster starts replacements. The mailboxes themselves lie on the replicated storage of the cluster, so a mailbox server on any machine sees the same mail. Dovecot is configured for that kind of shared storage: it writes to disk immediately and locks files in a way that works across machines, because otherwise two servers could write into the same mailbox at the same time. Once an hour the mailboxes are copied to a storage system outside the cluster.

A domain in one command

Setting up mail for a domain is one command. It creates the domain in the directory, generates the signing key pair for that domain and stores it, makes the signing service pick the key up, proposes the change to the spam allow list as a merge request that I review, creates the first mailbox with a generated password, and prints the DNS records the customer has to publish.

Those records are strict on purpose. We ask for two mail servers (a primary and a backup), an SPF record that ends in a hard fail, the DKIM key, and a DMARC policy of reject. For the customer this means: a mail that pretends to come from their domain and does not come from us is rejected by the receiving server. A spoofer cannot produce a signature or a sending address that lines up with a domain they do not control.

The same tool adds users and refuses duplicates, creates aliases, changes passwords, rotates a domain's signing key, shows what is configured for a domain, and generates a short guide for the user.

The sites send through it too

The sites we host send their mails through this system as well, each with its own credentials, so no site shares a login with another. Our monitoring checks that mail really gets delivered, and it checks whether our server appears on a spam blocklist, which is the thing that silently breaks mail delivery for everyone on the server.

Today the system carries the mailboxes of our mail customers and the outgoing mail of every Tagfalter site, shop, Nextcloud and community site we host, on our hardware in Tyrol. Two things are still done by hand: the DNS records are set at the registrar by the customer or by me, and the spam and virus filter runs once, not redundantly.

Author: René Zingerle, CISSP, SSCP
Last Update: 26.11.2026