Don’t want to be asking an already answered question, but I can’t seem to track down info on integrating [i]avastd[/i] with a local MTA on my Linux box. Certainly the config seems to suggest that such an integration is possible.
Is it something along the lines of setting up my MTA to listen on an alternate port, and have [i]avastd[/i] answer on standard 25 and forward the cleaned mail to another host/port combo?
Paolo, you should use avastlite for this. It’s included with the source code, and also has much easier output to parse (documented inside the .c source code file). Please note that it requires the avast daemon to be running, though… (but will be much faster that normal avast, too, since it routes all the work to the daemon).
Thanks Vlk,
I’m not exper in c, anyway I try cc avastlite.c -o avastlite
avastlite --help
-_, --console STDIN/STDOUT mode
-t, --timeout Operation timeout in seconds (max. 1 minute)
-?, --help Give this help list
–usage Give a short usage message
-V, --version Print program version
start avastd (dazuko installed)
start amavisd with
Avast4Linux AntiVirus
$avast4 = “/usr/bin/avastlite”;
if ($avast4) {
do_log(2,“Using $avast4”);
chop($output = $avast4 --console $TEMPDIR/parts);
$errval = retcode($?);
do_log(2,$output);
if ($errval == 1) { # no errors, no viruses found
$scanner_errors = 0;
} elsif ($errval && $errval == 2) { # no errors, viruses discovered
$scanner_errors = 0; @virusname = ($output =~ /Infected: (.+)/g);
pop @virusname;
do_virus();
} else {
do_log(0,“Virus scanner failure: $avast4 (error code: $errval)”);
}
}
but no result
I tried also switch from avast -a -c -i etc…
amavisd[7202]: All virus scanners failed - mail requeued
do_exit:513 - ending execution with 75
Virus scanner failure: /usr/bin/avastlite (error code: 32)
All virus scanners failed - mail requeued
Ciao Paolo,
I think we’re getting closer to the positive results.
Error 32 is no_input_data, and it’s quite understandable from the code snippet why that occured. The reason is that you specified the –console switch to the command-line, but you want to scan a file. The –console switch means that the program works as a filter, expecting data to be piped to it, and returning to STDOUT either the data unchanged, if there is no virus, or a virus warning to STDERR. That’s a useful feature, but not really in this case because you already have the data in temporary files; so it’s better not to use the –console option in this case.
One more question, though (I’m not much familiar with amavis, sorry): Is $TEMPDIR/parts file or directory? I think avastlite is constructed to scan a single file, so if it’s a directory, you might need to add an extra loop to the perl script that will call avastlite for each file contained in the directory (if that’s what you want to do). If it’s a file, you should be all right.