[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
howtos:network_services:postfix_dovecot_mysql:dovecot [2015/02/15 07:35 (UTC)] – created astrogeek | howtos:network_services:postfix_dovecot_mysql:dovecot [2015/04/01 21:22 (UTC)] (current) – Fix Dovecot connection string. denydias | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Installing and Configuring The Dovecot MDA ===== | + | ====== Installing |
+ | |||
+ | This page is supplemental to main article: [[howtos: | ||
+ | |||
+ | Dovecot is a popular and secure mail delivery agent, or MDA, which can be configured to work alongside the postfix MTA. | ||
+ | |||
+ | As with postfix, we will build and install our dovecot package using the current build script from [[http:// | ||
+ | |||
+ | We will assume that you are familiar with SlackBuilds and will provide only the essential steps for building dovecot here. For more detailed information please visit the [[http:// | ||
+ | |||
+ | Our dovecot build requires no special parameters. The essential steps for building dovecot are (as root): | ||
+ | < | ||
+ | cd /tmp | ||
+ | wget http:// | ||
+ | tar -xvzf dovecot.tar.gz | ||
+ | cd dovecot | ||
+ | cat dovecot.info | ||
+ | ... | ||
+ | DOWNLOAD=" | ||
+ | MD5SUM=" | ||
+ | ... | ||
+ | |||
+ | # Fetch archive from URL in DOWNLOAD line # | ||
+ | wget http:// | ||
+ | |||
+ | # Verify integrity of archive - compare to MD5SUM line # | ||
+ | md5sum dovecot-2.2.13.tar.gz | ||
+ | a3eb1c0b1822c4f2b0fe9247776baa71 | ||
+ | |||
+ | # Build package # | ||
+ | chmod +x dovecot.SlackBuild | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | The resulting package will be found in / | ||
+ | |||
+ | Copy the package file to the target platform if necessary and install: | ||
+ | < | ||
+ | |||
+ | ====== | ||
+ | |||
+ | You should become familiar with the [[http:// | ||
+ | |||
+ | <note important> | ||
The dovecot package will create a mostly empty configuration directory at / | The dovecot package will create a mostly empty configuration directory at / | ||
Line 7: | Line 50: | ||
/ | / | ||
- | So we will create the necessary structure and copy the necessary example config files to the working location. | + | So we will create the necessary |
< | < | ||
Line 22: | Line 65: | ||
We will work from top to bottom of the copied file list to perform configuration. | We will work from top to bottom of the copied file list to perform configuration. | ||
- | Open the file, / | + | Open the file, / |
< | < | ||
vi / | vi / | ||
- | ... uncomment | + | # Uncomment |
protocols = imap pop3 lmtp | protocols = imap pop3 lmtp | ||
- | ... set postmaster_address to your admin address | + | |
+ | # Set postmaster_address to your admin address | ||
postmaster_address = me@my-domain.com | postmaster_address = me@my-domain.com | ||
- | ... Add following line commented, uncomment to see SSL errors | + | |
+ | # Add following line commented, uncomment to troubleshoot | ||
# | # | ||
+ | </ | ||
+ | |||
+ | Next, configure the database access parameters and password query for dovecot: | ||
+ | |||
+ | < | ||
+ | vi / | ||
+ | # Uncomment and set the following lines as shown # | ||
+ | driver = mysql | ||
+ | connect = " | ||
+ | default_pass_scheme = SHA512-CRYPT | ||
+ | password_query = SELECT email as user, password FROM virtual_users WHERE email=' | ||
+ | </ | ||
+ | |||
+ | Next, we configure the authentication methods to be used by dovecot. We will restrict it to use only secure authentication by the settings here and in the included auth-sql.conf.ext file, excluding other methods. | ||
+ | |||
+ | < | ||
+ | vi / | ||
+ | # Uncomment this line - no plain text authentication! # | ||
+ | disable_plaintext_auth = yes | ||
+ | |||
+ | # Plain is inside SSL, add " | ||
+ | auth_mechanisms = plain login | ||
+ | |||
+ | # Comment out this line, no file based auth # | ||
+ | #!include auth-system.conf.ext | ||
+ | |||
+ | # Uncomment this line to allow SQL based auth # | ||
+ | !include auth-sql.conf.ext | ||
+ | </ | ||
+ | |||
+ | Set the filesystem path for virtual mail. The virtual user's mail boxes will be at / | ||
+ | |||
+ | < | ||
+ | vi / | ||
+ | |||
+ | # Uncomment and set the mail_location path # | ||
+ | mail_location = maildir:/ | ||
+ | </ | ||
+ | |||
+ | Set the configuration for the dovecot master process: | ||
+ | < | ||
+ | vi / | ||
+ | |||
+ | # Find the " | ||
+ | service imap-login { | ||
+ | | ||
+ | port = 0 | ||
+ | } | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | # Find the " | ||
+ | service pop3-login { | ||
+ | inet_listener pop3 { | ||
+ | port = 0 | ||
+ | } | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | # Find the " | ||
+ | service lmtp { | ||
+ | unix_listener / | ||
+ | mode = 0600 | ||
+ | user = postfix | ||
+ | group = postfix | ||
+ | } | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | # Find the " | ||
+ | service auth { | ||
+ | unix_listener / | ||
+ | mode = 0666 | ||
+ | user = postfix | ||
+ | group = postfix | ||
+ | } | ||
+ | unix_listener auth-userdb { | ||
+ | mode = 0600 | ||
+ | user = vmail | ||
+ | } | ||
+ | user = dovecot | ||
+ | } | ||
+ | |||
+ | # Find the " | ||
+ | service auth-worker { | ||
+ | user = vmail | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Next we set up the SSL configuration so it is mandatory and uses the certificates created earlier: | ||
+ | |||
+ | < | ||
+ | vi / | ||
+ | |||
+ | # Uncomment as necessary and make the following changes # | ||
+ | ssl = required | ||
+ | ssl_cert = </ | ||
+ | ssl_key = </ | ||
+ | </ | ||
+ | |||
+ | Finally, configure authentication and user data paths for dovecot access: | ||
+ | |||
+ | < | ||
+ | vi / | ||
+ | |||
+ | # Find the " | ||
+ | passdb { | ||
+ | driver = sql | ||
+ | args = / | ||
+ | } | ||
+ | |||
+ | # Find the " | ||
+ | userdb { | ||
+ | driver = static | ||
+ | args = uid=vmail gid=vmail home=/ | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Now we want to further secure the installation by making all dovecot configutation files owned by the non--privledged vmail user, and accessible by the dovecot group, with no access by others. | ||
+ | |||
+ | < | ||
+ | chown -R vmail: | ||
+ | chmod -R o-rwx / | ||
</ | </ | ||
[[howtos: | [[howtos: | ||
- | {{tag> | + | ====== Sources ====== |
+ | * Based primarily on [[http:// | ||
+ | * Originally written by [[wiki: | ||
+ | {{tag> |