Dovecot

aus www.kruedewagen.de, Homepage von Ralf und Judith Krüdewagen (Kruedewagen)
Zur Navigation springen Zur Suche springen
Die druckbare Version wird nicht mehr unterstützt und kann Darstellungsfehler aufweisen. Bitte aktualisiere deine Browser-Lesezeichen und verwende stattdessen die Standard-Druckfunktion des Browsers.

Dovecot ist ein Open-Source IMAP und POP3 Email-Server.

Dovecot 1.x

Installation und Konfiguration

Siehe CompilingSource, QuickConfiguration, BasicConfiguration.

Hinweise: - pam-devel muss installiert sein

Spezielle Konfiguration

  • configure ohne Parameter oder configure --with-ldap --with-mysql für spezielle Auth-Module.
  • PAM in /etc/pam.d/dovecot (statt pam_unix.so):
auth    required        pam_unix2.so
account required        pam_unix2.so
oder je nach Distribution
auth    required        pam_unix.so
account required        pam_unix.so
  • dovecot.conf ("dovecot -n"):
disable_plaintext_auth: no
login_dir: /usr/local/var/run/dovecot/login
login_executable: /usr/local/libexec/dovecot/imap-login
last_valid_uid: 3000
last_valid_gid: 10000
mail_location: maildir:~/Maildir
namespace:
  type: private
  separator: /
  location: maildir:~/Maildir
  inbox: yes
auth default:
  passdb:
    driver: pam
  userdb:
    driver: passwd
  • SSL-Test-Zertifikat & Key erstellen für TLS (port 143), Dateien /etc/ssl/private/dovecot.pem und /etc/ssl/certs/dovecot.pem
vi /opt/pkg/dovecot/dovecot-<version>/doc/dovecot-openssl.cnf
sh /opt/pkg/dovecot/dovecot-<version>/doc/mkcert.sh
oder offizielle Zertifikate verwenden in 10-ssl.conf:
ssl_cert = </etc/apache2/ssl.crt/my.crt
ssl_key = </etc/apache2/ssl.key/my.key

LDA

Konfiguration inkl. Plugin

protocol lda {
  postmaster_address = aaa@bbb.de
  hostname = bbb.de
  mail_plugins = cmusieve
  mail_plugin_dir = /usr/local/lib/dovecot/lda
  log_path =
  info_log_path =
}

LDA Integration in Postfix

Siehe [1]. main.cf:

mailbox_command = /usr/local/libexec/dovecot/deliver

Sieve-Filter als LDA-Plugin

Siehe Anleitung bei Dovecot. Filter-Code in Datei $HOME/.dovecot.sieve. Beispiel:

require "fileinto";
if address :is "to" "aaa@bbb.de" {
  fileinto "Test";
} elsif address :is "to" "ccc@ddd.de" {
  fileinto "Test2";
} elsif exists "X-Spam-Flag" {
  fileinto "SPAM";
} else {
  # The rest goes into INBOX
  # default is "implicit keep", we do it explicitly here
  keep;
}

Hinweise:

  • Falls das Sieve-Plugin nicht gefunden wird, verbleibt die Email in der Queue des MTA !
  • Das Einrichten des Dovecot-LDA in Postfix ist notwendig, siehe oben.

Dovecot 2.x

Installation und Konfiguration

Sieve:

Booten

Starten durch systemd:

./configure --with-systemdsystemunitdir=/lib/systemd/system
systemctl enable dovecot.service

Oder Datei /etc/systemd/system/multi-user.target.wants/dovecot.service manuell anlegen:

[Unit]
Description=Dovecot IMAP/POP3 email server
After=local-fs.target network.target

[Service]
Type=simple
ExecStart=/usr/local/sbin/dovecot -F
NonBlocking=yes

[Install]
WantedBy=multi-user.target

Zusätzlich muss wohl doch noch das init-Script installiert werden (sonst erscheint der Service nicht in Yast):

cp doc/dovecot-initd.sh /etc/init.d/dovecot
chmod 755  /etc/init.d/dovecot

Spezielle Konfiguration

Konfiguration in /usr/local/etc/dovecot/.

dovecot.conf

protocols = imap

conf.d/10-auth.conf

disable_plaintext_auth = no
auth_mechanisms = plain

conf.d/10-mail.conf

mail_location = maildir:~/Maildir
namespace {
  type = private
  separator = /
  location = maildir:~/Maildir
  inbox = yes
}

conf.d/10-ssl.conf

ssl_cert = </etc/apache2/ssl.crt/server_www.kruedewagen.de.crt
ssl_key = </etc/apache2/ssl.key/server_www.kruedewagen.de.key

conf.d/15-lda.conf

postmaster_address = webmaster@mydomain65.de
hostname = mydomain65.de
protocol lda {
  mail_plugins = $mail_plugins sieve
}

conf.d/90-plugin.conf

plugin {
  sieve = ~/.dovecot.sieve
  sieve_global_path = /var/lib/dovecot/sieve/default.sieve
  sieve_dir = ~/sieve
  sieve_global_dir = /var/lib/dovecot/sieve/global/
}

Postfix (main.cf):

mailbox_command = /usr/local/libexec/dovecot/dovecot-lda

Upgrade

Einfach drüber installieren. Die Konfig wird nicht überschrieben.

cd /opt/pkg/dovecot/dovecot-2.0.10
./configure
make
su
make install
exit

Pigeonhole (Sieve) sollte danach ebenfalls neu übersetzt und installiert werden:

cd /opt/pkg/dovecot/dovecot-2.0-pigeonhole-0.2.2
make distclean
./configure
make
su
make install

Tipps & Tricks

  • Konfiguration ausgeben für nicht-default Werte:
doveconf -n
  • "Permission denied" Fehler unter openSUSE werden oft durch ein aktiviertes AppArmor verursacht.

Siehe auch

Weblinks