**************************************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的[email protected]帳戶的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
通過以下命令獲得[email protected]的用戶名及密碼的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 [email protected]
+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 [email protected]
maildrop: authlib: groupid=1000
maildrop: authlib: userid=1000
maildrop: authlib: [email protected], 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 [email protected]
maildrop: Attempting .mailfilter
maildrop: Delivery complete.
*********************************************************************************************************
測試courier-auth
[root@Mail postfix]# /usr/sbin/authtest -s login [email protected] extmail
Authentication succeeded.
Authenticated: [email protected] (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 [email protected]
maildrop: authlib: groupid=1000
maildrop: authlib: userid=1000
maildrop: authlib: [email protected], 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