[Dovecot] Loginname - mapping
Hi!
I have a server with a few thousand mailboxes (for a few hundred domains) on it. The usernames are following several naming conventions:
username_domain domain_username username_domain.tld username-domain domain.username
The reason for this chaos is that the accounts were set up on different mailservers, some imail, some linux, some with virtualmin and some manually and through aquisitons etc it has all ended up in one server.
Now we are setting up atmail to replace imp. The loginprocess of atmail is a bit different in that you just type in your mail address and atmail tries a few combinations of loginnames to login.
However, some of the combinations over atmail cant login to. Some of them works fine when using this line in dovecot.conf
auth_username_translation = @_
Is there any facility to let dovecot do username mapping?
If I eg have a file: usermapping that looks like this:
user@domain1.com domain1_user user@domain2.com user_domain2 user@domain3.com domain3.user
And yes, I know that the best way is to start again and use virtual domains and get all into one naming standard, but unfortunately, that is not going to happen.
The other alternative is of course to hack into the source code of atmail, but I am not that confident in PHP.
Any ideas?
-- Regards Roald Amundsen
On Sat, 2008-11-29 at 21:49 +0100, Roald Amundsen wrote:
Is there any facility to let dovecot do username mapping?
If I eg have a file: usermapping that looks like this:
user@domain1.com domain1_user user@domain2.com user_domain2 user@domain3.com domain3.user
Yes, but can you change your passdb? You can use any passdb that allows specifying user=user@domain extra field (http://wiki.dovecot.org/PasswordDatabase/ExtraFields). For example with passwd-file (http://wiki.dovecot.org/AuthDatabase/PasswdFile):
domain1_user:{plain}pass:1000:1000::/home/domain1.com/user::user=user@domain1.com
Timo Sirainen wrote:
On Sat, 2008-11-29 at 21:49 +0100, Roald Amundsen wrote:
Is there any facility to let dovecot do username mapping?
If I eg have a file: usermapping that looks like this:
user@domain1.com domain1_user user@domain2.com user_domain2 user@domain3.com domain3.user
Yes, but can you change your passdb? You can use any passdb that allows specifying user=user@domain extra field (http://wiki.dovecot.org/PasswordDatabase/ExtraFields). For example with passwd-file (http://wiki.dovecot.org/AuthDatabase/PasswdFile):
domain1_user:{plain}pass:1000:1000::/home/domain1.com/user::user=user@domain1.com
Thanks, this seems to be what I am looking for. However, I am not sure if I am reading the links right. I am supposed to make a custom passwd-file, and point dovecot to this?
I can use a script to parse genericstable or even virtusertable and add this information at the end of the dovecot-passwd-file?
And I can still use /etc/passwd as a fallback in case something goes wrong? As long as I keep userdb passwd in dovecot.conf?
Well, I think I should be reading some more documentation and look at the example configs on the wiki. Thanks for the help!
-- Roald Amundsen
On Dec 1, 2008, at 10:49 PM, Roald Amundsen wrote:
Timo Sirainen wrote:
Is there any facility to let dovecot do username mapping?
If I eg have a file: usermapping that looks like this:
user@domain1.com domain1_user user@domain2.com user_domain2 user@domain3.com domain3.user Yes, but can you change your passdb? You can use any passdb that
allows specifying user=user@domain extra field (http://wiki.dovecot.org/PasswordDatabase/ExtraFields). For example
withOn Sat, 2008-11-29 at 21:49 +0100, Roald Amundsen wrote: passwd-file (http://wiki.dovecot.org/AuthDatabase/PasswdFile): domain1_user:{plain}pass:1000:1000::/home/domain1.com/user::user=user@domain1.com
Thanks, this seems to be what I am looking for. However, I am not
sure if I am reading the links right. I am supposed to make a custom
passwd-file, and point dovecot to this?I can use a script to parse genericstable or even virtusertable and
add this information at the end of the dovecot-passwd-file?
I guess. Just make sure that the file is updated using mv (rename())
command so that it gets updated atomically (so Dovecot never reads
partially written files).
And I can still use /etc/passwd as a fallback in case something goes
wrong? As long as I keep userdb passwd in dovecot.conf?
You could set that up with:
passdb passwd-file { args = /etc/dovecot.passwd } passdb passwd { }
Also if you keep using userdb passwd, you don't need to have the uid/ gid/home in the passwd-file at all, so the files would then look like:
domain1_user:{plain}pass::::::user=user@domain1.com
Timo Sirainen wrote:
On Dec 1, 2008, at 10:49 PM, Roald Amundsen wrote:
On Sat, 2008-11-29 at 21:49 +0100, Roald Amundsen wrote:
Is there any facility to let dovecot do username mapping? Yes, but can you change your passdb? You can use any passdb that allows specifying user=user@domain extra field I can use a script to parse genericstable or even virtusertable and add this information at the end of the dovecot-passwd-file? I guess. Just make sure that the file is updated using mv (rename()) command so that it gets updated atomically (so Dovecot never reads
Timo Sirainen wrote: partially written files). And I can still use /etc/passwd as a fallback in case something goes You could set that up with:
passdb passwd-file { args = /etc/dovecot.passwd } passdb passwd { }
Also if you keep using userdb passwd, you don't need to have the uid/gid/home in the passwd-file at all, so the files would then look like:
domain1_user:{plain}pass::::::user=user@domain1.com
Thanks a lot! This is exactly what I was looking for, but I didn't really think it was possible. Thanks for a great program!
-- Regards Roald Amundsen
participants (2)
-
Roald Amundsen
-
Timo Sirainen