Dovecot: Unterschied zwischen den Versionen

aus www.kruedewagen.de, Homepage von Ralf und Judith Krüdewagen (Kruedewagen)
Zur Navigation springen Zur Suche springen
 
(31 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
Dovecot ist ein '''IMAP/POP3''' Email-Server.
Dovecot ist ein [[Open-Source]] '''IMAP''' und '''POP3''' [[Email]]-Server.


== Installation und Konfiguration ==
== Dovecot 1.x ==
Siehe [http://wiki.dovecot.org/QuickConfiguration], [http://wiki.dovecot.org/BasicConfiguration].
=== Installation und Konfiguration ===
<tt>configure</tt> ohne Parameter.
Siehe [http://wiki.dovecot.org/CompilingSource CompilingSource], [http://wiki.dovecot.org/QuickConfiguration QuickConfiguration], [http://wiki.dovecot.org/BasicConfiguration BasicConfiguration].


=== Spezielle Konfiguration ===
Hinweise:
- pam-devel muss installiert sein
 
==== Spezielle Konfiguration ====
*<tt>configure</tt> ohne Parameter oder <tt>configure --with-ldap --with-mysql</tt> für spezielle Auth-Module.
*PAM in <tt>/etc/pam.d/dovecot</tt> (statt pam_unix.so):
*PAM in <tt>/etc/pam.d/dovecot</tt> (statt pam_unix.so):
  auth    required        pam_unix2.so
  auth    required        pam_unix2.so
  account 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"):
*dovecot.conf ("dovecot -n"):
<pre><nowiki>
<pre><nowiki>
Zeile 29: Zeile 36:
</nowiki></pre>
</nowiki></pre>
*SSL-Test-Zertifikat & Key erstellen für TLS (port 143), Dateien <tt>/etc/ssl/private/dovecot.pem</tt> und <tt>/etc/ssl/certs/dovecot.pem</tt>
*SSL-Test-Zertifikat & Key erstellen für TLS (port 143), Dateien <tt>/etc/ssl/private/dovecot.pem</tt> und <tt>/etc/ssl/certs/dovecot.pem</tt>
  sh /opt/pkg/dovecot/dovecot-1.0.0/doc/mkcert.sh
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 ====
<pre>
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 =
}
</pre>
==== LDA Integration in Postfix ====
Siehe [http://wiki.dovecot.org/LDA]. <tt>main.cf</tt>:
mailbox_command = /usr/local/libexec/dovecot/deliver
 
==== Sieve-Filter als LDA-Plugin ====
Siehe Anleitung bei [http://wiki.dovecot.org/LDA/Sieve Dovecot]. Filter-Code in Datei <tt>$HOME/.dovecot.sieve</tt>. Beispiel:
<pre><nowiki>
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;
}
</nowiki></pre>
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 ===
*http://wiki2.dovecot.org/Upgrading/2.0
*http://wiki2.dovecot.org/CompilingSource
*http://wiki2.dovecot.org/QuickConfiguration
*http://wiki2.dovecot.org/BasicConfiguration
 
Sieve:
*http://wiki2.dovecot.org/LDA/Sieve
*http://wiki2.dovecot.org/LDA/Sieve/Dovecot
*http://wiki2.dovecot.org/Pigeonhole
 
==== 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:
<pre>
[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
</pre>
 
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


== Sieve-Filter ==
Pigeonhole (Sieve) sollte danach ebenfalls neu übersetzt und installiert werden:
Siehe http://wiki.dovecot.org/LDA/Sieve. Filter-Code in Datei <tt>$HOME/.dovecot.sieve</tt>.
cd /opt/pkg/dovecot/dovecot-2.0-pigeonhole-0.2.2
make distclean
./configure
make
su
make install


== Tipps & Tricks ==
== Tipps & Tricks ==
*Konfiguration ausgeben für nicht-Default Werte:
*Konfiguration ausgeben für nicht-default Werte:
  dovecot -n
  doveconf -n
 
*"Permission denied" Fehler unter openSUSE werden oft durch ein aktiviertes [[AppArmor]] verursacht.


== Siehe auch ==
== Siehe auch ==
*[[Postfix#SpamAssassin_Integration|Postfix SpamAssassin_Integration]]
*[[Postfix#SpamAssassin_Integration|Postfix SpamAssassin Integration]]


== Weblinks ==
== Weblinks ==
*http://www.dovecot.org
*http://www.dovecot.org
*http://wiki.dovecot.org
*http://wiki.dovecot.org
*http://de.wikipedia.org/wiki/Dovecot
*Sieve
**http://sieve.info/
**http://www.holtmann.org/email/sieve/
[[Kategorie:Email]]

Aktuelle Version vom 2. Juni 2015, 13:08 Uhr

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