procmail virus and spam users

procmail virus and spam users

am 19.09.2006 16:20:02 von mcstanga

i made a /etc/procmailrc script for filtering spam with spamassassin
and virus with clamfilter.pl.
it's working nicely, but now i want to resend all the spam to a
masterspam user and all the viruses to mastervirus user that are on the
same server that is filtered by the script.

this is my /etc/procmailrc:

PATH=/bin:/usr/bin
MAILDIR=$HOME/Maildir
DEFAULT=$HOME/Maildir
LOGFILE=$HOME/procmail.log
VERBOSE=yes

:0fw: spamassassin.lock
* < 256000
| spamassassin

:0
* ^X-Spam-Status: Yes
! masterspam@theonfoundry.eu

:0fw
| /usr/local/bin/clamfilter.pl

:0
* ^X-Virus-Found: yes
! mastervirus@theonfoundry.eu

:0
* .*
../

the problem is that once a mail is recognized as spam the system sends
it to masterspam and then the mail loops for some time beetween
masterspam and masterspam... :)
how can i avoid that the mail resended to masterspam and mastervirus
are processed and resended to themselves in a loop?
thanks,
ale.

Re: procmail virus and spam users

am 19.09.2006 16:44:29 von mcstanga

mmm maybe i have found a solution?


PATH=/bin:/usr/bin
MAILDIR=$HOME/Maildir
DEFAULT=$HOME/Maildir
LOGFILE=$HOME/procmail.log
VERBOSE=yes

:0fw: spamassassin.lock
*!^X-Original-To: masterspam@theonfoundry.eu
*!^X-Original-To: mastervirus@theonfoundry.eu
* < 256000
| spamassassin

:0
* ^X-Spam-Status: Yes
*!^X-Original-To: masterspam@theonfoundry.eu
*!^X-Original-To: mastervirus@theonfoundry.eu
! masterspam@theonfoundry.eu

:0fw
*!^X-Original-To: mastervirus@theonfoundry.eu
*!^X-Original-To: masterspam@theonfoundry.eu
| /usr/local/bin/clamfilter.pl

:0
* ^X-Virus-Found: yes
*!^X-Original-To: mastervirus@theonfoundry.eu
*!^X-Original-To: masterspam@theonfoundry.eu
! mastervirus@theonfoundry.eu

:0
* .*
../

Re: procmail virus and spam users

am 19.09.2006 23:59:17 von AK

mcstanga wrote:

> mmm maybe i have found a solution?
>
>
> PATH=/bin:/usr/bin
> MAILDIR=$HOME/Maildir
> DEFAULT=$HOME/Maildir
> LOGFILE=$HOME/procmail.log
> VERBOSE=yes
>
> :0fw: spamassassin.lock
> *!^X-Original-To: masterspam@theonfoundry.eu
> *!^X-Original-To: mastervirus@theonfoundry.eu
> * < 256000
> | spamassassin
>
> :0
> * ^X-Spam-Status: Yes
> *!^X-Original-To: masterspam@theonfoundry.eu
> *!^X-Original-To: mastervirus@theonfoundry.eu
> ! masterspam@theonfoundry.eu
>
> :0fw
> *!^X-Original-To: mastervirus@theonfoundry.eu
> *!^X-Original-To: masterspam@theonfoundry.eu
> | /usr/local/bin/clamfilter.pl
>
> :0
> * ^X-Virus-Found: yes
> *!^X-Original-To: mastervirus@theonfoundry.eu
> *!^X-Original-To: masterspam@theonfoundry.eu
> ! mastervirus@theonfoundry.eu
>
> :0
> * .*
> ./


I would think it would be better to check for viruses prior to checking
for spam.

PATH=/bin:/usr/bin
MAILDIR=$HOME/Maildir
DEFAULT=$HOME/Maildir
LOGFILE=$HOME/procmail.log
VERBOSE=yes

:0
*!^X-myloop_check: master(spam|virus)@theonfoundry.eu
{
:0fw
| /usr/local/bin/clamfilter.pl

:0
* ^X-Virus-Found: yes
{
:0fw
|formail -A "X-myloop_check: mastervirus@theonfoundry.eu"

:0
! mastervirus@theonfoundry.eu
}

:0fw: spamassassin.lock
* < 256000
| spamassassin

:0
* ^X-Spam-Status: Yes
{
:0fw
|formail -A "X-myloop_check: masterspam@theonfoundry.eu"

:0
! masterspam@theonfoundry.eu
}

}

:0
* .*
../


---
Depending on your mail server, you might be better off checking for
virus during the SMTP transaction versus when the final delivery is
attempted. You might wish to introduce a check that can not be included
in the message such that you anti-virus/anti-spam mechanisms can be
bpassed by inclusion of the headers.

AK