您的位置:首页 > 大数据 > 人工智能

postfix dovecot extmail ldap

2012-09-17 21:45 204 查看

# yum install openldap-clients openldap-servers -y

# mkdir /var/www/extsuite

# tar zxf extmail-1.2.tar.gz -C /var/www/extsuite

# tar zxf extman-1.1.tar.gz -C /var/www/extsuite

# cd /var/www/extsuite

# mv extmail-1.2 extmail

# mv extman-1.1extman

# cd extman/docs/

# cp extmail.schema /etc/openldap/schema

# cd /etc/openldap

# rm -fr slapd.d

# cp slapd.conf.bak slapd.conf

# chgrp ldap slapd.conf

# cp /usr/share/doc/openldap-servers-2.4.19/DB_CONFIG.example /var/lib/ldap/DB_CONFIG

# chown ldap.ldap /var/lib/ldap/DB_CONFIG

# vi slapd.conf

include /etc/openldap/schema/corba.schema

include /etc/openldap/schema/core.schema

include /etc/openldap/schema/cosine.schema

include /etc/openldap/schema/duaconf.schema

include /etc/openldap/schema/dyngroup.schema

include /etc/openldap/schema/inetorgperson.schema

include /etc/openldap/schema/java.schema

#include /etc/openldap/schema/misc.schema

include /etc/openldap/schema/nis.schema

include /etc/openldap/schema/openldap.schema

include /etc/openldap/schema/ppolicy.schema

include /etc/openldap/schema/collective.schema

include /etc/openldap/schema/extmail.schema

allow bind_v2

pidfile /var/run/openldap/slapd.pid

argsfile /var/run/openldap/slapd.args

database bdb

suffix "dc=westos.org"

checkpoint 1024 15

rootdn "cn=Manager,dc=westos.org"

rootpw westos

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

database monitor

access to *

by dn.exact="cn=Manager,dc=westos.org" read

by * none

# service slapd start

# cd /var/www/extsuite/extman/docs/

# sed -i 's/extmail.org/westos.org/g' init.ldif

# ldapadd -W -x -D "cn=manager,dc=westos.org" -f init.ldif

Enter LDAP Password: westos

adding new entry "dc=westos.org"

adding new entry "cn=Manager,dc=westos.org"

adding new entry "o=extmailAccount,dc=westos.org"

adding new entry "o=extmailAlias,dc=westos.org"

adding new entry "o=extmailManager,dc=westos.org"

adding new entry "virtualDomain=westos.org, o=extmailAccount, dc=westos.org"

adding new entry "mail=postmaster@westos.org, virtualDomain=westos.org, o=extmailAccount,

dc=westos.org"

adding new entry "mailLocalAddress=support@westos.org, o=extmailAlias, dc=westos.org"

adding new entry "mail=root@westos.org, o=extmailManager, dc=westos.org"

注: postmaster@westos.org默认密码为extmail

root@westos.org默认密码为extmail*123*

# cp ldap_virtual_alias_maps.cf ldap_virtual_domains_maps.cf ldap_virtual_mailbox_maps.cf /etc/postfix/

# groupadd -g 600 vgroup

# useradd -u 600 -g vgroup -d /home/domains -s /sbin/nologin vuser

# postconf -e inet_interfaces=all

# postconf -e virtual_mailbox_base=/home/domains/

# postconf -e virtual_uid_maps=static:600

# postconf -e virtual_gid_maps=static:600

# postconf -e virtual_alias_maps=ldap:/etc/postfix/ldap_virtual_alias_maps.cf

# postconf -e virtual_mailbox_domains=ldap:/etc/postfix/ldap_virtual_domains_maps.cf

# postconf -e virtual_mailbox_maps=ldap:/etc/postfix/ldap_virtual_mailbox_maps.cf

# service postfix restart

# echo “hello world” | mail -s test support@westos.org

# ll -d /home/domains/westos.org/postmaster/Maildir/ 如自动创建用户目录表示成功

# yum install -y dovecot

# cp /usr/share/doc/dovecot-2.0/example-config/dovecot-ldap.conf.ext /etc/dovecot/

# cd /etc/dovecot/conf.d/

# vi 10-mail.conf

