You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Peter Tselios <s9...@yahoo.gr> on 2012/03/08 10:43:18 UTC

Σχετ: Mark message as spam from Postfix Queue

Απο: Tom Kinghorn <th...@gmail.com>
Προς: users@spamassassin.apache.org 
Στάλθηκε: 10:55 π.μ. Πέμπτη, 8 Μαρτίου 2012
Θεμα: Re: Mark message as spam from Postfix Queue
 


On 08/03/2012 10:52, Peter Tselios wrote: 
Hallo,
>
>Is it possible to somehow instruct spamassassin to mark messages as spam when those messages are in Postfix queue?
>The ideal in my mind is to get the queue id of the spam message and somehow extract it from the queue and then use it to train spamassassin. Is it possible?
>
>
>My setup is postfix, amavisd-new, spamassassin 3.3.1
>
>
Why use it to train spamassassin if it has already been deemed to be spam?

Just a thought.

Tom

---------------------------------------------------------------

Because it's marked as spam but it has less than "kill" score...

Peter

Re: Σχετ: Mark message as spam from Postfix Queue

Posted by Tom Kinghorn <th...@gmail.com>.
On 08/03/2012 12:19, xTrade Assessory wrote:
> Ts you could easily configure to your convenience in
> local.cf or set the reject limit in your filter/milter
>
> wow 5 processes for each step ... that eventually gets your machine 
> real busy ... at least join all this greps into one grep -e pattern -e 
> pattern or egrep "pattern1|pattern2" but then when you have the score 
> what do you do with it? Hans 

its called an example.

The choice of what to look for is yours.

Don't flame if you are not willing to offer your own idea's

Re: Σχετ: Mark message as spam from Postfix Queue

Posted by xTrade Assessory <xt...@matik.com.br>.
Bowie Bailey wrote:
> On 3/8/2012 5:19 AM, xTrade Assessory wrote:
>> Tom Kinghorn wrote:
>>> You can then grep through the spam files and search for a common
>>> string, eg score.
>>>
>>> e.g
>>> # cd /amavis/virusmails
>>> #
>>> # ls -la | grep "spam" | grep "Mar  8" | awk '{print $9}' | xargs
>>> zgrep -i "score="
>>>
>>>
>> wow 5 processes for each step ... that eventually gets your machine real
>> busy ...
>>
>> at least join all this greps into one grep -e pattern -e pattern or
>> egrep "pattern1|pattern2"
> That isn't the same search.
>
> grep -e pattern1 -e pattern2    = pattern1 or pattern2
>
> grep pattern1 | grep pattern2    = pattern1 and pattern2
>

yooo :) day starts good :)

the first ok, but depends, anyway my point was another, but let's look
deeper then

the second is not exactly an 'and' but a search within the results of
the first search
if you want a real 'and' you probable will write an regex as grep -e
"pattern1.*pattern2"

but that was not my point, simplicity was, writing cheaper expressions,
such one as above could render a machine or run for hours, well depends
on number of files and their size

grepping ls -la is a bad idea because you run one grep on *any* file, in
this case even on the . (dot)  entries, then another on each. so at
least use ls -l

but we could resume it in a better expression as

find /amavis/virusmails --maxdepth=2 -type f -name spam -mtime 1 -exec
zgrep -i "score=" {} \;

mtime 1 is yesterday, so you can run it from cron every day on the
yesterday results without need to check your script before each run,
depending on what you want you also may check mtime -1 or +1

this case you run two processes on each matching file without having
empty runs
supposed the files are really compressed, if not I wouldn't use zgrep here

if you prefer awk you could do it as

find /amavis/virusmails --maxdepth=2 -type f -name spam | awk '/Mar 8/
{print $9}' | zgrep -i "score="

what IMO is not very elegant and awk is expensive, anyway, it's 3 shots
on each file

Hans


-- 
XTrade Assessory
International Facilitator
BR - US - CA - DE - GB - RU - UK
+55 (11) 4249.2222
http://xtrade.matik.com.br


Re: Σχετ: Mark message as spam from Postfix Queue

Posted by Bowie Bailey <Bo...@BUC.com>.
On 3/8/2012 5:19 AM, xTrade Assessory wrote:
> Tom Kinghorn wrote:
>>
>> You can then grep through the spam files and search for a common
>> string, eg score.
>>
>> e.g
>> # cd /amavis/virusmails
>> #
>> # ls -la | grep "spam" | grep "Mar  8" | awk '{print $9}' | xargs
>> zgrep -i "score="
>>
>>
> wow 5 processes for each step ... that eventually gets your machine real
> busy ...
>
> at least join all this greps into one grep -e pattern -e pattern or
> egrep "pattern1|pattern2"

That isn't the same search.

grep -e pattern1 -e pattern2    = pattern1 or pattern2

grep pattern1 | grep pattern2    = pattern1 and pattern2

-- 
Bowie

Re: Σχετ: Mark message as spam from Postfix Queue

Posted by xTrade Assessory <xt...@matik.com.br>.
Tom Kinghorn wrote:
>
>> Because it's marked as spam but it has less than "kill" score...
>> Peter
well scores and limits you could easily configure to your convenience in
local.cf or set the reject limit in your filter/milter

> Fair enough.
>
> Why not learn at spam / non-spam from the quarantined messages?
> If the messages are tagged as spam, they will be moved to quarantine.
>
> You can then grep through the spam files and search for a common
> string, eg score.
>
> e.g
> # cd /amavis/virusmails
> #
> # ls -la | grep "spam" | grep "Mar  8" | awk '{print $9}' | xargs
> zgrep -i "score="
>
>

wow 5 processes for each step ... that eventually gets your machine real
busy ...

at least join all this greps into one grep -e pattern -e pattern or
egrep "pattern1|pattern2"


but then when you have the score what do you do with it?


Hans





-- 
XTrade Assessory
International Facilitator
BR - US - CA - DE - GB - RU - UK
+55 (11) 4249.2222
http://xtrade.matik.com.br