[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: MailScanner and Auto Update Virus definitions?



Bengt Thuree wrote:

Hej,

I managed to figured out the answers after some serious looking...
I am basing all my answers upon SARGE current release.

So, I figured to answer my own questions, just in case someone else are wondering...

Question
--------
Am I supposed to manually start a cron job running the
    /etc/MailScanner/autoupdate/f-prot-autoupdate
    /etc/MailScanner/clamav-autoupdate

Yes


Question
--------
Will f-prot-autoupdate also update the f-prot engine?
    (/usr/sbin/update-f-prot)

No, but I did create a small MailScanner autoupdate script that will update the f-prot engine. With lock files, so scanning will be suspended during the actuall update.
See script which is attached

Question
--------
Ok, perhaps I should ask a simple and direct question instead.
How do I turn on auto update of virus definitions and f-prot engine on a Sarge installation (updated from a very very mini Woody)


1) First fix a fault in /etc/MailScanner/autoupdate/clamav-autoupdate
	Change path to "/usr/" in $PackageDir
		$PackageDir = shift || "/usr/";

2) verify that both scripts work by using command line to start them

3) Put the two scripts in cron.daily
	ln -s /etc/MailScanner/autoupdate/f-prot-autoupdate \ 		
		/etc/cron.daily/f-prot-autoupdate
	ln -s /etc/MailScanner/autoupdate/clamav-autoupdate \ 		
		/etc/cron.daily/clamav-autoupdate
	(or create a cron.d job with multiple updates per day)
27 4,16 * * * root if [ -x /etc/MailScanner/autoupdate/f-prot-autoupdate ]; then /etc/
MailScanner/autoupdate/f-prot-autoupdate -cron; fi

27 5,17 * * * root if [ -x /etc/MailScanner/autoupdate/clamav-autoupdate ]; then /etc/
MailScanner/autoupdate/clamav-autoupdate -cron; fi

4) Put the F-Prot engine update script in cron.weekly
	ln -s /etc/MailScanner/autoupdate/f-prot-pgm-autoupdate \ 		
		/etc/cron.daily/f-prot-pgm-autoupdate

Good luck

/Bengt

-------------------- f-prot-pgm-autoupdate
#!/usr/bin/perl

use Sys::Syslog;

$UpdateDir = shift || "/usr/sbin";

$LockFile = "/tmp/FProtBusy.lock";

$LOCK_SH = 1;
$LOCK_EX = 2;
$LOCK_NB = 4;
$LOCK_UN = 8;
$FProtIsLocked = 0;

Sys::Syslog::openlog("update-f-prot", 'pid, nowait', 'mail');

BailOut("Installation dir \"$UpdateDir\" does not exist!")
  unless $UpdateDir ne "" && -e $UpdateDir;

&LockFProt();
system("$UpdateDir/update-f-prot -i");
&UnlockFProt();
Sys::Syslog::syslog('info', "F-Prot program updated");
Sys::Syslog::closelog();
exit 0;

sub BailOut {
        &UnlockFProt();
Sys::Syslog::openlog("F-Prot program update", 'pid, nowait', 'mail');

        Sys::Syslog::syslog('err', @_);
        Sys::Syslog::closelog();
        warn "@_, $!";
        exit 1;
}

sub LockFProt {
        open(LOCK, ">$LockFile") or return;
        flock(LOCK, $LOCK_EX);
        print LOCK "Locked for updating F-Prot program files by $$\n";
        $FProtIsLocked = 1;
}

sub UnlockFProt {
        return unless $FProtIsLocked;
        print LOCK "Unlocked after updating F-Prot program files by $$\n";
        unlink $LockFile;
        flock(LOCK, $LOCK_UN);
        close LOCK;
}

Attachment: pgpDvb7CM5Iuz.pgp
Description: PGP signature


Reply to: