Dovecot IMAP, POP Server, LDA, and Sieve configuration Version 1.2

t

This page explains installation and configuration of dovecot 1.2 as shipped with Ubuntu 10.04LTS. For the installation of dovecot 2, e. g. on Ubuntu 12.04LTS, please check this page.

Dovecot IMAP and POP3 services are installed using the following command.

sudo aptitude install dovecot-imapd dovecot-pop3d

To tell dovecot to use MySQL tables for user authentication and do some further settings, modify the following for your installation. The listing was derived using the postfixadmin documentation (for dovecot) and taken from /etc/dovecot/dovecot-sql.conf:

driver = mysql
connect = host=127.0.0.1 port=3306 user=mailuser password=mailuserpassword dbname=mailserver

# depends on postfixadmin config
default_pass_scheme = MD5-CRYPT

# taken from postfixadmin docs
password_query = SELECT username as user, password, concat('/var/spool/postfix/virtual/', maildir) as userdb_home, concat('maildir:/var/spool/postfix/virtual/', maildir) as userdb_mail, 118 as userdb_uid, 8 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'

# taken from postfixadmin docs
user_query = SELECT concat('/var/spool/postfix/virtual/', maildir) as home, concat('maildir:/var/spool/postfix/virtual/',maildir) as mail, 118 AS uid, 8 AS gid FROM mailbox WHERE username = '%u' AND active='1'

And in the main entry configuration file, make sure to have the following settings. Don’t forget to modify the first_valid_uid to your values! /etc/dovecot/dovecot.conf:

protocols = imaps imap pop3s pop3

userdb sql {
 args = /etc/dovecot-sql.conf
}

passdb sql {
 args = /etc/dovecot-sql.conf
}

# set this to the mail user-id
first_valid_uid = 118
# as it has been set in postfix
mail_location = maildir:/var/spool/postfix/virtual/%u/

# LDA specific settings
protocol lda {
  # Address to use when sending rejection mails.
  postmaster_address = postmaster@yourdomain.com
  # Hostname to use in various parts of sent mails, eg. in Message-Id.
  # Default is the system's real hostname.
  hostname = yourdomain.com
  # Enabling Sieve plugin for server-side mail filtering
  mail_plugins = cmusieve
}

# It's possible to export the authentication interface to other programs:
socket listen {
  master {
    # Master socket provides access to userdb information. It's typically
    # used to give Dovecot's local delivery agent access to userdb so it
    # can find mailbox locations.
    path = /var/run/dovecot/auth-master
    mode = 0600
    # Default user/group is the one who started dovecot-auth (root)
    user = vmail
    group = mail
  }

  # for SMTP passwords
  client {
    # The client socket is generally safe to export to everyone. Typical
    # use is to export it to your SMTP server so it can do SMTP AUTH
    # lookups using it.
    path = /var/spool/postfix/private/auth-client
    mode = 0660
    user = postfix
    group = postfix
  }
}

Additionally, you can change the local delivery for the local users as well. You do this by modifying the following lines in your /etc/postfix/main.cf:

mailbox_command = /usr/lib/dovecot/deliver
mailbox_transport = dovecot

The only problem remaining with sieve is, that I have not found a nice filter managment GUI for all users, even without a ssh account on the server. For now, I need to maintain my sieve files by vim. As soon, as I found a nice user friendly management software, I’ll update this post. Now restart dovecot, reload postfix and check your mail!

Cheers, iss.

Flattr: