Replying to myself...
On Thu, 2 Sep 2004, Charles Sprickman wrote:
Hi,
I'm trying to do some clamav scanning over the network, and I found this nice
program that can handle that:
ftp://victor.teaser.fr/pub/lwa/clamd-stream-client
In many ways it is similar to spamc; it takes a message on STDIN and can be
directed to a remote clamav scanner. However, it does not pass the message
back to STDOUT; instead it is silent if there's no virus and echos the virus
name if on is found. Exit code is 0 if the message is clean.
Since it doesn't pass the message back out, xfilter doesn't work.
This is what I'm using for the time being. I was not aware that a
"backticked" program was given the message on STDIN. So this seems to
basically work:
log "in local mailfilter rules"
if ( $SIZE < 262144 )
{
VIRUS=`/usr/local/bin/clamd-stream-client -t 6 -d clamd.local`
log $RETURNCODE
log $VIRUS
if ($RETURNCODE == 65)
{
`test -d ./Maildir/.Virus`
if( $RETURNCODE != 0 )
{
log "= CREATING VIRUSDIR"
`maildirmake -f Virus ./Maildir`
log "= SUBSCRIBING VIRUSDIR"
`echo INBOX.Virus >>
./Maildir/courierimapsubscribed`
}
to $VDIR/Maildir/.Virus
}
}
Here's the big question... I'm looking at $VIRUS and it's always empty.
However, if the client finds a virus, it spits the name of the virus to
STDOUT. What am I doing wrong that keeps that value from ending up in
"$VIRUS"? Looking at the docs and the list archives it seems that the
line:
VIRUS=`/usr/local/bin/clamd-stream-client -t 6 -d clamd.local`
Should put any output of that command into $VIRUS, no?
Thanks,
Charles
I want to avoid executing any additional scripts (perl, sh or other) since
this is a fairly busy mail server.
Any ideas how to get the message to this program then make a decision based
on the exit code in maildrop?
Thanks,