3、配置Clam AntiVirus:
(1)
编辑主配置文件:
#vi /etc/clamav/clamd.conf
注释掉第八行的Example,如下:
# Example
找到如下行
#LogFile /tmp/clamd.log
#PidFile /var/run/clamd.pid
LocalSocket /tmp/clamd.socket
#DatabaseDirectory /var/lib/clamav
#User clamav
修改为:
LogFile /var/log/clamav/clamd.log
PidFile /var/run/clamav/clamd.pid
LocalSocket /var/run/clamav/clamd.socket
DatabaseDirectory /usr/local/clamav/share
User amavis
启用以下选项
LogSyslog yes
LogFacility LOG_MAIL
LogVerbose yes
StreamMaxLength 20M //
后面的数值应该与邮件服务器允许的最大附件值相一致
编辑更新进程的配置文件
TCPSocket 3310 //tcp
监听端口
(2)#vi /etc/clamav/freshclam.conf
注释掉Example,如下:
# Example
找到如下行
#DatabaseDirectory /var/lib/clamav
#UpdateLogFile /var/log/freshclam.log
PidFile /var/run/freshclam.pid
分别修改为:
DatabaseDirectory /usr/local/clamav/share
UpdateLogFile /var/log/clamav/freshclam.log
PidFile /var/run/clamav/freshclam.pid
启用以下选项:
DatabaseMirror db.XY.clamav.net //
这里也可以把XY改成您的国家代码来实现,比如,我们用cn来代替
LogSyslog yes
LogFacility LOG_MAIL
LogVerbose yes
4、建立日志所在的目录、进程与socket所在的目录,并让它属于clamav用户
#mkdir -v /var/log/clamav
#chown -R amavis.amavis /var/log/clamav
#mkdir -v /var/run/clamav
#chmod -R 777 /var/run/clamav
#chown -R amavis.amavis /var/run/clamav
建立freshlog的日志文件
#touch /var/log/clamav/freshclam.log
#chown clamav.clamav /var/log/clamav/freshclam.log
5、配置crontab,让Clam AntiVirus每小时检测一次新的病毒库
#crontab -e
添加:
37 * * * * /usr/local/clamav/bin/freshclam
6、配置库文件搜索路径
#echo “/usr/local/clamav/lib” >> /etc/ls.so.conf
#ldconfig -v
7、配置clamav开机自动启动
# chkconfig --add clamd
#chkconfig --level 35 clamd on
8 编辑/etc/rc.d/init.d/clamd,将服务进程的路径指向刚才的安装目录
#vi /etc/rc.d/init.d/clamd
找到如下行
progdir="/usr/local/sbin"
修改为:
progdir="/usr/local/clamav/sbin"
9. 启动clamd
service clamd start
九、安装配置装Spamassassin-3.2.3(反垃圾邮件过滤器)
1、安装依赖的perl相关包
推荐使用CPAN自动安装(你的主机要能连上Internet),它能够自动下载安装,并能解决安装过程中的依赖关系。您可以使用类同的以下的命令来进行安装:
# cpan
cpan> install Digest::SHA1 //Digest::SHA1
为要安装的包名称
所需安装的依赖包列表如下:
Digest::SHA1
HTML::Parser
Net::DNS
LWP (aka libwww-perl)
HTTP::Date
IO::Zlib
Archive::Tar
2、安装Spamassassin-3.2.3
#tar jxvf Mail-SpamAssassin-3.2.3.tar.bz2
#cd Mail-SpamAssassin-3.2.3
#perl Makefile.PL
#make
#make install
3、编辑主配置文件/etc/mail/spamassassin/local.cf
required_hits 10.0
rewrite_subject 1
required_score 5.0
rewrite_header Subject *****SPAM*****
report_safe 1
use_bayes 1
bayes_auto_learn 1
skip_rbl_checks 1
use_razor2 0
use_pyzor 0
ok_locales all
4、测试spamassassin
#spamassassin -t < sample-nonspam.txt > nonspam.out
#spamassassin -t < sample-spam.txt > spam.out
查看测试结果:
less nonspam.out
less spam.out
5、检查配置文件
#spamassassin -d �Clint
要是出现config: SpamAssassin failed to parse line, skipping: rewrite_subject 1的警告,可以把
/etc/mail/spamassassin/local.cf
配置文件的
rewrite_subject 1
注释掉
6、启动进程,并将其加入到自动启动队列
#cp /root/postfix/Mail-SpamAssassin-3.0.5/spamd/
redhat-rc-script.sh
/etc/init.d/spamd // root/postfix/Mail-SpamAssassin-3.0.5/spamd/
下
的启动脚本要根据自己的系统来进行cp
#chkconfig --add spamd
#chkconfig spamd on
#service spamd start