Problem switching from LDA to LMTP (with Postfix)

Alex JOST
Fri, 04 Aug 2017 11:07:13 -0000

Am 04.08.2017 um 12:06 schrieb Nikolaos Milas:
> Hello,
>
> I am trying to switch from LDA to LMTP on a Postfix/Dovecot setup, but
> something is going wrong.
>
> I have followed the directions at:
> https://wiki.dovecot.org/HowTo/PostfixDovecotLMTP
>
> Here is a session from dovecot.log:
>
> Aug  4 12:19:42 vmail2 dovecot: lmtp(3152): Connect from local
> Aug  4 12:19:42 vmail2 dovecot: auth: ldap(imaptester at noa.gr): unknown
user
> Aug  4 12:19:42 vmail2 dovecot: lmtp(3152): Disconnect from local:
> Successful quit
> Aug  4 12:19:42 vmail2 dovecot: lmtp(3152): Connect from local
> Aug  4 12:19:42 vmail2 dovecot: auth: ldap(nmilas at noa.gr): unknown user
> Aug  4 12:19:42 vmail2 dovecot: lmtp(3152): Disconnect from local:
> Successful quit
> Aug  4 12:19:42 vmail2 dovecot: imap(nmilas): save: box=Sent, uid=31,
> msgid=<c84ae059-854d-12bc-6aa2-9099cc2977b2 at noa.gr>, size=445,
> vsize=459, from=Nikolaos Milas <nmilas at noa.gr>, subject=Test (12)
-
> vmail2, flags=(\Seen)
>
> What is going wrong?
>
> It seems authentication is not working correctly with this setup. If
> understand right, dovecot is querying ldap with the whole mail address
> and not with the local part only (which is the username), as I would
> expect.
>

>
> FILE: /etc/dovecot/dovecot-usrdb-ldap.conf
>
> hosts = localhost
> tls = no
> base = ou=people, dc=noa, dc=gr
> scope = onelevel
> ldap_version = 3
> dn = uid=auth,ou=Sys,dc=noa,dc=gr
> dnpass = secret
> auth_bind = yes
> user_filter = (uid=%u)
> pass_filter = (uid=%u)
> pass_attrs = uid=user,userPassword=password
> auth_bind_userdn = uid=%u,ou=people,dc=noa,dc=gr
> user_attrs = roomNumber=quota_rule=*:bytes=%$,uid=home=/home/vmail/%u
> iterate_filter = (objectClass=*)

You are searching for the complete username (%u = user at domain) but it
sounds like you only want the localpart (%n). See:

   https://wiki.dovecot.org/Variables

--
Alex JOST