[Mimedefang] HOW TO install clamd on Fedora 11forusebymimedefang

Cliff Hayes chayes at afo.net
Mon Jan 25 20:03:11 EST 2010


Done!  Thanks :)

I created a perl script to generate the email from one of our external list
servers.  I put the script in crontab to run each morning.  I pasted the
script below for the archives.

I keep a record of all incoming emails in a mysql database (I do a database
write from mimedefang). So, for end-to-end validation, I added a database
query search for the email to my ASP dashboard so I'll get a red light if
the email was not received by the system.  This will give me two layers of
notification, if I actually receive the email in my inbox (per your
suggestion) then I know clamd is broke.  If I get a red light, then I know
the testing system is broke.

#!/usr/bin/perl -w
use POSIX;
$booAbort = 0;
if (!open logFile, ">>/scripts/set.log") {
 print "Fatal error ... unable to open ehm.log ... $!";
 exit(0);
}
$strDateTime = strftime("%Y%m%d/%H:%M:%S", localtime);
print logFile ("$strDateTime **** Begin **** \n");
if (!open outFile, ">/scripts/EICARtest.txt") {
 $strDateTime = strftime("%Y%m%d/%H:%M:%S", localtime);
 print logFile ("$strDateTime Fatal Error: unable to open output file \n");
 $booAbort = 1;
}
if ($booAbort == 1) { goto end; }
$dateTime  = localtime time;
@dateArray = split(/\s+/, $dateTime);
$strDay    = $dateArray[0];
$strMonth  = $dateArray[1];
$strDate   = $dateArray[2];
$strTime   = $dateArray[3];
$strYear   = $dateArray[4];
print outFile "From eicartest\@afo.net $strDay $strMonth $strDate $strTime
$strYear";
print outFile "\n";
print outFile 'Return-Path: <eicartest at afo.net>';
print outFile "\n";
print outFile 'MIME-Version: 1.0';
print outFile "\n";
print outFile 'From: AFO Test <eicartest at afo.net>';
print outFile "\n";
print outFile 'To: chayes at afo.net';
print outFile "\n";
print outFile 'Subject: Alert!  You Should Not Receive This!';
print outFile "\n";
print outFile "Date: $strDay, $strDate $strMonth $strYear $strTime -0600";
print outFile "\n";
print outFile 'MIME-Version: 1.0';
print outFile "\n";
print outFile 'Content-Type: multipart/mixed;';
print outFile "\n";
print outFile '
boundary="----=_NextPart_000_003D_01CA9D9D.F58B8BF0"';
print outFile "\n";
print outFile 'Importance: Normal';
print outFile "\n";
print outFile "\n";
print outFile 'This is a multi-part message in MIME format.';
print outFile "\n";
print outFile "\n";
print outFile '------=_NextPart_000_003D_01CA9D9D.F58B8BF0';
print outFile "\n";
print outFile 'Content-Type: text/plain;';
print outFile "\n";
print outFile '        charset="iso-8859-1"';
print outFile "\n";
print outFile 'Content-Transfer-Encoding: 7bit';
print outFile "\n";
print outFile "\n";
print outFile 'refer atch';
print outFile "\n";
print outFile '------=_NextPart_000_003D_01CA9D9D.F58B8BF0';
print outFile "\n";
print outFile 'Content-Type: text/plain;';
print outFile "\n";
print outFile '        name="test.txt"';
print outFile "\n";
print outFile 'Content-Transfer-Encoding: quoted-printable';
print outFile "\n";
print outFile 'Content-Disposition: attachment;';
print outFile "\n";
print outFile '        filename="test.txt"';
print outFile "\n";
print outFile "\n";
print outFile
'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*';
print outFile "\n";
print outFile '------=_NextPart_000_003D_01CA9D9D.F58B8BF0-';
print outFile "\n";
close outFile;
$strDateTime = strftime("%Y%m%d/%H:%M:%S", localtime);
$strCommand = 'sendmail -f "eicartest at afo.net" "chayes at afo.net" <
/scripts/EICARtest.txt';
system("$strCommand");
if    ($? == 0) { print logFile ("$strDateTime unixCommand successful
\n"); }
elsif ($? == -1) { print logFile ("$strDateTime unixCommand failed to
execute due to: $! \n"); }
else  { print logFile ("$strDateTime unixCommand exited with value $?
\n"); }
end:
print logFile ("$strDateTime **** End **** \n");
exit(0);



-----Original Message-----
From: mimedefang-bounces at lists.roaringpenguin.com
[mailto:mimedefang-bounces at lists.roaringpenguin.com]On Behalf Of
WBrown at e1b.org
Sent: Monday, January 25, 2010 2:56 PM
To: mimedefang at lists.roaringpenguin.com
Subject: Re: [Mimedefang] HOW TO install clamd on Fedora
11forusebymimedefang


Cool!

Now just set the text of the message to tell you that clam failed and it is
time to panic.  :)


--

William Brown
Web Development & Messaging Services
Technology Services, WNYRIC, Erie 1 BOCES



"Cliff Hayes" <chayes at afo.net> wrote on 01/25/2010 03:24:34 PM:

> From: "Cliff Hayes" <chayes at afo.net>
> To: <mimedefang at lists.roaringpenguin.com>
> Date: 01/25/2010 03:39 PM
> Subject: Re: [Mimedefang] HOW TO install clamd on Fedora 11
forusebymimedefang
> Sent by: mimedefang-bounces at lists.roaringpenguin.com
>
> Figured it out.
> I had the eicar string in the body and not in an attachment.
> Once I put it in an attachment, it worked.
>

Confidentiality Notice: This electronic message and any attachments may
contain confidential or privileged information, and is intended only for the
individual or entity identified above as the addressee. If you are not the
addressee (or the employee or agent responsible to deliver it to the
addressee), or if this message has been addressed to you in error, you are
hereby notified that you may not copy, forward, disclose or use any part of
this message or any attachments. Please notify the sender immediately by
return e-mail or telephone and delete this message from your system.
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang at lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.730 / Virus Database: 271.1.1/2644 - Release Date: 01/25/10
01:36:00




More information about the MIMEDefang mailing list