mail

FreeBSD mail server: rspamd & DKIM

Now that we have our basic mail infrastructure working, we will add support for rspamd and enable DKIM signing of our messages. In this series we will set up a fully-featured mail server in a FreeBSD jail using OpenSMTPd, Dovecot and rspamd. In contrast to many other guides, this one is split into multiple posts that can either be read and followed individually, or as a whole. After each post, you end up with a fully working system (that might lack some features ;)).

FreeBSD mail server: Virtual users and LMTP

In this part of the FreeBSD mail server, we build on the recent two posts where we set up the IMAP and SMTP and extend our configuration to support virtual users, which means that we don’t autenticate with system users anymore and, alongside, hand over the incoming email management to Dovecot by providing email from OpenSMTPd to Dovecot using LMTP. Since both daemons will not work together more closely, we will also unify the login credentials in a single passwd-style file that can be read from both OpenSMTPd and Dovecot.

FreeBSD mail server: IMAP using Dovecot

This is a follow-up post to the initial FreeBSD mail server article that I posted a few weeks ago. In this step, we will build upon what we set up in the first part and add the possibility to fetch email from a mail client using IMAP. We will still use system users for authentication, before we switch to virtual users in the next step. In this series we will set up a fully-featured mail server in a FreeBSD jail using OpenSMTPd, Dovecot and rspamd.

FreeBSD mail server: Basic SMTP with OpenSMTPd

I run mail servers for many years now, but I was never brave enough to set up one from scratch for my daily mail. So I always fell back to pre-configured solutions like docker-mailserver, Mailcow, or in case of FreeBSD to iRedMail. My biggest pain point was the secure configuration of Postfix. When I discovered OpenSMTPd, I decided that it’s the right time now to finally build a fully-featured mail server setup from scratch including virtual users, spam filter etc.

Postfix subaddressing (with PostgreSQL)

I have so many accounts for various web-based solutions, I barely can remember a few. And they send emails. So many that it’s sometimes hard to not loose the overview in my mailbox. When you run your own mail server, it’s easy to set up a dynamic aliases for your mailserver based on a regular expression pattern that allows to e.g. have a own email address for each service you register.

FreeBSD: Send mails over an external SMTP server

FreeBSD is shipped with sendmail as the default MTA, which is configured to local delivery on a vanilla installation. Therefore many people don’t even recognize one of FreeBSDs great features for system administrators: FreeBSD sends system status emails through periodic(8)

Simple mail forwarding using Postfix

It’s more than likely that your email provider of choice, especially the ones that offer mail services free of charge, will not support receiving email to custom domain names like, in my case, davd.net. Running your own mail server would solve this problem but running a fully featured mail stack including POP, IMAP, Sieve filters et cetera requires a fairly powerful machine. Additionally, if not configured properly, there’s big potential for abuse, e.g. spam.

As an alternative, it’s possible to just run a MTA which redirects all incoming email to an external mail server. This can be ran on almost any machine, even on a low-budget computer like the Raspberry Pi or a cheap virtual server.