CentOS 5.6+Postfix+LDAP(虚拟域)+ExtMail+BIND9+Dovecot

来源:互联网 发布:zbrush mac破解版 编辑:程序博客网 时间:2024/05/21 09:53
Mail Server建置很久了,今天帖上来,记录建置邮件服务器的全过程,中间图片还在插进来就不帖上了

一,Setup OS

图:省略,默认安装即可 

二,BIND9 Named Setup (可以不用做,一樣可以收發郵件)

[root@mail chroot]# yum install bind-libbind-devel
[root@mail chroot]# yum install bind-devel
[root@mail chroot]#yum install caching-nameserver
[root@mail chroot]# rpm -qa | grep bind
bind-utils-9.3.6-16.P1.el5
ypbind-1.19-12.el5
bind-chroot-9.3.6-16.P1.el5
bind-9.3.6-16.P1.el5
bind-libs-9.3.6-16.P1.el5
bind-libbind-devel-9.3.6-16.P1.el5
bind-devel-9.3.6-16.P1.el5
[root@mail chroot]#
[root@mail chroot]# more /etc/named.caching-nameserver.conf
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver 
// (as a localhost DNS resolver only). 
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on 
// caching-nameserver package upgrade.
//
options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";

        // Those options should be used carefully because they disable port
        // randomization
        // query-source    port 53;
        // query-source-v6 port 53;

        allow-query     { any; };
        allow-query-cache { any; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

[root@mail etc]# vi /var/named/chroot/etc/named.rfc1912.zones    //add 
zone "wht.com" IN {
        type master;
        file "wht.com.zone";
        allow-update { none; };
};

zone "86.16.172.in-addr.arpa" IN {
        type master;
        file "named.172.16.86";
        allow-update { none; };
};

[root@mail named]# cd /var/named/chroot/var/named
[root@mail named]#cp named.local named.172.16.86
[root@mail named]#cp localhost.zone wht.com.zone
[root@mail named]#vi named.172.16.86 
$TTL    86400
@       IN      SOA     mail.wht.com. root.wht.com.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
          IN      NS      mail.wht.com.
103       IN      PTR     mail.wht.com.
103       IN      PTR     www.wht.com.
[root@mail named]#
[root@mail named]# vi wht.com.zone 
$TTL    86400
@       IN SOA  mail.wht.com root.wht.com. (
                    42      ; serial (d. adams)
                    3H      ; refresh
                    15M     ; retry
                    1W      ; expiry
                    1D )        ; minimum
            IN NS       www.wht.com.
        IN MX 5     mail.wht.com.
www     IN A        172.16.86.103
mail    IN A        172.16.86.103
[root@mail named]#
[root@mail named]#chown –R root.named /var/named/chroot/var/named
[root@mail named]#service named start
[root@mail named]# host www.wht.com
www.wht.com has address 172.16.86.103
[root@mail named]# host 172.16.86.103
103.86.16.172.in-addr.arpa domain name pointer mail.wht.com.
103.86.16.172.in-addr.arpa domain name pointer www.wht.com.
[root@mail named]# host -t mx mail.wht.com
mail.wht.com has no MX record
[root@mail named]# host -t mx wht.com     
wht.com mail is handled by 5 mail.wht.com.
[root@mail named]# pwd
/var/named/chroot/var/named
[root@mail named]#


三,OpenLDAP setup
[root@mail ~]# rpm -qa|grep openldap
openldap-clients-2.3.43-12.el5_5.3
openldap-2.3.43-12.el5_5.3
[root@mail ~]# yum install openldap-*(只安裝下面藍色部分也行)
Dependencies Resolved

====================================================================================================================================
 Package                                    Arch                  Version                            Repository                Size
====================================================================================================================================
Installing:
 openldap-devel                             i386                  2.3.43-12.el5_7.9                  updates                  1.5 M
 openldap-servers                           i386                  2.3.43-12.el5_7.9                  updates                  3.1 M
 openldap-servers-overlays                  i386                  2.3.43-12.el5_7.9                  updates                  194 k
 openldap-servers-sql                       i386                  2.3.43-12.el5_7.9                  updates                  120 k
Installing for dependencies:
 cyrus-sasl-devel                           i386                  2.1.22-5.el5_4.3                   base                     1.4 M

Transaction Summary
====================================================================================================================================
Install       5 Package(s)
Upgrade       0 Package(s)

Total download size: 6.3 M
Is this ok [y/N]: y
[root@mail config]# vi /etc/openldap/ldap.conf
BASE    dc=wht.com
URI     ldap://172.16.86.103
SIZELIMIT       12
TIMELIMIT       15
DEREF           never

[root@mail openldap]# vi /etc/openldap/slapd.conf
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/nis.schema
allow bind_v2
pidfile         /var/run/openldap/slapd.pid
argsfile        /var/run/openldap/slapd.args
access to dn.base="" by * read
access to dn.base="cn=Subschema" by * read
access to *     
        by self write 
        by users read 
        by anonymous auth 
// by anonymous read
        by * none
后续这两行要更改及加入,否则extmail默认匿名存取ldap,将得不到ldap的数据,造成邮件无法收寄,这里搞了好久。
//
database        bdb
suffix          "dc=wht.com"             //这个一定要和ExtMail中init.ldif设置一样,否则init.ldif无法改入
rootdn          "cn=Manager,dc=wht.com"
rootpw         {SSHA}{MD5}EehorLTQ01Upk2R8Av/HXw== (密碼postfix,使用slappasswd –h {MD5}前面不能有空格,否則會出現錯誤:ldap_bind: Invalid credentials (49))
directory       /var/lib/ldap
index objectClass                       eq,pres
index ou,cn,mail,surname,givenname      eq,pres,sub
index uidNumber,gidNumber,loginShell    eq,pres
index uid,memberUid                     eq,pres,sub
index nisMapName,nisMapEntry            eq,pres,sub
loglevel 256  //注意要用TAB分開,不能用空格,否則產生不了日志

[root@mail openldap]# slaptest
bdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/ldap: (2)
Expect poor performance for suffix dc=wht,dc=com.
config file testing succeeded
[root@mail openldap]#
[root@mail ldap]#cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
[root@mail ldap]# service ldap restart
正在停止 slapd: [  確定  ]
正在為 slapd 檢查設定檔案:  config file testing succeeded
[  確定  ]
正在啟動 slapd: [  確定  ]


[root@mail soft]# vi wht.com.ldif  //这个只是测试没有什么实际意义,可以不做,下步导入ExtMail的init.ldif才是最主要的
dn: dc=wht,dc=com
dc: wht
o:  wht.com
objectClass: top
objectClass: domain

dn: ou=mail,dc=wht,dc=com
ou: mail
objectClass: top
objectClass: organizationalUnit

dn: cn=Manager,dc=wht,dc=com
objectClass: top
objectClass: organizationalRole
cn: Manager 
[root@mail soft]#


[root@mail soft]# ldapadd -x -D "cn=Manager,dc=wht,dc=com" -w postfix -f wht.com.ldif
adding new entry "dc=wht,dc=com"
adding new entry "ou=mail,dc=wht,dc=com"

啟用LDAP Log功能 
[root@mail log]# vi /etc/openldap/slapd.conf 
Loglevel 256  //注意要用TAB分開,不能用空格,否則產生不了日志

[root@mail log]# vi /etc/syslog.conf
#Save OpenLDAP.log
local4.*                                                /var/log/openldap.log
[root@mail log]# touch /var/log/openldap.log
[root@mail log]# chown ldap.ldap /var/log/openldap.log
[root@mail log]# service syslog restart
[root@mail log]# service ldap restart


安裝phpldapadmin
[root@mail soft]# tar -zxvf phpldapadmin-0.9.8.5.tar.gz
[root@mail soft]# mv  phpldapadmin-0.9.8.5 /var/www/html/phpldapadmin
[root@mail soft]# cd /var/www/html/ phpldapadmin/conf
[root@mail config]# cp config.php.example config.php
#vi config.php
$config->custom->appearance['language'] = 'zh_TW';
$ldapservers->SetValue($i,'server','name','wht.com LDAP Server');
$ldapservers->SetValue($i,'server','host','localhost');
$ldapservers->SetValue($i,'server','port','389');
$ldapservers->SetValue($i,'server','base',array('dc=wht,dc=com'));
$ldapservers->SetValue($i,'server','auth_type','cookie');
$ldapservers->SetValue($i,'login','dn','cn=Manager, dc=umec,dc=com');
#service httpd restart

 

 

安裝webmin

[root@mail soft]# rpm -ivh webmin-1.520-1.noarch.rpm
警告:webmin-1.520-1.noarch.rpm: 表頭 V3 DSA 簽名:NOKEY, key ID 11f63c51
正在準備…             ########################################### [100%]
Operating system is CentOS Linux
   1:webmin                 ########################################### [100%]
Webmin install complete. You can now login to https://mail.wht.com:10000/
as root with your root password.
 
 

為VIM增加顏色
[root@mail soft]# yum install vim-common vim-enhanced
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Setting up Install Process
Package 2:vim-common-7.0.109-7.el5.i386 already installed and latest version
Package 2:vim-enhanced-7.0.109-7.el5.i386 already installed and latest version
Nothing to do
export TERM=xterm-color

[root@mail soft]# mv /bin/vi /bin/vi.bak
[root@mail soft]# ln -s /usr/bin/vim /bin/vi


四,Postfix setup

[root@mail extsuite]# rpm -e sendmail --nodeps
警告:/var/log/mail/statistics 已被另存為 /var/log/mail/statistics.rpmsave
[root@mail ~]# more /etc/yum.conf
#proxy server
proxy=http://172.16.86.253:3128

//这里实际上要设置postfix的uid gid都是extmail默认的1000,否则将来收发邮件时,出现一些莫名的问题,后来懒的改了,就重新安装postfix,设置uid及gid为1000才没有出现其它问题。

[root@mail backup]#groupdel postfix
[root@mail backup]#userdel postfix
[root@mail home]# groupadd -g 1000 postfix
[root@mail home]# useradd postfix -g postfix -u 1000 -G postdrop -c "Postfix User" -d /dev/null -s /sbin/nologin
//

[root@mail ~]# yum install postfix
[root@mail extsuite]# id postfix
uid=89(postfix) gid=89(postfix) groups=89(postfix),12(mail)
[root@mail extsuite]# mkdir -p /home/vmail
[root@mail extsuite]# chown -R postfix.postfix /home/vmail
[root@mail extsuite]# postconf -m
btree
cidr
environ
hash
ldap  //支持LDAP
nis
pcre
proxy
regexp
static
unix
[root@mail extsuite]# alternatives --display mta
mta - 狀態是自動的。
 目前連結指向 /usr/sbin/sendmail.postfix
/usr/sbin/sendmail.postfix - 優先順序 30
 從屬裝置 mta-pam: /etc/pam.d/smtp.postfix
 從屬裝置 mta-mailq: /usr/bin/mailq.postfix
 從屬裝置 mta-newaliases: /usr/bin/newaliases.postfix
 從屬裝置 mta-rmail: /usr/bin/rmail.postfix
 從屬裝置 mta-sendmail: /usr/lib/sendmail.postfix
 從屬裝置 mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
 從屬裝置 mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
 從屬裝置 mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
 從屬裝置 mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
目前 `最好的' 版本是 /usr/sbin/sendmail.postfix。
[root@mail extsuite]# alternatives --config mta

有 1 程式提供 'mta'。

  選擇        指令
-----------------------------------------------
*+ 1           /usr/sbin/sendmail.postfix

請輸入以保留目前的選擇[+],或輸入選擇號碼:
[root@mail extsuite]#
[root@mail postfix]# vi /etc/postfix/main.cf
[root@mail postfix]# postconf -n
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailbox_size_limit = 209715200  #邮箱大小限制200M
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 14336000  #每个邮件最大尺寸10M
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = wht.com
myhostname = mail.wht.com
mynetworks = 172.16.0.0/16, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_banner = $myhostname ESMTP "Version not Available"
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_path = /var/run/dovecot/auth-client  #与dovecot.conf中如下的的path一致
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot    #使用dovecot进行验证
unknown_local_recipient_reject_code = 550
virtual_alias_domains = 
virtual_alias_maps = ldap:/etc/postfix/ldap/ldap_virtual_alias_maps.cf
virtual_gid_maps = static:89
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = ldap:/etc/postfix/ldap/ldap_virtual_domains_maps.cf
virtual_mailbox_limit = 209715200 #虚拟邮箱大小限制200M
virtual_mailbox_maps = ldap:/etc/postfix/ldap/ldap_virtual_mailbox_maps.cf
virtual_transport = virtual
virtual_uid_maps = static:89
[root@mail postfix]#
[root@mail postfix]# mkdir ldap

[root@mail sasl2]# vi /usr/lib/sasl2/smtpd.conf 
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
[root@mail sasl2]#

安裝 Extman,ExtMail
[root@mail soft]# tar zxvf extmail-1.1.1.tar.gz
[root@mail soft]# tar zxvf extman-1.0.1.tar.gz
[root@mail soft]# mkdir -pv /var/www/extsuite
mkdir: created directory ‘/var/www/extsuite’
[root@mail soft]# mv extman-1.0.1 /var/www/extsuite/extman
[root@mail soft]# mv extmail-1.1.1 /var/www/extsuite/extmail

回到OpenLDAP setup
[root@mail docs]# cp /var/www/extsuite/extman/docs/extmail.schema /etc/openldap/schema
[root@mail docs]# vi /etc/openldap/slapd.conf  //add如下
include         /etc/openldap/schema/extmail.schema

index objectClass                       eq,pres
index mail,active,virtualDomain,mailLocalAddress        eq,pres

[root@mail soft]# cat /etc/openldap/ldap.conf | grtep –v “#”
BASE    dc=wht.com
URI     ldap://172.16.86.103
SIZELIMIT       12
TIMELIMIT       15
DEREF           never
[root@mail soft]# cat /etc/openldap/slapd.conf |grep -v "#"
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/extmail.schema
allow bind_v2
pidfile         /var/run/openldap/slapd.pid
argsfile        /var/run/openldap/slapd.args
access to dn.base="" by * read
access to dn.base="cn=Subschema" by * read
access to *     
        by self write 
        by users read 
        by anonymous auth 

database        bdb
suffix          "dc=wht.com"
rootdn          "cn=Manager,dc=wht.com"
rootpw          {SSHA}wJeA7NVNB7XtXeC8/3PIKJnSuPYbkvKA
directory       /var/lib/ldap
index objectClass                       eq,pres
index mail,active,virtualDomain,mailLocalAddress        eq,pres
loglevel        256
[root@mail soft]#

[root@mail docs]# cp init.ldif init-wht.ldif
[root@mail docs]# vi init-wht.ldif
:%s/extmail.org/dc=wht.com/g

[root@mail soft]# more init-wht.ldif 
# wht.com
dn: dc=wht.com   //这个一定要和openldap中的设置一样,否则无法导入
objectClass: organization
objectClass: dcObject
dc: wht.com
o: wht.com

# Manager, wht.com
dn: cn=Manager,dc=wht.com
objectClass: top
objectClass: organizationalRole
cn: Manager

# domains + users: o=extmailAccount, dc=wht.com
dn: o=extmailAccount,dc=wht.com
objectClass: organization
o: extmailAccount

# aliases: o=extmailAlias, dc=wht.com
dn: o=extmailAlias,dc=wht.com
objectClass: organization
o: extmailAlias

# manager: o=extmailManager, dc=wht.com
dn: o=extmailManager,dc=wht.com
objectClass: organization
o: extmailManager

# Domain: virtualDomain=wht.com, o=extmailAccount, dc=wht.com
dn: virtualDomain=wht.com, o=extmailAccount, dc=wht.com
virtualDomain: wht.com
description: A virtualDomain for wht.com
hashDirPath: A0/B0
Transport: virtual:
domainMaxQuota: 1073741824
domainMaxUsers: 50
domainMaxAlias: 50
domainMaxNetStore: 1073741824
defaultQuota: 5242880
defaultNetStore: 5242880
defaultExpire: 1y
disablesmtpd: 0
disablesmtp: 0
disablewebmail: 0
disablenetdisk: 0
disableimap: 1
disablepop3: 0
active: 1
expireDate: 2010-10-01
createDate: 2007-02-14 13:47:56
objectclass: top
objectclass: extmailDomain

# User: mail=postmaster@wht.com, virtualDomain=wht.com, o=extmailAccount, dc=wht.com
dn: mail=postmaster@wht.com, virtualDomain=wht.com, o=extmailAccount, dc=wht.com
cn: Test user
uid: test
mail: postmaster@wht.com
virtualDomain: wht.com
mailMessageStore: wht.com/postmaster/Maildir/
homeDirectory: wht.com/postmaster
userName: postmaster@wht.com
mailQuota: 104857600S
netdiskQuota: 52428800S
uidNumber: 1000                //默认为1000,此处最好改为id postfix的gid及uid
gidNumber: 1000                //默认为1000,此处最好改为id postfix的gid及uid
userPassword: {CRYPT}$1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0
active: 1
disablesmtpd: 0
disablesmtp: 0
disablewebmail: 0
disablenetdisk: 0
disableimap: 0
disablepop3: 0
expireDate: 2010-10-01
createDate: 2007-02-14 17:56:33
objectClass: top
objectClass: uidObject
objectClass: extmailUser

# Alias: mailLocalAddress=support@wht.com, o=extmailAlias, dc=wht.com
dn: mailLocalAddress=support@wht.com, o=extmailAlias, dc=wht.com
mailLocalAddress: support@wht.com
virtualDomain: wht.com
mail: postmaster@wht.com
active: 1
objectclass: extmailAlias
//以下为域管理员的帐户及密码,可以在phpmyadmin中修改
# Manager: mail=root@wht.com, o=extmailManager, dc=wht.com
dn: mail=root@wht.com, o=extmailManager, dc=wht.com
cn: Root
uid: root
mail: root@wht.com
userPassword: {CRYPT}$1$BrT9qxfB$Ha81Mb5YVV6rNKNN5jmtj1
managerType: admin
active: 1
question: who are you?
answer: postmaster
disablePasswdChange: 0
createDate: 2007-02-14 18:32:14
expireDate: 2010-08-01
objectclass: top
objectclass: extmailManager
[root@mail soft]#

[root@mail docs]# ldapadd -x -D "cn=Manager,dc=wht,dc=com" -w postfix -f /var/www/extsuite/extman/docs/init-wht.ldif

adding new entry "dc=wht.com"

adding new entry "cn=Manager,dc=wht.com"

adding new entry "o=extmailAccount,dc=wht.com"

adding new entry "o=extmailAlias,dc=wht.com"

adding new entry "o=extmailManager,dc=wht.com"

adding new entry "virtualDomain=wht.com, o=extmailAccount, dc=wht.com"

adding new entry "mail=postmaster@wht.com, virtualDomain=wht.com, o=extmailAccount, dc=wht.com"

adding new entry "mailLocalAddress=support@wht.com, o=extmailAlias, dc=wht.com"

adding new entry "mail=root@wht.com, o=extmailManager, dc=wht.com"



回到Postfix setup
[root@mail docs]# cp ldap_*.cf /etc/postfix/ldap
[root@mail schema]# cd /etc/postfix/ldap/
:%s/extmail.org/wht.com/g
[root@mail ldap]# cat ldap_virtual_alias_maps.cf 
server_host = localhost
search_base = o=extmailAlias,dc=wht.com
query_filter = (&(objectClass=extmailAlias)(mailLocalAddress=%s)(active=1))
result_attribute = mail
cache = no
bind = no
scope = sub
[root@mail ldap]#
[root@mail ldap]# cat ldap_virtual_domains_maps.cf 
server_host = localhost
search_base = o=extmailAccount,dc=wht.com
query_filter = (&(objectClass=extmailDomain)(virtualDomain=%s)(active=1))
result_attribute = virtualDomain
cache = no
bind = no
scope = sub
[root@mail ldap]#
[root@mail ldap]# cat ldap_virtual_limit_maps.cf 
server_host = localhost
search_base = o=extmailAccount,dc=wht.com
query_filter = (&(objectClass=extmailUser)(mail=%s)(active=1))
result_attribute = mailQuota
cache = no
bind = no
scope = sub
[root@mail ldap]#
[root@mail ldap]# cat ldap_virtual_mailbox_maps.cf 
server_host = localhost
search_base = o=extmailAccount,dc=wht.com
query_filter = (&(objectClass=extmailUser)(mail=%s)(active=1))
result_attribute = mailMessageStore
cache = no
bind = no
scope = sub
[root@mail ldap]#
[root@mail ldap]# cat ldap_virtual_sender_maps.cf 
server_host = localhost
search_base = o=extmailAccount,dc=wht.com
query_filter = (&(objectClass=extmailUser)(mail=%s)(active=1))
result_attribute = mail
cache = no
bind = no
scope = sub
[root@mail ldap]#
[root@mail ldap]# cat ldap_virtual_alias_maps.cf 
server_host = localhost
search_base = o=extmailAlias,dc=wht.com
query_filter = (&(objectClass=extmailAlias)(mailLocalAddress=%s)(active=1))
result_attribute = mail
cache = no
bind = no
scope = sub
[root@mail ldap]#



五,配置Dovecot

[root@mail ldap]# rpm -qa |grep dovecot
dovecot-1.0.7-7.el5
[root@mail ldap]# cp /etc/dovecot.conf /etc/dovecot.conf.bak
[root@mail ldap]# vi /etc/dovecot.conf
base_dir = /var/run/dovecot/
protocols = imap imaps pop3 pop3s
listen = *
log_path = /var/log/dovecot.log
info_log_path =  /var/log/dovecot-info.log
mail_location = maildir:/home/vmail/%d/%n/Maildir
first_valid_uid = 89  //后来重新安装后改为1000
auth_default_realm = wht.com //20120407增加,解决outlook中认证默认域名问题
protocol imap {
}
protocol pop3 {
}
protocol lda {
  postmaster_address = postmaster@example.com
}
auth default {
  mechanisms = plain login
  passdb pam {
  }
  passdb ldap {
    args = /etc/dovecot-ldap.conf
  }
  userdb passwd {
  }
  userdb ldap {
    args = /etc/dovecot-ldap.conf
  }
  user = root
  socket listen {
    client {
      path = /var/run/dovecot/auth-client
      mode = 0660
      user = postfix
      group = postfix
    }
  }
}

dict {
}

plugin {
}
[root@mail ldap]#


[root@mail ldap]# cat /etc/dovecot-ldap.conf 
hosts = 172.16.86.103:389
dn = cn=Manager,dc=wht.com
dnpass = postfix
ldap_version = 3
base =  o=extmailAccount,dc=wht.com
deref = never
scope = subtree
user_attrs = mail,homeDirectory,,,uidNumber,gidNumber
user_filter = (&(objectClass=extmailUser)(mail=%u)(active=1))
pass_attrs = mail,userPassword
pass_filter = (&(objectClass=extmailUser)(mail=%u)(active=1))
default_pass_scheme = crypt
#default_pass_scheme = plain
user_global_uid = postfix
user_global_gid = postfix
auth_bind = yes
[root@mail ldap]#
[root@mail ldap]# service dovecot start

回到ExtMail,ExtMan setup

[root@mail tmp]# mkdir /tmp/extmail
[root@mail tmp]# mkdir /tmp/extman
[root@mail tmp]# chown -R postfix.postfix extman/
[root@mail tmp]# chown -R postfix.postfix extmail/

#/tmp下的文件每次系统重启都会丢失,建议将webman.cf中SYS_SESS_DIR 修改为/var/tmp/extman/,然后创建/var/tmp/extman目录,修改权限,就不会出现这样的界面了。
 


[root@mail ldap]# cd /var/www/extsuite/extmail/
[root@mail extmail]# cp webmail.cf.default webmail.cf
[root@mail extmail]# cat webmail.cf | grep -v "#"
SYS_CONFIG = /var/www/extsuite/extmail/
SYS_LANGDIR = /var/www/extsuite/extmail/lang
SYS_TEMPLDIR = /var/www/extsuite/extmail/html
SYS_HTTP_CACHE = 0
SYS_SMTP_HOST = 127.0.0.1
SYS_SMTP_PORT = 25
SYS_SMTP_TIMEOUT = 5
SYS_SPAM_REPORT_ON = 0
SYS_SPAM_REPORT_TYPE = dspam
SYS_SHOW_WARN = 0
SYS_PERMIT_NOQUOTA = 1
SYS_SESS_DIR = /tmp
SYS_UPLOAD_TMPDIR = /tmp
SYS_LOG_ON = 1
SYS_LOG_TYPE = file
SYS_LOG_FILE = /var/log/extmail.log
SYS_SESS_TIMEOUT = 0
SYS_SESS_COOKIE_ONLY = 1
SYS_USER_PSIZE = 10
SYS_USER_SCREEN = auto
SYS_USER_LANG = zh_TW
SYS_APP_TYPE = WebMail
SYS_USER_TEMPLATE = default
SYS_USER_CHARSET = utf-8
SYS_USER_TRYLOCAL = 1
SYS_USER_TIMEZONE = +0800
SYS_USER_CCSENT = 1
SYS_USER_SHOW_HTML = 1
SYS_USER_COMPOSE_HTML = 1
SYS_USER_CONV_LINK =1
SYS_USER_ADDR2ABOOK = 1
SYS_MESSAGE_SIZE_LIMIT = 5242880
SYS_MIN_PASS_LEN = 2
SYS_MFILTER_ON = 1
SYS_NETDISK_ON = 1
SYS_SHOW_SIGNUP = 1
SYS_DEBUG_ON = 1
SYS_AUTH_TYPE = ldap
SYS_MAILDIR_BASE = /home/vmail
SYS_AUTH_SCHEMA = virtual
SYS_CRYPT_TYPE = crypt
SYS_LDAP_BASE = o=extmailAccount,dc=wht.com
SYS_LDAP_RDN = cn=Manager,dc=wht.com
SYS_LDAP_PASS = postfix
SYS_LDAP_HOST = localhost
SYS_LDAP_ATTR_USERNAME = mail
SYS_LDAP_ATTR_DOMAIN = virtualDomain
SYS_LDAP_ATTR_PASSWD = userPassword
SYS_LDAP_ATTR_CLEARPW = clearPassword
SYS_LDAP_ATTR_QUOTA = mailQuota
SYS_LDAP_ATTR_NDQUOTA = netdiskQuota
SYS_LDAP_ATTR_HOME = homeDirectory
SYS_LDAP_ATTR_MAILDIR = mailMessageStore
SYS_LDAP_ATTR_DISABLEWEBMAIL = disablewebmail
SYS_LDAP_ATTR_DISABLENETDISK = disablenetdisk
SYS_LDAP_ATTR_DISABLEPWDCHANGE = disablePasswdChange
SYS_LDAP_ATTR_ACTIVE = active
SYS_LDAP_ATTR_PWD_QUESTION = question
SYS_LDAP_ATTR_PWD_ANSWER = answer
SYS_AUTHLIB_SOCKET = /var/spool/authdaemon/socket
SYS_G_ABOOK_TYPE = ldap
SYS_G_ABOOK_LDAP_HOST = localhost
SYS_G_ABOOK_LDAP_BASE = ou=AddressBook,dc=wht.com
SYS_G_ABOOK_LDAP_ROOTDN = cn=Manager,dc=wht.com
SYS_G_ABOOK_LDAP_ROOTPW = postfix
SYS_G_ABOOK_LDAP_FILTER = objectClass=OfficePerson
SYS_G_ABOOK_FILE_PATH = /var/www/extsuite/extmail/globabook.cf
SYS_G_ABOOK_FILE_LOCK = 1
SYS_G_ABOOK_FILE_CONVERT = 0
SYS_G_ABOOK_FILE_CHARSET = utf-8

[root@mail extmail]# chown -R postfix.postfix cgi

[root@mail extmail]# cd ../extman
[root@mail extman]# chown -R postfix.postfix cgi
[root@mail extman]# cp webman.cf.default webman.cf
[root@mail extman]# vi webman.cf
SYS_CONFIG = /var/www/extsuite/extman/
SYS_LANGDIR = /var/www/extsuite/extman/lang
SYS_TEMPLDIR = /var/www/extsuite/extman/html
SYS_MAILDIR_BASE = /home/vmail
SYS_SHOW_WARN = 0
SYS_SESS_DIR = /tmp/extman/
SYS_CAPTCHA_ON = 0  //ExtMan,ExtMail验证码不显示
SYS_CAPTCHA_KEY = r3s9b6a7
SYS_CAPTCHA_LEN = 6
SYS_PURGE_DATA = 0
SYS_PSIZE = 20
SYS_APP_TYPE = ExtMan
SYS_TEMPLATE_NAME = default
SYS_DEFAULT_EXPIRE = 1y
SYS_GROUPMAIL_SENDER = postmaster@wht.com
SYS_DEFAULT_SERVICES = webmail,smtpd,smtp,pop3,netdisk
SYS_ISP_MODE = no
SYS_DOMAIN_HASHDIR = yes
SYS_DOMAIN_HASHDIR_DEPTH = 2x2
SYS_USER_HASHDIR = yes
SYS_USER_HASHDIR_DEPTH = 2x2
SYS_MIN_UID = 500
SYS_MIN_GID = 100
SYS_DEFAULT_UID = 1000
SYS_DEFAULT_GID = 1000
SYS_QUOTA_MULTIPLIER = 1048576
SYS_QUOTA_TYPE = courier
SYS_DEFAULT_MAXQUOTA = 500
SYS_DEFAULT_MAXALIAS = 100
SYS_DEFAULT_MAXUSERS = 100
SYS_DEFAULT_MAXNDQUOTA = 500
SYS_USER_DEFAULT_QUOTA = 5
SYS_USER_DEFAULT_NDQUOTA = 5
SYS_USER_DEFAULT_EXPIRE = 1y
SYS_BACKEND_TYPE = ldap
SYS_CRYPT_TYPE = crypt
SYS_LDAP_BASE = dc=wht.com
SYS_LDAP_RDN = cn=Manager,dc=wht.com
SYS_LDAP_PASS = postfix
SYS_LDAP_HOST = localhost
SYS_LDAP_ATTR_USERNAME = mail
SYS_LDAP_ATTR_PASSWD = userPassword
SYS_RRD_DATADIR = /var/lib
SYS_RRD_TMPDIR = /tmp/viewlog
SYS_RRD_QUEUE_ON = yes
SYS_CMDSERVER_SOCK = /tmp/cmdserver.sock 
SYS_CMDSERVER_MAXCONN = 5
SYS_CMDSERVER_PID = /var/run/cmdserver.pid
SYS_CMDSERVER_LOG = /var/log/cmdserver.log
SYS_CMDSERVER_AUTHCODE = your_auth_code_here
SYS_IGNORE_SERVER_LIST = web
[root@mail extman]#

[root@mail extmail]# vi /etc/httpd/conf/httpd.conf
User postfix          //默認為apache
Group postfix         //默認為apache
#
#Extmail
#
# Directives to allow use of Extmail as a CGI
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
<Directory "/var/www/extsuite/extmail/cgi">
     AllowOverride None
     Options None
     Order allow,deny
     Allow from all
</Directory>
# This is to permit URL access to scripts/files in Extmail directory.
Alias /extmail /var/www/extsuite/extmail/html
<Directory “/var/www/extsuite/extmail/html”>
      Options Indexes FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
</Directory>

ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi
<Directory "/var/www/extsuite//extman/cgi">
     AllowOverride None
     Options None
     Order allow,deny
     Allow from all
</Directory>
Alias /extman /var/www/extsuite/extman/html
SuexecUserGroup postfix postfix
<Directory “/var/www/extsuite/extman/html”>
      Options Indexes FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
</Directory>

[root@mail extmail]# service httpd restart



[root@mail Unix-Syslog-1.1]# tar -zxvf Unix-Syslog-1.1.tar.gz
[root@mail Unix-Syslog-1.1]# cd Unix-Syslog-1.1
[root@mail Unix-Syslog-1.1]# perl Makefile.PL
Writing Makefile for Unix::Syslog
[root@mail Unix-Syslog-1.1]# make
gcc -c   -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables   -DVERSION=\"1.1\" -DXS_VERSION=\"1.1\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE"   Syslog.c
Syslog.c: In function 「XS_Unix__Syslog_priorityname」:
Syslog.c:324: 警告:未使用的變數 「targ」
Syslog.c:323: 警告:未使用的變數 「RETVAL」
Syslog.c:322: 警告:未使用的變數 「p」
Syslog.c: In function 「XS_Unix__Syslog_facilityname」:
Syslog.c:342: 警告:未使用的變數 「targ」
Syslog.c:341: 警告:未使用的變數 「RETVAL」
Syslog.c:340: 警告:未使用的變數 「f」
Syslog.c: In function 「XS_Unix__Syslog_setlogmask」:
Syslog.c:438: 警告:未使用的變數 「targ」
Syslog.c:437: 警告:未使用的變數 「RETVAL」
Running Mkbootstrap for Unix::Syslog ()
chmod 644 Syslog.bs
rm -f blib/arch/auto/Unix/Syslog/Syslog.so
gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib Syslog.o  -o blib/arch/auto/Unix/Syslog/Syslog.so    \
           -lc          \
          
chmod 755 blib/arch/auto/Unix/Syslog/Syslog.so
cp Syslog.bs blib/arch/auto/Unix/Syslog/Syslog.bs
chmod 644 blib/arch/auto/Unix/Syslog/Syslog.bs
Manifying blib/man3/Unix::Syslog.3pm
[root@mail Unix-Syslog-1.1]# make install
Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Unix/Syslog/Syslog.bs
Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Unix/Syslog/Syslog.so
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Unix/Syslog.pm
Installing /usr/share/man/man3/Unix::Syslog.3pm
Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Unix/Syslog/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
[root@mail Unix-Syslog-1.1]#
[root@mail soft]# tar zxvf DBI-1.611.tar.gz
[root@mail soft]# cd DBI-1.611
[root@mail DBI-1.611]# perl Makefile.PL
[root@mail DBI-1.611]# make
[root@mail DBI-1.611]# make install
安裝時有如下錯誤
[root@mail soft]# cd Unix-Syslog-1.1
[root@mail Unix-Syslog-1.1]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Unix::Syslog
[root@mail Unix-Syslog-1.1]# make
cp Syslog.pm blib/lib/Unix/Syslog.pm
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp  -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap  Syslog.xs > Syslog.xsc && mv Syslog.xsc Syslog.c
gcc -c   -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables   -DVERSION=\"1.1\" -DXS_VERSION=\"1.1\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE"   Syslog.c
/bin/sh: gcc: command not found
make: *** [Syslog.o] Error 127
解決:gcc開發程式沒有安裝:
[root@mail log]# rpm -qa|grep gcc
libgcc-4.1.2-51.el5
[root@mail Unix-Syslog-1.1]# yum install gcc
[root@mail Unix-Syslog-1.1]# yum install gcc-c++
[root@mail Unix-Syslog-1.1]# yum install gcc-gfortran
[root@mail log]# rpm -qa|grep gcc
gcc-c++-4.1.2-51.el5
gcc-4.1.2-51.el5
gcc-gfortran-4.1.2-51.el5
libgcc-4.1.2-51.el5
[root@mail log]#



http://172.16.86.103/extman
出現如下錯誤:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
________________________________________
Apache/2.2.3 (CentOS) Server at 172.16.86.103 Port 80

 

解決方法:
[root@mail log]# vi /etc/httpd/conf/httpd.conf    //注掉以下行
#SuexecUserGroup postfix postfix
[root@mail log]# service httpd restart
 
[root@mail log]#touch /var/log/extmail.log
[root@mail log]# chown postfix.postfix /var/log/extmail.log
否則訪問http://172.16.86.103/extmail時會出現下述錯誤
/var/log/extmail.log not writable: Permission denied

 

进入ExtMan后,提示如下:
系统信息无法显示:No such file or directory
 
解决方法:
[root@mail daemon]# /var/www/extsuite/extman/daemon/cmdserver --daemon
[root@mail daemon]# vi /etc/rc.local  //add
/var/www/extsuite/extman/daemon/cmdserver --daemon
 


Extman,ExtMail问题一二三
一,初始登入extman时默认用户名为root@wht.com,密码为extmail*123*
即导入init-wht.ldif时密码,最后一个“dn: mail=root@wht.com, o=extmailManager, dc=wht.com”的密码,可以phpmyadmin中修改
二,刚开始可能权限没有加到,导致ExtMan无法在/home/vmail中自动创建域wht.com的目录及邮箱目录,在登入ExtMan后,在管理员—>操作编辑root@wht.com管理域名中加入所属域wht.com后,再创建用户就可以自动创建域目录wht.com及用户邮箱目录了

 
 
错误提示:
[root@mail log]# tail dovecot.log 
dovecot: Oct 08 14:37:24 Error: POP3(wht@wht.com): mkdir(/home/vmail/wht.comwht/Maildir/cur) failed: Permission denied
dovecot: Oct 08 14:37:24 Error: POP3(wht@wht.com): Couldn't open INBOX: Internal error occurred. Refer to server log for more information. [2011-10-08 14:37:24]
解决:
[root@mail log]# vi /etc/dovecot.conf
mail_location = maildir:/home/vmail/%d/%n/Maildir
上面在“%d%n”之间少加“/”,加上后即可。

错误提示:
发送邮件接收不到,提示:
[root@mail log]# tail maillog
Oct  8 15:05:06 mail postfix/pickup[3741]: 42678D5808A: uid=0 from=<root>
Oct  8 15:05:06 mail postfix/cleanup[3748]: 42678D5808A: message-id=<20111008070506.42678D5808A@mail.wht.com>
Oct  8 15:05:06 mail postfix/qmgr[3742]: 42678D5808A: from=<root@wht.com>, size=279, nrcpt=1 (queue active)
Oct  8 15:05:06 mail postfix/smtp[3750]: 42678D5808A: to=<wht@wht.com>, relay=none, delay=0.04, delays=0.02/0.02/0/0, dsn=5.4.6, status=bounced (mail for wht.com loops back to myself)
Oct  8 15:05:06 mail postfix/cleanup[3748]: 4BEA4D5808D: message-id=<20111008070506.4BEA4D5808D@mail.wht.com>
Oct  8 15:05:06 mail postfix/qmgr[3742]: 4BEA4D5808D: from=<>, size=1931, nrcpt=1 (queue active)
Oct  8 15:05:06 mail postfix/bounce[3751]: 42678D5808A: sender non-delivery notification: 4BEA4D5808D
Oct  8 15:05:06 mail postfix/qmgr[3742]: 42678D5808A: removed
Oct  8 15:05:06 mail postfix/smtp[3750]: 4BEA4D5808D: to=<root@wht.com>, relay=none, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for wht.com loops back to myself)
Oct  8 15:05:06 mail postfix/qmgr[3742]: 4BEA4D5808D: removed

[root@mail ~]# vi /etc/postfix/main.cf
local_recipient_maps =          //add
mydestination = $myhostname, localhost.$mydomain, localhost ,wht.com
如下修改后提示如下

[root@mail ~]# tail /var/log/maillog
Oct  8 17:54:23 mail postfix/local[4434]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Oct  8 17:54:23 mail postfix/local[4436]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Oct  8 17:54:23 mail postfix/local[4434]: 9BE27D58096: to=<t1@wht.com>, relay=local, delay=0.07, delays=0.04/0.02/0/0.02, dsn=5.1.1, status=bounced (unknown user: "t1")
Oct  8 17:54:24 mail postfix/local[4436]: 9BE27D58096: to=<wht@wht.com>, relay=local, delay=0.92, delays=0.04/0.03/0/0.86, dsn=5.1.1, status=bounced (unknown user: "wht")
Oct  8 17:54:24 mail postfix/cleanup[4431]: 86C78D58099: message-id=<20111008095424.86C78D58099@mail.wht.com>
Oct  8 17:54:24 mail postfix/qmgr[4427]: 86C78D58099: from=<>, size=4451, nrcpt=1 (queue active)
Oct  8 17:54:24 mail postfix/bounce[4435]: 9BE27D58096: sender non-delivery notification: 86C78D58099
Oct  8 17:54:24 mail postfix/qmgr[4427]: 9BE27D58096: removed
Oct  8 17:54:24 mail postfix/local[4434]: 86C78D58099: to=<wht@wht.com>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=5.1.1, status=bounced (unknown user: "wht")
Oct  8 17:54:24 mail postfix/qmgr[4427]: 86C78D58099: removed

用webmin联到postfix观察虚拟网域时发现。
原来用postfixadmin+mysql做的,正常是:
 
No mappings of this type have been defined yet.
没有认到虚拟邮箱

 
点下去发现ldap是匿名登陆的,于是用ldap brower测试,发现匿名找不到ldap帐户
 
 
于是修改
[root@mail openldap]# vi /etc/openldap/slapd.conf
access to dn.base="" by * read
access to dn.base="cn=Subschema" by * read
access to *
        by self write
        by users read
        by anonymous read   //原来是by anonymous auth
        by * none
[root@mail openldap]# service ldap restart
让匿名用户可以访问ldap
再用ldap brower测试 ,正常

再后来,如果不修改ldap支持匿名查询,也可以通过修改/etc/postfix/ldap/ldap_virtual_*几个虚拟域的文件,添加登入ldap的dn及possword后也可以,只不过ldap_virtual_*五个虚拟域文件都要修改,比较麻烦,以下仅以ldap_virtual_alias_maps.cf文件作示需要添加登入ldap的内容。

[root@mail ldap]# vi /etc/postfix/ldap/ldap_virtual_alias_maps.cf //增加以下蓝字内容。
server_host = localhost
search_base = o=extmailAlias,dc=wht.com
query_filter = (&(objectClass=extmailAlias)(mailLocalAddress=%s)(active=1))
result_attribute = mail
cache = no
bind = yes
scope = sub
start_tls = no
bind_dn = cn=Manager,dc=wht.com
bind_pw = postfix
原来ldap_virtual_alias_maps.cf的设置是
[root@mail ldap]# more ldap_virtual_alias_maps.cf 
server_host = localhost
search_base = o=extmailAlias,dc=wht.com
query_filter = (&(objectClass=extmailAlias)(mailLocalAddress=%s)(active=1))
result_attribute = mail
cache = no
bind = no
scope = sub
[root@mail ldap]#

 
 
再来,只找到一个support@wht.com,在进步,再查
[root@mail openldap]# mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
B15F0D580A0      276 Mon Oct 10 12:25:00  root@wht.com
                                             (mail system configuration error)
                                         wht@test.com

37816D5809D      277 Mon Oct 10 11:45:05  root@wht.com
                                             (mail system configuration error)
                                         wht@wht.com

37611D58097      274 Mon Oct 10 09:20:56  root@wht.com
                                             (mail system configuration error)
                                         wht@wht.com

D8122D58096      275 Mon Oct 10 09:06:06  root@wht.com
                                             (mail system configuration error)
                                         wht@wht.com

A78E9D580A6      556 Mon Oct 10 12:26:31  t1@test.com
                                             (mail system configuration error)
                                         wht@test.com

-- 2 Kbytes in 5 Requests.
[root@mail openldap]#
Oct 10 14:50:25 mail postfix/smtpd[14824]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Oct 10 14:50:25 mail postfix/smtpd[14824]: connect from localhost.localdomain[127.0.0.1]
Oct 10 14:50:25 mail postfix/smtpd[14824]: D4587D58096: client=localhost.localdomain[127.0.0.1]
Oct 10 14:50:25 mail postfix/cleanup[14827]: D4587D58096: message-id=<20111010065025.D4587D58096@mail.wht.com>
Oct 10 14:50:25 mail postfix/smtpd[14824]: disconnect from localhost.localdomain[127.0.0.1]
Oct 10 14:50:25 mail postfix/qmgr[14772]: D4587D58096: from=<t1@wht.com>, size=658, nrcpt=1 (queue active)
Oct 10 14:50:25 mail postfix/virtual[14828]: warning: recipient wht@wht.com: bad uid 89 in virtual_uid_maps
Oct 10 14:50:26 mail postfix/virtual[14828]: D4587D58096: to=<wht@wht.com>, relay=virtual, delay=0.16, delays=0.08/0.01/0/0.08, dsn=
4.3.5, status=deferred (mail system configuration error)
Oct 10 14:50:33 mail postfix/smtpd[14824]: connect from unknown[172.16.100.10]
Oct 10 14:50:33 mail postfix/smtpd[14824]: 925A8D58099: client=unknown[172.16.100.10]
Oct 10 14:50:33 mail postfix/cleanup[14827]: 925A8D58099: message-id=<62F99912657D43D8A40A5830F6E4AABF@whtpc>
Oct 10 14:50:33 mail postfix/qmgr[14772]: 925A8D58099: from=<wht@wht.com>, size=1304, nrcpt=1 (queue active)
Oct 10 14:50:33 mail postfix/virtual[14828]: warning: recipient t1@wht.com: bad uid 89 in virtual_uid_maps
Oct 10 14:50:33 mail postfix/smtpd[14824]: disconnect from unknown[172.16.100.10]
Oct 10 14:50:33 mail postfix/virtual[14828]: 925A8D58099: to=<t1@wht.com>, relay=virtual, delay=0.05, delays=0.05/0/0/0, dsn=4.3.5, 
status=deferred (mail system configuration error)


解決方法:
//重新安装postfix,设置postfix的uid gid都是extmail默认的1000
[root@mail home]#cp /etc/postfix/main.cf ~/backup
[root@mail home]#cp /usr/lib/sasl2/smtpd.conf ~/backup
[root@mail backup]# service postfix stop
[root@mail backup]# yum remove postfix
[root@mail backup]#groupdel postfix
[root@mail backup]#userdel postfix
[root@mail home]# groupadd -g 1000 postfix
[root@mail home]# useradd postfix -g postfix -u 1000 -G postdrop -c "Postfix User" -d /dev/null -s /sbin/nologin
[root@mail wht.com]# id postfix
uid=1000(postfix) gid=1000(postfix) groups=1000(postfix),90(postdrop)
[root@mail backup]# yum install postfix
[root@mail backup]# cp –y ~/backup/main.cf /etc/postfix
[root@mail backup]# cp –y ~/backup/smtpd.conf /usr/lib/sasl2/
[root@mail wht.com]# postconf -n
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 5242880
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = wht.com
myhostname = mail.wht.com
mynetworks = 172.16.0.0/16, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_banner = $myhostname ESMTP "Version not Available"
smtpd_client_restrictions = permit_sasl_authenticated
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_path = /var/run/dovecot/auth-client
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
unknown_local_recipient_reject_code = 550
virtual_alias_domains = 
virtual_alias_maps = ldap:/etc/postfix/ldap/ldap_virtual_alias_maps.cf
virtual_gid_maps = static:1000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = ldap:/etc/postfix/ldap/ldap_virtual_domains_maps.cf
virtual_mailbox_limit = 209715200
virtual_mailbox_maps = ldap:/etc/postfix/ldap/ldap_virtual_mailbox_maps.cf
virtual_transport = virtual
virtual_uid_maps = static:1000

[root@mail postfix]# cat /etc/dovecot.conf |grep -v "#"
base_dir = /var/run/dovecot/
protocols = imap imaps pop3 pop3s
listen = *
log_path = /var/log/dovecot.log
info_log_path =  /var/log/dovecot-info.log
mail_location = maildir:/home/vmail/%d/%n/Maildir
first_valid_uid = 1000
protocol imap {
}
 protocol pop3 {
}
protocol lda {
  postmaster_address = postmaster@wht.com
}
auth default {
  mechanisms = plain login
  passdb pam {
  }
  passdb ldap {
    args = /etc/dovecot-ldap.conf
  }
  userdb passwd {
  }
  userdb ldap {
    args = /etc/dovecot-ldap.conf
  }
  user = root
  socket listen {
    client {
      path = /var/run/dovecot/auth-client
      mode = 0660
      user = postfix
      group = postfix
    }
  }
}
dict {
}
plugin {
}
[root@mail postfix]#

[root@mail postfix]# cat /etc/dovecot-ldap.conf |grep -v "#"  
hosts = 172.16.86.103:389
dn = cn=Manager,dc=wht.com
dnpass = postfix
ldap_version = 3
base =  o=extmailAccount,dc=wht.com
deref = never
scope = subtree
user_attrs = mail,homeDirectory,,,uidNumber,gidNumber
user_filter = (&(objectClass=extmailUser)(mail=%u)(active=1))
pass_attrs = mail,userPassword
pass_filter = (&(objectClass=extmailUser)(mail=%u)(active=1))
default_pass_scheme = plain
user_global_uid = 1000
user_global_gid = 1000
auth_bind = yes
[root@mail postfix]#
[root@mail postfix]#service postfix start
[root@mail postfix]#service dovecot restart

[root@mail home]# chown -R postfix.postfix /home/vmail
[root@mail home]# chown -R postfix.postfix /tmp/extmail
[root@mail home]# chown -R postfix.postfix /tmp/extman
[root@mail home]# chown -R postfix.postfix /tmp/sid_*
[root@mail postfix]# chown -R postfix.postfix /var/www/extsuite/extman/cgi
[root@mail postfix]# chown -R postfix.postfix /var/www/extsuite/extmail/cgi
[root@mail extman]# vi /var/www/extsuite/extman/webman.cf
SYS_DEFAULT_UID = 1000
SYS_DEFAULT_GID = 1000
[root@mail extman]#service httpd restart

[root@mail extman]# cat /etc/openldap/slapd.conf |grep -v "#"
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/extmail.schema
allow bind_v2

pidfile         /var/run/openldap/slapd.pid
argsfile        /var/run/openldap/slapd.args
access to dn.base="" by * read
access to dn.base="cn=Subschema" by * read
access to *     
        by self write 
        by users read 
        by anonymous read
        by * none
database        bdb
suffix          "dc=wht.com"
rootdn          "cn=Manager,dc=wht.com"
rootpw          {SSHA}wJeA7NVNB7XtXeC8/3PIKJnSuPYbkvKA
directory       /var/lib/ldap
index objectClass                       eq,pres
index mail,active,virtualDomain,mailLocalAddress        eq,pres
loglevel        256
[root@mail extman]#


[root@mail extmail]# cat webmail.cf |grep -v "#"
SYS_CONFIG = /var/www/extsuite/extmail/
SYS_LANGDIR = /var/www/extsuite/extmail/lang
SYS_TEMPLDIR = /var/www/extsuite/extmail/html
SYS_HTTP_CACHE = 0
SYS_SMTP_HOST = 127.0.0.1
SYS_SMTP_PORT = 25
SYS_SMTP_TIMEOUT = 5
SYS_SPAM_REPORT_ON = 0
SYS_SPAM_REPORT_TYPE = dspam
SYS_SHOW_WARN = 0
SYS_PERMIT_NOQUOTA = 1
SYS_SESS_DIR = /tmp
SYS_UPLOAD_TMPDIR = /tmp
SYS_LOG_ON = 1
SYS_LOG_TYPE = file
SYS_LOG_FILE = /var/log/extmail.log
SYS_SESS_TIMEOUT = 0
SYS_SESS_COOKIE_ONLY = 1
SYS_USER_PSIZE = 10
SYS_USER_SCREEN = auto
SYS_USER_LANG = zh_TW
SYS_APP_TYPE = WebMail
SYS_USER_TEMPLATE = default
SYS_USER_CHARSET = utf-8
SYS_USER_TRYLOCAL = 1
SYS_USER_TIMEZONE = +0800
SYS_USER_CCSENT = 1
SYS_USER_SHOW_HTML = 1
SYS_USER_COMPOSE_HTML = 1
SYS_USER_CONV_LINK =1
SYS_USER_ADDR2ABOOK = 1
SYS_MESSAGE_SIZE_LIMIT = 5242880
SYS_MIN_PASS_LEN = 2
SYS_MFILTER_ON = 1

SYS_NETDISK_ON = 1
SYS_SHOW_SIGNUP = 1
SYS_DEBUG_ON = 1
SYS_AUTH_TYPE = ldap
SYS_MAILDIR_BASE = /home/vmail
SYS_AUTH_SCHEMA = virtual
SYS_CRYPT_TYPE = crypt
SYS_MYSQL_USER = db_user
SYS_MYSQL_PASS = db_pass
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = localhost
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
SYS_MYSQL_TABLE = mailbox
SYS_MYSQL_ATTR_USERNAME = username
SYS_MYSQL_ATTR_DOMAIN = domain
SYS_MYSQL_ATTR_PASSWD = password
SYS_MYSQL_ATTR_CLEARPW = clearpwd
SYS_MYSQL_ATTR_QUOTA = quota
SYS_MYSQL_ATTR_NDQUOTA = netdiskquota
SYS_MYSQL_ATTR_HOME = homedir
SYS_MYSQL_ATTR_MAILDIR = maildir
SYS_MYSQL_ATTR_DISABLEWEBMAIL = disablewebmail
SYS_MYSQL_ATTR_DISABLENETDISK = disablenetdisk
SYS_MYSQL_ATTR_DISABLEPWDCHANGE = disablepwdchange
SYS_MYSQL_ATTR_ACTIVE = active
SYS_MYSQL_ATTR_PWD_QUESTION = question
SYS_MYSQL_ATTR_PWD_ANSWER = answer
SYS_LDAP_BASE = o=extmailAccount,dc=wht.com
SYS_LDAP_RDN = cn=Manager,dc=wht.com
SYS_LDAP_PASS = postfix
SYS_LDAP_HOST = localhost
SYS_LDAP_ATTR_USERNAME = mail
SYS_LDAP_ATTR_DOMAIN = virtualDomain
SYS_LDAP_ATTR_PASSWD = userPassword
SYS_LDAP_ATTR_CLEARPW = clearPassword
SYS_LDAP_ATTR_QUOTA = mailQuota
SYS_LDAP_ATTR_NDQUOTA = netdiskQuota
SYS_LDAP_ATTR_HOME = homeDirectory
SYS_LDAP_ATTR_MAILDIR = mailMessageStore
SYS_LDAP_ATTR_DISABLEWEBMAIL = disablewebmail
SYS_LDAP_ATTR_DISABLENETDISK = disablenetdisk
SYS_LDAP_ATTR_DISABLEPWDCHANGE = disablePasswdChange
SYS_LDAP_ATTR_ACTIVE = active
SYS_LDAP_ATTR_PWD_QUESTION = question
SYS_LDAP_ATTR_PWD_ANSWER = answer
SYS_AUTHLIB_SOCKET = /var/spool/authdaemon/socket
SYS_G_ABOOK_TYPE = ldap
SYS_G_ABOOK_LDAP_HOST = localhost
SYS_G_ABOOK_LDAP_BASE = ou=AddressBook,dc=wht.com
SYS_G_ABOOK_LDAP_ROOTDN = cn=Manager,dc=wht.com
SYS_G_ABOOK_LDAP_ROOTPW = postfix
SYS_G_ABOOK_LDAP_FILTER = objectClass=OfficePerson
SYS_G_ABOOK_FILE_PATH = /var/www/extsuite/extmail/globabook.cf
SYS_G_ABOOK_FILE_LOCK = 1
SYS_G_ABOOK_FILE_CONVERT = 0
SYS_G_ABOOK_FILE_CHARSET = utf-8
[root@mail extmail]#


[root@mail extman]# cat webman.cf |grep -v "#"  
SYS_CONFIG = /var/www/extsuite/extman/
SYS_LANGDIR = /var/www/extsuite/extman/lang
SYS_TEMPLDIR = /var/www/extsuite/extman/html
SYS_MAILDIR_BASE = /home/vmail
SYS_SHOW_WARN = 0
SYS_SESS_DIR = /tmp/extman/
SYS_CAPTCHA_ON = 0
SYS_CAPTCHA_KEY = r3s9b6a7
SYS_CAPTCHA_LEN = 6
SYS_PURGE_DATA = 0
SYS_PSIZE = 20
SYS_APP_TYPE = ExtMan
SYS_TEMPLATE_NAME = default
SYS_DEFAULT_EXPIRE = 1y
SYS_GROUPMAIL_SENDER = postmaster@wht.com
SYS_DEFAULT_SERVICES = webmail,smtpd,smtp,pop3,netdisk
SYS_ISP_MODE = no
SYS_DOMAIN_HASHDIR = yes
SYS_DOMAIN_HASHDIR_DEPTH = 2x2
SYS_USER_HASHDIR = yes
SYS_USER_HASHDIR_DEPTH = 2x2
SYS_MIN_UID = 500
SYS_MIN_GID = 100
SYS_DEFAULT_UID = 1000
SYS_DEFAULT_GID = 1000
SYS_QUOTA_MULTIPLIER = 1048576
SYS_QUOTA_TYPE = courier
SYS_DEFAULT_MAXQUOTA = 500
SYS_DEFAULT_MAXALIAS = 100
SYS_DEFAULT_MAXUSERS = 100
SYS_DEFAULT_MAXNDQUOTA = 500
SYS_USER_DEFAULT_QUOTA = 5
SYS_USER_DEFAULT_NDQUOTA = 5
SYS_USER_DEFAULT_EXPIRE = 1y
SYS_BACKEND_TYPE = ldap
SYS_CRYPT_TYPE = crypt
SYS_MYSQL_USER = webman
SYS_MYSQL_PASS = webman
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = localhost
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
SYS_MYSQL_TABLE = manager
SYS_MYSQL_ATTR_USERNAME = username
SYS_MYSQL_ATTR_PASSWD = password

SYS_LDAP_BASE = dc=wht.com
SYS_LDAP_RDN = cn=Manager,dc=wht.com
SYS_LDAP_PASS = postfix
SYS_LDAP_HOST = localhost
SYS_LDAP_ATTR_USERNAME = mail
SYS_LDAP_ATTR_PASSWD = userPassword
SYS_RRD_DATADIR = /var/lib
SYS_RRD_TMPDIR = /tmp/viewlog
SYS_RRD_QUEUE_ON = yes
SYS_CMDSERVER_SOCK = /tmp/cmdserver.sock 
SYS_CMDSERVER_MAXCONN = 5
SYS_CMDSERVER_PID = /var/run/cmdserver.pid
SYS_CMDSERVER_LOG = /var/log/cmdserver.log
SYS_CMDSERVER_AUTHCODE = your_auth_code_here
SYS_IGNORE_SERVER_LIST = web
[root@mail extman]#




使Apache支持suEXEC,避免user apache & postfix相冲突,导致部分网页显示不正常
[root@mail extmail]# vi /etc/httpd/conf/httpd.conf
LoadModule suexec_module        lib/apache/mod_suexec.so
User apache
Group apache

<VirtualHost *:80>
#
#Extmail
#
# Directives to allow use of Extmail as a CGI
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
<Directory "/var/www/extsuite/extmail/cgi">
     AllowOverride None
     Options None
     Order allow,deny
     Allow from all
</Directory>
# This is to permit URL access to scripts/files in Extmail directory.
Alias /extmail /var/www/extsuite/extmail/html
<Directory “/var/www/extsuite/extmail/html”>
      Options Indexes FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
</Directory>

ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi
<Directory "/var/www/extsuite//extman/cgi">
     AllowOverride None
     Options None
     Order allow,deny
     Allow from all
</Directory>
Alias /extman /var/www/extsuite/extman/html
SuexecUserGroup postfix postfix
<Directory “/var/www/extsuite/extman/html”>
      Options Indexes FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
</Directory>

</VirtualHost>
[root@mail extmail]# service httpd restart


ExtMail验证证无法显示


[root@mail extman]# vi /var/www/extsuite/extman/webman.cf

省事的办法是关掉验证码,找到/extman/webman.cf
SYS_CAPTCHA_ON = 1  //0为关闭验证码
SYS_CAPTCHA_KEY = 7d7af0
SYS_CAPTCHA_LEN = 6(验证码位数)
治本的办法是安装perl-GD,安装方式如下“

[root@mail ~]# rpm -qa|grep gd
gd-2.0.33-9.4.el5_4.2
gdm-2.16.0-56.el5.centos
gdbm-1.8.0-26.2.1
sysklogd-1.4.1-46.el5
[root@mail ~]# yum install gd-devel

[root@mail ~]# rpm -qa|grep gd      
gd-2.0.33-9.4.el5_4.2
gdm-2.16.0-56.el5.centos
gdbm-1.8.0-26.2.1
sysklogd-1.4.1-46.el5
gd-devel-2.0.33-9.4.el5_4.2
[root@mail ~]#tail /var/log/httpd/error_log
[Wed Oct 12 17:15:50 2011] [error] [client 172.16.100.10] BEGIN failed--compilation aborted at /var/www/extsuite/extman/libs/Ext/GD.pm line 14., referer: http://172.16.86.103/extman/cgi/index.cgi?__mode=show_login&error=vcode
[root@mail ~]#
下载GD
ftp://ftp.cpan.org/pub/CPAN/modules/by-module/GD/GD-2.46.tar.gz
[root@mail soft]# tar zxvf GD-2.46.tar.gz
[root@mail soft]# cd GD-2.46
[root@mail GD-2.46]# perl Makefile.PL
[root@mail GD-2.46]# make 
[root@mail GD-2.46]# make test
[root@mail GD-2.46]# make install

 



安装图形化日志(ExtMan,查看邮件流量)


1)首先确认系统上是否安装gd,如果没有安装请安装gd

[root@mail ~]# rpm -qa|grep gd
gd-2.0.33-9.4.el5_4.2
gdm-2.16.0-56.el5.centos
gdbm-1.8.0-26.2.1
sysklogd-1.4.1-46.el5
[root@mail ~]# 
//如果没有以下安装
#tar xvf GD-2.45.tar.gz.gz
# cd GD-2.45
#./configure 
#make
#make install

2)    安装Time-HiRes

# wget http://cpan.weepee.org/authors/id/J/JH/JHI/Time-HiRes-1.9721.tar.gz
#tar xvf Time-HiRes-1.9721.tar.gz
#cd Time-HiRes-1.9721
#perl Makefile.PL
#make
#make test
#make install
3)    安装File-Tail

# wget http://ftp.belnet.be/mirror/ftp.cpan.org/authors/id/M/MG/MGRABNAR/File-Tail-0.99.3.tar.gz
#tar xvf File-Tail-0.99.3.tar.gz
#cd File-Tail-0.99.3
#perl Makefile.PL
#make 
#make test
#make install

4)    安装rrdtools
# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.4.tar.gz
#tar xvf    rrdtool-1.4.4_.tar.gz
#cd  rrdtool-1.4.4
#./configure --prefix=/usr/local/rrdtool
#make
#make install

编译rrdtool时会出现很多错误,照着出现的提示,下载lib包再安装即可,我的安装记录是
yum install cairo-devel
yum install pango-devel// 或pango-* 
//实际上以下两个包libxml和glib,系统都有默认安装,只是不知道怎么认不到,后来采用tar方式安装才认到,因为先tar安装glib2.14,最后才yum install pango,后来查看安装pango时随带也安装glib2.12的版本,也许就不用再安装了,后来想一想也许应该是yum和tar安装路径不一样,tar设置的路径的符合rrdtool的要求罢了
yum install libxml2
yum install libxml2-devel
yum install glib*
yum install glib-*

glib-2.0
下载地址:http://oss.oetiker.ch/rrdtool/pub/libs/
卸载自带的glib1.2.10版本,安装glib2.15.4
Make时出现错误
configure: error:
*** GLIB 2.13.5 or better is required. The latest version of
*** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/. 
参考网上的资料 是因为系统自带的GLIB的原因 
处理的方法如下: 
cd glib-2.14.0 
make uninstall 反安装 
#rm /usr/bin/glib* //删除系统自带 
#rm /usr/local/lib/glib-2.0 //同上

重新编译安装 glib-2.14.0 还在/usr/local目录下, 然后设置环境变量 
#export LD_LIBRARY_PATH=/usr/local/lib 
#export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure --prefix=$INSTALL_DIR
make 
make install

freetype
安装过程freetype字体时出现make: Nothing to be done for `unix'. 
这个错误不影响
也可以如下操作
# make clean
# make
pango

libxml2-2.6.32
./configure
make 
make install

复制mailgraph_ext到/usr/local,并启动之
# cp -r /var/www/extsuite/extman/addon/mailgraph_ext /usr/local 

5)    复制启动脚本,并把其加入到自动启动列队中

#cp /usr/local/mailgraph_ext/mailgraph-init /etc/rc.d/init.d/mailgraph
#chmod 700 /etc/rc.d/init.d/mailgraph
#chkconfig --add mailgraph
#chkconfig mailgraph on

[root@mail init.d]# ./mailgraph start
Starting mail statistics grapher: mailgraph_ext
Can't locate RRDs.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/mailgraph_ext/mailgraph_ext.pl line 292.
BEGIN failed--compilation aborted at /usr/local/mailgraph_ext/mailgraph_ext.pl line 292.
Starting queue statistics grapher: qmonitor
Can't locate RRDs.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/mailgraph_ext/qmonitor.pl line 8.
BEGIN failed--compilation aborted at /usr/local/mailgraph_ext/qmonitor.pl line 8.
[root@mail init.d]#

分析:
[root@mail init.d]# whereis rrdtool
rrdtool: /opt/rrdtool-1.4.4/bin/rrdtool
[root@mail rrdtool-1.4.4]cd /opt/rrdtool-1.4.4
[root@mail rrdtool-1.4.4]# find ./ -name "RRDs.pm"    
./lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm
安装rrdtool时未指定路径,直接./configure,将rrdtool安装在系统默认在/opt/rrd-tool-1.4.4下,在linux为了方便,将其安装在/usr/local下,所以重新安装rrdtool,如果不重新安装直接到“解决”执行ln –sv也行
[root@mail rrdtool-1.4.4]make uninstall
[root@mail rrdtool-1.4.4]cd ..
[root@mail soft]# rf –rf  rrdtool-1.4.4
[root@mail soft]# # tar zxvf rrdtool-1.4.4.tar.gz
[root@mail soft]# cd rrdtool-1.4.4  
[root@mail rrdtool-1.4.4]# ./configure --prefix=/usr/local/rrdtool
[root@mail rrdtool-1.4.4]make & make install
[root@mail rrdtool-1.4.4]# whereis rrdtool
rrdtool: /usr/local/rrdtool
[root@mail soft]# find /usr/local/rrdtool -name "RRDs.pm"      
/usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm

解决:
[root@mail 5.8.8]#ln -sv /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi

[root@mail i386-linux-thread-multi]# /etc/rc.d/init.d/mailgraph restart
Starting mail statistics grapher: mailgraph_ext
Can't locate loadable object for module RRDs in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/mailgraph_ext/mailgraph_ext.pl line 292
Compilation failed in require at /usr/local/mailgraph_ext/mailgraph_ext.pl line 292.
BEGIN failed--compilation aborted at /usr/local/mailgraph_ext/mailgraph_ext.pl line 292.
Starting queue statistics grapher: qmonitor
Can't locate loadable object for module RRDs in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/mailgraph_ext/qmonitor.pl line 8
Compilation failed in require at /usr/local/mailgraph_ext/qmonitor.pl line 8.
BEGIN failed--compilation aborted at /usr/local/mailgraph_ext/qmonitor.pl line 8.
解决:

[root@mail 5.8.8]# ln -sv /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/auto/RRDs /RRDs.so /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi

[root@mail i386-linux-thread-multi]# /etc/rc.d/init.d/mailgraph restart
Stopping mail statistics grapher: mailgraph_ext
Stopping queue statistics grapher: qmonitor
Starting mail statistics grapher: mailgraph_ext
Starting queue statistics grapher: qmonitor

