On Thu, 2011-08-04 at 16:34 -0600, LuKreme wrote:
Arthur Dent <misc(_dot_)lists(_at_)blueyonder(_dot_)co(_dot_)uk> squaked out
on Thu 04-Aug-2011 09:21
I would check if clamd is running first, then proceed only if it is.
CLAMRUN=`ps -Uroot -co command | grep "\bclamd\b"`
:0
* CLAMRUN ?? clamd
{
# Your existing recipes, with some fixes
}
Hi LuKreme,
This was my first idea too. Unfortunately there are other error cases I
want to catch as well as just the situation where clamd is simply not
running. For example, (this is a Fedora box) SELinux will prevent
Procmail accessing clamd even though clamd is running just fine. This
will produce an error along the lines of:
"ERROR: Can't connect to clamd: Permission denied". Another error I have
encountered is:
"ERROR: Can't connect to clamd: No such file or directory"
I want to trap these errors and report them in the headers for further
investigation.
I can modify your suggestion so that I only run my recipe if clamd does
not produce an error:
VIRUS=`${CLAMDSCAN} --no-summary --stdout -`
# If clamd is not running or there is another error:
:0
* VIRUS ?? !^ERROR
{
recipe
}
But if I want to mark up the headers to show the failure I run into a
logic problem which I can't quite get my head around:
Pseudocode
==========
IF (no clamd error)
{
IF (malware detected)
{
mark up headers
deliver message to MALWARE folder
}
ELSE
{
mark up headers
return to calling recipe <--- NEEDS TO EXIT HERE!
}
}
ELSE
{
mark up headers to show clamd error
return to calling recipe <--- OR NEEDS TO EXIT HERE!
}
In this recipe (in production) there will be only one case where the
mail is actually delivered.
I don't know how to exit a procmail recipe and allow it to return to the
calling recipe. I have seen the SWITCHRC command - but I don't think
that is what I want here.
Thanks for all the help so far...
Mark
signature.asc
Description: This is a digitally signed message part
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail