Changes

Dovecot and Postfix Hybrid Authentication Example

1,835 bytes added, 02:29, 14 February 2014
The following lines were added (+) and removed (-):
== configure postfix ==== configuration steps with examples ===== Step 1: prepare necessary files and directories ===Locate your postfix configuration files, they might be in /etc/postfix, or /etc/mail/postfix, or /etc/mail depending on your distro and installation.  For Redhat/Fedora/CentOS you will likely find the following directory structure:Locate your postfix configuration files, they might be in /etc/postfix, or /etc/mail/postfix, or /etc/mail depending on your distro and installation. /etc/poastfix /etc/dovecotYou will have to manually create some files. touch [[/etc/postfix/virtual]] touch [[/etc/postfix/domains]] touch [[/etc/postfix/vmailbox]] mkdir /etc/auth touch [[/etc/auth/yourdomain.com/passwd]]This document is not complete... here is a summaryYou will have to manually populate those files. Click on each one for a sample. Remember to change obvious things such as yourdomain.com to your actual domain name, and populate the users with your actual users.* Set up postfix virtual mailbox text file with email address and destination folder - this is plain text file that must be made hash database== Step 2: edit the postfix main.cf ==* Make sure all domains are configured in postfix* create a passwd file for each virtual user domain /etc/passwd.domain.com* edit dovecot/conf.d/auth-checkpassword.conf.ext mail_location = maildir:~/Maildir passdb {  driver = pam }  driver = passwd-file  args = /etc/postfix/passwd/%d == edit the postfix main.cf ==  virtual_mailbox_base = /var/spool/vmail  virtual_mailbox_base = /var/vmail== edit the dovecot.conf ==Note the virtual_mailbox_base parameter.  This is where mail for virtual users is delivered to and stored.  This mail is kept separate from mail for system users.  Since we are using Maildir/ style mailboxes, for each user postfix will deliver to the proper Maildir structure under /var/spool/vmail .  The first time an email is delivered, and the structure under /var/spool/vmail does not yet exist for the user, postfix will create the directories.  It is important that postfix have write permission to the /var/spool/vmail folder.   Another important consideration is that later, when we configure dovecot so users can pop or imap in to read their mail, it use the same path for mail_location. The config files that begin with the word "hash" in the parameter, like virtual_alias_maps, /etc/postfix/domains, /etc/postfix/vmailbox are not directly read from by postfix.  These have to be processed by 'postmap' so they are made into a hash "lookup table" which is all of the data in your text file made optimized for faster parsing by postfix.  Use the command 'postmap' to make a hash AFTER you populate these files with your data. postmap /etc/postfix/virtual postmap /etc/postfix/domains postmap /etc/postfix/vmailbox == Step 3: edit the dovecot.conf ==== edit conf.d/10-auth.conf ==== Step 4: edit conf.d/10-auth.conf ==== edit conf.d/auth-checkpassword.conf.ext ==== Step 5: edit conf.d/auth-checkpassword.conf.ext ==== conclusion ==There are many guides on how to do this, with different structures in the files and locations, or even how the virtual user tables and mailbox are made distinct.  If you become familiar with how it works, then you can customize it to fit your system schema. If you find any errors on this page, please create a wiki account and correct them.These are the best references and related guides as of 2014 for postmap/dovecot virtual user configuration.
Bureaucrat, administrator
16,192
edits