**************************************postfix+mysql+authlib+sasl+Nginx+maildrop********************************************
折腾了我几天的邮件系统终于搞完了
现将配置过程,与解决某些问题的方法记录下来,以供参考
提供网址
PS:http://rpmfind.net/   查找动态包网址
http://rpm.pbone.net/   查找rpm包
http://www.extmail.org/docs/extmail_solution_linux/#os           extmail官方针对CentOS4.0的安装指南
http://www.sunnyu.com/?p=196        针对Redhat5.3的安装指南   非官方


************************************************************************************************************
系统准备
              系统为:2.6内核,CentOS
[root@Mail ~]# lsb_release -a
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description:    CentOS release 5.5 (Final)
Release:        5.5
Codename:       Final

[root@Mail ~]# uname -a
Linux Mail 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686 athlon i386 GNU/Linux


使用默认方式安装系统后,从RHEL安装盘上拷贝一些下面安装步骤需要的rpm包先安装上
可通过yum install

[root@Mail ~]# rpm -qa | grep postgresql
postgresql-libs-8.1.22-1.el5_5.1
postgresql-devel-8.1.22-1.el5_5.1
postgresql-8.1.22-1.el5_5.1

pexpect-2.3-3.el5
expect-5.43.0-5.1

rpm -ivh libtool-ltdl-devel-1.5.22-6.1.i386.rpm
 
rpm -ivh mysql-devel-5.0.45-7.el5.i386.rpm
rpm -ivh openldap-servers-2.3.43-3.el5.i386.rpm
rpm -ivh openldap-servers-sql-2.3.43-3.el5.i386.rpm
 
rpm -ivh pcre-6.6-2.el5_1.7.i386.rpm
rpm -ivh pcre-devel-6.6-2.el5_1.7.i386.rpm

###################################################################
关闭SEliux
修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启

如果不想重启系统,使用命令setenforce 0
注:
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式
在lilo或者grub的启动参数中增加:selinux=0,也可以关闭selinux

查看selinux状态:
[root@Mail postfix]# /usr/sbin/sestatus -v
SELinux status:                 disabled

或者

setsebool httpd_disable_trans=1
setsebool mysqld_disable_trans=1

最好全关闭Selinux  并且重启机器

++++++++++++++++++++++++++++++++++++++++++++++++
1.从 www.extmail.org 网站上下载最新的 extmail 相关包

extmail-1.1.1.tar.gz
extman-1.0.1.tar.gz

2.导入extman后台数据库数据

tar -xzvf extman-1.0.1.tar.gz
cd extman-1.0.1/docs

注:mysql版本问题的时候,请选择5.1版本  TYPE=MYISAM类型导入出错

mysql -u root -p
mysql> GRANT ALL PRIVILEGES ON *.* TO 'extmail'@'%' IDENTIFIED BY 'extmail';
mysql> source extmail.sql
mysql> source init.sql
mysql> exit

3.准备rpm环境变量
按照参考文档,采用rpm方式安装,首先设置环境变量,方便后面操作的目录切换。

export rpms=/usr/src/redhat/RPMS
export source=/usr/src/redhat/SOURCES
export spec=/usr/src/redhat/SPECS

================================================================

安装authlib
a.下载源码包

tar -xjf courier-authlib-0.63.0.tar.bz2
cd courier-authlib-0.63.0
cp courier-authlib.spc $spec
cd ..
cp courier-authlib-0.63.0.tar.gz2 $source
cd $spec
rpmbuild -bb courier-authlib.spec                                                              --注意此处如果ltd.h文件找不到,在后面加上--nodeps强制安装
b.安装生成的rpm
cd $rpms/i386
rpm -ivh courier-authlib-0.63.0-1.i386.rpm
rpm -ivh courier-authlib-devel-0.63.0-1.i386.rpm
rpm -ivh courier-authlib-mysql-0.63.0-1.i386.rpm


c.配置authlibdaemon
cd /etc/authlib
mv authdaemonrc authdaemonrc.bak
vi authdaemonrc
输入以下内容
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=5
authdaemonvar=/var/spool/authdaemon
DEBUG_LOGIN=2
DEFAULTOPTIONS=""
LOGGEROPTS=""

 

