How can I integrate Kaspersky Anti-Virus (KAV) into the SME Server?
|
> mkdir /tmp/kav4sme/Create the directories for KAV:
> mkdir /opt/AVP > mkdir /opt/AVP/Bases > mkdir /opt/AVP/kavkeeper > mkdir /opt/AVP/keys > mkdir /opt/AVP/ToolsNow download the files and store them in /tmp/kav4es/:
> cd /tmp/kav4sme/ > tar -xvzf *kavselinux.tgz # (010810kavselinux.tgz at time of writing)This will give us several files for different mail servers (sendmail, qmail, postfix and exim). As SME uses qmail, we're only interested in this one (don't mind the others):
> tar -xvzf kavkeeper-qmail-linux-3.5.136.tgz # (engine 3.5, release 136 is current at time of writing)
> tar -xvzf kavwslinux.tgz
> cd /tmp/kav4sme/kavwslinux/ > mv AvpUnix.ini defUnix.prf kav* /opt/AVP/ > ln -s /opt/AVP/AvpUnix.ini /root/ > mv *.key /opt/AVP/keys/ > mv ../kavkeeper.ini /opt/AVP/kavkeeper/ > mv Tools/checkurl /opt/AVP/Tools/ > mv EtcScripts/cron/kavupdater.daily /etc/cron.daily/ > mv EtcScripts/init.d/kavdaemon.rh7 /etc/init.d/kavdaemon.start > mv ../kavkeeper.8 /usr/man/man8/ > mv Docs/man/*.8 /usr/man/man8/Make sure, checkurl is known system wide:
> ln -s /opt/AVP/Tools/checkurl /usr/binCreate the links to automatically start the kavdaemon on system boot:
> ln -s /etc/init.d/kavdaemon.start /etc/rc7.d/S80kavdaemon.start > ln -s /etc/init.d/kavdaemon.start /etc/rc7.d/K10kavdaemon.start
BasePath=/opt/AVP/Bases KeysPath=/opt/AVP/keys UpdatePath=ftp://download.avp-de.com/updates/At this stage you can test what you've done so far by firing up either the command line scanner or the daemon:
> /opt/AVP/kavupdater.sh # download virus-definition files first; otherwise the scanner won't really know, what to search for... > /opt/AVP/kavscanner # if you're impatient you can cancel that at some stage by pressing <Ctrl-C> > /opt/AVP/kavdaemonBoth should work and - among other things - state, that they're running in trial mode. If they give you error messages: go back! Do your homework! You failed! (everyone getting caught in an endless loop here is allowed to send me mail.
> /etc/init.d/qmail stopWe want to integrate KAV into qmail and the mechanism for this is to rename the original "qmail-queue" file and replace it by one that incorporates the kavdaemon:
> mv /var/qmail/bin/qmail-queue /var/qmail/bin/qmail-que > mv /tmp/kav4sme/qmail-queue /var/qmail/bin/qmail-queue > chown qmailq:qmail /var/qmail/bin/qmail-queueUse your editor to open /opt/AVP/kavkeeper/kavkeeper.ini and modify these entries:
[kavdaemon] kavdaemonname=kav@yourdomain.comm # well - you'll obviously want to replace the domain name; # this entry determines the "from" address of virus detection mail messages [GROUP:DEFAULT] infectedaction=NOTIFY # send message to recipient, sender and admin infectednotify=virus@yourdomain.comm # well - same thing - replace this! # this is where the admin mails go to # Remark: you can also set this to "root" which only makes sense # if you don't "forward administrative notices" to a local user!!! # If you do, you'll get a nice mail loop: # (mail -> scan for viruses -> infected -> notify admin -> forward to local user # -> scan for viruses -> infected -> ... attachinfected=no # don't attach the original mail message - even if it has been disinfected # why? Imagine a user getting a message "hey - user "foo" was going to send you mail that was infected with virus "bar" # you can find the message in the attachment" # well - is the virus really gone? I'm scared! ... [log] usesyslog=no
[Report] Report=Yes ReportFileName=/var/log/kavscan.rpt ReportFileLimit=Yes ReportFileSize=50000 # maximum file size in kBytes
> /etc/init.d/kavdaemon.start startAnd qmail also:
> /etc/init.d/qmail start