[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.

Welcome to the Slackware Documentation Project

¡Esta es una revisión vieja del documento!


En proceso de traducción. Victor

Instalar el Dovecot MDA

Esta página es complementaria al artículo principal: Creando un servidor de correo virtual con Postfix, Dovecot y MySQL

Dovecot es un agente de entrega de correo corriene y seguro, o MDA, que puede configurarse para funcionar junto con el MTA postfix.Al igual que con postfix, construiremos e instalaremos nuestro paquete dovecot usando el script de compilación actual de SBo. Este ejemplo utiliza la versión actual en el momento de la escritura, pero siempre debe compilar la última versión disponible para su versión de Slackware.

Asumiremos que usted está familiarizado con SlackBuilds y que le proporcionaremos solo los pasos esenciales para construir dovecot aquí. Para obtener información más detallada, visite la SBo How-To page.Nuestra compilación no requiere ningún parámetro especial.

Los pasos esenciales para construir dovecot son (como root):

cd /tmp
wget http://slackbuilds.org/slackbuilds/14.1/network/dovecot.tar.gz
tar -xvzf dovecot.tar.gz
cd dovecot
cat dovecot.info
...
DOWNLOAD="http://www.dovecot.org/releases/2.2/dovecot-2.2.13.tar.gz"
MD5SUM="a3eb1c0b1822c4f2b0fe9247776baa71"
...

# Fetch archive from URL in DOWNLOAD line #
wget http://www.dovecot.org/releases/2.2/dovecot-2.2.13.tar.gz

# Verify integrity of archive - compare to MD5SUM line #
md5sum dovecot-2.2.13.tar.gz
a3eb1c0b1822c4f2b0fe9247776baa71

# Build package #
chmod +x dovecot.SlackBuild
./dovecot.SlackBuild

El paquete resultante se encontrará en /tmp/dovecot-2.2.13-x86_64-1_SBo.tgz (o similar para la versión de 32 bits).

Copie el archivo del paquete a la plataforma de destino si es necesario e instale:

installpkg {path-to/}dovecot-2.2.13-x86_64-1_SBo.tgz

Configuring The Dovecot MDA

You should become familiar with the dovecot documentation in order to properly configure your installation. You will also find a local copy of the complete documentation installed with the package in /usr/doc/dovecot-2.2.13/wiki/ (adjust for you version number if necessary).

You must become familiar with the tools available to you in order to safely admin and maintain your mail server! Take the time necessary to read the man pages - man dovecot, man doveconf, man doveadm, before you start your mail server!

The dovecot package will create a mostly empty configuration directory at /etc/dovecot.

cat /etc/dovecot/README
Configuration files go to this directory. See example configuration files in
/usr/doc/dovecot-2.2.13/example-config/

So we will create the necessary directory structure and copy only the necessary example config files to the working location as our point of reference.

mkdir /etc/dovecot/conf.d
cp /usr/doc/dovecot-2.2.13/example-config/dovecot.conf /etc/dovecot/.
cp /usr/doc/dovecot-2.2.13/example-config/dovecot-sql.conf.ext /etc/dovecot/.
cp /usr/doc/dovecot-2.2.13/example-config/conf.d/10-auth.conf /etc/dovecot/conf.d/.
cp /usr/doc/dovecot-2.2.13/example-config/conf.d/10-mail.conf /etc/dovecot/conf.d/.
cp /usr/doc/dovecot-2.2.13/example-config/conf.d/10-master.conf /etc/dovecot/conf.d/.
cp /usr/doc/dovecot-2.2.13/example-config/conf.d/10-ssl.conf /etc/dovecot/conf.d/.
cp /usr/doc/dovecot-2.2.13/example-config/conf.d/auth-sql.conf.ext /etc/dovecot/conf.d/.

We will work from top to bottom of the copied file list to perform configuration.

Open the file, /etc/dovecot/dovecot.conf and make the following changes:

vi /etc/dovecot/dovecot.conf
# Uncomment the following line to set supported protocols #
protocols = imap pop3 lmtp

# Set postmaster_address to your admin address #
postmaster_address = me@my-domain.com

# Add following line commented, uncomment to troubleshoot SSL errors #
#verbose_ssl = yes

Next, configure the database access parameters and password query for dovecot:

vi /etc/dovecot/dovecot-sql.conf.ext
# Uncomment and set the following lines as shown #
driver = mysql
connect = "host=localhost dbname=mailserver user=mailuser password={your mailuser password}"
default_pass_scheme = SHA512-CRYPT
password_query = SELECT email as user, password FROM virtual_users WHERE email='%u';

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 /etc/dovecot/conf.d/10-auth.conf
# Uncomment this line - no plain text authentication! #
disable_plaintext_auth = yes

# Plain is inside SSL, add "login" for MUA user/pass authentication #
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 /var/vmail/vhosts/DOMAIN/USER. Dovecot will perform the substitutions for %d and %n at runtime.

vi /etc/dovecot/conf.d/10-mail.conf

# Uncomment and set the mail_location path #
mail_location = maildir:/var/vmail/vhosts/%d/%n

Set the configuration for the dovecot master process:

vi /etc/dovecot/conf.d/10-master.conf

# Find the "service imap-login" section and set port to 0 to disable insecure imap login #
service imap-login {
     inet_listener imap {
           port = 0
        }
        ...
}

# Find the "service pop3-login" section and set port to 0 to disable insecure pop3 login #
service pop3-login {
  inet_listener pop3 {
       port = 0
        }
        ...
}

# Find the "service lmtp" section and make the following changes #
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
     mode = 0600
     user = postfix
     group = postfix
    }
    ...
}

# Find the "service auth" section, set postfix handler for SASL, db auth user/perms #
service auth {
    unix_listener /var/spool/postfix/private/auth {
    mode = 0666
    user = postfix
    group = postfix
  }
  unix_listener auth-userdb {
    mode = 0600
    user = vmail
  }
  user = dovecot
}

# Find the "service auth-worker" section, run auth processes as unpriv user #
service auth-worker {
  user = vmail
}

Next we set up the SSL configuration so it is mandatory and uses the certificates created earlier:

vi /etc/dovecot/conf.d/10-ssl.conf

# Uncomment as necessary and make the following changes #
ssl = required
ssl_cert = </etc/ssl/localcerts/dove.pem
ssl_key = </etc/ssl/private/dove.key

Finally, configure authentication and user data paths for dovecot access:

vi /etc/dovecot/conf.d/auth-sql.conf.ext

# Find the "passdb" section and configure as follows #
passdb {
    driver = sql
    args = /etc/dovecot/dovecot-sql.conf.ext
}

# Find the "userdb" section and configure as follows #
userdb {
      driver = static
      args = uid=vmail gid=vmail home=/var/vmail/vhosts/%d/%n
}

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:dovecot /etc/dovecot
chmod -R o-rwx /etc/dovecot

Return to main article page

Sources

 es:howtos:network_services:postfix_dovecot_mysql:dovecot ()