主题: 求教mysql存储的iredmail下别装ldap

==== 必填信息。没有填写将不予回复 ====
- iRedMail 版本号:
- 使用哪个数据库存储用户帐号(OpenLDAP,MySQL,PostgreSQL):
- 使用的 Linux/BSD 发行版名称及版本号:
- 与您的问题相关的日志信息:
====
之前曾经请教过的,mysql存储数据的情况下,目前没有ldap服务的,如果想有,需要自己另外安装配置,于是想知道有这方教程么?有谁曾经配置过?有可参考的么?谢谢

回复: 求教mysql存储的iredmail下别装ldap

在虚拟机里安装个 iRedMail,选择 OpenLDAP 后端,用里头的配置文件作参考。

3 最后由 yejunyue (2016-10-20 16:46:14) 编辑

回复: 求教mysql存储的iredmail下别装ldap

ZhangHuangbin 写道:

在虚拟机里安装个 iRedMail,选择 OpenLDAP 后端,用里头的配置文件作参考。

==== 必填信息。没有填写将不予回复 ====
- iRedMail 版本号:0.9.4
- 使用哪个数据库存储用户帐号(OpenLDAP,MySQL,PostgreSQL):MySQL
- 使用的 Linux/BSD 发行版名称及版本号:Ubuntu 14.04
- 与您的问题相关的日志信息:
======================================

张工好:
    我也遇到楼主的问题,我在虚拟机上安装 iRedMail,选择 OpenLDAP 后端,参照里头,修改了目标iRedmail服务器,无法实现LDAP登录。
【情况说明:我在另外一台服务器上搭建LAPD,已经在Gitlab、Redmine、Odoo上实现LDAP连接,现在想让iRedmail也使用这台LDAP认证】

以下是我在目标iRedmail上做的修改

【修改】
1、/etc/dovecot/dovecot.conf

=================================================
# Virtual mail accounts.
#userdb {
#    args = /etc/dovecot/dovecot-mysql.conf
#    driver = sql
#}
#passdb {
#    args = /etc/dovecot/dovecot-mysql.conf
#    driver = sql
#}
=================================================

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

2、新建/etc/dovecot/dovecot-ldap.conf

===================================================================
hosts           = 172.16.1.253:389        #根据我的LDAP修改,原文:127.0.0.1:389
ldap_version    = 3
auth_bind       = yes
dn              = cn=admin,dc=gmechina,dc=com  #根据我的LDAP修改,原文:cn=vmail,dc=gmechina,dc=com
dnpass          = ********                     # LDAP用户的明文密码,我在Gitlab配置LDAP时也是使用明文,可以正常使用。
base            = ou=people,dc=gmechina,dc=com #根据我的LDAP修改,原文:o=domains,dc=gmechina,dc=com
scope           = subtree
deref           = never

# Below two are required by command 'doveadm mailbox ...'
iterate_attrs   = mail=user
iterate_filter  = (&(objectClass=mailUser)(accountStatus=active)(enabledService=mail))