d.配置authmysqlrc
mv authmysqlrc authmysqlrc.bak
vi authmysqlrc

输入以下内容
MYSQL_SERVER            127.0.0.1
MYSQL_USERNAME          extmail
MYSQL_PASSWORD          extmail
MYSQL_SOCKET            /var/lib/mysql/mysql.sock
MYSQL_PORT              3306
MYSQL_OPT               0
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        homedir
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     maildir
MYSQL_QUOTA_FIELD       quota
MYSQL_SELECT_CLAUSE     SELECT username,password,"",uidnumber,gidnumber,\
                        CONCAT('/home/domains/',homedir),               \
                        CONCAT('/home/domains/',maildir),               \
                        quota,                                          \
                        name                                            \
                        FROM mailbox                                    \
                        WHERE username = '$(local_part)@$(domain)'
      

目录权限
[root@Mail i386]# ll /etc/authlib/
总计 128
-rwxr-xr-x 1 vuser  vgroup 3573 03-18 15:34 authdaemonrc
-rwxr-xr-x 1 daemon daemon 3708 03-18 00:31 authdaemonrcbak
-rwxr-xr-x 1 daemon daemon 3708 03-18 00:27 authdaemonrc.dist
-rwxr-xr-x 1 daemon daemon 8229 03-18 00:31 authldaprc
-rwxr-xr-x 1 daemon daemon 8229 03-18 00:27 authldaprc.dist
-rwxr-xr-x 1 vuser  vgroup  994 03-18 16:32 authmysqlrc
-rwxr-xr-x 1 daemon daemon 8812 03-18 00:31 authmysqlrcbak
-rwxr-xr-x 1 root   root    666 03-18 12:56 authmysqlrcbak2
-rwxr-xr-x 1 daemon daemon 8812 03-18 00:27 authmysqlrc.dist
-rwxr-xr-x 1 daemon daemon 8117 03-18 00:31 authpgsqlrc
-rwxr-xr-x 1 daemon daemon 8117 03-18 00:27 authpgsqlrc.dist

[root@Mail i386]# ll /etc/ | grep authlib
drwxr-xr-x  2 daemon daemon    4096 03-18 16:32 authlib


e.启动authlib
service courier-authlib start
chmod 777 /var/spool/authdaemon/

[root@Mail i386]# ll /var/spool/authdaemon/
总计 8
-rw-r--r-- 1 root  root   5 03-18 23:11 pid
-rwxrwxrwx 1 vuser vgroup 0 03-18 00:34 pid.lock
srwxrwxrwx 1 root  root   0 03-18 23:11 socket

[root@Mail i386]# ll /var/spool/ | grep authdaemon
drwxrwxrwx  2 vuser  vgroup 4096 03-18 23:11 authdaemon

-----------------------------------------------------------------------------------------------------------

5.安装courier-imap
不能使用root身份生成rpm,需要建立一个新的普通账号。

useradd kangta
软件包依赖需要openldap-server,我们在前面已经准备好(rpm创建好后可以删除)
建立需要的目录和设置环境变量

su - kangta
cd /home/kangta
mkdir -p rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
vi ~/.rpmmacros
输入如下内容

%_topdir /home/kangta/rpm
获取源码包

courier-imap-4.8.1.tar.bz2

cp courier-imap-4.8.1.tar.bz2 rpm/SOURCES/
tar -xjf courier-imap-4.8.1.tar.bz2
cd courier-imap-4.8.1
cp courier-imap.spec ../rpm/SPECS/
cd ../rpm/SPECS/
编辑courier-imap.spec文件,将下面内容作修改

%if %suse_version
BuildPreReq: rpm >= 3.0.5 /usr/bin/sed openldap2 openldap2-devel %([ %{suse_version} -gt 819 ]
&& echo /usr/include/fam.h)
%else
BuildPreReq: rpm >= 4.0.2 sed /usr/include/fam.h openldap-devel openldap-servers
%endif
修改为

