配置extmail过程详解

Idealityhunter 2011-09-08

Step1、安装apache+mysql+php,配置dns

Step2、安装cyrus-sasl-2.1.22删除以前的rpm包以及相关目录

rpm-e--nodepscyrus-sasl-2.1.10-4cyrus-sasl-plain-2.1.10-4cyrus-sasl-md5-2.1.10-4cyrus-sasl-devel-2.1.10-4

rm-rf/usr/lib/sasl

rm-rf/usr/lib/sasl2

tar-zxvfcyrus-sasl-2.1.22.tar.tar

cdcyrus-sasl-2.1.22

./configure--enable-plain--enable-cram--disable-digest--enable-login--enable-sql--disable-anon--disable-ntlm--disable-gssapi--disable-krb4--disable-otp--disable-srp--disable-srp-setpass--with-authdaemond=/usr/local/courier-authlib/var/spool/authdaemon/socket--with-mysql=/usr/local/mysql--with-mysql-includes=/usr/local/mysql/include--with-mysql-libs=/usr/local/mysql/lib

Make

makeinstall

ln-s/usr/local/lib/sasl2/usr/lib/sasl2(重要)增加"/usr/local/lib"到你的"/etc/ld.so.conf",并执行ldconfig命令。

Setp3.编译postfix2.x建立所需要的用户和组#groupadd-g1000postfix

#groupaddpostdrop

#useradd-u1000-gpostfix-Gpostdrop-c"Postfixuser"-d/dev/null-s/sbin/nologin-Mpostfix

#groupadd-g1002vmail

#useradd-gvmail-u1002-M-s/sbin/nologinvmail

#mkdir/home/mail

如果你的系统上原来有sendmail,先将其停止并将其文件改名

#/etc/init.d/sendmailstop

#chkconfig--level2345sendmailoff

#mv/usr/bin/newaliases/usr/bin/newaliases.old

#mv/usr/bin/mailq/usr/bin/mailq.old

#mv/usr/sbin/sendmail/usr/sbin/sendmail.old

#rpm-esendmail--nodeps

tar-zvxfpostfix-2.4.5.tar.gz

cdpostfix-2.4.5

maketidy

make-fMakefile.initmakefiles'CCARGS=-DHAS_MYSQL-I/usr/local/mysql/include/mysql-DUSE_SASL_AUTH-DUSE_CYRUS_SASL-I/usr/local/include/sasl''AUXLIBS=-L/usr/local/mysql/lib/mysql-lmysqlclient-lz-lm-L/usr/local/lib-lsasl2'

make

makeinstall

#mv/etc/aliases/etc/aliases.old

#ln-s/etc/postfix/aliases/etc/aliases

#echo'root:[email protected]'>>/etc/postfix/aliases#/usr/bin/newaliases

vi/etc/postfix/main.cf

#=====================BASE=========================

myhostname=mail.lin.net

mydomain=lin.net

myorigin=$mydomain

mydestination=$myhostnamelocalhostlocalhost.$mydomain

mynetworks=127.0.0.0/8

inet_interfaces=all

home_mailbox=Maildir/

在/etc/postfix/main.cf中加入:

#=====================VritualMailboxsettings====================

#指定用户邮箱所在的根目录virtual_mailbox_base=/home/mail/

virtual_alias_maps=mysql:/etc/postfix/mysql_virtual_alias_maps.cf

virtual_mailbox_domains=mysql:/etc/postfix/mysql_virtual_domains_maps.cf

virtual_alias_domains=

virtual_mailbox_maps=mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

virtual_uid_maps=static:1000

virtual_gid_maps=static:1000

#usethisforvirtualdelivery(如果没有安装maildrop,则此处为virtual)#virtual_transport=virtual

#usethisformaildrop-delivery(如果有maildrop,则此处为maildrop)virtual_transport=maildrop

#Maildrop-Optionsforusagewithmaildrop

maildrop_destination_recipient_limit=1

maildrop_destination_concurrency_limit=1

#/home/mail/最后的"/"字符不能省略

#====================QUOTA========================

message_size_limit=14336000

virtual_mailbox_limit=102400000

virtual_create_maildirsize=yes

virtual_mailbox_extended=yes

virtual_mailbox_limit_maps=mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf

virtual_mailbox_limit_override=yes

virtual_maildir_limit_message=Sorry,theuser'smaildirhasoverdrawnhisdiskspacequota,pleaseTidyyourmailboxandtryagainlater

virtual_overquota_bounce=yes

#====================SASL========================

broken_sasl_auth_clients=yes

#Inordertoallowmailrelayingbyauthenticatedclients

smtpd_recipient_restrictions=

permit_mynetworks,

permit_sasl_authenticated,

reject_invalid_hostname,

reject_non_fqdn_hostname,

reject_unknown_sender_domain,

reject_non_fqdn_sender,

reject_non_fqdn_recipient,

reject_unknown_recipient_domain,

reject_unauth_pipelining,

reject_unauth_destination,

permit

smtpd_sasl_auth_enable=yes

smtpd_sasl_local_domain=$myhostname

smtpd_sasl_security_options=noanonymous

smtpd_sasl_application_name=smtpd

smtpd_banner=$myhostnameESMTP"VersionnotAvailable

#=============================================

mailbox_command=/usr/bin/maildrop

mail_owner=postfix

mailq_path=/usr/bin/mailq

manpage_directory=/usr/local/man

newaliases_path=/usr/bin/newaliases

queue_directory=/var/spool/postfix

readme_directory=no

sample_directory=/etc/postfix

sendmail_path=/usr/sbin/sendmail

setgid_group=postdrop

unknown_local_recipient_reject_code=550

启动和停止postfix服务/usr/sbin/postfixstart

/usr/sbin/postfixstop

Step4、安装courier-authlib#tarjxvfcourier-authlib-0.60.2.tar.bz2

#cdcourier-authlib-0.60.2

#./configure--prefix=/usr/local/courier-authlib--without-authuserdb--without-authpam--without-authldap--without-authpwd--without-authshadow--without-authvchkpw--without-authpgsql--without-stdheaderdir--without-authcustom--with-authmysql--with-mysql-libs=/usr/local/mysql/lib/mysql--with-mysql-includes=/usr/local/mysql/include/mysql--with-redhat--with-authmysqlrc=/usr/local/courier-authlib/etc/authmysqlrc--with-authdaemonrc=/usr/local/courier-authlib/etc/authdaemonrc

#make

#makeinstall

#makeinstall-migrate

#makeinstall-configure

chmod755/usr/local/courier-authlib/var/spool/authdaemon

vi/usr/local/courier-authlib/etc/authdaemonrc可以不修改

authmodulelist="authmysql"

authmodulelistorig="authmysql"

daemons=10

DEBUG_LOGIN=2

vi/usr/local/courier-authlib/etc/authmysqlrc

MYSQL_SERVERlocalhost

MYSQL_USERNAMEextmail

MYSQL_PASSWORDextmail

MYSQL_SOCKET/tmp/mysql.sock自定义安装(MYSQL_SOCKET/var/lib/mysql/mysql.sock默认安装)MYSQL_PORT3306

MYSQL_DATABASEextmail

MYSQL_USER_TABLEmailbox

MYSQL_CRYPT_PWFIELDpassword

MYSQL_UID_FIELDuidnumber

MYSQL_GID_FIELDgidnumber

MYSQL_LOGIN_FIELDusername

MYSQL_HOME_FIELD'/home/mail/'#设置postfix存储邮件的目录

MYSQL_NAME_FIELDname

MYSQL_MAILDIR_FIELDmaildir

MYSQL_QUOTA_FIELDconcat(quota,'s')

注意:MYSQL_GID_FIELD和MYSQL_UID_FIELD是postfix的UID和GID,而不是MySQL的。

如果想使用md5密码,把MYSQL_CLEAR_PWFIELDpassword改成MYSQL_CRYPT_PWFIELDpassword

#cpcourier-authlib.sysvinit/etc/init.d/courier-authlib

#chmod755/etc/init.d/courier-authlib

#chkconfig--addcourier-authlib

#chkconfig--level2345courier-authlibon

增加"/usr/local/courier-authlib/lib/courier-authlib"到你的"/etc/ld.so.conf",并执行ldconfig命令。echo"/usr/local/courier-authlib/lib/courier-authlib">>/etc/ld.so.conf

ldconfig

#servicecourier-authlibstart(启动服务)

Step5、安装courier-imap#tarjxvfcourier-imap-4.1.0.tar.bz2