user_filter     = (&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
user_attrs      = mail=master_user,mail=user,homeDirectory=home,=mail=maildir:~/Maildir/,mailQuota=quota_rule=*:bytes=%$

# Used for dn lookup
pass_filter     = (&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
pass_attrs      = mail=user,userPassword=password,allowNets=allow_nets
default_pass_scheme = CRYPT

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

重启后,访问Web端,输入LDAP中的账号,提示“连接至IMAP服务器失败”。请问想实现Mysql-->LDAP的转变,除了以上的修改,还有其他地方要改,还是我的配置文件修改有误。

【错误Log】

1、/var/log/dovecot.log
错误log:
Oct 20 15:19:29 master: Info: Dovecot v2.2.9 starting up (core dumps disabled)
Oct 20 15:19:29 master: Warning: /var/lib/ureadahead/debugfs/tracing is no longer mounted. See http://wiki2.dovecot.org/Mountpoints
Oct 20 15:20:42 auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Oct 20 15:20:42 auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
Oct 20 15:20:42 auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Oct 20 15:20:42 auth: Fatal: Support not compiled in for passdb driver 'ldap'
Oct 20 15:20:42 master: Error: service(auth): command startup failed, throttling for 2 secs
Oct 20 15:20:42 imap-login: Info: Disconnected: Auth process broken (disconnected before auth was ready, waited 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, secured, session=<jRFyw0Y/DAB/AAAB>
Oct 20 15:20:55 auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Oct 20 15:20:55 auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
Oct 20 15:20:55 auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Oct 20 15:20:55 auth: Fatal: Support not compiled in for passdb driver 'ldap'
Oct 20 15:20:55 master: Error: service(auth): command startup failed, throttling for 4 secs
Oct 20 15:20:55 imap-login: Info: Disconnected: Auth process broken (disconnected before auth was ready, waited 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, secured, session=<EEg2xEY/EAB/AAAB>

2、/var/log/mail.log
错误log:
Oct 20 15:20:20 mail postfix/master[2919]: daemon started -- version 2.11.0, configuration /etc/postfix
Oct 20 15:20:20 mail postfix/qmgr[2927]: warning: /etc/postfix/main.cf, line 272: overriding earlier entry: recipient_bcc_maps=proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf    proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf
Oct 20 15:20:20 mail postfix/pickup[2923]: warning: /etc/postfix/main.cf, line 272: overriding earlier entry: recipient_bcc_maps=proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf    proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf
Oct 20 15:20:20 mail postfix/pickup[2923]: warning: /etc/postfix/main.cf, line 273: overriding earlier entry: sender_bcc_maps=proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf    proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf
Oct 20 15:20:20 mail postfix/qmgr[2927]: warning: /etc/postfix/main.cf, line 273: overriding earlier entry: sender_bcc_maps=proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf    proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf
Oct 20 15:20:20 mail postfix/proxymap[2934]: warning: /etc/postfix/main.cf, line 272: overriding earlier entry: recipient_bcc_maps=proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf    proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf
Oct 20 15:20:20 mail postfix/proxymap[2934]: warning: /etc/postfix/main.cf, line 273: overriding earlier entry: sender_bcc_maps=proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf    proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf
Oct 20 15:20:55 mail roundcube: <3bfvaalt> IMAP Error: Login failed for postmaster@xmgme.com from 192.168.17.1. Wrong startup greeting (127.0.0.1:143): * BYE Disconnected: Auth process broken in /opt/www/roundcubemail-1.1.4/program/lib/Roundcube/rcube_imap.php on line 197 (POST /mail/?_task=login?_task=login&_action=login)

【另外】

我将虚拟机的iRedmail的dovecot-ldap.conf改成上面的dovecot-ldap.conf,想试下使用OpenLDAP保存密码的iRedmail,改成我自己的LDAP会怎样。

【错误Log】

1、/var/log/dovecot.log
错误log:
Oct 20 16:00:12 master: Info: Dovecot v2.2.22 (fe789d2) starting up for pop3, imap, sieve, lmtp (core dumps disabled)
Oct 20 16:01:26 imap-login: Info: Disconnected (auth failed, 1 attempts in 2 secs): user=<postmaster@xmgme.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<f5X1VEc/Uqt/AAAB>
Oct 20 16:03:18 imap-login: Info: Disconnected (auth failed, 1 attempts in 2 secs): user=<yejunyue@xmgme.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<zkmpW0c/Xqt/AAAB>

2、/var/log/mail.log
错误log:
Oct 20 16:00:46 mails amavis[2126]: Using primary internal av scanner code for ClamAV-clamd
Oct 20 16:00:46 mails amavis[2126]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
Oct 20 16:00:46 mails amavis[2126]: Deleting db files __db.001,__db.002,nanny.db,snmp.db,__db.003 in /var/lib/amavis/db
Oct 20 16:00:46 mails amavis[2126]: Creating db in /var/lib/amavis/db/; BerkeleyDB 0.55, libdb 5.3
Oct 20 16:01:26 mails roundcube: <4ndi3uq7> IMAP Error:Login failed for yejunyue@xmgme.com from 192.168.17.1. LOGIN: Authentication failed.

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

问题:
1、想要实现Mysql-->OpenLDAP的转换,除了修改dovecot.conf和dovecot-ldap.conf外,还需要修改哪些地方?

2、是不是我的LDAP不适合iRedmail,要想建立iRedmail可以使用的LDAP,有没有那些关键的属性需要建立的。

3、我想用LDAP admin工具连接iRedmail的LDAP,为什么无法连接,需要做什么配置吗?

希望有人能帮忙解答下我的疑惑,谢谢!

回复: 求教mysql存储的iredmail下别装ldap

yejunyue 写道:

Oct 20 15:20:55 auth: Fatal: Support not compiled in for passdb driver 'ldap'

安装 dovecot-ldap 包,重启 dovecot 即可。
有什么问题都先看 log 文件,找到关键的 log,顺藤摸瓜。

另外,自己的技术问题请发一个新的论坛主题进行讨论,把问题描述清楚,附上相关 log 或配置文件等必要信息。不要在其他人的主题里跟帖。