3,安装 dovecot
yum -y install dovecot
修改/etc/dovecot.conf
添加一行
procotol = pop3
启动dovecot 服务
service dovecot start
4。安装openwebmail
perl-Text-Iconv 这个包源里面没有,但官网的其它directory 里面有,直接rpm 安装
首先配置openwebmail 的yum 源MIMEdefang
rpm -ivh
http://openwebmail.org/openwebma ... -1.7-2.el5.i386.rpm
# cd /etc/yum.repos.d
# lftpget
http://openwebmail.org/openwebma ... se/openwebmail.repo
If SELinux enabled, you may need to set it 'permissive' in
/etc/sysconfig/selinux or system-config-selinux
Installing: openwebmail-data ######################### [4/4]
Dependency Installed: openwebmail.i386 0:2.53-1 openwebmail-data.i386 0:2.53-1 perl-Text-Iconv.i386 0:1.5-1.fc8 perl-suidperl.i386 4:5.8.8-32.fc8
Complete!
# yum install openwebmail
fedora 100% |=========================| 2.1 kB 00:00
openwebmail 100% |=========================| 951 B 00:00
updates 100% |=========================| 2.3 kB 00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package openwebmail.i386 0:2.53-1 set to be updated
--> Processing Dependency: openwebmail-data = 2.53-1 for package: openwebmail
--> Processing Dependency: perl-suidperl for package: openwebmail
--> Processing Dependency: perl-Text-Iconv for package: openwebmail
--> Running transaction check
---> Package openwebmail-data.i386 0:2.53-1 set to be updated
---> Package perl-suidperl.i386 4:5.8.8-32.fc8 set to be updated
---> Package perl-Text-Iconv.i386 0:1.5-1.fc8 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing for dependencies:
openwebmail i386 2.53-1 openwebmail 2.3 M
openwebmail-data i386 2.53-1 openwebmail 7.0 M
perl-Text-Iconv i386 1.5-1.fc8 fedora 20 k
perl-suidperl i386 4:5.8.8-32.fc8 updates 60 k
Total download size: 9.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): perl-Text-Iconv-1. 100% |=========================| 20 kB 00:00
(2/4): openwebmail-2.53-1 100% |=========================| 2.3 MB 00:03
(3/4): perl-suidperl-5.8. 100% |=========================| 60 kB 00:00
(4/4): openwebmail-data-2 100% |=========================| 7.0 MB 00:10
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID cfb164d8
Importing GPG key 0xCFB164D8 "Thomas Chung <
tchung@openwebmail.org>" from
http://openwebmail.org/.../RPM-GPG-KEY-openwebmail
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-Text-Iconv ######################### [1/4]
Installing: perl-suidperl ######################### [2/4]
Installing: openwebmail ######################### [3/4]
Permission and Ownership for openwebmail files have been fixed!
Please execute following tool first as a root:
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
After restarting httpd service, login with non-root account from
http://localhost.localdomain/cgi-bin/openwebmail/openwebmail.pl
or
http://localhost.localdomain/webmail
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init 进行配置,直接回车就可以了
http://youservername/cgi-bin/openwebmail/openwebmail.pl
##如果安装不成功,直接到官网下载。再安装也是一样的效果,新版本的OPENWEBMAIL真的是比较智能化,配置也简单多了。语言支持也非常不错!对于 语言要求比较高的公司也是个不错的选择。而且采用是CGI模式,相对来说,蛮快的。上面几个依赖的包也是CGI的加速软件。看以后能不能再加上 fastcgi模块来优化一下(小弟对这些不是太懂)
安装apace
yum -y install httpd
然后配置apache
允许CGI执行
配置以下两项
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
AllowOverride None
Options ExecCGI ##原有的是Opentions None 改成我前面写的Options ExecCGI 这个意思是允许执行CGI类型的文件
Order allow,deny
Allow from all
</Directory>
找到这一行,把前面的#号去掉并且加上支持.pl文件类型
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl ####在这一行添加对.pl文件类型的支持。因为我们的openwebmail是perl 语言编写的。而且我们的openwebmail文件后缀名为pl.把以最好加上 .pl。这样不容易出错!
===========================================================
配置openwebmail 可以被 clamav扫描
# vi openwebmail.conf
enable_viruscheck yes
viruscheck_pipe /usr/bin/clamdscan --mbox --disable-summary --stdout -
viruscheck_source_allowed all
####这是官方的howto文档。我是直接抄过来的。MS没有啥效果!大家有兴趣可以自己研究
4,安装spamassassin (mimedefang 为调用spamassassin来防垃圾邮件)
yum -y install spamassassin
配置spamassassin
2.编辑主配置文件/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
#service spamassassin start
spamassassin 报错
如果出现 /var/log/maillog 报错
spamd[850]: rules: meta test DIGEST_MULTIPLE has undefined dependency 'DCC_CHECK'
vi /etc/mail/spamassassin/v310.pre
去掉下面的注释符号# 不然服务会启动后,不能和mimedefang结合使用
loadplugin Mail::SpamAssassin: lugin: CC
如果要更强的防垃圾邮件规则,大家可以到网上找找相关的规则 !
安装chinese_rules.cf
下载文件: wget -N -P /usr/share/spamassassin/
www.ccert.edu.cn/spam/sa/Chinese_rules.cf
/etc/init.d/init-script restart
可以把这个放到crontab 里面,定时更新防垃圾规则,规则要量力而行,生产环境要经过测试,最好不要挡住正常邮件
以下是网上的规则,最好经过测试再用
--------------------------------------------------------------------------
Jul 18 18:53:41 huzi sendmail[4592]: m6IArbo3004592: Milter delete (noop): header: X-Spam-Score (正常结合mimedefang使用了)
Jul 18 18:53:41 huzi sendmail[4592]: m6IArbo3004592: Milter add: header: X-Scanned-By: MIMEDefang 2.64 on 192.168.1.180 (mimedefang 已经正常和上面的spamassassin一起使用)
Jul 18 18:53:41 huzi sendmail[4591]: m6IArbL3004591: to=huzi, ctladdr=root (0/0), delay=00:00:04, xdelay=00:00:04, mailer=relay, pri=30027, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m6IArbo3004592 Message accepted for delivery)
Jul 18 18:53:41 huzi sendmail[4595]: m6IArbo3004592: to=<
huzi@huzi.uplookinghuzi.com>, ctladdr=<
root@huzi.uplookinghuzi.com> (0/0), delay=00:00:04, xdelay=00:00:00, mailer=local, pri=30623, dsn=2.0.0, stat=Sent
-------------------------------------------------------------------------------
下面是网上的一个防垃圾邮件的规则。大家看着用吧。用前先测试 !
为了尽量减少误判,建议使用SpamAssassin提供的白名单功能。比如在/etc/mail/SpamAssassin/sa-mimedefang.cf中添加
whitelist_from *@cernet.edu.cn
会使所有来自cernet.edu.cn的邮件被视为正常邮件。
SpamAssassin 主要配置文件是 /etc/mail/spamassassin/local.cf和 /usr/share/spamassassin/*.cf,后者是默认的规则文件集,一般不要改动;前者可以让管理员修改配置添加规则。由于默认的规则 库不太符合国内中文邮件,所以你得添加一些适合中文的规则到local.cf文件中,下面的是由反垃圾邮件联盟网站ten提供的适合中文邮件规则集:
##################################################
#Follow is diables some bad rules for chinese mail
#################################################
score SUBJ_FULL_OF_8BITS 0.0
score BASE64_ENC_TEXT 0.0
score BAYES_99 0.1
score BAYES_90 0.1
score BAYES_80 0.1
score BAYES_70 0.1
score BAYES_60 0.1
score FROM_ILLEGAL_CHARS 0.1
score HEAD_ILLEGAL_CHARS 0.1
score SUBJ_ILLEGAL_CHARS 0.1
score MIME_BASE64_TEXT 0.1
score FAKE_HELO_AOL 0.1
score NO_RDNS_DOTCOM_HELO 0.1
score CHINA_HEADER 0.1
鉴于相当多的网友询问如何在Spamassassin里配置CBL的黑名单作为其评分标准之一,
故整理了一下CBL/CDL/CBL+/CBL-的在Spamassassin里的配置格式,
其中有些设置了检查返验证码,有些没设,以及分值的设定等等,这些可根据各自的实际情况设置。
其中我们推荐优先使用CBL-和CML。
CODE
#最佳推荐之使用CBL-#
header RCVD_IN_CBLLESS eval:check_rbl('cblless', 'cblless.anti-spam.org.cn.', '127.0.8.5')
describe RCVD_IN_CBLLESS Received via a relay in cblless.anti-spam.org.cn
tflags RCVD_IN_CBLLESS net
score RCVD_IN_CBLLESS 3.5
#最佳推荐之使用CML#
header RCVD_IN_CML eval:check_rbl('cml', 'cml.anti-spam.org.cn.', '127.0.8.1')
describe RCVD_IN_CML Received via a white list relay in cml.anti-spam.org.cn
tflags RCVD_IN_CML net nice
score RCVD_IN_CML -20.0
#header RCVD_IN_CBL eval:check_rbl('cbl', 'cbl.anti-spam.org.cn.')
#describe RCVD_IN_CBL Received via a relay in cbl.anti-spam.org.cn
#tflags RCVD_IN_CBL net
#score RCVD_IN_CBL 2.0
#header RCVD_IN_CBL_DIALUP eval:check_rbl('cdl-notfirsthop', 'cdl.anti-spam.org.cn.', '127.0.8.4')
#describe RCVD_IN_CBL_DIALUP CBL: dialup sender did non-local SMTP
#tflags RCVD_IN_CBL_DIALUP net
#score RCVD_IN_CBL_DIALUP 1.5
#header RCVD_IN_CBL_PLUS eval:check_rbl('cblplus', 'cblplus.anti-spam.org.cn.')
#describe RCVD_IN_CBL_PLUS Received via a relay in cblplus.anti-spam.org.cn
#tflags RCVD_IN_CBL_PLUS net
#score RCVD_IN_CBL_PLUS 1.0
以下两行另存为一个.cf文件 ,过滤指定主题和内容
header CN_SUBJECT_992 Subject =~ /135/
describe CN_SUBJECT_992 Subject contains "135"
score CN_SUBJECT_992 0.3
body CN_BODY_977 /91\.com/
describe CN_BODY_977 Body contains "91\.com"
score CN_BODY_977 1.500
body CH_FREE /免费/
describe CH_FREE 内有中文字"免费",疑为垃圾信件。
score CH_FREE 15
#whitelist_from *@163.com
whitelist_from *@koowo.com
blacklist_from *@listhost.us