dspam, Cyrus-imapd and Postfix - how I do it

I use my mail server for several things;
- Standard email hosting
- Receiving mail to go off to scripts for processing (ie. bounces from newsletters)
- Forwarding mail for certain mailboxes/domains off to other servers outside my control
- etc.

Previously, I had dspam set up to process mail in the postfix content_filter mode on the smtpd process. This is OK, but it means that I spam filter email that I forward, and I don’t really want that. I don’t really want to have to opt-out every address that I forward to, either. There was a transport configured to process email in dspam, by calling the dspamc binary, and piping the email to it. It would be sent to the dspam server.
The dspam server would process mail, then deliver it back to Postfix via SMTP on a special unfiltered port for delivery via cyrus using the ‘deliver’ binary that ships with cyrus-imapd.

Now I’ve changed things a bit. The virtual_transport and mailbox_transport in Postfix is set to use LMTP to deliver to my dspam LMTP socket. Dspam is configured to process the mail (it selects user based on the ‘To’ in the envelope), and then deliver it with LMTP to cyrus-imapd. The virtual_transport and mailbox_transport parts run after the alias processing, so mail that goes to remote servers goes un-scanned.
I have to wonder whether there’s a performance boost in here somewhere because of the use of LMTP instead of calling the “deliver” and “dspamc” binaries.

Like I say, it’s possible to accomplish this with optIn/optOut settings, but I like having default optIn for my users who actually receive mail on my server.

Leave a Reply