mail_location = maildir:/home/domains/%d/%n/Maildir

mail_uid = vuser

mail_gid = vgroup

first_valid_uid = 600

# vi 10-auth.conf

#!include auth-system.conf.ext

!include auth-ldap.conf.ext

# grep -v ^# ../dovecot-ldap.conf.ext

hosts = 127.0.0.1:389

dn = cn=Manager,dc=westos.org

dnpass = westos

auth_bind = yes

base = o=extmailAccount,dc=westos.org

deref = never

scope = subtree

pass_attrs = mail,userPassword

pass_filter = (&(objectClass=extmailUser)(mail=%u)(active=1))

default_pass_scheme = MD5

# service dovecot start

# telnet localhost 110

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

+OK Dovecot ready. <6a8.1.4f9ce1c6.LI4j9IG7RmIkeMFH4d95VA==@demo.example.com>

user postmaster@westos.org

+OK

pass extmail

+OK Logged in.

list

+OK 1 messages:

1 546

.

quit

+OK Logging out.

Connection closed by foreign host. 如此表示收信服务配置成功。

# yum install httpd perl-CGI perl-LDAP perl-GD -y

# vi /etc/httpd/conf/httpd.conf

NameVirtualHost *:80

<VirtualHost *:80>

DocumentRoot /var/www/html

ServerName demo.example.com

</VirtualHost>

<VirtualHost *:80>

ServerName mail.westos.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

SuexecUserGroup vuser vgroup

</VirtualHost>

# service httpd start

# cd /var/www/extsuite/extmail/

# chown -R vuser.vgroup cgi

# cp webmail.cf.default webmail.cf

# vi webmail.cf

SYS_LOG_ON = 1 #开启日志功能,需要安装Unix::Syslog模块;0表示关闭。

SYS_AUTH_TYPE = ldap

SYS_MAILDIR_BASE = /home/domains

SYS_CRYPT_TYPE = md5crypt

SYS_LDAP_BASE = o=extmailAccount,dc=westos.org

SYS_LDAP_RDN = cn=Manager,dc=westos.org

SYS_LDAP_PASS = westos

SYS_LDAP_HOST = localhost

# cd /var/www/extsuite/extman/

# chown -R vuser.vgroup cgi

# cp webman.cf.default webman.cf

# vi webman.cf

SYS_MAILDIR_BASE = /home/domains

SYS_SESS_DIR = /tmp

SYS_CAPTCHA_ON = 1

SYS_CAPTCHA_LEN = 4

SYS_BACKEND_TYPE = ldap

SYS_CRYPT_TYPE = plain

SYS_LDAP_BASE = dc=westos.org

SYS_LDAP_RDN = cn=Manager,dc=westos.org

SYS_LDAP_PASS = westos

SYS_LDAP_HOST = localhost

至此配置完成,测试http://mail.westos.org

rhel6上perl默认没有Unix::Syslog模块,在访问时会出现以下错误:

Unix::Syslog not found, please install it first! (in cleanup) Undefined subroutine &Ext::Logger::do_closelog

called at /var/www/extsuite/extmail/libs/Ext/Logger.pm line 86.

使用如下方法解决:

# yum install make gcc perl-ExtUtils-MakeMaker -y

# tar zxf Unix-Syslog-1.1.tar.gz 可从www.cpan.org网站下载

# cd Unix-Syslog-1.1

# perl Makefile.PL

# make test

# make install

登录http://mail.westos.org/extman 管理后台,会发现如下问题:

1. system信息无法显示,使用如下方法解决:

/var/www/extsuite/extman/daemon/cmdserver -d

可加入/etc/rc.local文件,实现开机自动启动。

2. Graph Log无法显示,使用如下方法解决:

# yum install rrdtool-perl perl-Time-HiRes -y

# tar zxf File-Tail-0.99.3.tar.gz

# cd File-Tail-0.99.3

# perl Makefile.PL

# make

# make install

# cp -r /var/www/extsuite/extman/addon/mailgraph_ext /usr/local

# /usr/local/mailgraph_ext/mailgraph-init start

可加入/etc/rc.local文件,实现开机自动启动。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  postfix ldap dovecot extmail