#cdcourier-imap-4.1.0

#./configure--prefix=/usr/local/courier-imap--with-redhat--enable-unicode--disable-root-check--with-trashquota--without-ipv6--with-authmysqlCPPFLAGS='-I/usr/local/courier-authlib/include'COURIERAUTHCONFIG='/usr/local/courier-authlib/bin/courierauthconfig'(CPPFLAGS='-I/usr/local/courier-authlib/include'

make

makeinstall-strip(先install-strip,如果失败,再makeinstall)makeinstall-configure

配置Courier-IMAP,为用户提供pop3服务:vi/usr/local/courier-imap/etc/pop3d

POP3DSTART=yes

如果你想为用户提供IMAP服务,可以在"/usr/local/courier-imap/etc/imapd"文件中设置"IMAPDSTART=yes"。cpcourier-imap.sysvinit/etc/rc.d/init.d/imapd

chmod755/etc/rc.d/init.d/imapd

chkconfig--addimapd

/etc/rc.d/init.d/imapdstart

chkconfig--level235imapdon

Step6、配置SMTP认证编辑/usr/lib/sasl2/smtpd.conf为以下内容vi/usr/local/lib/sasl2/smtpd.conf

pwcheck_method:authdaemond

log_level:3

mech_list:plainlogin

authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

Step7、安装Extmail-1.0.31、安装#tarzxvfextmail-1.0.3.tar.gz

#mkdir-pv/usr/local/apache/htdocs/extsuite

#mvextmail-1.0.3/usr/local/apache/htdocs/extsuite/extmail

#cp/usr/local/apahehtdocs/extsuite/extmail/webmail.cf.default/usr/local/apache/htdocs/extsuite/extmail/webmail.cf

2、修改主配置文件

#vi/usr/local/apache/htdocs/extsuite/extmail/webmail.cf

部分修改选项的说明:SYS_CONFIG=/usr/local/apache/htdocs/extsuite/extmail/

SYS_LANGDIR=/usr/local/apache/htdocs/extsuite/extmail/lang

SYS_TEMPLDIR=/usr/local/apache/htdocs/extsuite/extmail/html

SYS_MESSAGE_SIZE_LIMIT=5242880

用户可以发送的最大邮件YS_USER_LANG=en_US

语言选项,可改作:SYS_USER_LANG=zh_CN

SYS_MAILDIR_BASE=/home/domains

此处即为您在前文所设置的用户邮件的存放目录,可改作:SYS_MAILDIR_BASE=/home/mail

SYS_MYSQL_USER=db_user

SYS_MYSQL_PASS=db_pass

以上两句句用来设置连接数据库服务器所使用用户名、密码和邮件服务器用到的数据库,这里修改为:SYS_MYSQL_USER=extmail

SYS_MYSQL_PASS=extmail

SYS_MYSQL_HOST=localhost

指明数据库服务器主机名,这里默认即可

SYS_MYSQL_SOCKET=/var/lib/mysql/mysql.sock

连接数据库的sock文件位置,这里修改为:SYS_MYSQL_SOCKET=/tmp/mysql.sock

SYS_CRYPT_TYPE=cleartext(使用明文密码,配合/usr/local/courier-authlib/etc/authlib/authmysqlrc文件设置)

SYS_MYSQL_TABLE=mailbox

SYS_MYSQL_ATTR_USERNAME=username

SYS_MYSQL_ATTR_DOMAIN=domain

SYS_MYSQL_ATTR_PASSWD=password

以上用来指定验正用户登录里所用到的表,以及用户名、域名和用户密码分别对应的表中列的名称;这里默认即可

SYS_AUTHLIB_SOCKET=/var/spool/authdaemon/socket

此句用来指明authdaemosocket文件的位置,这里修改为:SYS_AUTHLIB_SOCKET=/usr/local/courier-authlib/var/spool/authdaemon/socket

3、apache相关配置#vi/usr/local/apache/conf/httpd.conf

Userpostfix

Grouppostfix

<VirtualHost*:80>

ServerNamemail.lin.net

DocumentRoot/usr/local/apache/htdocs/extsuite/extmail/html/

ScriptAlias/extmail/cgi/usr/local/apache/htdocs/extsuite/extmail/cgi