%if %suse_version
BuildPreReq: rpm >= 3.0.5 /usr/bin/sed openldap2 openldap2-devel
%else
BuildPreReq: rpm >= 4.0.2 sed openldap-devel openldap-servers
%endif

创建rpm,并使用exit退出当前用户

rpmbuild -bb courier-imap.spec
exit
安装生成好的rpm,并运行服务

rpm -ivh /home/kangta/rpm/RPMS/i386/courier-imap-4.4.1-1.i386.rpm
service courier-imap start

====================================================================================

安装cyrus-sasl
a.安装srpm
wget ftp://194.199.20.114/linux/fedora/updates/8/SRPMS/cyrus-sasl-2.1.22-8.fc8.src.rpm     注:此处不能下载时,可以rpm网站上找到对应的包

rpm -ivh cyrus-sasl-2.1.22-8.fc8.src.rpm
cd $spec
编辑cyrus-sasl.spec 将下面:

# bundling copy of berkeley db, for sasldb support.
topdir=`pwd`
pushd db-%{db_version}/build_unix
../dist/configure \r
        --with-mutex=unix/fcntl --disable-shared --enable-static --with-pic \
        --with-uniquename=_cyrus_sasl_sasldb_rh \
        --prefix=${topdir}/db-instroot \
        --includedir=${topdir}/db-instroot/include \
        --libdir=${topdir}/db-instroot/lib
改为:

# bundling copy of berkeley db, for sasldb support.
topdir=`pwd`
pushd db-%{db_version}/build_unix
../dist/configure \r
        --with-mutex=unix/fcntl --disable-shared --enable-static --with-pic \
        --with-uniquename=_cyrus_sasl_sasldb_rh \
        --prefix=${topdir}/db-instroot \
        --includedir=${topdir}/db-instroot/include \
        --libdir=${topdir}/db-instroot/lib \
        --with-authdaemond=/var/spool/authdaemon
  
b、生成rpm并做安装
rpmbuild -bb cyrus-sasl.spec
cd $rpms/i386
rpm -e –nodeps cyrus-sasl-devel cyrus-sasl-plain cyrus-sasl cyrus-sasl-lib (如果这些包存在,先卸载)
rpm -ihv cyrus-sasl-lib-2.1.22-8.i386.rpm
rpm -ihv cyrus-sasl-2.1.22-8.i386.rpm
rpm -ihv cyrus-sasl-plain-2.1.22-8.i386.rpm
rpm -ihv cyrus-sasl-devel-2.1.22-8.i386.rpm
rpm -ihv cyrus-sasl-md5-2.1.22-8.i386.rpm
c、配置sasl2
创建/usr/lib/sasl2/smtpd.conf 文件,输入下面的内容:
文件权限
[root@Mail i386]# ll /usr/lib/sasl2/smtpd.conf
-rwxr-xr-x 1 root root 110 03-18 15:39 /usr/lib/sasl2/smtpd.conf


pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path:/var/spool/authdaemon/socket

重启cyrus-sasl
[root@Mail postfix]# /etc/init.d/saslauthd start

********************************************************************************************************************

7.安装postfix
a、下载软件包
cd ~
wget http://ftp.wl0.org/official/2.5/SRPMS/postfix-2.5.4-2.src.rpm
rpm -ivh postfix-2.5.4-2.src.rpm
cd $spec
编辑postfix.spec 修改下面的选项

%define distribution rhel-5.0
%define with_mysql_redhat 1
%define with_sasl         2
%define with_vda          1

b、创建rpm并做安装
rpmbuild -bb postfix.spec
cd $rpms/i386
rpm -ivh postfix-2.5.4-2.rhel4.i386.rpm

c、切换mta
alternatives –config mta (选择2,postfix)
rpm -e sendmail
cd /usr/sbin/
mv sendmail sendmail.bak
newaliases
ln -s sendmail.postfix sendmail

d、配置postfix
cd /etc/postfix/
mv main.cf main.cf.bak
vi main.cf

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = /usr/share/doc/postfix-2.5.4-documentation/html
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.5.4-documentation/readme
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop

