Hallo Steffen, thanks for your advices. Something helped me, but I still have a few misunderstandings. More is beside your answers below:
On Wed, 7 Feb 2018 08:14:43 +0100 (CET) Steffen Kaiser skdovecot@inf.h-brs.de wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, 6 Feb 2018, Franta Hanzlík wrote:
I want to use Dovecot LDA (or rather LMTP) use as local deliver with Postfix MTA. Users are in LDAP DB with structure as:
dn: cn=username, ou=rank, o=myorg cn: username objectClass: Person gidNumber: uNNN uidNumber: gNNN userPassword: (somehow hashed, can only bind verification) homeDirectory: /Home/$rank/$username mailActive: 0/1 mail: usera@OneDomain mail: userb@SecDomain (not all users have 2+ addresses] uid: username groupMembership: group DN (can be multiple times for different groups) ...
where:
- cn = uid = expected IMAP login username (which hasn't @domain part)
- user1 (and user2) isn't always same as username
?? What means this requirement?
It isn't requirement, but it is just a statement that the login name can not be derived from the mail, and vice versa, that the email address can not be derived from the login name.
LDAP database and mail practices are not my design, I just inherited them and I can not do almost anything with them.
Now I not know, how to solve IMO diferent requirements to userdb:
- LDA/LMTP need LDAP userdb unit, that can retrieve the name from an email address (ie for "usera@myDomain" returns cn/uid (as dovecot "username").
For LDA, just use another config.
Hm.. how to do it? Dovecot LMTP has not man page, nor own help, I found only something on wiki ( https://wiki2.dovecot.org/LMTP ), but there is nothing about how to use different userdb. Perhaps is not possible to specify different full dovecot.conf file (via option switch, environment variable or so)? Maybe is possible to specify alternative path for LMTP :
protocol lmtp { auth_socket_path = dovecot-lmtp-userdb }
but what next? Is possible to define some non-default user-defined auth-like service with this socket?
- IMAP server need LDAP userdb unit, that will have the user login (username) as the input parameter, and which returns information whether or not the user exists.
user_filter = (&(|(mail=%n)(uid=%u))(mailActive=1)(objectClass=person))
this assumes that usera (without @domain) is not the username of another entry and that there is one entry for each mail address only. Users may login with their mail address.
This point is clear to me. In IMAP user filter can be even more simpler, as login uid are unique in the whole database LDAP DB.
On the other hand, can you solve the aliases in LDAP into usernames by Postfix: http://www.postfix.org/ldap_table.5.html
thanks! The 'result_format' parameter has helped me. (but IMO some form of regex substitution would be much more useful)
user_attrs =
=home=%{ldap:homeDirectory},
=uid=%{ldap:uidNumber}, =gid=%{ldap:gidNumber}, =quota_rule=*:bytes=%{ldap:quotaBytes}, =namespace/default/separator=%{ldap:mailSeparator}Can anyone explain how these constructions work? And what do mean attribute notations in the form '=attr=' or '@attr=' or 'quota_rule=*:storage=100M' ? Nowhere have I found a sufficiently comprehensible description of these constructions...
https://wiki2.dovecot.org/AuthDatabase/LDAP/Userdb?highlight=%28%40mail%29
Yes, I've seen this page. But, there are examples rather than definitions with good description. Excuse me, this is maybe useful for dovecot developers, but not for normal administrator. For these constructions: '=mail' '@mail' 'quota_rule=*:storage=100M'
I can not see any comprehensible description. And for what I found on Dovecot site, e.g. these definitions for userdb attributes use every other form, I do understand only first one:
'https://wiki.dovecot.org/HowTo/DovecotOpenLdap': user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid (here <ldap attribute>=<dovecot field> describe mapping, not assignment)
'https://wiki.dovecot.org/Upgrading/1.2': user_attrs = homeDirectory=home=/var/mail/%$
'https://wiki.dovecot.org/AuthDatabase/LDAP/Userdb': user_attrs = =mail=maildir:/var/spool/vmail/
What do the last two mean?
Thanks, Franta Hanzlik