This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| virtualmailboxeswitheximanddovecot [2011/02/24 12:53] – Authentication via Dovecot jim | virtualmailboxeswitheximanddovecot [2016/08/15 08:43] (current) – Give Exim read permission on vmail passwd jim | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| ===== Set up virtual mailbox space and configuration ===== | ===== Set up virtual mailbox space and configuration ===== | ||
| - | First I created a system | + | First I created a user and group '' |
| - | # adduser | + | # adduser --home / |
| | | ||
| and a configuration directory. | and a configuration directory. | ||
| Line 44: | Line 44: | ||
| </ | </ | ||
| - | The second, '' | + | The second, '' |
| < | < | ||
| - | # / | + | # doveadm pw -s SHA256-CRYPT |
| - | {CRAM-MD5}9186d855e11eba527a7a52ca82b313e180d62234f0acc9051b527243d41e2740 | + | {SHA256-CRYPT}$5$TQGxffy9XCxe53vu$L2NWgKJ47w3PoAIj3/ |
| # cat > / | # cat > / | ||
| - | tommy.atkins: | + | tommy.atkins: |
| ^D | ^D | ||
| - | # chgrp / | + | # chown dovecot: |
| - | # chmod 0640 / | + | # adduser Debian-exim vmail |
| + | # chmod 0660 / | ||
| </ | </ | ||
| Line 60: | Line 61: | ||
| The next step is to configure Exim to deliver to virtual mailboxes. | The next step is to configure Exim to deliver to virtual mailboxes. | ||
| - | The first thing to do is to add the domain to the list of local domains. How you do this depends on which of Debian' | + | Exactly how you do this depends on which of Debian' |
| - | Next we need a router to expand virtual domain aliases. | + | The first thing to do is to add the domain to the list of local domains. You need to end up with a configuration file with the domain as part of the '' |
| + | |||
| + | < | ||
| + | VMAIL_DELIVERY=dovecot_vmail | ||
| + | |||
| + | VMAIL_DOMAINS=dsearch;/ | ||
| + | |||
| + | VMAIL_ALIASES=/ | ||
| + | VMAIL_PASSWD=/ | ||
| + | |||
| + | VMAIL_MAILBOX_DIR=/ | ||
| + | </ | ||
| + | |||
| + | That '' | ||
| + | |||
| + | I then made a small modification to '' | ||
| + | |||
| + | < | ||
| + | # Local modification - add vmail domains to local domains, and provide | ||
| + | # main_local_domains for the non-vmail domains. | ||
| + | domainlist local_domains = MAIN_LOCAL_DOMAINS : VMAIL_DOMAINS | ||
| + | domainlist main_local_domains = MAIN_LOCAL_DOMAINS | ||
| + | </ | ||
| + | |||
| + | (I use '' | ||
| + | |||
| + | Next I need a router to expand virtual domain aliases. I put this into '' | ||
| < | < | ||
| vmail_aliases: | vmail_aliases: | ||
| driver = redirect | driver = redirect | ||
| - | data = ${lookup{$local_part}lsearch{/ | + | |
| - | domains = dsearch;/ | + | allow_fail |
| + | allow_defer | ||
| + | | ||
| qualify_domain = $domain | qualify_domain = $domain | ||
| - | retry_use_local_part | ||
| </ | </ | ||
| - | That '' | + | '' |
| - | Once that's done, we can think about routing to a transport for delivery. | + | Once that's done, I can think about routing |
| < | < | ||
| - | vmail_deliver: | + | vmail_user: |
| driver = accept | driver = accept | ||
| - | | + | |
| - | domains = dsearch;/ | + | local_parts |
| - | | + | transport = VMAIL_DELIVERY |
| - | | + | |
| - | | + | vmail_no_such_user: |
| + | driver = redirect | ||
| + | domains = VMAIL_DOMAINS | ||
| + | | ||
| + | | ||
| + | | ||
| </ | </ | ||
| - | Here we're accepting the mail on condition that the local part of the address appears in the domain' | + | Here I'm accepting the mail on condition that the local part of the address appears in the domain' |
| + | |||
| + | Now to the transports. I am now delivering all mail using Dovecot '' | ||
| + | |||
| + | < | ||
| + | dovecot_vmail: | ||
| + | driver = pipe | ||
| + | command = / | ||
| + | message_prefix = | ||
| + | message_suffix = | ||
| + | log_output | ||
| + | delivery_date_add | ||
| + | envelope_to_add | ||
| + | return_path_add | ||
| + | user = vmail | ||
| + | temp_errors = 64 : 69 : 70: 71 : 72 : 73 : 74 : 75 : 78 | ||
| + | </ | ||
| + | Prior to using Dovecot '' | ||
| < | < | ||
| - | vmail_delivery: | + | vmail_home: |
| driver = appendfile | driver = appendfile | ||
| envelope_to_add | envelope_to_add | ||
| - | directory = / | + | directory = VMAIL_MAILBOX_DIR/ |
| maildir_format | maildir_format | ||
| create_directory = true | create_directory = true | ||
| Line 109: | Line 159: | ||
| # exim4 -bt tommy.atkins@example.mod | # exim4 -bt tommy.atkins@example.mod | ||
| tommy.atkins@example.mod | tommy.atkins@example.mod | ||
| - | router = vmail_deliver, transport = vmail_delivery | + | router = vmail_user, transport = dovecot_vmail |
| ===== Reading mail ===== | ===== Reading mail ===== | ||
| Now we need to modify the Dovecot setup to allow our user to read mail. | Now we need to modify the Dovecot setup to allow our user to read mail. | ||
| + | |||
| + | ==== Dovecot 1.x ==== | ||
| I'm assuming your '' | I'm assuming your '' | ||
| Line 159: | Line 210: | ||
| | | ||
| to your '' | to your '' | ||
| + | |||
| + | ==== Dovecot 2.x with Debian conf.d configuration ==== | ||
| + | |||
| + | Again, I'm assuming that '' | ||
| + | |||
| + | mail_location = maildir: | ||
| + | |||
| + | in it, telling Dovecot to find your regular users mail in '' | ||
| + | |||
| + | I first added a new auth configuration file, '' | ||
| + | |||
| + | # Virtual mailbox passwords. | ||
| + | passdb { | ||
| + | driver = passwd-file | ||
| + | args = username_format=%n / | ||
| + | } | ||
| + | | ||
| + | # VMail static settings. | ||
| + | userdb { | ||
| + | driver = static | ||
| + | args = uid=vmail gid=vmail home=/ | ||
| + | } | ||
| + | |||
| + | This gives Dovecot the essential password and user info settings. | ||
| + | |||
| + | I then modified '' | ||
| + | |||
| + | !include auth-vmail.conf.ext | ||
| + | |||
| + | To debug authentication problems, enable '' | ||
| ===== Letting your virtual users send mail ===== | ===== Letting your virtual users send mail ===== | ||
| Line 165: | Line 246: | ||
| There' | There' | ||
| + | |||
| + | ==== Dovecot 1.x ==== | ||
| I needed to create the Dovecot authenticator socket by adding | I needed to create the Dovecot authenticator socket by adding | ||
| Line 182: | Line 265: | ||
| section in '' | section in '' | ||
| - | Then, in the Exim configuration, | + | Then, in the Exim configuration, |
| < | < | ||
| Line 200: | Line 283: | ||
| server_mail_auth_condition = false | server_mail_auth_condition = false | ||
| </ | </ | ||
| + | |||
| + | ==== Dovecot 2.x ==== | ||
| + | |||
| + | In '' | ||
| + | |||
| + | < | ||
| + | unix_listener auth-client { | ||
| + | mode = 0660 | ||
| + | group = Debian-exim | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Then add '' | ||