如何将ClamAV集成到PureFTPd中以进行病毒扫描Mandriva 2010.0
本教程将介绍如何将ClamAV集成到PureFTPd中,以便在Mandriva 2010.0系统上进行病毒扫描。 最后,每当通过PureFTPd上传文件时,ClamAV将检查文件并将其删除,如果它是恶意软件。
我不会保证这将为您工作!
1初步说明
您应该在Mandriva 2010.0服务器上安装一个工作的PureFTPd设置,例如本教程所示: 使用PureFTPd和MySQL进行虚拟托管(包括配额和带宽管理)Mandriva 2009.1 (是的,适用于Mandriva 2009.1,但适用于Mandriva 2010.0 )。
2安装ClamAV
ClamAV可以安装如下:
urpmi clamd clamav
接下来,我们为clamd和freshclam创建系统启动链接并启动它们:
chkconfig clamd on
chkconfig freshclam on
/etc/init.d/clamd start
freshclam
/etc/init.d/freshclam start
3配置PureFTPd
首先我们打开/etc/pure-ftpd/pure-ftpd.conf
并将CallUploadScript
设置为yes
:
vi /etc/pure-ftpd/pure-ftpd.conf
[...] # If your pure-ftpd has been compiled with pure-uploadscript support, # this will make pure-ftpd write info about new uploads to # /var/run/pure-ftpd.upload.pipe so pure-uploadscript can read it and # spawn a script to handle the upload. CallUploadScript yes [...] |
接下来,我们创建文件/etc/pure-ftpd/clamav_check.sh
(每当通过PureFTPd上传文件时,它将调用/ usr / bin /
clamdscan)...
vi /etc/pure-ftpd/clamav_check.sh
#!/bin/sh /usr/bin/clamdscan --remove --quiet --no-summary "$1" |
...并使其可执行:
chmod 755 /etc/pure-ftpd/clamav_check.sh
现在我们启动pure-uploadscript
程序作为守护进程,每当通过PureFTPd上传文件时,它将会调用我们的/etc/pure-ftpd/clamav_check.sh
脚本:
pure-uploadscript -B -r /etc/pure-ftpd/clamav_check.sh
当然,你不想在启动系统时手动启动守护进程 - 因此我们打开/etc/rc.local
...
vi /etc/rc.local
...并将/ usr / sbin / pure-uploadscript -b -r /etc/pure-ftpd/clamav_check.sh添加
到其中 - 如下所示:
#!/bin/sh # ### BEGIN INIT INFO # Provides: rc.local # X-Mandriva-Compat-Mode # Default-Start: 2 3 4 5 # Short-Description: Local initialization script # Description: This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. ### END INIT INFO /usr/sbin/pure-uploadscript -B -r /etc/pure-ftpd/clamav_check.sh touch /var/lock/subsys/local |
最后我们重新启动PureFTPd:
/etc/init.d/pure-ftpd restart
而已! 现在每当有人尝试通过PureFTPd将恶意软件上传到您的服务器时,“坏”文件将被默认删除。
4链接
- PureFTPD: http : //www.pureftpd.org/
- ClamAV: http : //www.clamav.net/
- Mandriva: http : //www.mandriva.com/