# hostname
mynetworks = 127.0.0.1
myhostname = mail.extmail.org
mydestination = $mynetworks $myhostname

# banner
mail_name = Postfix - by extmail.org
smtpd_banner = $myhostname ESMTP $mail_name

# response immediately
smtpd_error_sleep_time = 0s
unknown_local_recipient_reject_code = 450

# extmail config here
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_transport = maildrop:

maildrop_destination_recipient_limit = 1
# smtpd related config
smtpd_recipient_restrictions =
    permit_mynetworks,
        permit_sasl_authenticated,
        reject_non_fqdn_hostname,
        reject_non_fqdn_sender,
        reject_non_fqdn_recipient,
        reject_unauth_destination,
        reject_unauth_pipelining,
        reject_invalid_hostname,

# SMTP AUTH config here
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous

编辑mysql_virtual_alias_maps.cf
vi /etc/postfix/mysql_virtual_alias_maps.cf

内容如下:
user = extmail
password = extmail
hosts = 127.0.0.1
dbname = extmail
table = alias
select_field = goto
where_field = address

编辑mysql_virtual_domains_maps.cf
vi /etc/postfix/mysql_virtual_domains_maps.cf

内容如下:
user = extmail
password = extmail
hosts = 127.0.0.1
dbname = extmail
table = domain
select_field = description
where_field = domain
#additional_conditions = and backupmx ='0' and active ='1'

编辑mysql_virtual_mailbox_maps.cf
vi /etc/postfix/mysql_virtual_mailbox_maps.cf
内容如下:
user = extmail
password = extmail
hosts = 127.0.0.1
dbname = extmail
table = mailbox
select_field = maildir
where_field = username
#additional_conditions = and active = '1'

启动postfix

service postfix start

**********************************************************************************************


8.安装maildrop
a.下载生成rpm
cd ~
wget http://prdownloads.sourceforge.net/courier/maildrop-2.0.4.tar.bz2
cp maildrop-2.0.4.tar.bz2 $source
tar xjf maildrop-2.0.4.tar.bz2
cd maildrop-2.0.4
cp maildrop.spec $spec
cd $spec
编辑maildrop.spec 把下面:

BuildRequires: /usr/include/fam.h gdbm-devel pcre-devel
改为:

BuildRequires:  gdbm-devel pcre-devel
把下面:

%configure --with-devel --enable-userdb --enable-maildirquota  \
--enable-syslog=1 --enable-trusted-users='root mail daemon postmaster qmaild mmdf' \
--enable-restrict-trusted=0 \r
--enable-sendmail=/usr/sbin/sendmail
改为:

%configure --with-devel --enable-userdb --enable-maildirquota \
--enable-syslog=1 --enable-trusted-users='root mail daemon postmaster qmaild mmdf' \
--enable-restrict-trusted=0 --enable-sendmail=/usr/sbin/sendmail \
--enable-authlib

说明:如果tail -f /var/log/maillog 提示“maildrop: maildir over quota”,可以将
“–enable-maildirquota ”配置选项清除,既可以解决maildrp 误报“maildir over quota”错误.


b.创建maildrop rpm并安装
rpmbuild -bb maildrop.spec
cd $rpms/i386
rpm -ivh maildrop-2.0.4-1.i386.rpm
rpm -ivh maildrop-devel-2.0.4-1.i386.rpm
c.添加虚似用户及创建目录
cd ~
groupadd -g 1000 vgroup
useradd -g 1000 -u 1000 -s /sbin/nologin -d /dev/null vuser

 

编辑/etc/postfix/master.cf ,加入下面的内容:
maildrop  unix  -       n       n       -       -       pipe
    flags=DRhu user=vuser argv=/usr/bin/maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}
 注意flags前面有空格
 
 
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

10.配置Apache

编辑httpd.conf:
vi /etc/httpd/conf/httpd.conf

在730行左右,屏蔽掉AddDefaultCharset:
#AddDefaultCharset UTF-8

使apache开机默认启动:

chkconfig httpd on
虚拟主机设置
编辑/etc/httpd/conf/httpd.conf文件,在最后一行加上:

NameVirtualHost *:80
Include conf/vhost_*.conf


编辑/etc/httpd/conf/vhost_extmail.conf,里面定义虚拟主机的相关内容,包括主目录,以及ExtMail和ExtMan的相关配置,Suexec的设置等。
# VirtualHost for ExtMail Solution
<VirtualHost *:80>
ServerName mail.extmail.org
DocumentRoot /var/www/extsuite/extmail/html/

ScriptAlias /extmail/cgi/ /var/www/extsuite/extmail/cgi/
Alias /extmail/ /var/www/extsuite/extmail/html/

ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/
Alias /extman/ /var/www/extsuite/extman/html/

# Suexec config
SuexecUserGroup vuser vgroup
</VirtualHost>

重新启动apache:
service httpd restart


&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

配置Extmail

建立/var/www/extsuite并复制源码到该目录,相关命令:
mkdir /var/www/extsuite
tar -zxvf src/extmail-1[1][1].0.4.tar.gz -C src
cp -r src/extmail-1.0.4 /var/www/extsuite/extmail
cd /var/www/extsuite/extmail
cp webmail.cf.default webmail.cf
cd $OLDPWD

注意:上面命令行中最后一个cd $OLDPWD是返回原始路径(即ExtMail Solution软件包根目录)

安装perl-Unix-Syslog包
rpm -ivh RPMS/perl-Unix-Syslog-1.0-1ext.i386.rpm

编辑webmail.cf
修改/var/www/extsuite/extmail/webmail.cf里的其他参数,主要变动的内容见下:

SYS_USER_LANG = zh_CN
SYS_USER_CHARSET = gb2312

SYS_MFILTER_ON = 1
SYS_NETDISK_ON = 1
SYS_SHOW_SIGNUP = 1

SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_DB = extmail

SYS_G_ABOOK_TYPE = file
SYS_G_ABOOK_FILE_CHARSET = gb2312


其中SYS_MFILTER_ON及SYS_NETDISK_ON 设置为1是为了打开网络磁盘和过滤器;SYS_SHOW_SIGNUP控制首页是否显示免费注册邮箱按钮;全局地址本默认为ldap格式,现在也改为文本格式,并将地址本的转换编码改为GB2312

更新cgi目录权限
由于SuEXEC的需要,必须将extmail的cgi目录修改成vuser:vgroup权限:

chown -R vuser:vgroup /var/www/extsuite/extmail/cgi/
安装ExtMan - web后台
在ExtMail-Solution软件包根目录下执行:

tar -zxvf src/extman-0[1][1].2.4.tar.gz -C src
cp -r src/extman-0.2.4 /var/www/extsuite/extman/

 

配置webman.cf
修改/var/www/extsuite/extman/webman.cf内SYS_CHARSET及SYS_LANG参数为:

SYS_CAPTCHA_ON = 1
# SYS_CAPTCHA_ON参数控制首页是否采用校验码登陆
SYS_CHARSET = gb2312
SYS_LANG = zh_CN

其他参数基本上可以使用默认值。

安装perl-GD包
rpm -ivh RPMS/perl-GD-2.35-2ext.i386.rpm

更新cgi目录权限
由于SuEXEC的需要,必须将extman的cgi目录修改成vuser:vgroup权限:

chown -R vuser:vgroup /var/www/extsuite/extman/cgi/


查看文件权限

[root@Mail postfix]# ll /var/www/extsuite/
总计 16
drwxr-xr-x  7 root root 4096 03-18 14:26 extmail
drwxr-xr-x 11 root root 4096 03-18 14:11 extman

[root@Mail postfix]# ll /var/www/extsuite/extmail/ | grep cgi
drwxr-xr-x 2 vuser vgroup  4096 2009-11-07 cgi

建立临时文件夹:
mkdir /tmp/extman
chown -R vuser:vgroup /tmp/extman

建立刚才导入mysql的postmaster@extmail.org帐户的Maildir,请输入如下命令:

cd /var/www/extsuite/extman/tools
./maildirmake.pl /home/domains/extmail.org/postmaster/Maildir
chown -R vuser:vgroup /home/domains/extmail.org
cd $OLDPWD

