[Dovecot] custom maildir location mapping
Greetings,
I'm migrating from a sendmail/dovecot setup with system users to a postfix/dovecot maildir setup with virtual users. To simplify the mess we've gotten into by having users that can't remember their username, we've switched to email address being the username. In order to allow for a smooth migration, I need to allow users to be able to login with their email address as well as their (old) username for about a month or so.
I have all the usernames, email addresses and passwords stored in SQL and I'm generating the userdb and passworddb manually.
Is there any way to create a userdb and passworddb so that users can login with either username or email address and have dovecot locate their maildir without an issue?
For example, I'd like to be able to login as either vlad or vlad@vladville.com and have dovecot locate my maildir:/var/spool/mail/%d/%n; I'd really appreciate any thoughts, ideas and examples anyone is willing to share. I'm really looking to avoid a shotgun approach ("On Feb 1, your new username is your email address").
Here are some notes on the currently functioning setup: I'm running dovecot 1.0.7 on CentOS 5.5 x64 with Postfix 2.3.3 mail_location = maildir:/var/spool/mail/%d/%n userdb static { args = uid=virtual gid=virtual home=/var/mail/%d/%u } passdb passwd-file { args = /etc/dovecot/passwd }
user@domain.com:{HMAC-MD5}1b05f379...
On 24.1.2011, at 23.30, Vlad Mazek wrote:
Is there any way to create a userdb and passworddb so that users can login with either username or email address and have dovecot locate their maildir without an issue? .. userdb static { args = uid=virtual gid=virtual home=/var/mail/%d/%u } passdb passwd-file { args = /etc/dovecot/passwd }
user@domain.com:{HMAC-MD5}1b05f379...
username:pass:...:user=user@domain.com
Where the last field is the "extra field" http://wiki.dovecot.org/AuthDatabase/PasswdFile
This changes the username to user@domain.com.
..
userdb static { args = uid=virtual gid=virtual home=/var/mail/%d/%u } passdb passwd-file { args = /etc/dovecot/passwd }
user@domain.com:{HMAC-MD5}1b05f379...
username:pass:...:user=user@domain.com
Where the last field is the "extra field" http://wiki.dovecot.org/AuthDatabase/PasswdFile
This changes the username to user@domain.com.
So the only required change is to add another line to the password file? Will test it in a bit, if it works it's amazingly slick. :)
participants (2)
-
Timo Sirainen
-
Vlad Mazek