How To Configure and Integrate ClamAV Into PureFTPd For Virus Scanning On Ubuntu 12.10 and UBuntu 12.04


1 Preliminary Note
You should have a operating PureFTPd setup on your Ubuntu twelve.10 server, e.g. as shown during this tutorial: Virtual Hosting With PureFTPd And MySQL (Incl. Quota And information measure Management) On Ubuntu twelve.10.

Make sure that you simply ar logged in as root (type in

sudo su

to become root), as a result of we have a tendency to should run all the steps from this tutorial as root user.

 2 putting in ClamAV
ClamAV are often put in as follows:

apt-get install clamav clamav-daemon clamav-data

Run

freshclam

to transfer the most recent virus signatures, and therefore the begin the ClamAV daemon:

/etc/init.d/clamav-daemon begin

3 Configuring PureFTPd
First we have a tendency to produce the file /etc/pure-ftpd/conf/CallUploadScript that merely contains the string yes:

echo "yes" > /etc/pure-ftpd/conf/CallUploadScript

Next we have a tendency to produce the file /etc/pure-ftpd/clamav_check.sh (which can decision /usr/bin/clamdscan whenever a file is uploaded through PureFTPd)...

vi /etc/pure-ftpd/clamav_check.sh

#!/bin/sh
/usr/bin/clamdscan --remove --quiet --no-summary "$1"
... and build it executable:

chmod 755 /etc/pure-ftpd/clamav_check.sh

Now we have a tendency to edit /etc/default/pure-ftpd-common...

vi /etc/default/pure-ftpd-common

... and alter the UPLOADSCRIPT line as follows:

[...]
# UPLOADSCRIPT: if this is often set and therefore the daemon is run in standalone mode,
# pure-uploadscript also will be run to spawn the program given below
# for handling uploads. see /usr/share/doc/pure-ftpd/README.gz or
# pure-uploadscript(8)

# example: UPLOADSCRIPT=/usr/local/sbin/uploadhandler.pl
UPLOADSCRIPT=/etc/pure-ftpd/clamav_check.sh
[...]

Finally we have a tendency to restart PureFTPd:

/etc/init.d/pure-ftpd-mysql restart

0 comments:

Post a Comment