[root@mail mailgraph_ext]# cd /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/
[root@mail i386-linux-thread-multi]# ll
總計 364
drwxr-xr-x 5 root root   4096 10月 12 10:18 auto
drwxr-xr-x 2 root root   4096 10月  7 12:32 Bundle
drwxr-xr-x 3 root root   4096 10月  7 12:32 DBD
drwxr-xr-x 8 root root   4096 10月  7 12:32 DBI
-r--r--r-- 1 root root 306143  4月 15  2010 DBI.pm
-r--r--r-- 1 root root   1533  7月 16  2007 dbixs_rev.pl
-r--r--r-- 1 root root  15161  3月 26  2005 Roadmap.pod
lrwxrwxrwx 1 root root     65 10月 12 14:21 RRDs.pm -> /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm
lrwxrwxrwx 1 root root     75 10月 12 14:33 RRDs.so -> /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/auto/RRDs/RRDs.so
-r--r--r-- 1 root root   1666  6月  8  2009 TASKS.pod
drwxr-xr-x 2 root root   4096 10月  7 12:30 Unix
drwxr-xr-x 2 root root   4096 10月  7 12:32 Win32
[root@mail i386-linux-thread-multi]#
[root@mail i386-linux-thread-multi]#

 
 


[root@mail rrdtool-1.4.4]# ./configure --prefix=/usr/local/rrdtool
...
Find 3rd-Party Libraries
checking for libdbi... no
checking for cairo_font_options_create in -lcairo... no
checking for pkg-config... pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no cairo-png.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of cairo-png. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libcairo and its header files. If
  you have not installed cairo-png, you can get it either from its original home on

     http://cairographics.org/releases/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of cairo-png is 1.4.6.

       LIBS=-lm 
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------
                