Alias/extmail/usr/local/apache/htdocs/extsuite/extmail/html

</VirtualHost>

修改cgi执行文件属主为apache运行身份用户:#chown-Rpostfix.postfix/usr/local/apache/htdocs/extsuite/extmail/cgi/

3、依赖关系的解决extmail将会用到perl的DBD::Mysql和Unix::syslogd功能#tarzxvfUnix-Syslog-0.100.tar.gz

#cdUnix-Syslog-0.100

#perlMakefile.PL

#make

#makeinstall

安装DBD::Mysql前先要安装DBI包tar-zxvfDBI-1.604.tar.gz

cdDBI-1.604

perlMakefile.PL

make

makeinstall

#tarzxvfDBD-mysql-3.0002_4.tar.gz

#cdDBD-mysql-3.0002_4

#perlMakefile.PL(此步骤中如果出现类同Can'texec"mysql_config":NosuchfileordirectoryatMakefile.PLline76.的错误是因为您的mysql的bin目录没有输出至$PATH环境变量exportPATH=$PATH:/usr/local/mysql/bin)

#make

#makeinstall

好了,到此为止,您的Webmail已经可以使用了

Step8、安装Extman-0.2.4#tarzxvfextman-0.2.4.tar.gz

#mvextman-0.2.4/usr/local/apache/htdocs/extsuite/extman

#cd/usr/local/apache/htdocs/extsuite/extman/docs

#cpmysql_virtual_*.cf/etc/postfix/

#chmod640/etc/postfix/mysql_*

#chgrpvmail/etc/postfix/mysql_*

(执行下面的命令导入ExtMail和ExtMan的数据库结构及初始化数据)#/usr/local/mysql/bin/mysql-uroot-p<extmail.sql

#/usr/local/mysql/bin/mysql-uroot-p<init.sql

(执行下面的命令链接基本库到ExtMail中)#cd/usr/local/apache/htdocs/extsuite/extman/libs/Ext

#./buildpkg.shbuild/usr/local/apache/htdocs/extsuite/extmail/libs/Ext

#mkdir/usr/local/apache/htdocs/extsuite/extman/tmp

#chown-Rpostfix.postfix/usr/local/apache/htdocs/extsuite/extman/tmp

#cd/usr/local/apache/htdocs/extsuite/extman/tools

#./maildirmake.pl/home/domains/extmail.org/test/Maildir

#chown-Rpostfix.postfix/home/mail

修改配置文件以符合本例的需要:#vi/var/www/extsuite/extman/webman.cf

SYS_CONFIG=/usr/local/apache/htdocs/extsuite/extman/

SYS_LANGDIR=/usr/local/apache/htdocs/extsuite/extman/lang

SYS_TEMPLDIR=/usr/local/apache/htdocs/extsuite/extman/html

SYS_MAILDIR_BASE=/home/domains

此处即为您在前文所设置的用户邮件的存放目录,可改作:SYS_MAILDIR_BASE=/home/mail

SYS_CAPTCHA_ON=0控制在首页是否使用校验码(1为使用,0为不使用)

SYS_MYSQL_SOCKET=/var/lib/mysql/mysql.sock

此处修改为:SYS_MYSQL_SOCKET=/tmp/mysql.sock

SYS_CRYPT_TYPE=cleartext(使用明文密码,配合/usr/local/courier-authlib/etc/authlib/authmysqlrc文件设置)

#chown-Rpostfix.postfix/home/mail

修改cgi目录的属主:#chown-Rpostfix.postfix/usr/local/apache/htdocs/extsuite/extman/cgi/

如果extman访问数据库权限不足的话,可采用以下命令将新生成的数据库赋予webman用户具有所有权限:mysql>GRANTallprivilegesonextmail.*TOwebman@localhostIDENTIFIEDBY'webman';

在apache的主配置文件中Extmail的虚拟主机部分,添加如下两行:ScriptAlias/extman/cgi/usr/local/apache/htdocs/extsuite/extman/cgi

Alias/extman/usr/local/apache/htdocs/extsuite/extman/html

创建其运行时所需的临时目录,并修改其相应的权限:#mkdir-pv/tmp/extman

#chownpostfix.postfix/tmp/extman

重新启动apache服务器,即可使用Extman了。默认管理帐号为:[email protected]密码为:extmail*123*

