Does someone know if its possible to pass email to SpamAssasin before delivery?
Or put it in another way, run SpamAssasin infront of Postfix?
My SpamAssasin works great, and its tagging messages with the Spam subject as I configured it to be.
The problem is that some email accounts are setup for piping to a PHP script, and there the spam just flows in like nothing. Since a copy is actually delivered to an email account I get the same message tagged correctly as SPAM in email client but the email itself was delivered to the piping without a tag.
This means emails are first piped before going trough the spam filter.
I also miss SpamHaus and Spamcop allot before, I used Exim and I configured the RBL filters to kill 90% of spam but I don´t see any option for RBLs. I read here on the forums that this is included already with SpamAssasin but I don´t think so because the spam I receive now is one I never received when I used Exim with RBL filters. At least SpamAssasin is actually working correctly as every single garbage is tagged in the subject, it would be just so nice to be tag this before the piping so I could filter them out or delete them instead of delivering them first.
Can you explain “setup for piping to a PHP script”? How exactly is that done?
You cannot run “Spamassassing in front of Postfix”, because Spamassassin naturally has no mail server functionality. It can only be called from a mail processing feature of an existing mailserver.
You can use RBLs in Postfix without problem, by adding them to the “smtpd_*_restrictions” directives. Here’s mine as example. Don’t just copy+paste it, but google for Postfix directives and adjust it to your needs!
smtpd_client_restrictions = permit_sasl_authenticated permit_dnswl_client list.dnswl.org reject_rbl_client zen.spamhaus.org
How did I created the piping for the PHP scrip?
From virtualmin in the mail aliases just select “Feed to program” on Alias destinations
I know Spamassasin does not have mail server functionality, let me rephrase it them. Making Spamassasin work between Postfix before the piping.
I get message copies from the piping and they are rewritten correctly in the subject with the SPAM tag. But not in the piping itself, the spam messages are delivered first to the piping, them to Spamassin which marks them as spam but to late already, so im guessing the filtering is happening after the piping of the messages.
Before I had an Exim server and the filtering was done before the piping to a script. Maybe its how im running spamassin? Honestly I did not test it to much but I was just curious why it was tagging messages correctly as Spam after the piping and not before.
Im not running it as a daemon so maybe this could be the issue. It would be nice to know the implications between running it as spamd or spamc
You mentioned to put the RBL in Postfix itself but I read somewhere in the Virtualmin site that Spamassin is supposed to use this RBL already. So which should I use them? Postfix RBL or Spamassasin.
Virtualmin configures the services so that Postfix passes accepted emails to Procmail, which in turn calls ClamAV and SpamAssassin. Running SpamAssassin/ClamAV as a daemon or volatile process should not make a difference in regards to your aims.
It’s certainly possible to change that setup and have SpamAssassin called in a different way. Unfortunately I’m not sufficiently versed in making the necessary configuration for Postfix and Procmail, including required scripts (that stuff is far from trivial!) to tell you exactly what you need to do there.
You can use RBLs both in Postfix and SpamAssassin. The latter has rules included to assign scores if a sender/relay is found in an RBL. Additionally you can configure Postfix to not accept mail in the first place if certain RBLs report a hit.
What I did for a client who uses Kayako is create the helpdesk as a regular user, then created a .forward file in their home directory, it forwards the mail after it passes through Spamassassin.