Lmtp w/ Postfix and LDAP: change mailbox name when saving mail.

Dan White dwhite at olp.net
Wed Jan 21 10:07:27 EST 2009

k bah wrote:
> cyrus-imapd-2.3.8
> cyrus-sasl-2.1.22
> postfix-2.4.5
> --------
>   On my LDAP server, the uid field of each user (person) is: "username~domain.org".
>   I correctly set up cyrus and saslauthd to authenticate with the username as the LDAP field above. A simple Horde hook does the job to make "user at whatever domain he/she typed" into "user~whatever domain...".
>  When authenticating, if the mailbox does not exist it gets created (autocreatequota is nonzero on imapd.conf). The mailbox is created following that naming convention (username~domain..).
>  Is it possible to (automatically) create mailboxes with that naming convention? I want cyrus to save mail to "username~domain.org" instead of "username".

You can use the ldapdb user canonicalization patch for SASL (See CVS) 
for situations like this. It won't automatically created mailboxes, but 
it will direct cyrus IMAP to use an alternative name before referencing 
the mailbox.

For example:

sasl_ldapdb_uri: ldap://ldap.example.org
sasl_ldapdb_mech: GSSAPI
sasl_ldapdb_canon_attr: uid
#sasl_canon_user_plugin: ladpdb
#imap_sasl_canon_user_plugin: ldapdb
#pop3_sasl_canon_user_plugin: ldapdb
#nntp_sasl_canon_user_plugin: ldapdb
#sieve_sasl_canon_user_plugin: ldapdb
lmtp_sasl_canon_user_plugin: ldapdb

Where 'lmtp' matches the name you use within /etc/cyrus.conf. This would 
direct cyrus imap, after authenticating, to look up the 'uid' attribute 
within LDAP, and use it as the effective username (and mailbox name).

You would not need to change your authentication setup from saslauthd to 
ldapdb auxprop, since auxprop plugins and user canonicalization plugings 
can function independently.

See the '/doc/options.html' documentation for cyrus SASL for more 
options (in CVS).

- Dan

More information about the Info-cyrus mailing list