Upgrade to OpenSMTPD 6.4.0

It’s no secret that configuration for OpenSMTPD changed a lot with version 6.4.0. Despite the fact that changes were announced long time ago and that many configuration examples have popped-up, my particular usage wasn’t covered(1). Namely: using OpenSMTPD with Dovecot and Rspamd as chained MTA.

Thanks to gilles@, I quickly ended up with a fully working configuration. But as I didn’t find such example before migrating, I thought it would be helpful to write about.

My OpenSMTPD instance accepts email for my local users only. Before the mail is delivered, it is passed through Rspamd that tags it as spam or ham. Then Rspamd passes the mail to Dovecot that delivers it in the proper place ; Inbox for ham and Junk from spam. The initial 6.0.3 configuration file looked like this:

Migrating from 6.0.3 to 6.4.0 should have “only” be a matter of splitting directives and create actions and matches. That nearly worked. Except that when emails were accepted, I got the following kind of error:

If I dropped Rspamd and only used Dovecot, that would work. Gilles@ said “You need to use an MDA wrapper (to chain Rspamd and Dovecot)”. In the man page, one should look for “wrapper” in the action section and to the “mda wrapper” defintion.