[root@Mail postfix]# ll /home/domains/
总计 8
drwxr-xr-x 5 vuser vgroup 4096 03-18 15:43 extmail.org
[root@Mail postfix]# ll /home/domains/extmail.org/
总计 24
drwxr-xr-x 3 vuser vgroup 4096 03-18 14:16 kangta
drwxr-xr-x 3 vuser vgroup 4096 03-18 15:43 lian
drwxr-xr-x 3 vuser vgroup 4096 03-18 14:14 postmaster
[root@Mail postfix]# ll /home/domains/extmail.org/kangta/
总计 8
drwxr-xr-x 9 vuser vgroup 4096 03-18 15:10 Maildir

=================================================================
测试SMTP

通过以下命令获得postmaster@extmail.org的用户名及密码的BASE64编码:

perl -e 'use MIME::Base64; print encode_base64("postmaster\@extmail.org")'
cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
perl -e 'use MIME::Base64; print encode_base64("extmail")'
ZXh0bWFpbA==

 

[root@Mail mail]# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to Mail (127.0.0.1).
Escape character is '^]'.
220 mail.extmail.org ESMTP Postfix - by extmail.org
ehlo demo.domain.tld
250-mail.extmail.org
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth login
334 VXNlcm5hbWU6
cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
334 UGFzc3dvcmQ6
ZXh0bWFpbA==
235 2.7.0 Authentication successful
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@Mail mail]#

===============================================================

测试POP
[root@Mail mail]# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to Mail (127.0.0.1).
Escape character is '^]'.
+OK Hello there.
user postmaster@extmail.org
+OK Password required.
pass extmail
+OK logged in.
list
+OK POP3 clients that break here, they violate STD53.
1 6
2 739
3 735
4 770
5 701
6 693
7 739
8 735
.
quit
+OK Bye-bye.
Connection closed by foreign host.
[root@Mail mail]#

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
测试maildrop

[root@Mail mail]# maildrop -v
maildrop 2.0.4 Copyright 1998-2005 Double Precision, Inc.
GDBM extensions enabled.
Courier Authentication Library extension enabled.            支持courier-auth
Maildir quota extension enabled.
This program is distributed under the terms of the GNU General Public
License. See COPYING for additional information.

[root@Mail extmail.org]# echo test| maildrop -V 10 -d postmaster@extmail.org
maildrop: authlib: groupid=1000
maildrop: authlib: userid=1000
maildrop: authlib: logname=postmaster@extmail.org, home=/home/domains/extmail.org/postmaster, mail=/home/domains/extmail.org/postmaster/Maildir/
maildrop: Changing to /home/domains/extmail.org/postmaster
Message start at 0 bytes, envelope sender=postmaster@extmail.org
maildrop: Attempting .mailfilter
maildrop: Delivery complete.

*********************************************************************************************************

测试courier-auth

[root@Mail postfix]# /usr/sbin/authtest -s login postmaster@extmail.org extmail
Authentication succeeded.

     Authenticated: postmaster@extmail.org  (uid 1000, gid 1000)
    Home Directory: /home/domains/extmail.org/postmaster
           Maildir: /home/domains/extmail.org/postmaster/Maildir/
             Quota: 104857600S
Encrypted Password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0
Cleartext Password: extmail
           Options: (none)
    
**************************************************************************************************************
测试sasl

[root@Mail postfix]# /usr/sbin/saslauthd -a shadow pam -d
saslauthd[7159] :main            : num_procs  : 5
saslauthd[7159] :main            : mech_option: NULL
saslauthd[7159] :main            : run_path   : /var/run/saslauthd
saslauthd[7159] :main            : auth_mech  : shadow
saslauthd[7159] :main            : could not lock pid lock file: /var/run/saslauthd/saslauthd.pid.lock
saslauthd[7159] :main            : fcntl: Resource temporarily unavailable

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

测试postfix

[root@Mail postfix]# postconf -m
btree
cidr
environ
hash
ldap
mysql       支持mysql
nis
proxy
regexp
static
unix
[root@Mail postfix]# postconf -a
cyrus   支持courer-auth
dovecot

 