checking for cairo_svg_surface_create in -lcairo... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no cairo-svg.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of cairo-svg. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libcairo and its header files. If
  you have not installed cairo-svg, you can get it either from its original home on

     http://cairographics.org/releases/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of cairo-svg is 1.4.6.

       LIBS=-lm 
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------
                
checking for cairo_pdf_surface_create in -lcairo... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no cairo-pdf.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of cairo-pdf. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libcairo and its header files. If
  you have not installed cairo-pdf, you can get it either from its original home on

     http://cairographics.org/releases/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of cairo-pdf is 1.4.6.

       LIBS=-lm 
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------
                
checking for cairo_ps_surface_create in -lcairo... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no cairo-ps.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of cairo-ps. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libcairo and its header files. If
  you have not installed cairo-ps, you can get it either from its original home on

     http://cairographics.org/releases/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of cairo-ps is 1.4.6.

       LIBS=-lm 
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------
                
checking for glib_check_version in -lglib-2.0... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no glib-2.0.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of glib-2.0. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libglib-2.0 and its header files. If
  you have not installed glib-2.0, you can get it either from its original home on

     ftp://ftp.gtk.org/pub/glib/2.12/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of glib-2.0 is 2.12.12.

       LIBS=-lm 
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------
                
checking for pango_cairo_context_set_font_options in -lpangocairo-1.0... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no pangocairo.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of pangocairo. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libpangocairo-1.0 and its header files. If
  you have not installed pangocairo, you can get it either from its original home on

     http://ftp.gnome.org/pub/GNOME/sources/pango/1.17

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of pangocairo is 1.17.

       LIBS=-lm 
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------
                
