Samba-vscan
From dghartung.com/docs
samba-vscan is an open-source, on-access virus scanner for use with samba file servers...hence the name.
It can be found at: http://www.openantivirus.org/projects.php
I install all the software via rpm, their instructions are somewhat misleading and I will explain the process I use here.
Contents |
Install Clamav
1. Get the sources from the clamav website http://www.clamav.net/
cd /usr/local/src wget http://easynews.dl.sourceforge.net/sourceforge/clamav/clamav-#.#.#.tar.gz
2. Untar
tar -zxvf clamav-#.#.#.tar.gz
3. Add the user and group clamav
useradd clamav groupadd clamav
4. Configure, make, and install the sources
cd clamav-#.#.# ./configure --sysconfdir=/etc/ make make install
5. Copy the starup file to the init.d folder and set with chkconfig
cp contrib/init/RedHat/clamd /etc/rc.d/init.d/clamd chmod 755 /etc/rc.d/init.d/clamd chkconfig clamd on
6. Modify your config files before operating
vi /etc/clamd.conf
- Comment out 'Example' #Example
- Change the location of the socket file to: LocalSocket /var/run/clamd
- Edit your /etc/fresclam file and comment out 'Example' #Example
7. Run Freshclam to update your cvd files
freshclam
8. Start the clamd daemon
service clamd start
9. Set up a cron job to update cvd files every once and a while ... as root
touch /var/log/clam-update.log chmod 755 /var/log/clam-update.log crontab -e
add the following line
14 * * * * /usr/local/bin/freshclam --quiet -l /var/log/clam-update.log
This will update the cvd files on the fourteenth minute of every hour, for more details on setting up cron jobs look here: http://www.adminschoice.com/docs/crontab.htm
Install samba-vscan
1. Back up existing samba config files and store them in a location where you know to retrieve them i.e.
cp -r /etc/samba/* /usr/local/src/samba-config.bak/
2. Run apt-get update
apt-get update
3. Install the current version of samba with apt-get
apt-get install samba samba-common
4. Now get the source files, if you haven't configured sources for samba look at Apt-get Notes and make sure your sources.lst includes the "rpm-src" line
apt-get source samba
5. cd to /usr/local/src and untar your source samba files
cd /usr/local/src tar -zxvf /usr/src/redhat/SOURCES/samba-3.#.#.tar.gz
6. Next you mave to configure and make proto in samba in order for samba-vscan to compile
cd samba-3.#.#/source ./configure make proto
7. cd two levels up and get the source samba-vscan
cd ../.. wget http://easynews.dl.sourceforge.net/sourceforge/openantivirus/samba-vscan-0.3.6b.tar.bz2
8. Untar, configure and make, Do Not "make install"
tar -jxvf samba-vscan-#.#.#.tar.gz cd samba-vscan-#.#.#.tar.gz ./configure --with-samba-source=/usr/local/src/samba-#.#.#/source make clamav
9. Copy some file to thier respective locations, Do Not "make install"
cp /usr/local/src/samba-vscan-#.#.#/vscan-clamav.so /usr/lib/samba/vfs/ cp /usr/local/src/samba-vscan-#.#.#/clamav/vscan-clamav.conf /etc/samba/
10. Have a look at the /etc/samba/vscan-clamav.conf, change your settings as desired, they will be based on system and network performance, you will have to tune this file or the whole process will get aggrevating
11. You can scan every share on your machine or just individual shares, add the following to the [global] or your [share definition] as needed in your /etc/samba/smb.conf
vfs object = vscan-clamav vscan-clamav: config-file = /etc/samba/vscan-clamav.conf
12. Restart samba
service smb restart
Check system and network performance before implementing this in production