========================================================================
Mar 18 15:38:08 Mail postfix/smtpd[31796]: warning: SASL authentication failure: cannot connect to Courier authdaemond: Permission denied
Mar 18 15:38:08 Mail postfix/smtpd[31796]: warning: Mail[127.0.0.1]: SASL login authentication failed: generic failure

此类问题最多的是几个问题
/usr/lib/sasl2/smtpd.conf    配置问题   文件的权限问题
/var/spool/authdaemon   文件的权限问题
/etc/authlib/authdaemon  配置问题
关于很多日志报拒绝情况下,检查权限的问题,多数情况 是SELinux搞的鬼,将SELinux关闭,重新启动机器再看一切运行正常


连不上数据的问题  最好将默认的localhost改为127.0.0.1

=============================================================================

extmail 与extman  web界面打开提示DBI连接数据库的问题,是因为缺少perl-DBD-MySQL包
提示 连接不上数据库是因为webman里面的数据库设置问题
没有那个邮件地址目录的,拒绝是因为权限的设置无法写入  比如drwxr-xr-x 5 vuser vgroup 4096 03-18 15:43 extmail.org


----------------------------------------------------------------------------------------------------------------------------------
temporary failure. Command output: /usr/bin/maildrop: Invalid home directory permissions - world writable. )

[root@Mail ~]# echo "test" | maildrop -V 10 -d lian@extmail.org
maildrop: authlib: groupid=1000
maildrop: authlib: userid=1000
maildrop: authlib: logname=lian@extmail.org, home=/home/domains/extmail.org/lian, mail=/home/domains/extmail.org/lian/Maildir/
maildrop: Changing to /home/domains/extmail.org/lian
maildrop: Invalid home directory permissions - world writable.

出现这样的问题是/home /domails文件的权限不能设高777   755恢复

================================================================================

打开extman 发现验证码图片显示 不出来

方法1:vim /var/www/extsuite/extman/webman.cf
SYS_CAPTCHA_ON = 1      修改为0   禁止图片显示

或者按网上说法
缺少perl-GD包,安装后问题消失
跟perl包
1.wget http://packages.sw.be/perl-GD/perl-GD-2.43-1.el5.rf.i386.rpm
2.rpm -ivh perl-GD-2.43-1.el5.rf.i386.rpm

##################################################################################################


e.打开extmail邮件系统的web页面加载很慢
经过分析,发现是由于页面加载时调用了extmail.net的rpc服务。
修改 /var/www/extsuite/extmail/html/plugins/rpc_init.js 文件,去除其中rpc的使用.

1.rpc_url_list = [
2.//    "http://rpc-srv01.extmail.net/phprpc/rpc.php",
3.//    "http://rpc-srv02.extmail.net/phprpc/rpc.php",
4.//    "http://rpc-srv03.extmail.net/phprpc/rpc.php",
5.];
6.
7.rpc_plg_list = [
8.//    "coolweather",
9.//    "etnews",
10.//    "chkupdate",
11.];
修改 /var/www/extsuite/extman/html/plugins/rpc_init.js 文件,去除其中rpc的使用.

1.rpc_url_list = [
2.//    "http://rpc-srv01.extmail.net/phprpc/rpc.php",
3.//    "http://rpc-srv02.extmail.net/phprpc/rpc.php",
4.//    "http://rpc-srv03.extmail.net/phprpc/rpc.php",
5.];
修改后,再次打开extmail的Web页面,没有任何停顿的感觉,说明是之前的访问速度慢是由于程序调用extmail的rpc服务造成的

##############################################################################################
c.全部配置完毕后登陆Extmail时出现”Unix::Syslog not found”错误
给perl安装Unix::Syslog包
1.perl -MCPAN -e 'install Unix::Syslog'

###############################extman后台管理系统控制没有信息输出的解决方法###################

