1

Currently I have Postfix with Amavis, Spamassassin, Clamav and all the bells and whistles up and running.

I would like to add RSpamd to the configuration, I don't want to replace Amavis, just keep them running side by side, marking spam messages in subject and adding headers to see which is better in catching spam.

Problem is that Amavis is added as smtpd_proxy_filter with return path. RSpamd is added as milter. Now running RSpamd by itself is fine, but when I add the Amavis, since the mail is redirected to proxy, the Received header is added, thus RSpamd thinks that all mails are from localhost, skipping some of the checks and not adding headers.

I was thinking about some solutions, but don't know if and how they can be implemented:

  1. Run milter before proxy, didn't work by adding the -o smtpd_milters to master.cf
  2. Tell amavis not to add the Received header
  3. Tell RSpamd to skip localhost Received headers and use the one after that

Is any of that achieveable?

Config files here:

My master.cf

My main.cf has these:

smtpd_milters = inet:127.0.0.1:12345
                inet:localhost:11332
non_smtpd_milters = inet:127.0.0.1:12345
milter_default_action = accept
milter_content_timeout = 30s

Port 12345 for DKIM and 11332 for RSpamd

Thanks

3

Been in similar situation a few years ago. You can actually remove unnecessary Received: header by adding via master.cf -o header_checks=pcre:/etc/postfix/remove_received.pcre to your smtpd that is receiving mail back from Amavis (probably 127.0.0.1:25 instance, but this depends on where your Amavis forwards filtered mail).

The PCRE in the remove_received.pcre looks like this:

/^Received: from server.my.domain \(\[127.0.0.1\]\).*/ IGNORE

Please note backslash escaping of brackets that would otherwise be interpreted as grouping operators. You may also need to add localhost as additional line depending on how your Amavis connects and introduces itself.

  • That is really clever, didn't think of that. Thank you. I will try it tomorrow. It acually goes from 25 to 10024 (Amavis), then to 10025 back to postfix, then there is content filter on this port, which sends it to 2526 (ESET Security) and then it goes back again to 2525 to Postfix, and then I think after all that it uses the milters (for DKIM and RSpamd). Thinking about it now, I could actually send it directly from Amavis to ESET Security port, and then return it to Postfix. – InToSSH Oct 7 '18 at 19:43
  • So I tried this idea, I had to install postfix-pcre and put the header_checks directly into main.cf, now the headers are removed, but RSpamd is still showing 127.0.0.1. I think it is actually getting the IP from the connection at EHLO command, so I would need to set the Amavis to send correct XFORWARD parameters, which I was unable to find how. – InToSSH Oct 11 '18 at 6:48
2

You should not use smtpd_proxy_filter and smtpd_milter together. To run Amavis and Rspamd side-by-side consider integrating Amavis with amavisd-milter. smtpd_milter can call different milters, one after another.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.