`
ShellyLi
  • 浏览: 114242 次
  • 性别: Icon_minigender_2
  • 来自: 山东
社区版块
存档分类
最新评论

配置extmail过程详解

阅读更多
Step1、安装apache+mysql+php,配置dns
Step2、安装cyrus-sasl-2.1.22删除以前的rpm包以及相关目录
rpm -e --nodeps cyrus-sasl-2.1.10-4 cyrus-sasl-plain-2.1.10-4 cyrus-sasl-md5-2.1.10-4 cyrus-sasl-devel-2.1.10-4
rm -rf /usr/lib/sasl
rm -rf /usr/lib/sasl2
tar -zxvf cyrus-sasl-2.1.22.tar.tar
cd cyrus-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
make install
ln -s /usr/local/lib/sasl2 /usr/lib/sasl2 (重要)增加"/usr/local/lib"到你的"/etc/ld.so.conf",并执行ldconfig命令。
Setp3.编译postfix2.x建立所需要的用户和组# groupadd -g 1000 postfix
# groupadd postdrop
# useradd -u 1000 -g postfix -G postdrop -c "Postfix user" -d /dev/null -s /sbin/nologin -M postfix
# groupadd -g 1002 vmail
# useradd -g vmail -u 1002 -M -s /sbin/nologin vmail
# mkdir /home/mail

如果你的系统上原来有sendmail,先将其停止并将其文件改名
# /etc/init.d/sendmail stop
# chkconfig --level 2345 sendmail off
# 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 -e sendmail --nodeps


tar -zvxf postfix-2.4.5.tar.gz
cd postfix-2.4.5
make tidy
make -f Makefile.init makefiles '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
make install

# mv /etc/aliases /etc/aliases.old
# ln -s /etc/postfix/aliases /etc/aliases
# echo 'root: llk726@lin.net'>>/etc/postfix/aliases# /usr/bin/newaliases

vi /etc/postfix/main.cf
#=====================BASE=========================
myhostname = mail.lin.net
mydomain = lin.net
myorigin = $mydomain
mydestination = $myhostname localhost localhost.$mydomain
mynetworks = 127.0.0.0/8
inet_interfaces = all
home_mailbox = Maildir/


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

#=====================Vritual Mailbox settings====================
# 指定用户邮箱所在的根目录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
# use this for virtual delivery(如果没有安装maildrop,则此处为virtual)#virtual_transport = virtual
#use this for maildrop-delivery (如果有maildrop,则此处为maildrop)virtual_transport = maildrop
#Maildrop-Options for usage with maildrop
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, the user's maildir has overdrawn his diskspace quota, please Tidy your mailbox and try again later
virtual_overquota_bounce = yes

#====================SASL========================
broken_sasl_auth_clients = yes
#In order to allow mail relaying by authenticated clients
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=$myhostname ESMTP "Version not Available

#=============================================
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/postfix start
/usr/sbin/postfix stop


  Step4、安装 courier-authlib# tar jxvf courier-authlib-0.60.2.tar.bz2
# cd courier-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
# make install
# make install-migrate
# make install-configure

chmod 755 /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_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_SOCKET /tmp/mysql.sock自定义安装(MYSQL_SOCKET         /var/lib/mysql/mysql.sock默认安装)MYSQL_PORT              3306
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD uidnumber
MYSQL_GID_FIELD gidnumber
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD        '/home/mail/'         #设置postfix存储邮件的目录
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD     maildir
MYSQL_QUOTA_FIELD   concat(quota,'s')
注意: MYSQL_GID_FIELD 和MYSQL_UID_FIELD是postfix的UID和GID,而不是MySQL的。
如果想使用md5密码,把MYSQL_CLEAR_PWFIELD password改成MYSQL_CRYPT_PWFIELD password

# cp courier-authlib.sysvinit /etc/init.d/courier-authlib
# chmod 755 /etc/init.d/courier-authlib
# chkconfig --add courier-authlib
# chkconfig --level 2345 courier-authlib on
增加"/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
# service courier-authlib start   (启动服务)

Step5、安装 courier-imap # tar jxvf courier-imap-4.1.0.tar.bz2
# cd courier-imap-4.1.0
#./configure --prefix=/usr/local/courier-imap --with-redhat --enable-unicode --disable-root-check --with-trashquota --without-ipv6  --with-authmysql   CPPFLAGS='-I/usr/local/courier-authlib/include' COURIERAUTHCONFIG='/usr/local/courier-authlib/bin/courierauthconfig' (CPPFLAGS='-I/usr/local/courier-authlib/include'  
make
make install-strip (先install-strip,如果失败,再make install)make install-configure
配置Courier-IMAP,为用户提供pop3服务:vi /usr/local/courier-imap/etc/pop3d
POP3DSTART=yes
如果你想为用户提供IMAP服务,可以在"/usr/local/courier-imap/etc/imapd"文件中设置"IMAPDSTART=yes"。cp courier-imap.sysvinit /etc/rc.d/init.d/imapd
chmod 755 /etc/rc.d/init.d/imapd
chkconfig --add imapd
/etc/rc.d/init.d/imapd start
chkconfig --level 235 imapd on

Step6、配置SMTP 认证编辑 /usr/lib/sasl2/smtpd.conf 为以下内容vi /usr/local/lib/sasl2/smtpd.conf
pwcheck_method: authdaemond
log_level: 3
mech_list: plain login
authdaemond_path: /usr/local/courier-authlib/var/spool/authdaemon/socket


Step7、安装Extmail-1.0.31、  安装# tar zxvf extmail-1.0.3.tar.gz
# mkdir -pv /usr/local/apache/htdocs/extsuite
# mv extmail-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
此句用来指明authdaemo socket文件的位置,这里修改为:SYS_AUTHLIB_SOCKET = /usr/local/courier-authlib/var/spool/authdaemon/socket

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

<VirtualHost *:80>
ServerName mail.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 -R postfix.postfix /usr/local/apache/htdocs/extsuite/extmail/cgi/

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

安装DBD::Mysql前先要安装DBI包tar -zxvf DBI-1.604.tar.gz 
cd DBI-1.604
perl Makefile.PL
make
make install
 
# tar zxvf DBD-mysql-3.0002_4.tar.gz
#  cd DBD-mysql-3.0002_4
# perl Makefile.PL   (此步骤中如果出现类同Can't exec "mysql_config": No such file or directory at Makefile.PL line 76.的错误是因为您的mysql的bin目录没有输出至$PATH环境变量  export PATH=$PATH:/usr/local/mysql/bin)
# make
# make install

好了,到此为止,您的Webmail已经可以使用了
Step8、安装Extman-0.2.4# tar zxvf extman-0.2.4.tar.gz
# mv extman-0.2.4 /usr/local/apache/htdocs/extsuite/extman
# cd /usr/local/apache/htdocs/extsuite/extman/docs
# cp mysql_virtual_*.cf /etc/postfix/
#  chmod 640 /etc/postfix/mysql_*
#  chgrp vmail /etc/postfix/mysql_*
(执行下面的命令导入 ExtMail 和 ExtMan 的数据库结构及初始化数据)# /usr/local/mysql/bin/mysql -u root -p < extmail.sql
# /usr/local/mysql/bin/mysql -u root -p < init.sql
(执行下面的命令链接基本库到 ExtMail 中)# cd /usr/local/apache/htdocs/extsuite/extman/libs/Ext
# ./buildpkg.sh build /usr/local/apache/htdocs/extsuite/extmail/libs/Ext
# mkdir /usr/local/apache/htdocs/extsuite/extman/tmp
# chown -R postfix.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 -R postfix.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 -R postfix.postfix /home/mail
修改cgi目录的属主:# chown -R postfix.postfix /usr/local/apache/htdocs/extsuite/extman/cgi/

如果extman访问数据库权限不足的话,可采用以下命令将新生成的数据库赋予webman用户具有所有权限:mysql> GRANT all privileges on extmail.* TO webman@localhost IDENTIFIED BY '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
#chown postfix.postfix  /tmp/extman

重新启动apache服务器,即可使用Extman了。默认管理帐号为:root@extmail.org  密码为:extmail*123*

(1)  如果您安装后无法正常显示校验码,安装perl-GD模块会解决这个问题。如果想简单,您可以到以下地址下载适合您的平台的rpm包
# rpm -vih perl-GD-2.35-1.el4.rf.i386.rpm
(2) extman-0.2.2自带了图形化显示日志的功能;此功能需要rrdtool的支持,您需要安装此些模块才可能正常显示图形日志。
安装Time::HiRes
#tar zxvf Time-HiRes-1.9707.tar.gz
#cd Time-HiRes-1.9707
#perl Makefile.PL
#make
#make test
#make install

安装File::Tail
#tar zxvf File-Tail-0.99.3.tar.gz
#cd File-Tail-0.99.3
#perl Makefile
#make
#make test
#make install


安装与rrdtool相关的包# rpm -ivh libart_lgpl-devel-2.3.16-3.i386.rpm
# ls -l /usr/lib/pkgconfig/libart-2.0.pc    (确定是否有此文件,有才说明 libart 正确安装)安装rrdtool-1.2.26
#tar zxvf rrdtool-1.2.26.tar.gz
#cd rrdtool-1.2.26
#./configure --prefix=/usr/local/rrdtool
#make
#make install

创建必要的符号链接(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-init  start
# /usr/local/mailgraph_ext/qmonitor-init  start


添加到自动启动队列
echo "/usr/local/mailgraph_ext/mailgraph-init start" >> /etc/rc.local
echo "/usr/local/mailgraph_ext/qmonitor-init start" >> /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
# tar jxvf pcre-7.6.tar.bz2
# cd pcre-7.6
# ./configure
# make
# make check
# make install
tar -jxvf maildrop-2.0.4.tar.bz2
cd maildrop-2.0.4
# ./configure     --enable-sendmail=/usr/sbin/sendmail     --enable-trusted-users='root vmail'     --enable-syslog=1 --enable-maildirquota     --enable-maildrop-uid=1002 --enable-maildrop-gid=1002 --with-trashquota --with-dirsync

# make
# make install

检查安装结果,请确保有"Courier Authentication Library extension enabled."一句出现:# maildrop –v
maildrop 2.0.4 Copyright 1998-2005 Double Precision, Inc.
GDBM extensions enabled.
Courier Authentication Library extension enabled.Maildir quota extension enabled.
This program is distributed under the terms of the GNU General Public
License. See COPYING for additional information.

2、新建其配置文件/etc/maildroprc文件,首先指定maildrop的日志记录位置:# vi /etc/maildroprc
添加:(文件内容如下,中间的空格用 TAB 键)logfile "/var/log/maildrop.log"
# touch /var/log/maildrop.log
# chown vmail.vmail /var/log/maildrop.log

3、配置Postfix
编辑master.cf
# vi /etc/postfix/master.cf
启用如下两行
maildrop  unix  -       n       n       -       -       pipe
   flags=DRhu user=vmail argv=/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可能会报告 “signal 0x06”的错误报告。
5、编辑/usr/local/apache/conf/httpd.conf,修改运行用户:
将前文中的如下项User postfix
Group postfix
修改为:User vmail
Group vmail

5、  将用户邮件所在的目录/home/mail和extman的临时目录/tmp/extman的属主和属组指定为vmail
#chown -R vmail.vmail /home/mail
#chown -R vmail.vmail /tmp/extman
# chown -R vmail.vmail /usr/local/apache/htdocs/extsuite/extman/cgi/
# chown -R vmail.vmail /usr/local/apache/htdocs/extsuite/extmail/cgi/
Step10、安装 clamav# groupadd clamav
# useradd -g clamav -M clamav
# tar -zxvf clamav-0.93.3.tar.gz
# cd clamav-0.93.3
# ./configure
# make
# make install

#设定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: error while loading shared libraries: libclamav.so.4: cannot open shared object file: No such file or directory
可以运行ldconfig解决问题。配置crontab,让Clam AntiVirus每小时检测一次新的病毒库:# crontab –e
添加:37 * * * * /usr/local/bin/freshclam
     
配置clamav开机自动启动# cp contrib/init/RedHat/clamd  /etc/rc.d/init.d/clamd
# cp contrib/init/RedHat/clamav-milter  /etc/rc.d/init.d/clamav-milter
# chkconfig --add clamd
# chkconfig --add clamav-milter
# chkconfig --level 2345 clamd on
# chkconfig --level 2345 clamav-milter on

Step11、编辑和安装spamassassin
自动安装[root@linuxas3 src]# perl -MCPAN -e shell
o conf prerequisites_policy ask
cpan> install Mail::SpamAssassin
提示安装以下包:REQUIRED module missing: Digest::SHA1
REQUIRED module missing: Net::DNS
optional module missing: Mail::SPF
optional module missing: Mail::SPF::Query
optional module missing: IP::Country
optional module missing: Razor2
optional module missing: Net::Ident
optional module missing: IO::Socket::INET6
optional module missing: IO::Socket::SSL
optional module missing: Mail::DomainKeys
optional module missing: Mail::DKIM
optional module missing: Archive::Tar
optional module missing: IO::Zlib
optional module missing: Encode::Detect
如果安装不上可以用force install 强制进行安装
编辑主配置文件/etc/mail/spamassassin/local.cf
required_score 5.0
rewrite_header Subject *****SPAM*****
# Encapsulate spam in an attachment.
# 要如何处理垃圾邮件。因为邮件还会经过防毒程序的处理,所以必须设定为 0。
# 0:将信息写入邮件表头。
# 1:将垃圾邮件转为附件。
# 2:将垃圾邮件转为纯文字附件。
report_safe 0
# Enable the Bayes system. 使用贝氏学习系统
use_bayes 1
# Enable Bayes auto-learning. 开起贝氏自动学习功能
bayes_auto_learn        1

skip_rbl_checks         1
use_razor2      0
use_pyzor       0
ok_locales      all

#黑白名单whitelist_from *@domain.com

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

#SCORE
score RCVD_IN_CBL 4.0
score RCVD_IN_CDL 3.0

# Disabled scores.
score HEADER_8BITS 0
score HTML_COMMENT_8BITS 0
score SUBJ_FULL_OF_8BITS 0
score UPPERCASE_25_50 0
score UPPERCASE_50_75 0
score UPPERCASE_75_100 0


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

#定期自动更新中文反垃圾邮件规则crontab –e
#加入0 0 1 * * wget -N -P /usr/share/spamassassin www.ccert.edu.cn/spam/sa/Chinese_rules.cf; 


Step12、安装MailScanner下载rpm.tar.gz 版本# tar -zxvf MailScanner-4.65.3-1.rpm.tar.gz
# cd  MailScanner-4.65.3-1
# ./install.sh

建立Mailscanner支持spamassassin所需的目录:# mkdir /var/spool/MailScanner/spamassassin
# chmod 700 /var/spool/MailScanner/spamassassin
# chown vmail.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
Run As User = vmail
Run As Group = vmail
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix
Virus Scanners = clamav
Always Include SpamAssassin Report = yes
Use SpamAssassin = yes
Required SpamAssassin Score = 4
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
SpamAssassin Install Prefix = /usr/bin
SpamAssassin Local Rules Dir = /etc/MailScanner

Incoming Work User = vmail
Incoming Work Group = vmail
Quarantine User = vmail
Quarantine Group = 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 -R vmail.vmail /var/spool/MailScanner/*
停止postfix执行、启动MailScanner
# /usr/sbin/postfix stop
# service MailScanner start
设定MailScanner,当MTA = postfix时,会自己启动postfix,如有设定启动postfix的请先将它停掉
Step13、测试clamav [root@mail MailScanner-4.65.3-1]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 mail.tao.com ESMTP "Version not Available
ehlo tao.com
250-mail.tao.com
250-PIPELINING
250-SIZE 14336000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:llk726@tao.com
250 2.1.0 Ok
rcpt to:botao@tao.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject:Virus test
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
.
250 2.0.0 Ok: queued as D7F3FFA50
quit
221 2.0.0 Bye
Connection closed by foreign host.

测试SpamAssassin
发一封邮件带如下内容,接收后,标题应该带有标记:Subject:spamassassin test
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X


问题解决办法:tail -n 20 /var/log/messages
Jul 10 08:37:01 mx02 postfix/smtpd[6217]: sql_select option missing
Jul 10 08:37:01 mx02 postfix/smtpd[6217]: auxpropfunc error no mechanism available
# cat /usr/lib/sasl2/smtpd.conf
pwcheck_method:authdaemond
log_level:3
mech_list: PLAIN LOGIN
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: select password from mailbox where username='%u'将原有的smtpd.conf配置文件添加以上内容(蓝色字体)后,此日志显示消失。
分享到:
评论

相关推荐

    linux环境下postfix+dovecot+extmail安装配置详解(二).pdf

    最后,安装并配置Extmail,这是一个Web界面,允许管理员方便地管理邮件系统,包括创建、删除和管理虚拟用户。按照Extmail的文档进行安装和配置,确保它能正确连接到MySQL数据库,并且Postfix和Dovecot的配置与...

    postfix邮件服务器配置详解与错误解析

    ### Postfix邮件服务器配置详解与错误解析 #### 一、所需软件 为了搭建Postfix邮件服务器,我们需要准备一系列软件,并确保它们能够协同工作。以下是所需的软件列表及其在邮件服务器中的作用: 1. **CentOS 5.6**...

    linux环境下postfixdovecotextmail安装配置详解(支持虚拟用户).docx

    ### Linux环境下Postfix、Dovecot与Extmail安装配置详解(支持虚拟用户) #### 一、概述 在Linux环境中配置Postfix、Dovecot以及Extmail来支持虚拟用户是一项复杂但重要的任务。本文将详细介绍这一过程,特别是...

    postfix邮件安装配置文档

    - 配置Extmail前端服务。 10. **安装DBD::mysql** - 解压并安装DBD::mysql源码包。 - 安装Perl模块。 11. **安装GD、Time::HiRes、File::Tail 和 RRDTool** - 解压并安装这些源码包。 - 配置相应的服务。 12...

    EMOS安装配置详细说明

    本文将深入解析EMOS1.5的安装配置过程,旨在为初次接触或希望深化理解EMOS的用户提供全面指导。 #### EMOS1.5核心组件介绍 EMOS1.5集成了多个关键组件,包括Extmail1.2和Extman1.1,共同构成了一个完整的邮件服务器...

    postfix+dovecot+extmai+mysql.pdf

    配置Extmail时,需要修改`webmail.cf`文件,设置数据库连接信息、邮件存储路径、语言包和模板目录等。 4. **MySQL**:MySQL是关系型数据库管理系统,用于存储邮件服务器的用户信息、权限、邮件元数据等。在上述环境...

    postfix+dovecot+extmai+mysql.docx

    安装过程包括下载`extmail-1.2.tar.gz`,解压并移动到适当的目录,然后配置其`webmail.cf`文件,设置数据库连接信息等。 4. **MySQL**: MySQL是一个关系型数据库管理系统,用于存储用户的邮件数据和Extmail的配置...

    outlook配置方式

    ### Outlook配置方式详解 在日常工作中,Outlook作为一款强大的电子邮件客户端被广泛使用。通过合理的配置,用户可以高效地管理自己的邮件、日程等信息。本文将基于提供的内容,详细介绍如何配置Outlook来连接特定...

    postfix邮局系统搭建全过程

    #### 三、安装过程详解 1. **安装 MySQL** - **步骤**:首先下载并安装 MySQL,按照官方文档完成数据库的安装和配置。 - **注意事项**:确保数据库安全,设置复杂的密码。 2. **安装 Cyrus SASL** - **步骤**...

    EMOS1.5详细安装说明手册

    21. **确认配置信息**:最后确认所有的配置信息无误后,开始配置过程。 22. **配置完成重启**:配置完成后,系统会提示重启计算机。 #### 二、升级 Extmail 至 1.2 版本 1. **备份**:在升级之前,务必备份现有的...

    emos1.5安装说明

    ### EMOS1.5安装与配置详解 #### 一、EMOS1.5安装步骤 **1. 安装模式选择** - 进入安装界面后,选择第一项“To install or upgrade in graphical mode”(图形化安装模式),然后按回车键。 **2. 跳过介质检查*...

    完整意义邮件服务器打包软件

    构建邮件服务器通常需要整合多个开源软件,这可能涉及到复杂的配置和调试过程。开发者经过一周的努力,成功地在RHEL6环境下整合了这些关键组件,形成了一套易于部署和使用的邮件服务器软件包。这个打包软件的出现,...

    emos rsync

    本文将详细介绍如何利用rsync工具在EMOS服务器端与备份服务器端之间进行数据同步,特别关注邮件文件和extmail数据库的备份过程。 首先,rsync是Linux系统下一款强大的文件同步工具,可以实现本地或远程文件的增量...

    邮件服务器本域用户不存在时停滞不发送邮件的解决方法.

    在日常的邮件服务管理过程中,我们可能会遇到一种情况:当尝试向本域内不存在的用户发送邮件时,邮件服务器会出现停滞现象,即邮件长时间处于“正在发送”状态而无法完成发送或退回操作。这种问题不仅会影响用户体验...

Global site tag (gtag.js) - Google Analytics