You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by ri...@naturecoast.net on 2005/04/19 16:42:40 UTC

Postfix+SA+MySQL

Hello all,
Was wondering if anyone can point me in the right directions here.

I'm running the following system;
Mandrake 10.1
Spamassassin 3.0.2
Postfix 2.1.4-2
MySQL 4.0.20

So far all is working well with scan/detection of spam. I'm able to pull
user_pref via MySQL for the $GLOBAL settings, but when I try to make user
specific rules SA is sending a query to the db with the user that invokes
my filters (in this case shauna77) and never the person in which mail
arrives for.

I've setup the master.cf with

spamassassin
unix      -          n     n         pipe
flags=Rq user=shauna77 argv=/etc/mail/postfixfilter -f ${sender} --
${recipient}


My postfix filter invokes with the following

#!/bin/bash
/usr/bin/spamc | /usr/sbin/sendmail -i "$@"
exit $?

I'm sure (at this point) this is more of a postfix question but was hoping
that somone here might be able to shed some light maybe from past
experience.

Thanks,
Rich


Re: Postfix+SA+MySQL

Posted by br...@sptroth.com.






ricker@naturecoast.net wrote on 19.04.2005 16:42:40:

> Hello all,
> Was wondering if anyone can point me in the right directions here.
>
> I'm running the following system;
> Mandrake 10.1
> Spamassassin 3.0.2
> Postfix 2.1.4-2
> MySQL 4.0.20
>
> So far all is working well with scan/detection of spam. I'm able to pull
> user_pref via MySQL for the $GLOBAL settings, but when I try to make user
> specific rules SA is sending a query to the db with the user that invokes
> my filters (in this case shauna77) and never the person in which mail
> arrives for.
>
> I've setup the master.cf with
>
> spamassassin
> unix      -          n     n         pipe
> flags=Rq user=shauna77 argv=/etc/mail/postfixfilter -f ${sender} --
> ${recipient}
>
>
> My postfix filter invokes with the following
>
> #!/bin/bash
> /usr/bin/spamc | /usr/sbin/sendmail -i "$@"
> exit $?
>
> I'm sure (at this point) this is more of a postfix question but was
hoping
> that somone here might be able to shed some light maybe from past
> experience.
>
> Thanks,
> Rich
>

Sorry,
i wrongly understood you

Your filterscript must use the -u option (use user specific rules)

sender=$1
shift
recip="$@"
/usr/bin/spamc -u $recip | /usr/sbin/sendmail -i -f $sender -- $recip

in the master.cf
spamassassin
          unix  -       n       n       -       -       pipe
  flags=Rq user=shauna77 argv=/usr/bin/spamfilter ${sender} ${recipient}

This will only work for one recipient!
If you wont that also messages to multiple recipient will work you must set
this option in your main.cf file:
spamassassin_destination_recipient_limit = 1

This works for me

Regards
Bruno




Re: Postfix+SA+MySQL

Posted by br...@sptroth.com.






ricker@naturecoast.net wrote on 19.04.2005 16:42:40:

> Hello all,
> Was wondering if anyone can point me in the right directions here.
>
> I'm running the following system;
> Mandrake 10.1
> Spamassassin 3.0.2
> Postfix 2.1.4-2
> MySQL 4.0.20
>
> So far all is working well with scan/detection of spam. I'm able to pull
> user_pref via MySQL for the $GLOBAL settings, but when I try to make user
> specific rules SA is sending a query to the db with the user that invokes
> my filters (in this case shauna77) and never the person in which mail
> arrives for.
>
> I've setup the master.cf with
>
> spamassassin
> unix      -          n     n         pipe
> flags=Rq user=shauna77 argv=/etc/mail/postfixfilter -f ${sender} --
> ${recipient}
>
>
> My postfix filter invokes with the following
>
> #!/bin/bash
> /usr/bin/spamc | /usr/sbin/sendmail -i "$@"
> exit $?
>
> I'm sure (at this point) this is more of a postfix question but was
hoping
> that somone here might be able to shed some light maybe from past
> experience.
>
> Thanks,
> Rich
>

Hello Rich

SA with MySQL does not support user specific rules !
Only in local cf files (like in /usr/share/spamassassin) you can
add new rules.

after you create a rule you must test the rule with spammassassin --lint -x

I have created a special DB Table wherer users can add new rules
with a cron job then i create the cf-files

If a rule exist in a cf-file all users will be able to set their scores
via MySQL userprefs Table.

Regards
Bruno