Selfhosting e-mail
When this blog post goes live, my new e-mail setup is live. Try sending me a mail, my postfix service will happily accept it, if you look legit enough :-)
Managed e-mail seems a solved problem these days. You can rent cheap managed mail services, add their MX, SPF and DKIM entries to your DNS, and you’re done. Why bother selfhosting it?
For one, curiosity. I wanted to learn about postfix, dovecot and the other services that go along with it, and I enjoy the feeling of “owning” my infrastructure, including communication services.
For the other, if everyone slowly but surely goes to the big providers, the knowledge of setting up your own mailserver will eventually be lost, and in my eyes the web should be decentralized, not centralized on a few big companies.
Hosting a bit fun even - now that I can send mail programmatically at will and no cost, there’s plenty of things I can use it for: so far the most useful is my server being able to email me properly, and configuring e-mail in my own apps is now fairly straightforward.
I followed the excellent ISPmail guide for it: I’m
running postfix
, dovecot
and rspamd
. fail2ban
keeps bad actors out,
although so far my logfile has been relatively tame (compared to what I’m used
to from the nginx
and ssh
logs).
I wrote an Ansible role for it that configures the services mentioned above with PostgreSQL as the backing store for users, mailboxes, aliases and domains. I may publish it if there is interest.
One thing my system is still missing is CalDAV and CardDAV, which I’m planning
to integrate with radicale
when Debian Bookworm is out and
python3-radicale-dovecot-auth
can be found in Debian stable. An alternative for this might be Cyrus
IMAP, which has built-in support for these
protocols.
As for the SMTP side, postfix
has been nothing but impressive. The
documentation is amazing: everything I need to know can be found on the
manpages, man 5 postconf
documents every configuration option in great detail.
I’m happy with it, although I’ve also been meaning to give
OpenSMTPD a shot some time, as it seems nice and
simple.