[Dovecot] sendmail to postfix-dovecot

Roger dovecot at w4r.nl
Thu Nov 28 12:56:52 EET 2013


OK,

My dovecot-sql.conf.ext  looks like this:

connect = host=127.0.0.1 port=3306 user=postfix password=blabla
dbname=postfix
driver = mysql
default_pass_scheme = MD5-CRYPT
password_query = SELECT password,CONCAT('/mail/', maildir) AS userdb_home,\
    '5000' AS userdb_uid, '5000' AS userdb_gid, allow_nets,\
    concat('*:bytes=', quota) AS userdb_quota_rule\
    FROM mailbox WHERE username='%u' AND domain='%d' AND active=1
user_query = SELECT CONCAT('/mail/', maildir) AS home, 'maildir:~/' as mail,
'5000' AS uid, '5000' AS gid,\
    concat('*:bytes=', quota) AS quota_rule\
    FROM mailbox WHERE username='%u' AND domain='%d' AND active=1
#iterate_query = SELECT username AS user FROM mailbox

-----Oorspronkelijk bericht-----
Van: dovecot-bounces at dovecot.org [mailto:dovecot-bounces at dovecot.org] Namens
Steffen Kaiser
Verzonden: donderdag 28 november 2013 10:09
Aan: R. Berger
CC: dovecot at dovecot.org
Onderwerp: Re: [Dovecot] sendmail to postfix-dovecot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 27 Nov 2013, R. Berger wrote:

> Steffen Kaiser schreef op 27-11-2013 17:48:
>> On Wed, 27 Nov 2013, Benny Pedersen wrote:
>> 
>>> Roger Berger skrev den 2013-11-27 11:41:
>>>> If I understand right it is not possible to use system and virtual 
>>>> users together.
>>> 
>>> incorrect it is, see here http://wiki2.dovecot.org/VirtualUsers part 
>>> of usernames and domains
>>> 
>>> its all about dovecot auth how its configured, if you want both 
>>> system and virtual users make sure system users get domain stripped 
>>> in auth
>> 
>> in addition to Benny's remark, you can also override the username, e.g. 
>> system users may auth without domain, but passdb/userdb return the 
>> user with domain. Then you can have all users as virtual user/domain.
>> 
>> But probably using two userdb's is easier to maintain.
>
> Here is my dovecot -n:
> root at mail:/usr/local/etc/dovecot/conf.d # dovecot -n # 2.2.6: 
> /usr/local/etc/dovecot/dovecot.conf

> mail_location = maildir:~/

you should not use the home directory as base for mail storage, use
~/Maildir

> passdb {
>   args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
>   driver = sql
> }

> userdb {
>  driver = prefetch
> }
> userdb {
>  args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
>  driver = sql
> }


> I've been thinking about this and I want to put all system users in 
> the database using the provided tools from postfixadmin and then sync 
> the mail using imapsync.

OK, then all user data are in the SQL database.

> In that case domain admins can handle their own mailboxes using
postfixadmin.
> In that case I have all users as virtual users, but they have to be 
> able to login with only their username.
> That means new users should login by using their complete emailaddress 
> and old users as username or emailaddress.
> so:
> old user: info at domain1.com user: info can login as info or 
> info at domain1.com old user: info at domain2.com user: info.ltd can login 
> as info.ltd or info at domain2.com new user: info at domain3.com can login 
> only as info at domain3.com if the new user tries to login as info he 
> gets a password failure Is this possible an correct ?

configure your SQL query so, that info at domain1.com and info hits the same
entry and that the username is overwritten (field "user", IMHO) to
info at domain1.com. Then this user can login as info at domain1.com or info with
the same password, internally Dovecot handles all mail as info at domain1.com
only.

Do the same for all other users as appropriate.

One can craft the database like so:

+ one table with the user data of info at domain1.com, username, password
a.s.o.

+ one table with alias names and foreign key of user data table

+ the select for passdb joins both tables

Search the list and wiki for such setup, e.g. 
http://wiki2.dovecot.org/PasswordDatabase?highlight=%28username%29

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBUpcIHl3r2wJMiz2NAQL5tgf/c130rwnZvXqNQOKiMpympmIZQhEmTMbd
skSn+Bq7oLlU1nR3ao8HrdPmDlKeJYDUgU2Gr2U1Gw8z247TdFCQhLczFrm0gL+J
gDUGS35sNVo6muSPlXGuTRL3J0kFDZX25Ic6APsvahk6HJGg3Z65cmYDLvi9PiyN
TYysA4/zHmn0rZqzAdmeJdRF5VdW4CcDJ2ThKfbUVDgVYhRLRV1NhxK1sujkAWR8
WRTd96iB7dqNZo4SMkxQ9qhwL+HmfyWY2z2WVniqkhzUSRuc3v/StOU4/T4EaUTA
wrM9TbHOWU7KU3DAmFj9TuVNP0KU2eINREainhl86IBrK5HTCY1NTQ==
=0voO
-----END PGP SIGNATURE-----

OK,
I have changed my mail_location. But the mysql is a bit off a hassle. If I
add tables to the database, will it still work with postfixadmin?

My dovecot-sql.conf.ext  looks like this:

connect = host=127.0.0.1 port=3306 user=postfix password=blabla
dbname=postfix
driver = mysql
default_pass_scheme = MD5-CRYPT
password_query = SELECT password,CONCAT('/mail/', maildir) AS userdb_home,\
    '5000' AS userdb_uid, '5000' AS userdb_gid, allow_nets,\
    concat('*:bytes=', quota) AS userdb_quota_rule\
    FROM mailbox WHERE username='%u' AND domain='%d' AND active=1
user_query = SELECT CONCAT('/mail/', maildir) AS home, 'maildir:~/' as mail,
'5000' AS uid, '5000' AS gid,\
    concat('*:bytes=', quota) AS quota_rule\
    FROM mailbox WHERE username='%u' AND domain='%d' AND active=1
#iterate_query = SELECT username AS user FROM mailbox

I'll check out the wiki pages.

Roger







More information about the dovecot mailing list