First make sure to install clamAV,We ave already discuss in our previous articles how to install and run clamAV on server. Clam ANTIVIRUS is a free and open-source, cross-platform antivirus software tool-kit which has now been included in Cpanel/WHM. It detect many types of malicious software, including viruses. One of its basic use is on mail servers as a server-side email virus scanner.
You can also install it from your WHM interface as root by clicking on:
cPanel —> Manage Plugins —> on clamavconnector
Check the “Install and Keep Updated” and then click at the bottom of the page to save.
Now we need to edit the file /etc/pure-ftpd.conf and change this line with:
CallUploadScript yes
Next create file /etc/pure-ftpd/clamav_check.sh with this content:
#!/bin/bash #Maximum file size to scan in bytes that’s set to 10MB MAXSIZE=10485760 if [ “$UPLOAD_SIZE” -le “$MAXSIZE” ]; then /usr/bin/clamdscan –remove –quiet –no-summary “$1” fi
Change its permissions to make it executable:
chmod 755 /etc/pure-ftpd/clamav_check.sh
Now we should start the pure-uploadscript daemon every time to call our script when a file is uploaded
/usr/sbin/pure-uploadscript -B -r /etc/pure-ftpd/clamav_check.sh
And to let it start with your server/vps boots just run this :
echo “/usr/sbin/pure-uploadscript -B -r /etc/pure-ftpd/clamav_check.sh” >> /etc/rc.d/rc.local
Now restart pure-ftpd :
service pure-ftpd restart
Now all your uploaded files which are less than 10MB in size will be scanned by ClamAV, You can adjust the size limit as per your requirements.
That’all to do.Please Give your opinion below if you experience any issues or to discuss your ideas and experiences.