checking for xmlParseFile in -lxml2... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no libxml-2.0.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of libxml-2.0. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libxml2 and its header files. If
  you have not installed libxml-2.0, you can get it either from its original home on

     http://xmlsoft.org/downloads.html

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of libxml-2.0 is 2.6.31.

       LIBS=-lm 
   LDFLAGS=
  CPPFLAGS= -I/usr/include/libxml2

----------------------------------------------------------------------------
                
configure: error: Please fix the library issues listed above and try again.

[root@mail rrdtool-1.4.4]# rpm -qa|grep libxml
libxml2-python-2.6.26-2.1.2.8.el5_5.1
libxml2-2.6.26-2.1.12
[root@mail rrdtool-1.4.4]# yum install cairo-devel
====================================================================================================================================
 Package                               Arch                  Version                                 Repository                Size
====================================================================================================================================
Installing:
 cairo-devel                           i386                  1.2.4-5.el5                             base                     131 k
Installing for dependencies:
 fontconfig-devel                      i386                  2.4.1-7.el5                             base                     168 k
 freetype-devel                        i386                  2.2.1-28.el5_5.1                        base                     148 k
 libX11-devel                          i386                  1.0.3-11.el5_7.1                        updates                  661 k
 libXau-devel                          i386                  1.0.1-3.1                               base                      11 k
 libXdmcp-devel                        i386                  1.0.1-2.1                               base                     7.5 k
 libXrender-devel                      i386                  0.9.1-3.1                               base                     8.8 k
 libpng-devel                          i386                  2:1.2.10-7.1.el5_7.5                    updates                  182 k
 mesa-libGL-devel                      i386                  6.5.1-7.8.el5                           base                     461 k
 xorg-x11-proto-devel                  i386                  7.1-13.el5                              base                     247 k
 zlib-devel                            i386                  1.2.3-4.el5                             base                     101 k
