[Dovecot] Loginname - mapping

Timo Sirainen tss at iki.fi
Mon Dec 1 23:44:39 EET 2008


On Dec 1, 2008, at 10:49 PM, Roald Amundsen wrote:

> 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 at domain1.com	domain1_user
>>> user at domain2.com	user_domain2
>>> user at domain3.com	domain3.user
>> Yes, but can you change your passdb? You can use any passdb that  
>> allows
>> specifying user=user at 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 at 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 at domain1.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20081201/b4d9dc13/attachment.bin 


More information about the dovecot mailing list