在CentOS5中安裝Qmail商業郵件系統
chengkinhung
|
11#
chengkinhung 发表于 2007-07-25 12:04
Clam AntiVirus是專為UNIX而設的GPL防毒軟件,主要用於郵件伺服器(附件掃描)。整套
軟件包括多執行緒常駐程式、指令式掃描器和自動網上更新工具(作為優秀的防毒軟件,最 重要的當然是經常更新病毒資料庫)。透過這些由Clam AntiVirus套裝軟件所分發的共用檔 案庫程式,讓您自由結合軟件. 以下是其主要功能: ------------------------------------------------------------------------------- 指令式掃描器 快速及多執行緒的常駐程式 可結合sendmail使用的milter介面 支援數碼簽署的病毒資料庫更新功具 病毒掃描器C檔案庫 on-access掃描功能(Linux®及FreeBSD®) 每天多次更新病毒資料庫(病毒識別碼的總數可參閱網頁) 內置支援RAR (2.0)、Zip、Gzip、Bzip2、Tar、MS OLE2、MS Cabinet檔案、MS CHM (壓縮HTML)、MS SZDD 內置支援mbox、Maildir和原始郵件檔案 內置支援用UPX、FSG和Petite壓縮的Portable Executable檔案 ------------------------------------------------------------------------------- ClamAV的基本安装包含了三个二进制工具(在/usr/bin目录下): ------------------------------------------------------------------------------- freshclam - As you know an anti-virus solution is only as good as the latest virus updates it has. This tool is used to update the virus databases on your system. It downloads the latest virus updates from the internet and keeps your anti-virus solution upto date. clamscan - This is the tool that actually checks your files to see if they are infected. sigtool - When you download the latest virus updates from the net, there should be a way of verifying the validity of the update. This is achieved by the sigtool. It is used to verify the digital signatures of databases and list virus signature names among other things. ------------------------------------------------------------------------------- =============================================================================== =============================================================================== 1) 检查系统所需相关套件和用户帐号(ClamAV需要zlib,bzip和gmp套件支持): =============================================================================== ------------------------------------------------------------------------------- 用RPM命令检查是否已经安装如下套件: ------------------------------------------------------------------------------- rpm -qa | grep zlib; rpm -qa | grep zlib-devel; rpm -qa | grep bzip2; rpm -qa | grep bzip2-devel; rpm -qa | grep gmp; rpm -qa | grep gmp-devel; ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- 如果没有安装相关套件,可用如下命令安装: ------------------------------------------------------------------------------- yum install zlib; yum install zlib-devel; yum install bzip2; yum install bzip2-devel; yum install gmp; yum install gmp-devel; ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- 检查openssl套件: ------------------------------------------------------------------------------- rpm -qa | grep openssl; yum list | grep openssl; #检查是否需要安装或更新 yum install openssl; yum update openssl; ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- 建立用户帐户: ------------------------------------------------------------------------------- 如果是第一次安装,系统应该还没有相关帐号,就要新建立: groupadd clamav; useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav; 请注意: 后面将介绍的RPM和YUM安装方法会自动安装用户帐号,如果采用这两种方法安装, 可以忽略建立用户的步骤; 但为了提高安全性和统一性, 建议一并使用上述命令手工建立 用户帐户. 請注意: 因为本系统的clamav将要结合qmail-scanner来扫描电邮,即通过 qmail-scanner 腳本来调用ClamAV的掃描功能, 因此ClamAV的日志文件权限必须设置成qmail-scanner的 执行者具有读写權限,否則會導致無法接受電郵; ------------------------------------------------------------------------------- =============================================================================== =============================================================================== 2) 安装ClamAV防病毒系统(如下A,B和C三种方法可任选其一); =============================================================================== ------------------------------------------------------------------------------- A) YUM在线安装方法(简单方便,推荐用此方法): ------------------------------------------------------------------------------- yum list clamav; yum install clamav; (會連帶自動安裝clamav-db) yum install clamav-devel; yum install clamav-milter; (僅sendmail需要,會連帶自動安裝clamd) yum install clamd; (若不安裝clamav-milter,就必須自行安裝clamd) 請注意: clamav-milter是專門為sendmail而設計的快速呼叫程序,如果您不使用sendmail, 或者想通過mail-scanner之類的腳本來呼叫ClamAV,則不必安裝和啟動clamav-milter. vi /etc/passwd; #为提高安全性,请将bash项目改为/bin/false,如下所示: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - clamav:x:104:104:Clam Anti Virus Checker:/var/clamav:/bin/false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 請注意: /etc/shells 中必須有 /bin/false ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- B) RPM安装方法; ------------------------------------------------------------------------------- 参考网站: http://www.clamav.net/ http://www.clamav.net/download/sources/ http://crash.fce.vutbr.cz/crash-hat/5/clamav/ 下载RPM套件: wget http://crash.fce.vutbr.cz/crash- ... v-0.90.1-0.i386.rpm; wget http://crash.fce.vutbr.cz/crash- ... b-0.90.1-0.i386.rpm; wget http://crash.fce.vutbr.cz/crash- ... l-0.90.1-0.i386.rpm; wget http://crash.fce.vutbr.cz/crash- ... r-0.90.1-0.i386.rpm; wget http://crash.fce.vutbr.cz/crash- ... r-0.90.1-0.i386.rpm; wget http://crash.fce.vutbr.cz/crash-hat/5/clamav/clamav.spec; 下载RPM资源: #如有需要,可用此src资源rebuild符合当前系统需要的rpm套件 wget http://crash.fce.vutbr.cz/crash- ... av-0.90.1-0.src.rpm; rpm -ivh clamav-0.90.1-0.i386.rpm; rpm -ivh clamav-db-0.90.1-0.i386.rpm; rpm -ivh --nodeps clamav-milter-0.90.1-0.i386.rpm; rpm -ivh clamav-server-0.90.1-0.i386.rpm; 請注意: 安裝clamav-milter時會尋找sendmail和sendmail-cf的依賴關系, 因此如果您的 系統不需要 sendmail, 就可用 --nodeps 參數忽略其依賴關系. ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- C) 二进制资源安装方法(本系统必须使用此安装方法); ------------------------------------------------------------------------------- wget http://freshmeat.net/redir/clama ... lamav-0.90.1.tar.gz; wget http://freshmeat.net/redir/clama ... lamav-0.90.3.tar.gz; tar zxvf clamav-0.90.1.tar.gz; cd clamav-0.90.1; 請注意: 此處編譯的關鍵地方是指定了 ClamAV 的運行者, 因此必須先建立相關用戶和組. 例如, 如果您打算采用(b)方式, 在下面的配置选项中指定用户 qscand 作为运行 ClamAV 的使用者身份,那么请先执行如下增加用户的Linux命令: groupadd qscand; useradd -g qscand -s /bin/false -c "Qmail-Scanner Account" qscand; 打補丁新版本不用打) wget http://www.fehcom.de/qmail/spamc ... .88.2_output.patch_; 請注意: 最新版補丁其實是包含在spamcontrol的資源中: cp /usr/local/src/qmail/qmail-1.03/*_output.patch_ ./ tar zxvf clamav-0.90.3.tar.gz; cd clamav-0.90.3; patch ../*_output.patch_; (a)指定用户clamav和组clamav来运行clamd: ./configure \ --sysconfdir=/etc \ --with-user=clamav \ --with-group=clamav \ --enable-milter; (b)指定以root来运行clamd,以结合QHPSI的掃描方法(或預設安裝再修改成root的身份): ./configure \ --sysconfdir=/etc \ --with-user=root \ --with-group=root \ --disable-zlib-vcheck \ --enable-milter; (c)指定用户qscand和组qscand来运行ClamAV,以结合后面qmail-qscand的安装: ./configure \ --sysconfdir=/etc \ --with-user=qscand \ --with-group=qscand \ --disable-zlib-vcheck \ --enable-milter; 注意: 因為本系统需要结合qmail-qscand来执行病毒扫描和用syslog来记录日志,所以若在 此編譯步驟中指定用户qscand来運行ClamAV, 就可以統一上述兩個系統的使用者,否则將要 在后面相關步驟中修改ClamAV的日志文档的属性,令qmail-qscand的脚本有权读写ClamAV的 日志文档.如果選擇使用QHPSI來調用ClamAV,則建議設置成用root的身份來掃描, 請參考后 續步驟(建立Qmail的運行腳本)中關于QHPSI的設置內容. make; make install; 請注意: 用tar資源安裝的預設路徑是/usr/local/bin/,若設置QHPSI請留意匹配相應設置. ------------------------------------------------------------------------------- =============================================================================== |