如何在PureFTPd中整合ClamAV

來源:互聯網
上載者:User

Pureftpd是一款快速,高品質,功能齊全的ftp伺服器,最重要的是可以支援設定用戶端預設編碼,今天我給大家詳細介紹下:在PureFTPd中整合ClamAV的方法

PureFTPd是Linux下一款非常好用的的FTP伺服器端軟體,但隨著Linux的普及,病毒也開始瞄向Linux,以前我們在Linux下經常裸奔,現在我們應當重視Linux伺服器的安全,本文就簡單介紹一下如何將Linux下大名鼎鼎的反病毒軟體ClamAV與PureFTPd結合,當有人通過PureFTPd上傳檔案時,ClamAV就會自動進行掃描,如果發現上傳的檔案包含病毒就自動刪除。

  1、說明

首先我不能保證你按照我介紹的步驟操作,能讓ClamAV和PureFTPd聯合運行,因為你我的環境可能不一樣,我是在OpenSUSE 11.2下做的實驗。

2、安裝ClamAV

安裝ClamAV的命令如下,非常簡單:

yast2 -i clamav clamav-db

接下來是為ClamAV建立系統啟動項:

chkconfig --add clamd

然後啟動它:

/etc/init.d/clamd start

3、配置PureFTPd

首先用文字編輯器開啟PureFTPd的設定檔/etc/pure-ftpd/pure-ftpd.conf:

vi /etc/pure-ftpd/pure-ftpd.conf

將Umask設定項的值設為133:022,這樣clamdscan才有權掃描上傳的檔案,同時將CallUploadScript設為yes:

  1. [...]# File creation mask. : .# 177:077 if you feel paranoid.Umask 133:022[...]# 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[...]  
  2.  

接下來建立一個/etc/pure-ftpd/clamav_check.sh檔案,無論何時通過PureFTPd上傳檔案時,都會觸發它調用ClamAV主程式/usr/bin/clamdscan掃描上傳的檔案:

vi /etc/pure-ftpd/clamav_check.sh

clamav_check.sh指令碼的內容如下:

  1. #!/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

如果你不想每次重啟系統後都要手工啟動pure-uploadscript進程,那開啟/etc/init.d/boot.local:

vi /etc/init.d/boot.local

向檔案中添加一行/usr/sbin/pure-uploadscript -B -r /etc/pure-ftpd/clamav_check.sh,如:

  1. #! /bin/sh## Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. All rights reserved.## Author: Werner Fink , 1996# Burchard Steinbild, 1996## /etc/init.d/boot.local## script with local commands to be executed from init on system startup## Here you should add things, that should happen directly after booting# before we're going to the first run level.#/usr/sbin/pure-uploadscript -B -r /etc/pure-ftpd/clamav_check.sh  
  2.  

最後我們重啟PureFTPd:

/etc/init.d/pure-ftpd restart

OK!從現在開始,如果有人上傳帶有惡意軟體的檔案,ClamAV會為你自動清理。

通過文章的介紹和描述,想必讀者們都知道了PureFTPd中整合ClamAV的過程。

  • Ubuntu Server 10.04下pure-ftpd配置大全
  • Ubuntu Server 10.04下pure-ftpd工作方式和原理
  • Pureftpd 和 mysql 架設FTP伺服器
  • Debian5 LNMP編譯安裝pureftpd手冊
  • pureftpd ubuntu配置指南
  • 用Pureftpd+PureDB建立一個簡單的Linux ftp網站
  • Pureftpd小小技巧 讓你受益無窮
  • Lnmp之Pureftpd管理面板安裝教程圖文)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.