Pure-ftpd needs to be compiled with "--with-uploadscript" flag (used by default in CustomBuild 2.0) to use this feature and ClamAV must be installed on the system:
Create a post-upload checking script. Open /etc/pureftpd-antivirus.sh (for example) and post the following content to it:
Important: replace /etc/init.d/pure-ftpd with /usr/local/etc/rc.d/pure-ftpd for the next steps on FreeBSD systems.
Save the file and close it. Add pure-uploadscript to pure-ftpd start/stop script:
Restart pure-ftpd with pure-uploadscript:
To remove pure-ftpd ClamAV scan:
Restart pure-ftpd without pure-uploadscript:
Create a post-upload checking script. Open /etc/pureftpd-antivirus.sh (for example) and post the following content to it:
Code:
echo '#!/bin/sh' > /etc/pureftpd-antivirus.sh
echo '/usr/bin/clamdscan --remove --quiet --no-summary $1' >> /etc/pureftpd-antivirus.sh
echo 'exit 0;' >> /etc/pureftpd-antivirus.sh
chmod 755 /etc/pureftpd-antivirus.sh
Save the file and close it. Add pure-uploadscript to pure-ftpd start/stop script:
Code:
perl -pi -e 's#touch /var/lock/subsys/pure-ftpd#touch /var/lock/subsys/pure-ftpd\n\t\t/usr/sbin/pure-uploadscript -B -r /etc/pureftpd-antivirus.sh 1>/dev/null 2>/dev/null#' /etc/init.d/pure-ftpd
perl -pi -e 's#rm -f /var/lock/subsys/pure-ftpd#rm -f /var/lock/subsys/pure-ftpd\n\t\tkillall -9 pure-uploadscript 1>/dev/null 2>/dev/null#' /etc/init.d/pure-ftpd
perl -pi -e 's#OPTIONS="-B#OPTIONS="-B -o#' /etc/init.d/pure-ftpd
Code:
/etc/init.d/pure-ftpd restart
To remove pure-ftpd ClamAV scan:
Code:
perl -pi -e 's#touch /var/lock/subsys/pure-ftpd\n\t\t/usr/sbin/pure-uploadscript -B -r /etc/pureftpd-antivirus.sh 1>/dev/null 2>/dev/null#touch /var/lock/subsys/pure-ftpd#' /etc/init.d/pure-ftpd
perl -pi -e 's#rm -f /var/lock/subsys/pure-ftpd\n\t\tkillall -9 pure-uploadscript 1>/dev/null 2>/dev/null#rm -f /var/lock/subsys/pure-ftpd#' /etc/init.d/pure-ftpd
perl -pi -e 's#OPTIONS="-B -o#OPTIONS="-B#' /etc/init.d/pure-ftpd
Restart pure-ftpd without pure-uploadscript:
Code:
/etc/init.d/pure-ftpd restart
Last edited: