This documentation is for Dovecot v2.x, see wiki1 for v1.x documentation.
Differences between revisions 1 and 18 (spanning 17 versions)
Revision 1 as of 2004-03-20 13:27:41
Size: 1552
Editor: spekje
Comment:
Revision 18 as of 2004-03-20 14:07:42
Size: 3025
Editor: spekje
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
I wanted to use Dovecot to deal with mailboxes of non-unix users. = Dovecot virtual users =
An exercise in mailrouting by F. Overkamp <florian@obsimref.com>
Line 3: Line 4:
Assumptions:
* All virtual users/mailboxes are in /home/dovecot/users
* Password file for these users is /home/dovecot/passwd (looks just like a htpasswd file)
== Preamble ==
I wanted to use Dovecot to deal with mailboxes that may belong to accounts that may or may not exist as a unix user. I also required a large amount of flexibility in migration options - so mail-accounts may have any number of formats and daemons. I am doing distribution of these users by using Perdition, but thats just a preference.
Line 7: Line 7:
1. Making dovecot use these mailboxes: A few assumptions were made in this setup:
 * All virtual users/mailboxes are in /home/dovecot/users
 * Password file for these users is /home/dovecot/passwd (looks just like a htpasswd file)
Line 9: Line 11:
 auth = default
 auth_userdb = static uid=500 gid=500 home=/home/dovecot/users/%u
 auth_passdb = passwd-file /home/dovecot/passwd
 auth_user = dovecot
== Desired results ==
The result I was looking for was this:

Mail for the domain comes in. If it has a dovecot mailbox, deliver it there. If not, continue with 'normal' local delivery.

 * So if frops@host is not a unix user and it does exist in dovecot, use that
 * So if florian@host is a unix user and it was not yet migrated to dovecot, use the old mailbox
 * So if dummy@host is a unix user and it was not yet migrated to dovecot, use the old mailbox
 * So if nonexistent@host exists nowhere, bounce :-)



== Making dovecot use these mailboxes ==

{{{
auth = default
auth_userdb = static uid=500 gid=500 home=/home/dovecot/users/%u
auth_passdb = passwd-file /home/dovecot/passwd
auth_user = dovecot
}}}
Line 16: Line 34:
2. Making exim deliver to those virtual users:

 
# Transport to send any mail for who a dovecot user exists to the appropriate maildir box
 # Transports are evaluated in order of configuration, so if you place this
 # above the local_delivery director this will play nice:
 # If there is a virtual user in the dovecot dirs it will use that
 # If not, it will try normal local delivery
 dovecot_transport:
   driver = appendfile
   user = dovecot
 
group = dovecot
  mode = 0600
   directory=/home/dovecot/users/${lc:$local_part}/
   maildir_format = true
 
mode_fail_narrower = false
   envelope_to_add = true
   return_path_add = true

 # Director to send an
y mail for who a dovecot user exists to the appropriate maildir box
 dovecot:
   driver = smartuser
   require_files = +/home/dovecot/users/${local_part}/
   transport = dovecot_transport
== Making exim deliver to those virtual users ==
{{{
# Director to send any mail for who a dovecot user exists to the appropriate maildir box
dovecot
:
  driver = smartuser
  require_files = +/home/dovecot/users/${local_part}/
  transport = dovecot_transport
}}}
{{{
# Transport to send any mail for who a dovecot user exists to the appropriate maildir box
# Transports are evaluated in order of configuration, so if you place this
# above the local_delivery director this will play nice:
# If there is a virtual user in the dovecot dirs it will use that
# If not, it will try normal local delivery
dovecot_transport:
  driver = appendfile
  user = dovecot
group = dovecot
  mode = 0600
  directory=/home/dovecot/users/${lc:$local_part}/
  maildir_format = true
mode_fail_narrower = false
  envelope_to_add = true
  return_path_add = true
}}}
In order to make this work, exim must be able to read the /home/dovecot/users/ director
y, otherwise delivery will not work.
Line 42: Line 63:
 * So if frops@host is not a unix user and it does exist in dovecot, use that:
{{{
frops@host
  deliver to frops in domain host
  director = dovecot, transport = dovecot_transport
}}}
 * So if florian@host is a unix user and it was not yet migrated to dovecot, use the old mailbox:
{{{
florian@host
  deliver to florian in domain host
  director = procmail, transport = procmail_pipe
}}}
----

Dovecot virtual users

An exercise in mailrouting by F. Overkamp <florian@obsimref.com>

Preamble

I wanted to use Dovecot to deal with mailboxes that may belong to accounts that may or may not exist as a unix user. I also required a large amount of flexibility in migration options - so mail-accounts may have any number of formats and daemons. I am doing distribution of these users by using Perdition, but thats just a preference.

A few assumptions were made in this setup:

  • All virtual users/mailboxes are in /home/dovecot/users
  • Password file for these users is /home/dovecot/passwd (looks just like a htpasswd file)

Desired results

The result I was looking for was this:

Mail for the domain comes in. If it has a dovecot mailbox, deliver it there. If not, continue with 'normal' local delivery.

  • So if frops@host is not a unix user and it does exist in dovecot, use that
  • So if florian@host is a unix user and it was not yet migrated to dovecot, use the old mailbox
  • So if dummy@host is a unix user and it was not yet migrated to dovecot, use the old mailbox
  • So if nonexistent@host exists nowhere, bounce :-)

Making dovecot use these mailboxes

auth = default
auth_userdb = static uid=500 gid=500 home=/home/dovecot/users/%u
auth_passdb = passwd-file /home/dovecot/passwd
auth_user = dovecot

By the way, I did not bother making another set of configs to deal with non-virtual users - I use perdition for that in my migration scenario.

Making exim deliver to those virtual users

# Director to send any mail for who a dovecot user exists to the appropriate maildir box
dovecot:
  driver = smartuser
  require_files = +/home/dovecot/users/${local_part}/
  transport = dovecot_transport

# Transport to send any mail for who a dovecot user exists to the appropriate maildir box
# Transports are evaluated in order of configuration, so if you place this 
# above the local_delivery director this will play nice:
# If there is a virtual user in the dovecot dirs it will use that
# If not, it will try normal local delivery
dovecot_transport:
  driver = appendfile
  user = dovecot
  group = dovecot
  mode = 0600
  directory=/home/dovecot/users/${lc:$local_part}/
  maildir_format = true
  mode_fail_narrower = false
  envelope_to_add = true
  return_path_add = true

In order to make this work, exim must be able to read the /home/dovecot/users/ directory, otherwise delivery will not work.

Be carefull how you do this - test it with 'exim -bt <address>' for a few different options

  • So if frops@host is not a unix user and it does exist in dovecot, use that:

frops@host
  deliver to frops in domain host
  director = dovecot, transport = dovecot_transport
  • So if florian@host is a unix user and it was not yet migrated to dovecot, use the old mailbox:

florian@host
  deliver to florian in domain host
  director = procmail, transport = procmail_pipe


None: HowTo/VirtualhostingWithExim (last edited 2013-03-31 13:40:36 by cpc5-basf10-2-0-cust708)