Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
virtualmailboxeswitheximanddovecot [2016/08/11 19:07] – dovecotpw is now doveadm pw jimvirtualmailboxeswitheximanddovecot [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 user and group ''vmail'' to own all virtual mailboxes.+First I created a user and group ''vmail'' to own all virtual mailboxes. I make the user a normal user because Dovecot will try to access all virtual mailboxes as that ''vmail'' user, and in Dovecot 2.x on Debian the config ''first_valid_uid'' is set to 500 to prevent attempts to access daemon mailboxes.
  
-  # adduser -system --home /var/local/vmail --group vmail+  # adduser --home /var/local/vmail --group vmail
      
 and a configuration directory. and a configuration directory.
Line 44: Line 44:
 </code> </code>
  
-The second, ''passwd'' contains the account information for the domain. There are two items on a line, username and password hash, separated by a colon. Generate the password has using the ''dovecotpw'' utility. Just to be on the safe side, we'll ensure the password file isn't world readable and is readable by Exim when in routing mode and in delivery mode.+The second, ''passwd'' contains the account information for the domain. There are two items on a line, username and password hash, separated by a colon. Generate the password has using the ''dovecotadm pw'' utility. Just to be on the safe side, we'll ensure the password file isn't world readable and is readable by Dovecot and Exim.
  
 <code> <code>
Line 52: Line 52:
 tommy.atkins:{SHA256-CRYPT}$5$TQGxffy9XCxe53vu$L2NWgKJ47w3PoAIj3/IxLJIREA9QSyBKdKDMJlXvn07 tommy.atkins:{SHA256-CRYPT}$5$TQGxffy9XCxe53vu$L2NWgKJ47w3PoAIj3/IxLJIREA9QSyBKdKDMJlXvn07
 ^D ^D
-# chown vmail:Debian-exim /etc/vmail/example.mod/passwd +# chown dovecot:vmail /etc/vmail/example.mod/passwd 
-# chmod 0640 /etc/vmail/example.mod/passwd+# adduser Debian-exim vmail 
 +# chmod 0660 /etc/vmail/example.mod/passwd
 </code> </code>
  
Line 163: Line 164:
  
 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 ''dovecot.conf'' already has I'm assuming your ''dovecot.conf'' already has
Line 207: Line 210:
      
 to your ''dovecot.conf'' while you try and work out what's going wrong. to your ''dovecot.conf'' while you try and work out what's going wrong.
 +
 +==== Dovecot 2.x with Debian conf.d configuration ====
 +
 +Again, I'm assuming that ''10-mail.conf'' has
 +
 +  mail_location = maildir:~/Maildir
 +
 +in it, telling Dovecot to find your regular users mail in ''~/Maildir''.
 +
 +I first added a new auth configuration file, ''auth-vmail.conf.ext''.
 +
 +  # Virtual mailbox passwords.
 +  passdb {
 +    driver = passwd-file
 +    args = username_format=%n /etc/vmail/%d/passwd
 +  }
 +  
 +  # VMail static settings.
 +  userdb {
 +    driver = static
 +    args = uid=vmail gid=vmail home=/var/local/vmail/%d/%n
 +  }
 +
 +This gives Dovecot the essential password and user info settings.
 +
 +I then modified ''10-auth.conf'', adding the new ''vmail'' auth at the end of the file.
 +
 +  !include auth-vmail.conf.ext
 +
 +To debug authentication problems, enable ''auth_debug'' and ''auth_debug_passwords'' in ''10-logging.conf''.
  
 ===== Letting your virtual users send mail ===== ===== Letting your virtual users send mail =====
Line 213: Line 246:
  
 There's several ways of cracking this nut. I'll just mention that if you do it by allowing authenticated SMTP, I found it easiest to do by handing the authentication over to Dovecot. There's several ways of cracking this nut. I'll just mention that if you do it by allowing authenticated SMTP, I found it easiest to do by handing the authentication over to Dovecot.
 +
 +==== Dovecot 1.x ====
  
 I needed to create the Dovecot authenticator socket by adding I needed to create the Dovecot authenticator socket by adding
Line 230: Line 265:
 section in ''dovecot.conf''. It's commented out by default in Debian. Without other arrangements, Exim needs its mode to be 0666; comments in the Dovecot config suggest this is generally safe. section in ''dovecot.conf''. It's commented out by default in Debian. Without other arrangements, Exim needs its mode to be 0666; comments in the Dovecot config suggest this is generally safe.
  
-Then, in the Exim configuration, use these authenticators:+Then, in the Exim configuration, add ''auth/30_dovecot_auth'' containing:
  
 <code> <code>
Line 248: Line 283:
   server_mail_auth_condition = false   server_mail_auth_condition = false
 </code> </code>
 +
 +==== Dovecot 2.x ====
 +
 +In ''10-master.conf'' I add a Dovecot authenticator socket with permissions for Exim by adding the following lines in the section ''service auth''.
 +
 +<code>
 +  unix_listener auth-client {
 +    mode = 0660
 +    group = Debian-exim
 +  }
 +</code>
 +
 +Then add ''auth/30_dovecot_auth'' to the Exim configuration as above.
  
 
virtualmailboxeswitheximanddovecot.1470942444.txt.gz · Last modified: 2016/08/11 19:07 by jim
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0