Author Topic: Sendmail / Postfix Integration  (Read 9923 times)

0 Members and 1 Guest are viewing this topic.

Black Orchid

  • Guest
Sendmail / Postfix Integration
« on: July 03, 2003, 02:26:09 AM »
Don't want to be asking an already answered question, but I can't seem to track down info on integrating 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 avastd[/i] answer on standard 25 and forward the cleaned mail to another host/port combo?

Any suggestions would be great!  Ciao.  Cheers.

Glen.

Offline Vlk

  • Moderator
  • Serious Graphoman
  • *
  • Posts: 11660
  • Please don't send me IM's. Email only. Thx.
    • ALWIL Software
Re:Sendmail / Postfix Integration
« Reply #1 on: July 04, 2003, 09:16:48 PM »
Currently there are no hooks for mailservers yet. With some skills, you could use suff like amavis (http://www.amavis.org) or openantivirus (http://www.openantivirus.org) to call avast.

However, soon we'll have our own smtp relay that will be able to integrate with the MTAs (like SendMail or Postfix).

Shouldn't take long now...

Vlk
« Last Edit: July 04, 2003, 09:17:06 PM by Vlk »
If at first you don't succeed, then skydiving's not for you.

Paolo

  • Guest
Re:Sendmail / Postfix Integration
« Reply #2 on: July 19, 2003, 03:34:13 PM »
hi,
I tried to use avast with amavisd but I get error 255 all the time.
in avastlite.c I find some error codes but this don't help me.

I tried many but some time I have a loop or no virus detection.

if ($avast4) {
    do_log(2,"Using $avast4");
    chop($output = `$avast4 -a -c -i --archivetype=A --continue=4 $TEMPDIR/parts`);
    $errval = retcode($?);
    do_log(2,$output);
    if ($errval == 0 || $errval == 1) { # no errors, no viruses found
        $scanner_errors = 0;
    } elsif ($errval && $errval >= 2) { # no errors, viruses discovered
        if ($errval <=10 ) {
            $scanner_errors = 0;
            @virusname = ($output =~ /Infected: (.+)/g);
            pop @virusname;
            do_virus();
        } else {
            do_log(0,"Virus scanner failure: $avast4 (error code: $errval)");
        }
    }
}

what is the right function I can use?

thanks... Paolo

Offline Vlk

  • Moderator
  • Serious Graphoman
  • *
  • Posts: 11660
  • Please don't send me IM's. Email only. Thx.
    • ALWIL Software
Re:Sendmail / Postfix Integration
« Reply #3 on: July 21, 2003, 12:28:32 PM »
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).

Hope this helps,
Vlk
If at first you don't succeed, then skydiving's not for you.

Paolo

  • Guest
Re:Sendmail / Postfix Integration
« Reply #4 on: July 21, 2003, 11:41:02 PM »
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

Offline Vlk

  • Moderator
  • Serious Graphoman
  • *
  • Posts: 11660
  • Please don't send me IM's. Email only. Thx.
    • ALWIL Software
Re:Sendmail / Postfix Integration
« Reply #5 on: July 22, 2003, 07:34:45 AM »
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.

Please let me know how it goes!

Thanks,
Vlk
If at first you don't succeed, then skydiving's not for you.

Dublin

  • Guest
Re:Sendmail / Postfix Integration
« Reply #6 on: July 14, 2004, 07:12:08 PM »
look at avast4linux MTA integration HOWTOs