Updating for dependencies:
 libX11                                i386                  1.0.3-11.el5_7.1                        updates                  797 k
 libpng                                i386                  2:1.2.10-7.1.el5_7.5                    updates                  241 k

Transaction Summary
====================================================================================================================================
Install      11 Package(s)
Upgrade       2 Package(s)

Total download size: 3.1 M
Is this ok [y/N]: y
再运行rrdtool configure 只剩下三个包没有安装了。
[root@mail rrdtool-1.4.4]# ./configure

configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no glib-2.0.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of glib-2.0. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libglib-2.0 and its header files. If
  you have not installed glib-2.0, you can get it either from its original home on

     ftp://ftp.gtk.org/pub/glib/2.12/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of glib-2.0 is 2.12.12.

       LIBS=-lcairo -lcairo -lcairo -lm  -lcairo -lpng12  
   LDFLAGS=    
  CPPFLAGS= -I/usr/include/cairo -I/usr/include/libpng12 -I/usr/include/freetype2  

----------------------------------------------------------------------------
                
checking for pango_cairo_context_set_font_options in -lpangocairo-1.0... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no pangocairo.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of pangocairo. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libpangocairo-1.0 and its header files. If
  you have not installed pangocairo, you can get it either from its original home on

     http://ftp.gnome.org/pub/GNOME/sources/pango/1.17

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of pangocairo is 1.17.

       LIBS=-lcairo -lcairo -lcairo -lm  -lcairo -lpng12  
   LDFLAGS=    
  CPPFLAGS= -I/usr/include/cairo -I/usr/include/libpng12 -I/usr/include/freetype2  

----------------------------------------------------------------------------
                
checking for xmlParseFile in -lxml2... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no libxml-2.0.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of libxml-2.0. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libxml2 and its header files. If
  you have not installed libxml-2.0, you can get it either from its original home on

     http://xmlsoft.org/downloads.html

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of libxml-2.0 is 2.6.31.

       LIBS=-lcairo -lcairo -lcairo -lm  -lcairo -lpng12  
   LDFLAGS=    
  CPPFLAGS= -I/usr/include/cairo -I/usr/include/libpng12 -I/usr/include/freetype2   -I/usr/include/libxml2

----------------------------------------------------------------------------
                
configure: error: Please fix the library issues listed above and try again.

再透过此方法卸载自带的glib1.2.10版本,安装glib2.15.4

安装glib-2.0
下载地址:http://oss.oetiker.ch/rrdtool/pub/libs/
Make时出现错误
configure: error:
*** GLIB 2.13.5 or better is required. The latest version of
*** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/. 
参考网上的资料 是因为系统自带的GLIB的原因 
处理的方法如下: 
cd glib-2.14.0 
make uninstall 反安装 
#rm /usr/bin/glib* //删除系统自带 
#rm /usr/local/lib/glib-2.0 //同上

重新编译安装 glib-2.14.0 还在/usr/local目录下, 然后设置环境变量 
#export LD_LIBRARY_PATH=/usr/local/lib 
#export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure --prefix=$INSTALL_DIR
make 
make install


[root@mail pango-1.17.5]# pkg-config --modversion pango 
1.17.5

[root@mail ~]# rpm -qa|grep glib
glibc-2.5-65
dbus-glib-0.73-10.el5_5
glibc-common-2.5-65
glib2-2.12.3-4.el5_3.1
avahi-glib-0.6.16-9.el5_5
NetworkManager-glib-0.7.0-10.el5_5.2
glibc-headers-2.5-65
glib2-devel-2.12.3-4.el5_3.1
glibc-devel-2.5-65

[root@mail lib]# tar zxvf libxml2-2.6.32.tar.tar
[root@mail lib]# cd libxml2-2.6.32
[root@mail libxml2-2.6.32]# ./configure
[root@mail libxml2-2.6.32]# make
[root@mail libxml2-2.6.32]# make install
//libxml2安装上去后还剩下pango一个包了

[root@mail rrdtool-1.4.4]# ./configure
configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of pangocairo. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libpangocairo-1.0 and its header files. If
  you have not installed pangocairo, you can get it either from its original home on

     http://ftp.gnome.org/pub/GNOME/sources/pango/1.17

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of pangocairo is 1.17.

       LIBS=-lcairo -lcairo -lcairo -lm  -lcairo -lpng12   -lglib-2.0  
   LDFLAGS=     -L/usr/local/lib    
  CPPFLAGS= -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/include/cairo -I/usr/include/libpng12   -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include  


[root@mail rrdtool-1.4.4]# yum install pango-devel

Transaction Summary
====================================================================================================================================
Install       4 Package(s)
Upgrade       0 Package(s)

Total download size: 1.6 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): libXft-devel-2.1.10-1.1.i386.rpm                                                                      |  16 kB     00:00     
(2/4): libXext-devel-1.0.1-2.1.i386.rpm                                                                      |  57 kB     00:00     
(3/4): pango-devel-1.14.9-8.el5.centos.3.i386.rpm                                                            | 275 kB     00:01     
(4/4): glib2-devel-2.12.3-4.el5_3.1.i386.rpm                                                                 | 1.2 MB     00:02     



