You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by James Keating <ja...@okeating.net> on 2006/04/06 01:28:41 UTC

Postfix/SpamAssassin Integration

Dear Sirs/Madams,

   I have been attempting to properly integrate SpamAssassin into 
Postfix and have not found the solution that I am looking for. 
Currently I have Spamassassin running as a daemon (spamd, version 
3.1.0a-2) which uses MySQL to store Bayes, AWL, user preferences and 
stats. Postfix is currently configured to connect to spamd using a pipe 
setup inside master.cf. Here is the current configuration:

smtp      inet  n       -       -       -       50      smtpd -o 
content_filter=spamassassin

spamassassin unix       -       n       n       -       50      pipe
   user=nobody argv=/usr/bin/spamc -u ${recipient} -d localhost -e 
/usr/lib/sendmail -oi -f ${sender} ${recipient}

   This setup appears to work properly but I am concerned about what 
happens when/if spamc cannot communicate properly with spamd.  Currently 
if spamd is not functioning or is dead, the message is passed through to 
sendmail, instead of being deferred and placed back into the queue until 
spamc can connect to spamd.  I have modified the spamc flags to contain 
-x (which is supposed to stop the graceful fall back), but sendmail is 
still passed the message and it is delivered to the user.
   I have already tried amavisd-new, spampd, qpsmtpd and a simple shell 
script for connecting to spamassassin. None of these allow me to fully 
use spamassassin's per user preferences and get proper fall back when/if 
spamd is dead.  I am hoping there is another option that I have not 
tried yet.  Any input would be greatly anticipated.

Thanks,
   James


Re: Postfix/SpamAssassin Integration

Posted by James Keating <ja...@okeating.net>.
mostlyharmless@optonline.net wrote:

> Is this a high volume mail server?

Yes it is rather high volume server, I don't have any estimates on # of 
messages.

> Something like this should do the trick (this is off the cuff, and just 
> a reference, you will have to modify for your exact setup).
> 
> master.cf
> spamassassin unix       -       n       n       -       50      pipe
>  argv=/usr/bin/procmail -m /path to procmailrc/procmailrc ${sender} 
> ${recipient}
> 

Procmail really isn't an option in this case, the server is in a tiered 
setup in which it forwards the mail on to another server which completes 
delivery.

- James


Re: Postfix/SpamAssassin Integration

Posted by mo...@optonline.net.
James Keating wrote:

> Dear Sirs/Madams,
>
>   I have been attempting to properly integrate SpamAssassin into 
> Postfix and have not found the solution that I am looking for. 
> Currently I have Spamassassin running as a daemon (spamd, version 
> 3.1.0a-2) which uses MySQL to store Bayes, AWL, user preferences and 
> stats. Postfix is currently configured to connect to spamd using a 
> pipe setup inside master.cf. Here is the current configuration:
>
> smtp      inet  n       -       -       -       50      smtpd -o 
> content_filter=spamassassin
>
> spamassassin unix       -       n       n       -       50      pipe
>   user=nobody argv=/usr/bin/spamc -u ${recipient} -d localhost -e 
> /usr/lib/sendmail -oi -f ${sender} ${recipient}
>
>   This setup appears to work properly but I am concerned about what 
> happens when/if spamc cannot communicate properly with spamd.  
> Currently if spamd is not functioning or is dead, the message is 
> passed through to sendmail, instead of being deferred and placed back 
> into the queue until spamc can connect to spamd.  I have modified the 
> spamc flags to contain -x (which is supposed to stop the graceful fall 
> back), but sendmail is still passed the message and it is delivered to 
> the user.
>   I have already tried amavisd-new, spampd, qpsmtpd and a simple shell 
> script for connecting to spamassassin. None of these allow me to fully 
> use spamassassin's per user preferences and get proper fall back 
> when/if spamd is dead.  I am hoping there is another option that I 
> have not tried yet.  Any input would be greatly anticipated.
>
> Thanks,
>   James
>
>
Is this a high volume mail server?

If it is not, you could call spamc/spamd procmail, check the email to 
see if it has spamassassin results, and if it does not, run it through 
spamassassin instead....  This is dangerous if your mail server is high 
volume because spamassassin chews a lot more resources then spamc/spamd

Something like this should do the trick (this is off the cuff, and just 
a reference, you will have to modify for your exact setup).

master.cf
spamassassin unix       -       n       n       -       50      pipe
  argv=/usr/bin/procmail -m /path to procmailrc/procmailrc ${sender} 
${recipient}

:0
* < 512000
{
        :0fw
        | spamc

        :0fw
        * !^X-SPAM-STATUS:
        | spamassassin
}

:0
! -f  "$@"