(1)如果您安装后无法正常显示校验码,安装perl-GD模块会解决这个问题。如果想简单,您可以到以下地址下载适合您的平台的rpm包

#rpm-vihperl-GD-2.35-1.el4.rf.i386.rpm

(2)extman-0.2.2自带了图形化显示日志的功能;此功能需要rrdtool的支持,您需要安装此些模块才可能正常显示图形日志。

安装Time::HiRes

#tarzxvfTime-HiRes-1.9707.tar.gz

#cdTime-HiRes-1.9707

#perlMakefile.PL

#make

#maketest

#makeinstall

安装File::Tail

#tarzxvfFile-Tail-0.99.3.tar.gz

#cdFile-Tail-0.99.3

#perlMakefile

#make

#maketest

#makeinstall

安装与rrdtool相关的包#rpm-ivhlibart_lgpl-devel-2.3.16-3.i386.rpm

#ls-l/usr/lib/pkgconfig/libart-2.0.pc(确定是否有此文件,有才说明libart正确安装)安装rrdtool-1.2.26

#tarzxvfrrdtool-1.2.26.tar.gz

#cdrrdtool-1.2.26

#./configure--prefix=/usr/local/rrdtool

#make

#makeinstall

创建必要的符号链接(Extman会到这些路径下找相关的库文件)

#ln-sv/usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/auto/RRDs/RRDs.so/usr/lib/perl5/5.8.8/i386-linux-thread-multi/

#ln-sv/usr/local/rrdtool/lib/perl/5.8.8/RRDp.pm/usr/lib/perl5/5.8.8

#ln-sv/usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm/usr/lib/perl5/5.8.8

复制mailgraph_ext到/usr/local,并启动之

#cp-r/usr/local/apache/htdocs/extsuite/extman/addon/mailgraph_ext/usr/local

#/usr/local/mailgraph_ext/mailgraph-initstart

#/usr/local/mailgraph_ext/qmonitor-initstart

添加到自动启动队列

echo"/usr/local/mailgraph_ext/mailgraph-initstart">>/etc/rc.local

echo"/usr/local/mailgraph_ext/qmonitor-initstart">>/etc/rc.local

Step9、安装maildrop-2.0.4

1、安装将courier-authlib的头文件及库文件链接至/usr目录(编译maildrop时会到此目录下找此些相关的文件):

#ln-sv/usr/local/courier-authlib/bin/courierauthconfig/usr/bin

#ln-sv/usr/local/courier-authlib/include/*/usr/include/

maildrop需要pcre的支持,因此,接下来将首先安装pcre

#tarjxvfpcre-7.6.tar.bz2

#cdpcre-7.6

#./configure

#make

#makecheck

#makeinstall

tar-jxvfmaildrop-2.0.4.tar.bz2

cdmaildrop-2.0.4

#./configure--enable-sendmail=/usr/sbin/sendmail--enable-trusted-users='rootvmail'--enable-syslog=1--enable-maildirquota--enable-maildrop-uid=1002--enable-maildrop-gid=1002--with-trashquota--with-dirsync

#make

#makeinstall

检查安装结果,请确保有"CourierAuthenticationLibraryextensionenabled."一句出现:#maildrop–v

maildrop2.0.4Copyright1998-2005DoublePrecision,Inc.

GDBMextensionsenabled.

CourierAuthenticationLibraryextensionenabled.Maildirquotaextensionenabled.

ThisprogramisdistributedunderthetermsoftheGNUGeneralPublic

License.SeeCOPYINGforadditionalinformation.

2、新建其配置文件/etc/maildroprc文件,首先指定maildrop的日志记录位置:#vi/etc/maildroprc

添加:(文件内容如下,中间的空格用TAB键)logfile"/var/log/maildrop.log"

#touch/var/log/maildrop.log

#chownvmail.vmail/var/log/maildrop.log

3、配置Postfix

编辑master.cf

#vi/etc/postfix/master.cf

启用如下两行

maildropunix-nn--pipe

flags=DRhuuser=vmailargv=/usr/local/bin/maildrop-d${recipient}

注意:定义transport的时候,即如上两行中的第二行,其参数行必须以空两格开头,否则会出错。

编辑main.cf

#vi/etc/postfix/main.cf

virtual_transport=virtual