[root@KangTa daemon]# pwd
/var/www/extsuite/extman/daemon
[root@KangTa daemon]# ./cmdserver --daemon
loaded ok
Found an server instance pid=15259 is running, abort..
[root@KangTa daemon]# ps -eaf | grep 15259
root     15259     1  0 21:31 ?        00:00:00 /usr/bin/perl -w ./cmdserver --daemon
root     15485 10403  0 21:36 pts/1    00:00:00 grep 15259
[root@KangTa daemon]# kill 15259

###########################################################################################

配置使用nginx的web-extmail

虚拟主机代码:
server
{
   listen       80;
   server_name  mail.test.com;
   index index.html index.htm index.php index.cgi;
   root  /var/www/extsuite/extmail/html/;

   location /extmail/cgi/ {

             fastcgi_pass          127.0.0.1:8888;
             fastcgi_index         index.cgi;
             fastcgi_param  SCRIPT_FILENAME   /var/www/extsuite/extmail/cgi/$fastcgi_script_name;
             include               fcgi.conf;
        }
        location  /extmail/  {
             alias  /var/www/extsuite/extmail/html/;
        }
        location /extman/cgi/ {

             fastcgi_pass          127.0.0.1:8888;
             fastcgi_index         index.cgi;
             fastcgi_param  SCRIPT_FILENAME   /var/www/extsuite/extman/cgi/$fastcgi_script_name;
             include            fcgi.conf;
        }
        location /extman/ {
             alias  /var/www/extsuite/extman/html/;
        }
      log_format  extmaillog  '$remote_addr - $remote_user [$time_local] "$request" '
              '$status $body_bytes_sent "$http_referer" '
              '"$http_user_agent" $http_x_forwarded_for';
      access_log  /data/logs/extmaillog.log  extmaillog;
   }


让extmail支持fcgi,先先运行/var/www/extsuite/extmail/dispatch-init start


启动:
/var/www/extsuite/extmail/dispatch-init start start
写入开机自运行:
echo "/var/www/extsuite/extmail/dispatch-init start" >> /etc/rc.local
注意的问题:
1、如果没装perl的FCGI模块,会提示
“Can’t locate Ext/FCGI.pm in @INC (@INC contains:,等等。”
解决:cpan install FCGI
2   Useless use of a constant in void context at /usr/local/apache2/htdocs/extsuite/extmail/dispatch.fcgi line 344.”
解决:   修改dispatch-init中的ext目录路径以及系统用户和组,同时记得要将cgi目录的所属权给这里的用户和组
重启nginx后,查看你的extmail是否建立成功!

修改一下文件

[root@KangTa libs]# vim /var/www/extsuite/extmail/dispatch-init

#!/bin/sh

# example init script for dispatch.fcgi server
#
# chkconfig: 2345 80 20
# description: dispatch.fcgi - a remote fastcgi server for
#              extmail FCGI support
#
# processname: dispatch.fcgi
# pidfile: /var/run/dispatch.pid

# startup parameters
MAXFORK=10
MINFORK=2
MAXREQS=25
TIMEOUT=360
PORT=8888                              注意端口别冲突
SU_UID=vuser                          注意用户名与组
SU_GID=vgroup

PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
BASE=/var/www/extsuite/extmail                 此处地址
BIN=dispatch.fcgi
PID_FILE=/$BASE/$BIN.pid

export PATH=$PATH

case "$1" in
'start')
        if [ ! -f $PID_FILE ]; then
                touch $PID_FILE
                chown $SU_UID:$SU_GID $PID_FILE
        else
                PID=`cat $PID_FILE`;
                kill -0 $PID
                if [ "$?" -eq 0 ];then
                        echo "Pid of $PID is running, abort..."
                        exit 255
                fi
        fi
        echo "Starting extmail FCGI server...";
        nice -19 $BASE/$BIN --port=$PORT --maxserver=$MAXFORK --minspare=$MINFORK --server \
                --host=127.0.0.1 --uid=$SU_UID --gid=$SU_GID --pid=$PID_FILE \
                --request=$MAXREQS --timeout=$TIMEOUT --debug --log=/tmp/dispatch.fcgi.log
        ;;


以上出现执行错误


需要先安装FCGI
[root@KangTa daemon]# cpan install FCGI