Steve Basford wrote the following on 3/4/2007 10:46 PM -0800:
> Dennis Peterson wrote:
>   
>> My guess is the MSRBL folks would like it if you downloaded the new
>> files only if the file has been modified.
>>
>>     
> I think you're right... the size of their images .ndb file
> (un-compressed) jumped to about 7.5 meg in size and I guess shifting
> that amount of data for x users, would slowly become more of a pain,
> especially as they seem to be adding md5 hashes at a growing rate, so
> with rsync used correctly, it'll only be shifting a small amount of data.
>
> Thanks for the script help too... if anyone would like to modify the
> current scripts on my site and come up with a rsync version for the
> msrbl sigs only... then I'll certainly update them on my site.
>
> Thanks all!
>
> Steve
>   
Steve, below is an update of my script using rsync for the MSRBL files:
==========
#!/bin/bash

# Either set and export PATH
PATH=/bin:/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
export PATH

# or set individual program paths
#clamd="/usr/local/sbin/clamd"
#clamscan="/usr/local/bin/clamscan"
#curl="/usr/local/bin/curl"
#gunzip="/bin/gunzip"
#service="/sbin/service"
#test="/usr/bin/test"

# Set working directory paths
tmp_dir="/var/tmp/clamdb"
rsync_dir="/var/tmp/rsync"

# Change shell to ClamAV database directory
cd /var/lib/clamav

# Check for SaneSecurity SCAM database update
curl -R -s -S -z scam.ndb.gz -o $tmp_dir/scam.ndb.gz \
   http://www.sanesecurity.com/clamav/scam.ndb.gz
      test -s $tmp_dir/scam.ndb.gz && \
      gunzip -cdf $tmp_dir/scam.ndb.gz > $tmp_dir/scam.ndb && \
      mv -f $tmp_dir/scam.ndb.gz . && \
      clamscan --quiet -d $tmp_dir/scam.ndb - < /dev/null && \
      cp --reply=yes scam.ndb scam.ndb-bak && \
      mv -f $tmp_dir/scam.ndb .

# Check for SaneSecurity PHISH database update
curl -R -s -S -z phish.ndb.gz -o $tmp_dir/phish.ndb.gz \
   http://www.sanesecurity.com/clamav/phish.ndb.gz
      test -s $tmp_dir/phish.ndb.gz && \
      gunzip -cdf $tmp_dir/phish.ndb.gz > $tmp_dir/phish.ndb && \
      mv -f $tmp_dir/phish.ndb.gz . && \
      clamscan --quiet -d $tmp_dir/phish.ndb - < /dev/null && \
      cp --reply=yes phish.ndb phish.ndb-bak && \
      mv -f $tmp_dir/phish.ndb .

# Check for MSRBL SPAM database update
rsync -a rsync://rsync.mirror.msrbl.com/msrbl/MSRBL-SPAM.ndb \
   $rsync_dir/MSRBL-SPAM.ndb
      cp $rsync_dir/MSRBL-SPAM.ndb $tmp_dir
      test -s $tmp_dir/MSRBL-SPAM.ndb && \
      clamscan --quiet -d $tmp_dir/MSRBL-SPAM.ndb - < /dev/null && \
      cp --reply=yes MSRBL-SPAM.ndb MSRBL-SPAM.ndb-bak && \
      mv -f $tmp_dir/MSRBL-SPAM.ndb .

# Check for MSRBL IMAGE database update
rsync -a rsync://rsync.mirror.msrbl.com/msrbl/MSRBL-Images.hdb \
   $rsync_dir/MSRBL-Images.ndb
      cp $rsync_dir/MSRBL-Images.ndb $tmp_dir
      test -s $tmp_dir/MSRBL-Images.hdb && \
      clamscan --quiet -d $tmp_dir/MSRBL-Images.hdb - < /dev/null && \
      cp --reply=yes MSRBL-Images.hdb MSRBL-Images.hdb-bak && \
      mv -f $tmp_dir/MSRBL-Images.hdb .

# Set appropriate file permission (should be whatever user account
# ClamD is running under)
chown -R clamav:clamav /var/lib/clamav

# Remove any leftover files in the working directory (should only
# happen when a corrupted database is detected)
rm -f /var/tmp/clamdb/*

# Reload database (should not be necessary if you have "SelfCheck"
# enabled in clamd.conf and/or "NotifyClamd" enabled in freshclam.conf)
#service clamd reload
==========

This script sets one additional working directory for storing rsync
files before copying them to the temp directory for testing and
processing.  Feel free to update the current script on your scripts
download site.

Bill
_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://lurker.clamav.net/list/clamav-users.html

Reply via email to