修改为:virtual_transport=maildrop

将下面两项指定的UID和GID作相应的修改:

virtual_uid_maps=static:1000

virtual_gid_maps=static:1000

修改为:

virtual_uid_maps=static:1002

virtual_gid_maps=static:1002

4、编辑authmysqlrc

#vi/usr/local/courier-authlib/etc/authmysqlrc

MYSQL_UID_FIELD'1000'

MYSQL_GID_FIELD'1000'

更改为:

MYSQL_UID_FIELD'1002'

MYSQL_GID_FIELD'1002'

注意:没有此处的修改,maildrop可能会报告“signal0x06”的错误报告。

5、编辑/usr/local/apache/conf/httpd.conf,修改运行用户:

将前文中的如下项Userpostfix

Grouppostfix

修改为:Uservmail

Groupvmail

5、将用户邮件所在的目录/home/mail和extman的临时目录/tmp/extman的属主和属组指定为vmail

#chown-Rvmail.vmail/home/mail

#chown-Rvmail.vmail/tmp/extman

#chown-Rvmail.vmail/usr/local/apache/htdocs/extsuite/extman/cgi/

#chown-Rvmail.vmail/usr/local/apache/htdocs/extsuite/extmail/cgi/

Step10、安装clamav#groupaddclamav

#useradd-gclamav-Mclamav

#tar-zxvfclamav-0.93.3.tar.gz

#cdclamav-0.93.3

#./configure

#make

#makeinstall

#设定clamd.conf

#vi/usr/local/etc/clamd.conf

#Example注释掉Example行编辑/usr/local/etc/freshclam.conf

#vi/usr/local/etc/freshclam.conf

#Example注释掉Example行

#执行Clamavs病毒库升级#/usr/local/bin/freshclam

运行时报错:./freshclam:errorwhileloadingsharedlibraries:libclamav.so.4:cannotopensharedobjectfile:Nosuchfileordirectory

可以运行ldconfig解决问题。配置crontab,让ClamAntiVirus每小时检测一次新的病毒库:#crontab–e

添加:37****/usr/local/bin/freshclam

配置clamav开机自动启动#cpcontrib/init/RedHat/clamd/etc/rc.d/init.d/clamd

#cpcontrib/init/RedHat/clamav-milter/etc/rc.d/init.d/clamav-milter

#chkconfig--addclamd

#chkconfig--addclamav-milter

#chkconfig--level2345clamdon

#chkconfig--level2345clamav-milteron

Step11、编辑和安装spamassassin

自动安装[root@linuxas3src]#perl-MCPAN-eshell

oconfprerequisites_policyask

cpan>installMail::SpamAssassin

提示安装以下包:REQUIREDmodulemissing:Digest::SHA1

REQUIREDmodulemissing:Net::DNS

optionalmodulemissing:Mail::SPF

optionalmodulemissing:Mail::SPF::Query

optionalmodulemissing:IP::Country

optionalmodulemissing:Razor2

optionalmodulemissing:Net::Ident

optionalmodulemissing:IO::Socket::INET6

optionalmodulemissing:IO::Socket::SSL

optionalmodulemissing:Mail::DomainKeys

optionalmodulemissing:Mail::DKIM

optionalmodulemissing:Archive::Tar

optionalmodulemissing:IO::Zlib

optionalmodulemissing:Encode::Detect

如果安装不上可以用forceinstall强制进行安装

编辑主配置文件/etc/mail/spamassassin/local.cf

required_score5.0

rewrite_headerSubject*****SPAM*****

#Encapsulatespaminanattachment.

#要如何处理垃圾邮件。因为邮件还会经过防毒程序的处理,所以必须设定为0。

#0:将信息写入邮件表头。

#1:将垃圾邮件转为附件。

#2:将垃圾邮件转为纯文字附件。

report_safe0

#EnabletheBayessystem.使用贝氏学习系统

use_bayes1

#EnableBayesauto-learning.开起贝氏自动学习功能

bayes_auto_learn1

skip_rbl_checks1

use_razor20

use_pyzor0

ok_localesall

#黑白名单whitelist_from*@domain.com

#---------------------------------------------------------------------------

#SCORE

scoreRCVD_IN_CBL4.0

scoreRCVD_IN_CDL3.0

#Disabledscores.

