You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by "J.J. Day" <da...@hotmail.com> on 2015/01/03 02:33:20 UTC

user scores not used by spamassassin

Hi,

I am using SpamAssassin with MimeDefang as a sendmail milter. I would like each recipient to have an individual user score configuration. None of the recipients have an account on the host so MySQL was installed and the needed lines added to the default local.cf file to provide that capability. The DB and access work properly when testing with spamd / spamc but appears to be ignored when called by MimeDefang. 

Is there some configuration error I might have missed or can spamassassin not be used this way? Or, should this be asked to MimeDefang support and I am asking the question in the wrong place?

My configuration and versions are as follows:
FreeBSD 10.0-RELEASE-p9 #0 r271756: 
sendmail Version 8.14.7
        (Cyrus v2.4.17)
        (MySQL 5.5.38)
SpamAssassin version 3.4.0
MIMEDefang 2.75
        Perl 5.016003

Thanks for any help you can give me,

JJ

Re: user scores not used by spamassassin

Posted by "Kevin A. McGrail" <KM...@PCCC.com>.
On 1/4/2015 10:40 PM, J.J. Day wrote:
> Hi Kevin,
>
> Thanks for the link. It's a starting point. As far as the two 
> functions are concerned, I was just hoping to short cut the process of 
> finding them.
>
> Actually, I am a pretty good programmer in half a dozen languages - 
> it's just that I have never used Perl. Since the problem isn't an 
> overlooked parameter setting, it looks like I will have to add Perl to 
> the library unless the mimedefang people can provide an existing hook.
Happy to help.  However, if you can program, then I think you are 
tackling to much at once.

My approach would be:

Stage 1: get SpamAssassin working with MD (look at one of the default 
milter examples for Windows)
Stage 2: get SA working with MD with an sa_object

At the top of your filter:

if ($Features{"SpamAssassin"}) {
     #$SALocalTestsOnly = 1;  # I do NOT want network tests
     $SALocalTestsOnly = 0;  # I DO want network tests

     #REMOVED PER DFS BUT NOT REALLY SURE WHY ;-)
     #spam_assassin_init()->compile_now(1) if defined(spam_assassin_init());

     #Switched to $sa_object as returned by SA per DFS
     $sa_object = spam_assassin_init() if defined(spam_assassin_init());
}


Stage 3: then add the few extra lines to switch to a different user hard 
coded to a specific user
Stage 4: Add logic for the username that that you need with good use of 
the md_syslog function for logging

Programming for MD requires a bit of ground work so read the mimedefang 
filter example and the mimedefang-filter man page

Also, if you are going to discuss programming in MD on the MD list, you 
really need to post the error you get along with things like your 
filter.  You didn't give us much to go on but as mentioned, this is the 
wrong list anyway, just lots of crossover with SA and MD.

Good luck!

Regards,
KAM

Re: user scores not used by spamassassin

Posted by "Kevin A. McGrail" <KM...@PCCC.com>.
Hi JJ, This is a question for the mimedefang list but yes, you need a semicolon on the first line.  That was just my quick cut and paste.

A quick Google finds this as perhaps a good starting point: http://lists.roaringpenguin.com/pipermail/mimedefang/2007-April/032485.html

However, you might be biting off more than you can chew and need to hire a programmer.
Regards,
KAM

On January 4, 2015 1:28:39 AM EST, "J.J. Day" <da...@hotmail.com> wrote:
>
>> 
>> On Jan 3, 2015, at 8:22 AM, Kevin A. McGrail <KM...@PCCC.com>
>wrote:
>> 
>> JJ, there is no logic by default in MD that turns email addresses
>into usernames.  You'll need to write that logic and then load the sql
>config options with something like this:
>> 
>> $sa_object->load_scoreonly_sql($username)
>> $sa_object->signal_user_changed({ username => $username}, user_dir =>
>undef);
>> 
>> Regards,
>> KAM
>
>KAM,
>
>Thanks for the information.
>
>I do not know Perl well enough to write code but extracting the
>username for the message within the spam assassin code block appears
>easy enough. Debug output statements confirms the username is set
>properly and the inserted code restricted to test cases. I have a
>problem though with the sample code you suggest.
>
>An error is generated for the first line unless an ";" is added at the
>end of the line. But the slave dies prematurely when the ";" is added
>and the message is temp failed. Since I don't understand the code, I
>have not idea how to tell what is wrong.
>
>Can you elaborate on the code and, in particular, where to find the
>functions load_scoreonly_sql() and signal_user_changed() ?
>
>TIA,
>
>JJ

Re: user scores not used by spamassassin

Posted by "Kevin A. McGrail" <KM...@PCCC.com>.
On 1/2/2015 8:33 PM, J.J. Day wrote:
> Hi,
>
> I am using SpamAssassin with MimeDefang as a sendmail milter. I would like each recipient to have an individual user score configuration. None of the recipients have an account on the host so MySQL was installed and the needed lines added to the default local.cf file to provide that capability. The DB and access work properly when testing with spamd / spamc but appears to be ignored when called by MimeDefang.
>
> Is there some configuration error I might have missed or can spamassassin not be used this way? Or, should this be asked to MimeDefang support and I am asking the question in the wrong place?
>
> My configuration and versions are as follows:
> FreeBSD 10.0-RELEASE-p9 #0 r271756:
> sendmail Version 8.14.7
>          (Cyrus v2.4.17)
>          (MySQL 5.5.38)
> SpamAssassin version 3.4.0
> MIMEDefang 2.75
>          Perl 5.016003
>
> Thanks for any help you can give me,

JJ, there is no logic by default in MD that turns email addresses into 
usernames.  You'll need to write that logic and then load the sql config 
options with something like this:

  $sa_object->load_scoreonly_sql($username)
  $sa_object->signal_user_changed({ username => $username}, user_dir => 
undef);

Regards,
KAM