[Mimedefang] Saving Headers for report

Jerome Tytgat jerome.tytgat at asterion.fr
Mon May 10 09:20:06 EDT 2004


Ok I've done something which looks working :

if ($FoundVirus) {
  my $logd = $Features{'Path:QUARANTINEDIR'} . "/virus-headers";
  if(-d $logd) {
   my $logf = "$logd/${MsgID}-Report-" . localtime() . ".txt";
   if(open(LOG, ">$logf")) {
    print LOG $report;
    if(open(H, 'HEADERS')) {
     # Start with a Received: header
     print LOG synthesize_received_header();
     print LOG join('', <H>);
     print LOG "X-Virus-Scanned-By: $MyFilterHostName, using $vscanner\n";
     print LOG "X-Virus-Flag: Yes\n";
     print LOG "X-Virus-Info: $RelayAddr is infected by $VirusName\n";
     print LOG "X-Virus-Debg: code=$code category=$category 
action=$action\n";
     print LOG "X-Scanned-By: MIMEDefang 2.42\n";
     close H;
    } else {
     print LOG "\nFailed to open headers: $!\n";
    }
    close LOG;
   } else {
    md_syslog('warning',"Failed to create logfile: $logf: $!");
   }
  } else {
   md_syslog('warning',"No maillog dir: $logd");
  }

  md_graphdefang_log('virus', $VirusName, $RelayAddr);
  md_syslog('warning', "Discarding because of virus $VirusName");
  return action_discard();
}


I'm just lacking the "Return-Path", any magic keyword which doing it ?

David F. Skoll wrote:
> On Mon, 10 May 2004, Jerome Tytgat wrote:
> 
> 
>>But I lack the last Received: line.
> 
> 
> It isn't added yet.  Sendmail only adds the Received: line when it delivers
> or forwards the mail.  Milters won't see it.  There is code in mimedefang.pl
> to synthesize a Received: line; you might be able to reuse it.
> 
> Regards,
> 
> David.
> _______________________________________________
> Visit http://www.mimedefang.org and http://www.canit.ca
> MIMEDefang mailing list
> MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
> 

-- 
====================================
 > Jérôme Tytgat
Administrateur  Réseau  et  Sécurité
ASTERION     -   Impasse de la Hache
CP 5911   -   44 477 CARQUEFOU CEDEX
T: 02 40 300 800 - F: 02 40 25 10 74
====================================



More information about the MIMEDefang mailing list