scoreHEADER_8BITS0

scoreHTML_COMMENT_8BITS0

scoreSUBJ_FULL_OF_8BITS0

scoreUPPERCASE_25_500

scoreUPPERCASE_50_750

scoreUPPERCASE_75_1000

启动:#/usr/bin/spamd-d

#echo"/usr/bin/spamd-d">>/etc/rc.local

#定期自动更新中文反垃圾邮件规则crontab–e

#加入001**wget-N-P/usr/share/spamassassinwww.ccert.edu.cn/spam/sa/Chinese_rules.cf;

Step12、安装MailScanner下载rpm.tar.gz版本#tar-zxvfMailScanner-4.65.3-1.rpm.tar.gz

#cdMailScanner-4.65.3-1

#./install.sh

建立Mailscanner支持spamassassin所需的目录:#mkdir/var/spool/MailScanner/spamassassin

#chmod700/var/spool/MailScanner/spamassassin

#chownvmail.vmail/var/spool/MailScanner/spamassassin

MailScanner设定1修改MailScanner.conf

#vi/etc/MailScanner/MailScanner.conf

%org-name%=lin.net

%org-long-name%=llk726

%web-site%=mail.lin.net

%report-dir%=/etc/MailScanner/reports/en

RunAsUser=vmail

RunAsGroup=vmail

IncomingQueueDir=/var/spool/postfix/hold

OutgoingQueueDir=/var/spool/postfix/incoming

MTA=postfix

VirusScanners=clamav

AlwaysIncludeSpamAssassinReport=yes

UseSpamAssassin=yes

RequiredSpamAssassinScore=4

SpamAssassinUserStateDir=/var/spool/MailScanner/spamassassin

SpamAssassinInstallPrefix=/usr/bin

SpamAssassinLocalRulesDir=/etc/MailScanner

IncomingWorkUser=vmail

IncomingWorkGroup=vmail

QuarantineUser=vmail

QuarantineGroup=vmail

2、修改postfix支持mailscanner

#vi/etc/postfix/main.cf

变更以下的值header_checks=regexp:/etc/postfix/header_checks

#vi/etc/postfix/header_checks

/^Received:/HOLD

注意,在/之前不可以有空白!

3、变更目录权限#chown-Rvmail.vmail/var/spool/MailScanner/*

停止postfix执行、启动MailScanner

#/usr/sbin/postfixstop

#serviceMailScannerstart

设定MailScanner,当MTA=postfix时,会自己启动postfix,如有设定启动postfix的请先将它停掉

Step13、测试clamav[[email protected]]#telnetlocalhost25

Trying127.0.0.1...

Connectedtolocalhost.localdomain(127.0.0.1).

Escapecharacteris'^]'.

220mail.tao.comESMTP"VersionnotAvailable

ehlotao.com

250-mail.tao.com

250-PIPELINING

250-SIZE14336000

250-VRFY

250-ETRN

250-AUTHPLAINLOGIN

250-AUTH=PLAINLOGIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250DSN

mailfrom:[email protected]

2502.1.0Ok

rcptto:[email protected]

2502.1.5Ok

data

354Enddatawith<CR><LF>.<CR><LF>

Subject:Virustest

X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

.

2502.0.0Ok:queuedasD7F3FFA50

quit

2212.0.0Bye

Connectionclosedbyforeignhost.

测试SpamAssassin

发一封邮件带如下内容,接收后,标题应该带有标记:Subject:spamassassintest

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

问题解决办法:tail-n20/var/log/messages

Jul1008:37:01mx02postfix/smtpd[6217]:sql_selectoptionmissing

Jul1008:37:01mx02postfix/smtpd[6217]:auxpropfuncerrornomechanismavailable

#cat/usr/lib/sasl2/smtpd.conf

pwcheck_method:authdaemond

log_level:3

mech_list:PLAINLOGIN

authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

allow_plaintext:true

auxprop_plugin:mysql

sql_hostnames:localhost

sql_user:extmail

sql_passwd:extmail

sql_database:extmail

sql_select:selectpasswordfrommailboxwhereusername='%u'将原有的smtpd.conf配置文件添加以上内容(蓝色字体)后,此日志显示消失。

相关推荐

strongyoung / 0评论 2020-01-25
zmjzhangmj / 0评论 2020-01-07