Problemstellung
Virenscanprogramme sind immer nur so gut, wie die Pattern
Dateien. Diese müssen dahrer regelmäßig auf den aktuellen Stand
gebracht werden. Wie das bei McAfee DAT-Files automatisch bewerkstelligt werden
kann ist im folgenden beschrieben.
Vorbereitungen
Damit ein täglicher Update nicht immer den gleichen
Traffic verursacht wird der NAI FTP Server mit wget lokal gespiegelt und per
ProFTP bereitgestellt. Dazu sind aus der Serie n von SuSE Linux die Paktete
wget, proftp und ftpdir zu installieren.
Konfiguration
.netrc:
default login anonymous password gwolf@chiemgau.com
/root/bin/dat-update.sh
#!/bin/sh
# Assume uvscan is installed in the same directory
# as this script.
install_directory="/usr/local/uvscan"
# Create a download directory
mkdir /tmp/dat-updates
cd /tmp/dat-updates
# Get the version of the currently installed .DATs
# from the info given by the --version switch
current_version=`
$install_directory/uvscan --version |
grep "Virus data file" |
awk '{ print substr($4,2,4) }'`
# Get the new .DATs.
# The entry in your .netrc file should take care
# of the downloading.
ftp ftp.nai.com << !
binary
cd /pub/antivirus/datfiles/4.x
prompt
mget dat-*.tar
quit
!
# Get the version of the new .DATs from the filename.
new_version=`echo dat-*.tar | awk '{ print substr($1,5,4) }'`
# If they are the same age or older than the current ones,
# do not install them
if [ "$current_version" -ge "$new_version" ]
then
echo "No new .DATs available at this time"
echo "Currently installed version: $current_version"
echo "Version on FTP site: $new_version"
else
tar -xf dat-*.tar
# Move them to the install directory, making sure
# the filename is lower case.
for file in `tar -tf dat-*.tar`
do
newfile=`echo $file | tr [A-Z] [a-z]`
echo Verschiebe $file nach $install_directory/$newfile
mv ./$file $install_directory/$newfile
done
# Get the current version again and make sure
# the new .DATs installed correctly.
current_version=`
$install_directory/uvscan --version |
grep "Virus data file" |
awk '{ print substr($4,2,4) }'`
if [!"$current_version" -eq "$new_version" ]
then
echo "DAT file updates did not work correctly."
echo "Please try manually."
fi
fi
# Delete the directory that you created.
cd /
rm -fr /tmp/dat-updates |