1 最后由 wenxin1234114 (2013-02-27 09:44:42) 编辑

主题: iredmail 0.8.3 mysql backend整合ldap验证

==== 必填信息。没有填写将不予回复 ====
- iRedMail 版本:
- 使用的 Linux/BSD 发行版名称及版本号:
- 与您的问题相关的日志信息:
==== ==== 必填信息。没有填写将不予回复 ====
- iRedMail 版本: 0.8.3
- 使用的 Linux/BSD 发行版名称及版本号: centos 6.3
- 与您的问题相关的日志信息:
====
张工,
最近可好?最近我安装iredmail 0.8.3基本mysql的,我想整合ldap验证,我配置如下:
我在dovecot.conf添加了如下几行:

#ldap users
passdb {
    driver = ldap
    args=/etc/dovecot/dovecot-ldap.conf
}
userdb {
    driver = ldap
    args=/etc/dovecot/dovecot-ldap.conf
}

/etc/dovecot/dovecot-ldap.conf 配置如下:

hosts           = 192.168.1.77
ldap_version    = 3
auth_bind       = yes
dn              = user@xxx.com
dnpass          = 123456
base            = CN=Users,DC=xxx,DC=com
scope           = subtree
deref           = never




user_filter = (&(objectClass=person)(|(mail=%u)))
pass_filter = (&(objectClass=person)(|(mail=%u)))


user_attrs = mail = user

日志报错如下:

Feb 27 09:21:46 auth: Debug: client in: AUTH    1    PLAIN    service=pop3    secured    lip=127.0.0.1    rip=127.0.0.1    lport=110    rport=45291    resp=AHlpbnh1ZXhpYW5nQG1hZGUtaW4tY2hpbmEuY29tADErMT10aHJlZQ==
Feb 27 09:21:46 auth-worker: Debug: Loading modules from directory: /usr/lib64/dovecot/auth
Feb 27 09:21:46 auth-worker: Debug: Module loaded: /usr/lib64/dovecot/auth/libauthdb_ldap.so
Feb 27 09:21:46 auth-worker: Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_mysql.so
Feb 27 09:21:46 auth-worker: Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_pgsql.so
Feb 27 09:21:46 auth-worker: Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
Feb 27 09:21:46 auth-worker: Debug: Module loaded: /usr/lib64/dovecot/auth/libmech_gssapi.so
Feb 27 09:21:46 auth-worker: Info: mysql(127.0.0.1): Connected to database vmail
Feb 27 09:21:46 auth-worker: Debug: sql(yinxue@test.com,127.0.0.1): query: SELECT password FROM mailbox WHERE username='yinxue@test.com' AND active='1'
Feb 27 09:21:46 auth-worker: Info: sql(yinxue@test.com,127.0.0.1): unknown user
Feb 27 09:21:46 auth: Debug: ldap(yinxue@test.com,127.0.0.1): bind search: base=CN=Users,DC=xxx,DC=com filter=(&(objectClass=person)(|(mail=yinxue@test.com)))
Feb 27 09:21:46 auth: Debug: ldap(yinxue@test.com,127.0.0.1): no fields returned by the server
Feb 27 09:21:46 auth: Debug: client out: OK    1    user=yinxue@test.com
Feb 27 09:21:46 auth: Debug: master in: REQUEST    3448111105    5387    1    35d25f310ef935f84db7fb79ab96bbaa
Feb 27 09:21:46 auth-worker: Debug: sql(yinxue@test.com,127.0.0.1): SELECT CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule FROM mailbox,domain WHERE mailbox.username='yinxue@test.com' AND mailbox.domain='test.com' AND mailbox.`enablepop3secured`=1 AND mailbox.domain=domain.domain AND domain.backupmx=0 AND domain.active=1 AND mailbox.active=1
Feb 27 09:21:46 auth-worker: Info: sql(yinxue@test.com,127.0.0.1): Unknown user
Feb 27 09:21:46 auth: Debug: ldap(yinxue@test.com,127.0.0.1): user search: base=CN=Users,DC=xxx,DC=com scope=subtree filter=(&(objectClass=person)(|(mail=yinxue@test.com))) fields=mail
Feb 27 09:21:46 auth: Debug: ldap(yinxue@test.com,127.0.0.1): no fields returned by the server
Feb 27 09:21:46 auth: Debug: master out: USER    3448111105    yinxue@test.com
Feb 27 09:21:46 pop3-login: Info: Login: user=<yinxue@test.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=5390, secured
Feb 27 09:21:46 pop3: Debug: Loading modules from directory: /usr/lib64/dovecot
Feb 27 09:21:46 pop3: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
Feb 27 09:21:46 pop3(yinxue@test.com): Debug: Effective uid=500, gid=500, home=
Feb 27 09:21:46 pop3(yinxue@test.com): Error: user yinxue@test.com: Initialization failed: userdb didn't return a home directory, but mail_location used it (%h): maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/
Feb 27 09:21:46 pop3(yinxue@test.com): Error: Invalid user settings. Refer to server log for more information.

看起来似乎是没连上ldap,麻烦有空帮看看,谢谢。

回复: iredmail 0.8.3 mysql backend整合ldap验证

日志里已经写明了:

Error: Invalid user settings. Refer to server log for more information.

对于 dovecot-ldap.conf 的设置,请参考这个模版文件:
https://bitbucket.org/zhb/iredmail/src/ … at=default

在 user_attrs 和 pass_attrs 必须有额外的属性。

3 最后由 wenxin1234114 (2013-02-27 11:47:29) 编辑

回复: iredmail 0.8.3 mysql backend整合ldap验证

试了还是不行,我们邮件帐户域名后辍和AD后辍不一样,我现在奇怪它为什么一直去本地找这个用户呢?

eb 27 09:21:46 auth: Debug: ldap(yinxue@test.com,127.0.0.1): user search: base=CN=Users,DC=xxx,DC=com scope=subtree filter=(&(objectClass=person)(|(mail=yinxue@test.com))) fields=mail

回复: iredmail 0.8.3 mysql backend整合ldap验证

我按照这个帖子已经弄差不多了。http://www.iredmail.com/wiki/index.php?title=Integration/Active.Directory.iRedMail

下面再调试一下。谢谢

5 最后由 wenxin1234114 (2013-02-27 16:57:33) 编辑

回复: iredmail 0.8.3 mysql backend整合ldap验证

分享下设置 :

hosts           = 192.168.1.77:389
ldap_version    = 3
auth_bind       = yes
dn              = user@test.com
dnpass          = 123456
base            = CN=Users,DC=test,DC=com
scope           = subtree
deref           = never
user_filter     = (&(mail=%u)(objectClass=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))
pass_filter     = (&(mail=%u)(objectClass=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))
pass_attrs      = userPassword=password
default_pass_scheme = CRYPT
user_attrs      = =home=/var/vmail/vmail1/%Ld/%Ln/Maildir/,=mail=maildir:/var/vmail/vmail1/%Ld/%Ln/Maildir/

回复: iredmail 0.8.3 mysql backend整合ldap验证

user_attrs 和 pass_attrs 里一定要带上 mail=user。例如:

user_attrs      = mail=user,=home=/var/vmail/vmail1/%Ld/%Ln/Maildir/,=mail=maildir:/var/vmail/vmail1/%Ld/%Ln/Maildir/