[Dovecot] What best decision to make for flatfiles or SQL when I use Dovecot2 + Postfix together?

Nick Rosier nick+dovecot at bunbun.be
Tue Sep 27 22:47:29 EEST 2011


Tom Hendrikx wrote:
> On 27/09/11 17:51, terryjames9461 at mm.st wrote:
>> Hello,
>>
>> I'm moving my mail server from Exchange to an opensource one.
>>
>> After a bunch of reading, I decided on building a Dovecot2 + Postfix
>> server in a VirtualUsers-only + Multiple-domains configuration.
>>
>> Since my messages will be stored by Dovecot, and the documentation is
>> really good, I figured that it's smartest to configure Dovecot, then
>> make Postfix 'fit' to it, sharing the data files that way.
>>
>> I read through lots of the Dovecot wiki for v2.
>>
>> There are many ways for storing the database data.  My goal is to only
>> have data in one instances, used by both Postfix&  Dovecot.
>>
>> I'm a little confused about: to do that sharing-in-one-place, do I have
>> to use SQL or can I use the flatfiles like passwd-db?   I think for sure
>> someone already decided the best approach for this, and maybe I'm not
>> understanding the logic to it.
>>
>> The data I think I need to share are:
>>
>>   users (user at domain.com)
>>   passwords
>>   user aliases (mapping user2 at domain.com ->  user1 at domain.com)
>>   domains
>>   domain aliases (domain.com also receives email for domain2.com)
>>
>> And I think all of this can be in passwd-db in Dovecot.  But I also want
>> to make sure that Postfix ONLY accepts email for users/domains that
>> exist, so it has to read that data too.
>>
>> Can I do this that way with the flatfiles?  Or do I have to use the SQL
>> approach?
>>
>
> The problem with passwd(like) files is that they are almost never in the
> correct format to fit both daemons. The easiest way to use a database.
>
> You could check out postfixadmin: it contains the database format you
> need, the documentation to hook postfix and dovecot into it, and a nice
> web gui for administrating the list of domains, aliases, mailboxes,
> passwords, etc etc.
+1 one on PostfixAdmin. Wouldn't want to live without it. The main 
advantage of using a DB is that all information is stored in 1 location 
and available in the right format through SQL-queries. My 1st config 
used flat-files and the biggest issue was keeping the different files in 
sync (i.e. when creating/deleting users making sure to update all the 
necessary files).

My main concern was losing mails if the DB is unavailable but this isn't 
a problem; if the DB is unavailable Postfix will return a temporarily 
unavailable and the MTA should retry.

Rgds,
N.





More information about the dovecot mailing list