[root@mail rrdtool-1.4.4]# ./configure
----------------------------------------------------------------
Config is DONE!

          With MMAP IO: yes
      Build rrd_getopt: no
       Static programs: no
          Perl Modules: perl_piped perl_shared
           Perl Binary: /usr/bin/perl
          Perl Version: 5.8.8
          Perl Options: PREFIX=/opt/rrdtool-1.4.4 LIB=/opt/rrdtool-1.4.4/lib/perl/5.8.8
          Ruby Modules: 
           Ruby Binary: no
          Ruby Options: sitedir=/opt/rrdtool-1.4.4/lib/ruby
    Build Lua Bindings: no
    Build Tcl Bindings: no
 Build Python Bindings: no
          Build rrdcgi: yes
       Build librrd MT: yes
           Use gettext: yes
           With libDBI: no

             Libraries: -lcairo -lcairo -lcairo -lm  -lcairo -lpng12   -lglib-2.0   -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0   -lxml2  

Type 'make' to compile the software and use 'make install' to 
install everything to: /opt/rrdtool-1.4.4.

       ... that wishlist is NO JOKE. If you find RRDtool useful
make me happy. Go to http://tobi.oetiker.ch/wish and
place an order.

                               -- Tobi Oetiker <tobi@oetiker.ch>
----------------------------------------------------------------
[root@mail rrdtool-1.4.4]# make & make install

至此RRDTOOL安装完成

虚拟邮箱wht.com发向test.com正常。

 
 
 

安装openwebmail(未测试)


安装openwebmail之前首先要安装perl-Text-Iconv这个组件在http://openwebmail.org/openwebmail/download/redhat/rpm/packages/下载,注意64位系统要安装64位的包,也可以在上面下载openwebmail的包(安装openwebmail需要两个包openwebmail-data-2.53-3.i386.rpm和openwebmail-2.53-3.i386.rpm)
(1)首先要编辑yum的一个文件vi /etc/yum.repos.d/openwebmail.repo默认是不存在的(要是安装openwebmail RPM包的话可以省略1—2步)
添加下面的数据
[openwebmail]
## Thomas Chung 
## 2008.05.29
name=Openwebmail for Fedora or Enterprise Linux
baseurl=http://openwebmail.org/openwebmail/download/redhat/rpm/release/
enabled=1
gpgcheck=1
gpgkey=http://openwebmail.org/openwebmail/download/redhat/rpm/release/RPM-GPG-KEY-openwebmail
#metadata_expire=0
(2)下载openwebmail 
[root@ser etc]#yum -y  install openwebmail 
[root@ser etc]#cd /var/www/cgi-bin/openwebmail/
[root@ser etc]#./openwebmail-tool.pl  --init  #出现Y/N时 ,按N.
修改openwebmail 的一些配置文件
[root@ser etc]# vi dbm.conf 
dbm_ext                 .db
dbmopen_ext             .db
dbmopen_haslock         no
[root@ser etc]]# cd defaults/
[root@ser defaults]#  vi dbm.conf 
dbm_ext                 .db
dbmopen_ext             .db
dbmopen_haslock         yes
smtpserver  192.168.1.2
[root@ser defaults]#  vi openwebmail.conf
domainnames             ***.com
smtpserver              192.168.1.2
authpop3_server         192.168.1.2
 
[root@ser defaults]# cd  ../../openwebmail-tool.pl  --init  
出现Y/N 时,按Y。
11、配置httpd
[root@ser ~]# vi /etc/httpd/conf/httpd.conf 
ServerAdmin 
root@***.com
ServerName  mail.***.com:80 
AddHandler cgi-script .cgi .pl
Service httpd start
12、测试登陆openwebmail
在IE里输入mail.***.com/cgi-bin/openwebmail/openwebmail.pl, 这个地址是不是很长,那么我们来点短点的
在  httpd的 配置文件中添加 下面 内容:
ScriptAlias  /mail    /var/www/cgi-bin/openwebmail/openwebmail.pl
这样在IE 中直接输入
mail.yjw.com/mail
 
13、修改openwebmail的中文支持
Vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
Domainnames ltext.com
Default_language    zh_CM.GB2312 
Default_iconset      Cool3D .Chinese.Simplified
然后用登陆openwebmail测试如果还是英语,就新建一个用户试试。

PHP测试
#vi /var/www/html/test.php
<?
 phpinfo();
?>
http://172.16.86.103/test.php





ExtMail1.1.1 LDAP 全局地址本,手工维护
1,增加LDAP Schema
[root@mail ~]# more /etc/openldap/schema/officeperson.schema 
objectClass ( 1.3.6.1.4.1.4203.666.100.1 
        NAME ( 'officePerson' )
        SUP top STRUCTURAL
        DESC 'extmail address book'
        MUST ( cn )        
        MAY ( mail $ o $ telephoneNumber))
[root@mail ~]# 
2,修改slapd.conf
[root@mail ~]# more /etc/openldap/slapd.conf|grep "include"
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/extmail.schema
include         /etc/openldap/schema/officeperson.schema
[root@mail ~]# 

3,确认Extmail配置文件webmail.cf中是否支持LDAP
[root@mail ~]# more /var/www/extsuite/extmail/webmail.cf | grep 'ABOOK' 
SYS_G_ABOOK_TYPE = ldap
# if ldap, all relate parameters should prefix as SYS_G_ABOOK_LDAP
SYS_G_ABOOK_LDAP_HOST = localhost
SYS_G_ABOOK_LDAP_BASE = ou=AddressBook,dc=wht.com
SYS_G_ABOOK_LDAP_ROOTDN = cn=Manager,dc=wht.com
SYS_G_ABOOK_LDAP_ROOTPW = postfix
SYS_G_ABOOK_LDAP_FILTER = objectClass=OfficePerson
# if file, all relate parameters should prefix as SYS_G_ABOOK_FILE
SYS_G_ABOOK_FILE_PATH = /var/www/extsuite/extmail/globabook.cf
SYS_G_ABOOK_FILE_LOCK = 1
SYS_G_ABOOK_FILE_CONVERT = 0
SYS_G_ABOOK_FILE_CHARSET = utf-8
[root@mail ~]# 
3,重启LDAP服务
#service ldap restart
4,用PHPLDAPADMIN在增加OU=AddressBook,及添加第一个联系人
打开phpldapadmin 添加一项ou=AddressBook(Create new entry here=>Custom=>objclass选organizationalRole,cn和sn随便填)(选organizationalRole纯属个人喜好,其实有很多都能选,只是作为上一层目录随便便可)
然后点击ou=AddressBook=>Create a child entry=>Custom=>objclass选officeperson,然后那个表Required Attributes为必填,cn是你的名字,灰色那些栏可以选择,挑一个mail出来添上,然后你的extmail就可以查询到该全局地址本了...



ExtMail使用LDAP帐户信息作为全局通讯录,采用系统表,不须手工维护

说明:
优点:此直接采用Postfix后台LDAP表,直接调用,不须手工维护。
缺点:只能作一般通讯录,姓名,邮件地址,其它栏位没有,如果要添加可能要更改LDAP架构,在哪个文章上看过,没有试验过。

主要修改一下ExtMail的配置文档就可以了,直接使用虚拟域的OU,如下:
[root@mail extmail]# more webmail.cf|grep "ABOOK"
SYS_G_ABOOK_TYPE = ldap
# if ldap, all relate parameters should prefix as SYS_G_ABOOK_LDAP
SYS_G_ABOOK_LDAP_HOST = localhost
#SYS_G_ABOOK_LDAP_BASE = ou=AddressBook,dc=wht.com
SYS_G_ABOOK_LDAP_BASE = o=extmailAccount,dc=wht.com
SYS_G_ABOOK_LDAP_ROOTDN = cn=Manager,dc=wht.com
SYS_G_ABOOK_LDAP_ROOTPW = postfix
#SYS_G_ABOOK_LDAP_FILTER = objectClass=OfficePerson
SYS_G_ABOOK_LDAP_FILTER = objectClass=extmailUser
# if file, all relate parameters should prefix as SYS_G_ABOOK_FILE
SYS_G_ABOOK_FILE_PATH = /var/www/extsuite/extmail/globabook.cf
SYS_G_ABOOK_FILE_LOCK = 1
SYS_G_ABOOK_FILE_CONVERT = 0
SYS_G_ABOOK_FILE_CHARSET = utf-8

 

 
这位仁兄还提到中文化显示乱码的问题,因为我的没有遇到,就没有测试了,但还是记录下来:
如果进入extmail全局地址本后,全局地址本信息为乱码,需要修改extmail源代码并增加webmail.cf配置文件参数,方法如下:
vi /usr/local/www/extmail/libs/Ext/App/GlobalAbook.pm
修改:
sub _init_obj { 
......
if ($type eq 'ldap') {
        $obj = Ext::GlobalAbook->new(
            type => 'ldap',
            base => $sysconfig->{SYS_G_ABOOK_LDAP_BASE},
            rootdn => $sysconfig->{SYS_G_ABOOK_LDAP_ROOTDN},
            rootpw => $sysconfig->{SYS_G_ABOOK_LDAP_ROOTPW},
            filter => $sysconfig->{SYS_G_ABOOK_LDAP_FILTER},
            host => $sysconfig->{SYS_G_ABOOK_LDAP_HOST},
            convert => 1, # XXX this must exist for LDAP v3
            bind => 1,
        );
......
}
其中
            convert => 1, # XXX this must exist for LDAP v3
改为
            #convert => 1, # XXX this must exist for LDAP v3
接着加两行,内容如下:
            convert => $sysconfig->{SYS_G_ABOOK_LDAP_CONVERT},
            charset => $sysconfig->{SYS_G_ABOOK_LDAP_CHARSET},
存盘退出
vi /usr/local/www/extmail/webmail.cf
加上:
SYS_G_ABOOK_LDAP_CONVERT = 0
SYS_G_ABOOK_LDAP_CHARSET = utf-8
存盘退出



Extmail登陆时显示默认域:

#vi /var/www/extsuite/extmail/html/default/index.html
主要修改162行如下:
<TR>
                <TD><%domain%></TD>
                <TD><INPUT TYPE="text" class="input_n" NAME="domain" Value="wht.com"></TD>
        </TR>

 

SASL认证,默认域问题,Outlook中使用完整用户名问题解决:


操作步骤:
# vi /etc/dovecot.conf
//707Line add如下
auth_default_realm = wht.com
# service dovecot restart



阅读(2756) | 评论(1) | 转发(1) |
0

上一篇:Extmail:SASL认证默认域名问题,解决OUTLOOK中用户名须设置邮箱全名问题

下一篇:修改Oracle最大连接数

相关热门文章
  • 用PHP输出LDAP查询结果
  • postfix安装和设置
  • postfix日常维护
  • 基于postfix邮件解决方案...
  • <!--:zh-->VestaCP -&nbs...
  • 承接自动化测试培训、外包、实...
  • Solaris PowerTOP 1.0 发布
  • For STKMonitor
  • busybox的httpd使用CGI脚本(Bu...
  • 项目小体会
  • IBM DS3400 盘阵怎么查看是单...
  • 启动auditd时,报错如下,怎么...
  • CGSL系统中root密码正确,但无...
  • 在CGSL系统中,如何为不同的用...
  • CGSL系统如何设置交换分区的大...
给主人留下些什么吧!~~

sjlcyy2012-07-02 17:08:37

很不错!!

回复 | 举报
评论热议
0 0