Dovecot, "der" IMAP-Server unter CentOS 7.x

Dovecot-Logo Für die eMail-Kommunikation in unserem SOHO1)-LAN bedienen wir uns des IMAP-Server Dovecot. Dies nicht zuletzt, da dieser, im Gegensatz zum Dinosaurier verschrieenen Cyrus wesentlich einfacher zu konfigurieren ist und auch sicherheitstechnische Vorteile bietet. Da der Dovecot-IMAP-Server, keine großartigen und besonderen Voraussetzungen erfordert, einfach und sehr schnell zu installieren ist, ist dies in der Regel die erste Wahl ein jedes Postmasters bei der Installation von kleinen bis hin zu großen Unternehmens oder sogar Carrier-Lösungen.

Die nachfolgende Beschreibung zeigt, wie man unter CentOS 7.x einen Dovecot-Mailserver MUA2) aufsetzen und sicher betreiben kann.

Grundvoraussetzung eines jeden Postmasters ist der Besitz und das eingehende, auch mehrmalige Studium des Dovecot-Bibel Dovecot (ISBN 978-3-95539-74-7) von Peer Heinlein.


Noch besser ist natürlich der Besuch eines Dovecot Kurses in der Heinlein Akademie.

Viele der Design und Konfigurationsvorschläge stammen aus Peers Buch bzw. aus dem Kurs Dovecot IMAP-Server an der Heinlein Akademie. Bei der genaueren Betrachtung der hier gezeigten Konfigurationsdokumentation, werden wir noch über den ein oder anderen Querverweis auf einzelne Seiten und Kapiteln des Buches stoßen.

Eine der Eigenschaften, die Dovecot als die erste Wahl bei der Installation eines POP3/IMAP-Servers machen, ist neben den Sicherheits- und Performanceaspekten, die leichte und einfache Konfiguration. Wer schon mal SASL beim Cyrus-IMAP-Server und beim Dovecot installiert und konfiguriert hat, wird hierbei sicherlich zustimmen.

Am einfachsten bedienen wir uns eines aktuell gepflegten Dovecot-Repositories, wie z.B. dem Repository mailserver.guru. Der dort enthaltene Release-Kandidat ist Dovecot 2.2.363). Die Installation und Integration des Repositories mailserver.guru ist im Kapitel mailserver.guru unter CentOS 6 und CentOS 7 einbinden erklärt.

 # yum list dovecot*
Loaded plugins: changelog, priorities
8 packages excluded due to repository priority protections
Available Packages
dovecot.x86_64                                 1:2.2.13-1.el7.centos                      mailserver.guru
dovecot-debuginfo.x86_64                       1:2.2.13-1.el7.centos                      mailserver.guru
dovecot-mysql.x86_64                           1:2.2.13-1.el7.centos                      mailserver.guru
dovecot-pgsql.x86_64                           1:2.2.13-1.el7.centos                      mailserver.guru
dovecot-pigeonhole.x86_64                      1:2.2.13-1.el7.centos                      mailserver.guru

Das Basispaket installieren wir einfach mit Hilfe von YUM.

 # yum install dovecot

Neben dem Basispaket wird auch noch das Paket clucene-core als Abhängigkeit mit installiert.

Was uns das Paket dovecot alles mit ins System bringt, zeigt uns der Befehl rpm mit der Option -qil.

 # rpm -qil dovecot
Name        : dovecot
Epoch       : 1
Version     : 2.2.13
Release     : 1.el7.centos
Architecture: x86_64
Install Date: Mon 21 Jul 2014 03:51:29 PM CEST
Group       : System Environment/Daemons
Size        : 10349188
License     : MIT and LGPLv2
Signature   : RSA/SHA1, Mon 21 Jul 2014 12:22:50 AM CEST, Key ID 60ecfb9e8195aea0
Source RPM  : dovecot-2.2.13-1.el7.centos.src.rpm
Build Date  : Mon 21 Jul 2014 12:22:23 AM CEST
Build Host  : vml000200.dmz.nausch.org
Relocations : (not relocatable)
Packager    : Django <django@mailserver.guru>
Vendor      : django
URL         : http://www.dovecot.org/
Summary     : Secure imap and pop3 server
Description :
Dovecot is an IMAP server for Linux/UNIX-like systems, written with security
primarily in mind.  It also contains a small POP3 server.  It supports mail
in either of maildir or mbox formats.

The SQL drivers and authentication plug-ins are in their subpackages.
/etc/dovecot
/etc/dovecot/conf.d
/etc/dovecot/conf.d/10-auth.conf
/etc/dovecot/conf.d/10-director.conf
/etc/dovecot/conf.d/10-logging.conf
/etc/dovecot/conf.d/10-mail.conf
/etc/dovecot/conf.d/10-master.conf
/etc/dovecot/conf.d/10-ssl.conf
/etc/dovecot/conf.d/15-lda.conf
/etc/dovecot/conf.d/15-mailboxes.conf
/etc/dovecot/conf.d/20-imap.conf
/etc/dovecot/conf.d/20-lmtp.conf
/etc/dovecot/conf.d/20-pop3.conf
/etc/dovecot/conf.d/90-acl.conf
/etc/dovecot/conf.d/90-plugin.conf
/etc/dovecot/conf.d/90-quota.conf
/etc/dovecot/conf.d/auth-checkpassword.conf.ext
/etc/dovecot/conf.d/auth-deny.conf.ext
/etc/dovecot/conf.d/auth-dict.conf.ext
/etc/dovecot/conf.d/auth-ldap.conf.ext
/etc/dovecot/conf.d/auth-master.conf.ext
/etc/dovecot/conf.d/auth-passwdfile.conf.ext
/etc/dovecot/conf.d/auth-sql.conf.ext
/etc/dovecot/conf.d/auth-static.conf.ext
/etc/dovecot/conf.d/auth-system.conf.ext
/etc/dovecot/conf.d/auth-vpopmail.conf.ext
/etc/dovecot/dovecot.conf
/etc/pam.d/dovecot
/etc/pki/dovecot
/etc/pki/dovecot/certs
/etc/pki/dovecot/certs/dovecot.pem
/etc/pki/dovecot/dovecot-openssl.cnf
/etc/pki/dovecot/private
/etc/pki/dovecot/private/dovecot.pem
/usr/bin/doveadm
/usr/bin/doveconf
/usr/bin/dsync
/usr/lib/systemd/system/dovecot.service
/usr/lib/systemd/system/dovecot.socket
/usr/lib/tmpfiles.d/dovecot.conf
/usr/lib64/dovecot
/usr/lib64/dovecot/auth
/usr/lib64/dovecot/auth/libauthdb_imap.so
/usr/lib64/dovecot/auth/libauthdb_ldap.so
/usr/lib64/dovecot/auth/libdriver_sqlite.so
/usr/lib64/dovecot/auth/libmech_gssapi.so
/usr/lib64/dovecot/dict
/usr/lib64/dovecot/dict/libdriver_sqlite.so
/usr/lib64/dovecot/doveadm
/usr/lib64/dovecot/doveadm/lib10_doveadm_acl_plugin.so
/usr/lib64/dovecot/doveadm/lib10_doveadm_expire_plugin.so
/usr/lib64/dovecot/doveadm/lib10_doveadm_quota_plugin.so
/usr/lib64/dovecot/doveadm/lib10_doveadm_sieve_plugin.so
/usr/lib64/dovecot/doveadm/lib20_doveadm_fts_lucene_plugin.so
/usr/lib64/dovecot/doveadm/lib20_doveadm_fts_plugin.so
/usr/lib64/dovecot/lib01_acl_plugin.so
/usr/lib64/dovecot/lib02_imap_acl_plugin.so
/usr/lib64/dovecot/lib02_lazy_expunge_plugin.so
/usr/lib64/dovecot/lib05_pop3_migration_plugin.so
/usr/lib64/dovecot/lib05_snarf_plugin.so
/usr/lib64/dovecot/lib10_mail_filter_plugin.so
/usr/lib64/dovecot/lib10_quota_plugin.so
/usr/lib64/dovecot/lib11_imap_quota_plugin.so
/usr/lib64/dovecot/lib11_trash_plugin.so
/usr/lib64/dovecot/lib15_notify_plugin.so
/usr/lib64/dovecot/lib20_autocreate_plugin.so
/usr/lib64/dovecot/lib20_expire_plugin.so
/usr/lib64/dovecot/lib20_fts_plugin.so
/usr/lib64/dovecot/lib20_listescape_plugin.so
/usr/lib64/dovecot/lib20_mail_log_plugin.so
/usr/lib64/dovecot/lib20_mailbox_alias_plugin.so
/usr/lib64/dovecot/lib20_replication_plugin.so
/usr/lib64/dovecot/lib20_virtual_plugin.so
/usr/lib64/dovecot/lib20_zlib_plugin.so
/usr/lib64/dovecot/lib21_fts_lucene_plugin.so
/usr/lib64/dovecot/lib21_fts_solr_plugin.so
/usr/lib64/dovecot/lib21_fts_squat_plugin.so
/usr/lib64/dovecot/lib30_imap_zlib_plugin.so
/usr/lib64/dovecot/lib90_stats_plugin.so
/usr/lib64/dovecot/lib95_imap_stats_plugin.so
/usr/lib64/dovecot/libdovecot-compression.so.0
/usr/lib64/dovecot/libdovecot-compression.so.0.0.0
/usr/lib64/dovecot/libdovecot-lda.so.0
/usr/lib64/dovecot/libdovecot-lda.so.0.0.0
/usr/lib64/dovecot/libdovecot-login.so.0
/usr/lib64/dovecot/libdovecot-login.so.0.0.0
/usr/lib64/dovecot/libdovecot-sieve.so.0
/usr/lib64/dovecot/libdovecot-sieve.so.0.0.0
/usr/lib64/dovecot/libdovecot-sql.so.0
/usr/lib64/dovecot/libdovecot-sql.so.0.0.0
/usr/lib64/dovecot/libdovecot-storage.so.0
/usr/lib64/dovecot/libdovecot-storage.so.0.0.0
/usr/lib64/dovecot/libdovecot.so.0
/usr/lib64/dovecot/libdovecot.so.0.0.0
/usr/lib64/dovecot/libdriver_sqlite.so
/usr/lib64/dovecot/libssl_iostream_openssl.so
/usr/lib64/dovecot/settings
/usr/libexec/dovecot
/usr/libexec/dovecot/aggregator
/usr/libexec/dovecot/anvil
/usr/libexec/dovecot/auth
/usr/libexec/dovecot/checkpassword-reply
/usr/libexec/dovecot/config
/usr/libexec/dovecot/decode2text.sh
/usr/libexec/dovecot/deliver
/usr/libexec/dovecot/dict
/usr/libexec/dovecot/director
/usr/libexec/dovecot/dns-client
/usr/libexec/dovecot/doveadm-server
/usr/libexec/dovecot/dovecot-lda
/usr/libexec/dovecot/gdbhelper
/usr/libexec/dovecot/imap
/usr/libexec/dovecot/imap-login
/usr/libexec/dovecot/imap-urlauth
/usr/libexec/dovecot/imap-urlauth-login
/usr/libexec/dovecot/imap-urlauth-worker
/usr/libexec/dovecot/indexer
/usr/libexec/dovecot/indexer-worker
/usr/libexec/dovecot/ipc
/usr/libexec/dovecot/lmtp
/usr/libexec/dovecot/log
/usr/libexec/dovecot/maildirlock
/usr/libexec/dovecot/mkcert.sh
/usr/libexec/dovecot/pop3
/usr/libexec/dovecot/pop3-login
/usr/libexec/dovecot/prestartscript
/usr/libexec/dovecot/quota-status
/usr/libexec/dovecot/rawlog
/usr/libexec/dovecot/replicator
/usr/libexec/dovecot/script
/usr/libexec/dovecot/script-login
/usr/libexec/dovecot/ssl-params
/usr/libexec/dovecot/stats
/usr/libexec/dovecot/xml2text
/usr/sbin/dovecot
/usr/share/doc/dovecot-2.2.13
/usr/share/doc/dovecot-2.2.13/AUTHORS
/usr/share/doc/dovecot-2.2.13/COPYING
/usr/share/doc/dovecot-2.2.13/COPYING.LGPL
/usr/share/doc/dovecot-2.2.13/COPYING.MIT
/usr/share/doc/dovecot-2.2.13/ChangeLog
/usr/share/doc/dovecot-2.2.13/NEWS
/usr/share/doc/dovecot-2.2.13/README
/usr/share/doc/dovecot-2.2.13/documentation.txt
/usr/share/doc/dovecot-2.2.13/dovecot-openssl.cnf
/usr/share/doc/dovecot-2.2.13/example-config
/usr/share/doc/dovecot-2.2.13/example-config/conf.d
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/10-auth.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/10-director.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/10-logging.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/10-mail.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/10-master.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/10-ssl.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/15-lda.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/15-mailboxes.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/20-imap.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/20-lmtp.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/20-pop3.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/90-acl.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/90-plugin.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/90-quota.conf
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-checkpassword.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-deny.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-dict.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-ldap.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-master.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-passwdfile.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-sql.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-static.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-system.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/conf.d/auth-vpopmail.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/dovecot-dict-auth.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/dovecot-dict-sql.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/dovecot-ldap.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/dovecot-sql.conf.ext
/usr/share/doc/dovecot-2.2.13/example-config/dovecot.conf
/usr/share/doc/dovecot-2.2.13/mkcert.sh
/usr/share/doc/dovecot-2.2.13/solr-schema.xml
/usr/share/doc/dovecot-2.2.13/wiki
/usr/share/doc/dovecot-2.2.13/wiki/ACL.txt
/usr/share/doc/dovecot-2.2.13/wiki/AixPluginsSupport.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.CheckPassword.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.Dict.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.LDAP.AuthBinds.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.LDAP.PasswordLookups.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.LDAP.Userdb.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.LDAP.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.Passwd.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.PasswdFile.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.SQL.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.VPopMail.txt
/usr/share/doc/dovecot-2.2.13/wiki/AuthDatabase.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.Caching.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.Kerberos.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.MasterUsers.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.Mechanisms.DigestMD5.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.Mechanisms.NTLM.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.Mechanisms.Winbind.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.Mechanisms.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.MultipleDatabases.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.PasswordSchemes.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.RestrictAccess.txt
/usr/share/doc/dovecot-2.2.13/wiki/Authentication.txt
/usr/share/doc/dovecot-2.2.13/wiki/BasicConfiguration.txt
/usr/share/doc/dovecot-2.2.13/wiki/Chrooting.txt
/usr/share/doc/dovecot-2.2.13/wiki/Clients.NegativeUIDs.txt
/usr/share/doc/dovecot-2.2.13/wiki/Clients.txt
/usr/share/doc/dovecot-2.2.13/wiki/CompilingSource.txt
/usr/share/doc/dovecot-2.2.13/wiki/Debugging.Authentication.txt
/usr/share/doc/dovecot-2.2.13/wiki/Debugging.ProcessTracing.txt
/usr/share/doc/dovecot-2.2.13/wiki/Debugging.Rawlog.txt
/usr/share/doc/dovecot-2.2.13/wiki/Debugging.Thunderbird.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Arrays.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.AuthProcess.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.AuthProtocol.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Buffers.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Code.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.DoveadmProtocol.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Dsync.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Indexes.Cache.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Indexes.MailIndexApi.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Indexes.MainIndex.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Indexes.TransactionLog.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Indexes.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.InputStreams.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.MailProcess.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Memory.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.OutputStreams.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Plugins.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Processes.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.ErrorHandling.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.Mail.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.MailNamespace.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.MailStorage.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.MailUser.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.Mailbox.Save.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.Mailbox.Search.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.Mailbox.Sync.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.Mailbox.Transaction.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.Mailbox.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.MailboxList.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Storage.Plugins.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.Strings.txt
/usr/share/doc/dovecot-2.2.13/wiki/Design.txt
/usr/share/doc/dovecot-2.2.13/wiki/Dict.txt
/usr/share/doc/dovecot-2.2.13/wiki/Director.txt
/usr/share/doc/dovecot-2.2.13/wiki/DomainLost.txt
/usr/share/doc/dovecot-2.2.13/wiki/Errors.ChgrpNoPerm.txt
/usr/share/doc/dovecot-2.2.13/wiki/FindMailLocation.txt
/usr/share/doc/dovecot-2.2.13/wiki/FinishBasicConfiguration.txt
/usr/share/doc/dovecot-2.2.13/wiki/HowTo.EximAndDovecotSASL.txt
/usr/share/doc/dovecot-2.2.13/wiki/HowTo.ImapcProxy.txt
/usr/share/doc/dovecot-2.2.13/wiki/HowTo.PopBSMTPAndDovecot.txt
/usr/share/doc/dovecot-2.2.13/wiki/HowTo.PopRelay.txt
/usr/share/doc/dovecot-2.2.13/wiki/HowTo.PostfixAndDovecotSASL.txt
/usr/share/doc/dovecot-2.2.13/wiki/HowTo.Rootless.txt
/usr/share/doc/dovecot-2.2.13/wiki/HowTo.SimpleVirtualInstall.txt
/usr/share/doc/dovecot-2.2.13/wiki/HowTo.txt
/usr/share/doc/dovecot-2.2.13/wiki/IndexFiles.txt
/usr/share/doc/dovecot-2.2.13/wiki/LDA.Exim.txt
/usr/share/doc/dovecot-2.2.13/wiki/LDA.Indexing.txt
/usr/share/doc/dovecot-2.2.13/wiki/LDA.Postfix.txt
/usr/share/doc/dovecot-2.2.13/wiki/LDA.Qmail.txt
/usr/share/doc/dovecot-2.2.13/wiki/LDA.Sendmail.txt
/usr/share/doc/dovecot-2.2.13/wiki/LDA.txt
/usr/share/doc/dovecot-2.2.13/wiki/LMTP.Exim.txt
/usr/share/doc/dovecot-2.2.13/wiki/LMTP.txt
/usr/share/doc/dovecot-2.2.13/wiki/Logging.txt
/usr/share/doc/dovecot-2.2.13/wiki/LoginProcess.txt
/usr/share/doc/dovecot-2.2.13/wiki/MDA.txt
/usr/share/doc/dovecot-2.2.13/wiki/MTA.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailLocation.LocalDisk.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailLocation.Maildir.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailLocation.SharedDisk.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailLocation.dbox.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailLocation.mbox.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailLocation.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailboxFormat.Cydir.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailboxFormat.MH.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailboxFormat.Maildir.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailboxFormat.dbox.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailboxFormat.mailstore.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailboxFormat.mbox.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailboxFormat.mbx.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailboxFormat.txt
/usr/share/doc/dovecot-2.2.13/wiki/MailboxSettings.txt
/usr/share/doc/dovecot-2.2.13/wiki/MboxChildFolders.txt
/usr/share/doc/dovecot-2.2.13/wiki/MboxLocking.txt
/usr/share/doc/dovecot-2.2.13/wiki/MboxProblems.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.BincIMAP.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.Courier.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.Cyrus.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.Dsync.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.Gmail.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.Linuxconf.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.MailFormat.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.Online.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.Teapop.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.UW.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.Vm-pop3d.txt
/usr/share/doc/dovecot-2.2.13/wiki/Migration.txt
/usr/share/doc/dovecot-2.2.13/wiki/MissingMailboxes.txt
/usr/share/doc/dovecot-2.2.13/wiki/Mountpoints.txt
/usr/share/doc/dovecot-2.2.13/wiki/NFS.txt
/usr/share/doc/dovecot-2.2.13/wiki/Namespaces.txt
/usr/share/doc/dovecot-2.2.13/wiki/OSCompatibility.txt
/usr/share/doc/dovecot-2.2.13/wiki/POP3Server.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.BSDAuth.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.ExtraFields.AllowNets.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.ExtraFields.Host.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.ExtraFields.NoDelay.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.ExtraFields.NoLogin.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.ExtraFields.Proxy.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.ExtraFields.User.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.ExtraFields.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.IMAP.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.PAM.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.Shadow.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.Static.txt
/usr/share/doc/dovecot-2.2.13/wiki/PasswordDatabase.txt
/usr/share/doc/dovecot-2.2.13/wiki/PerformanceTuning.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Installation.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.ManageSieve.Clients.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.ManageSieve.Configuration.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.ManageSieve.Install.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.ManageSieve.Troubleshooting.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.ManageSieve.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Configuration.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Examples.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Extensions.SpamtestVirustest.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Extensions.Vacation.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Extensions.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Plugins.Extdata.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Plugins.Extprograms.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Plugins.Pipe.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Plugins.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Troubleshooting.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.Usage.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.Sieve.txt
/usr/share/doc/dovecot-2.2.13/wiki/Pigeonhole.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Autocreate.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Compress.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Expire.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.FTS.Lucene.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.FTS.Solr.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.FTS.Squat.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.FTS.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Lazyexpunge.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Listescape.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.MailFilter.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.MailLog.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.MailboxAlias.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Notify.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Snarf.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Stats.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Trash.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Virtual.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.Zlib.txt
/usr/share/doc/dovecot-2.2.13/wiki/Plugins.txt
/usr/share/doc/dovecot-2.2.13/wiki/PostLoginScripting.txt
/usr/share/doc/dovecot-2.2.13/wiki/PreAuth.txt
/usr/share/doc/dovecot-2.2.13/wiki/QuickConfiguration.txt
/usr/share/doc/dovecot-2.2.13/wiki/Quota.Configuration.txt
/usr/share/doc/dovecot-2.2.13/wiki/Quota.Dict.txt
/usr/share/doc/dovecot-2.2.13/wiki/Quota.Dirsize.txt
/usr/share/doc/dovecot-2.2.13/wiki/Quota.FS.txt
/usr/share/doc/dovecot-2.2.13/wiki/Quota.Maildir.txt
/usr/share/doc/dovecot-2.2.13/wiki/Quota.txt
/usr/share/doc/dovecot-2.2.13/wiki/Replication.txt
/usr/share/doc/dovecot-2.2.13/wiki/RunningDovecot.txt
/usr/share/doc/dovecot-2.2.13/wiki/SSL.CertificateClientImporting.txt
/usr/share/doc/dovecot-2.2.13/wiki/SSL.CertificateCreation.txt
/usr/share/doc/dovecot-2.2.13/wiki/SSL.DovecotConfiguration.txt
/usr/share/doc/dovecot-2.2.13/wiki/SSL.SNIClientSupport.txt
/usr/share/doc/dovecot-2.2.13/wiki/SSL.txt
/usr/share/doc/dovecot-2.2.13/wiki/Sasl.txt
/usr/share/doc/dovecot-2.2.13/wiki/SecurityTuning.txt
/usr/share/doc/dovecot-2.2.13/wiki/Services.txt
/usr/share/doc/dovecot-2.2.13/wiki/SharedMailboxes.Permissions.txt
/usr/share/doc/dovecot-2.2.13/wiki/SharedMailboxes.Public.txt
/usr/share/doc/dovecot-2.2.13/wiki/SharedMailboxes.Shared.txt
/usr/share/doc/dovecot-2.2.13/wiki/SharedMailboxes.Symlinks.txt
/usr/share/doc/dovecot-2.2.13/wiki/SharedMailboxes.txt
/usr/share/doc/dovecot-2.2.13/wiki/SocketUnavailable.txt
/usr/share/doc/dovecot-2.2.13/wiki/Statistics.txt
/usr/share/doc/dovecot-2.2.13/wiki/SystemUsers.txt
/usr/share/doc/dovecot-2.2.13/wiki/TestInstallation.txt
/usr/share/doc/dovecot-2.2.13/wiki/TestPop3Installation.txt
/usr/share/doc/dovecot-2.2.13/wiki/TimeMovedBackwards.txt
/usr/share/doc/dovecot-2.2.13/wiki/Upgrading.1.0.txt
/usr/share/doc/dovecot-2.2.13/wiki/Upgrading.1.1.txt
/usr/share/doc/dovecot-2.2.13/wiki/Upgrading.1.2.txt
/usr/share/doc/dovecot-2.2.13/wiki/Upgrading.2.0.txt
/usr/share/doc/dovecot-2.2.13/wiki/Upgrading.2.1.txt
/usr/share/doc/dovecot-2.2.13/wiki/Upgrading.2.2.txt
/usr/share/doc/dovecot-2.2.13/wiki/Upgrading.txt
/usr/share/doc/dovecot-2.2.13/wiki/UserDatabase.ExtraFields.txt
/usr/share/doc/dovecot-2.2.13/wiki/UserDatabase.NSS.txt
/usr/share/doc/dovecot-2.2.13/wiki/UserDatabase.Prefetch.txt
/usr/share/doc/dovecot-2.2.13/wiki/UserDatabase.Static.txt
/usr/share/doc/dovecot-2.2.13/wiki/UserDatabase.txt
/usr/share/doc/dovecot-2.2.13/wiki/UserIds.txt
/usr/share/doc/dovecot-2.2.13/wiki/Variables.txt
/usr/share/doc/dovecot-2.2.13/wiki/VirtualUsers.Home.txt
/usr/share/doc/dovecot-2.2.13/wiki/VirtualUsers.txt
/usr/share/doc/dovecot-2.2.13/wiki/WhyDoesItNotWork.txt
/usr/share/doc/dovecot-2.2.13/wiki/maildrop.txt
/usr/share/doc/dovecot-2.2.13/wiki/mutt.txt
/usr/share/doc/dovecot-2.2.13/wiki/uw2dovecot.sh.txt
/usr/share/man/man1/deliver.1.gz
/usr/share/man/man1/doveadm-altmove.1.gz
/usr/share/man/man1/doveadm-auth.1.gz
/usr/share/man/man1/doveadm-batch.1.gz
/usr/share/man/man1/doveadm-config.1.gz
/usr/share/man/man1/doveadm-copy.1.gz
/usr/share/man/man1/doveadm-deduplicate.1.gz
/usr/share/man/man1/doveadm-director.1.gz
/usr/share/man/man1/doveadm-dump.1.gz
/usr/share/man/man1/doveadm-exec.1.gz
/usr/share/man/man1/doveadm-expunge.1.gz
/usr/share/man/man1/doveadm-fetch.1.gz
/usr/share/man/man1/doveadm-flags.1.gz
/usr/share/man/man1/doveadm-force-resync.1.gz
/usr/share/man/man1/doveadm-help.1.gz
/usr/share/man/man1/doveadm-import.1.gz
/usr/share/man/man1/doveadm-index.1.gz
/usr/share/man/man1/doveadm-instance.1.gz
/usr/share/man/man1/doveadm-kick.1.gz
/usr/share/man/man1/doveadm-log.1.gz
/usr/share/man/man1/doveadm-mailbox.1.gz
/usr/share/man/man1/doveadm-mount.1.gz
/usr/share/man/man1/doveadm-move.1.gz
/usr/share/man/man1/doveadm-penalty.1.gz
/usr/share/man/man1/doveadm-purge.1.gz
/usr/share/man/man1/doveadm-pw.1.gz
/usr/share/man/man1/doveadm-quota.1.gz
/usr/share/man/man1/doveadm-reload.1.gz
/usr/share/man/man1/doveadm-search.1.gz
/usr/share/man/man1/doveadm-stop.1.gz
/usr/share/man/man1/doveadm-user.1.gz
/usr/share/man/man1/doveadm-who.1.gz
/usr/share/man/man1/doveadm.1.gz
/usr/share/man/man1/doveconf.1.gz
/usr/share/man/man1/dovecot-lda.1.gz
/usr/share/man/man1/dovecot.1.gz
/usr/share/man/man1/dsync.1.gz
/usr/share/man/man5/dovecot.conf.5.gz
/usr/share/man/man7/doveadm-search-query.7.gz
/var/lib/dovecot
/var/run/dovecot
/var/run/dovecot/empty
/var/run/dovecot/login

Wie auch schon beim Paket dovecot wollen wir uns noch kurz ansehen, was das Paket clucene-core alles mit ins System bringt.

 # rpm -qil clucene-core
Name        : clucene-core
Version     : 2.3.3.4
Release     : 11.el7
Architecture: x86_64
Install Date: Mon 21 Jul 2014 03:51:26 PM CEST
Group       : Development/System
Size        : 1889958
License     : LGPLv2+ or ASL 2.0
Signature   : RSA/SHA256, Fri 04 Jul 2014 02:58:15 AM CEST, Key ID 24c6a8a7f4a80eb5
Source RPM  : clucene-2.3.3.4-11.el7.src.rpm
Build Date  : Tue 10 Jun 2014 12:18:02 AM CEST
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.sourceforge.net/projects/clucene
Summary     : Core clucene module
Description :
CLucene is a C++ port of the popular Apache Lucene search engine
(http://lucene.apache.org/java).
CLucene aims to be a high-speed alternative to Java Lucene, its API is very
similar to that of the Java version. CLucene has recently been brought up to
date with Lucene 2.3.2. It contains most of the same functionality as the Java version.
/usr/lib64/libclucene-core.so.1
/usr/lib64/libclucene-core.so.2.3.3.4
/usr/lib64/libclucene-shared.so.1
/usr/lib64/libclucene-shared.so.2.3.3.4
/usr/share/doc/clucene-core-2.3.3.4
/usr/share/doc/clucene-core-2.3.3.4/APACHE.license
/usr/share/doc/clucene-core-2.3.3.4/AUTHORS
/usr/share/doc/clucene-core-2.3.3.4/COPYING
/usr/share/doc/clucene-core-2.3.3.4/ChangeLog
/usr/share/doc/clucene-core-2.3.3.4/LGPL.license
/usr/share/doc/clucene-core-2.3.3.4/README

Die Konfiguration von Dovecot erfolgt nicht mit Hilfe einer großen Konfigurationsdatei, sondern ist aufgeteilt in kleinere spezielle Konfigurationsdateien, jeweils auf die einzelnen Anwendungsfälle abgestimmt.

Im Verzeichnis /etc/dovecot finden wir all diese Dateien.

/etc/dovecot/
├── conf.d
│   ├── 10-auth.conf
│   ├── 10-director.conf
│   ├── 10-logging.conf
│   ├── 10-mail.conf
│   ├── 10-master.conf
│   ├── 10-ssl.conf
│   ├── 15-lda.conf
│   ├── 15-mailboxes.conf
│   ├── 20-imap.conf
│   ├── 20-lmtp.conf
│   ├── 20-pop3.conf
│   ├── 90-acl.conf
│   ├── 90-plugin.conf
│   ├── 90-quota.conf
│   ├── auth-checkpassword.conf.ext
│   ├── auth-deny.conf.ext
│   ├── auth-dict.conf.ext
│   ├── auth-ldap.conf.ext
│   ├── auth-master.conf.ext
│   ├── auth-passwdfile.conf.ext
│   ├── auth-sql.conf.ext
│   ├── auth-static.conf.ext
│   ├── auth-system.conf.ext
│   └── auth-vpopmail.conf.ext
├── dovecot.conf
└── dovecot-sql.conf.ext

Abhängig von den installierten Dovecot-RPM-Paketen befinden sich dort entsprechend mehr oder weniger Dateien.

Doch selbst bei kleinen Installationen, lohnt es sich, kurz inne zu halten und zu überlegen, wo denn die Reise hingehen könnte. Der Wunsch nach KISS4) kann bei Zeiten gehörig nach hinten losgehen. Ganz klar, eine Benutzer- und Passwort-Verwaltung mit Hilfe der userdb und passdb scheint für eine kleine Firma auf den ersten Blick eine lohnende Sache zu sein. Warum solle ein Robert Nullinger seine eMail-Adresse beim Anmelden verwenden, wenn denn der doch kürzere Vorname robert auch ausreicht. Na ja, spätestens dann, wenn Robert Priesemut eingestellt oder eine zweite oder sehr viele Domains ins Spiel kommen, ist recht schnell „Schluß mit lustig“! Der spätere Mehraufwand bei Umstellungen, wird hier durchaus sehr schnell zum Showstopper und kosten (Arbeits-/Lebens)-Zeit sowie einen Haufen Nerven. Und von beiden hat der Admin und Postmaster gewöhnlich nie ausreichend viel über. ;-)

Wir werden daher nur ganz kurz zum Einstieg und Grundverständnis, auf die scheinbar einfachste Variante mit userdb und passdb eingehen. Die eigentliche Lösung, auf die wir im Detail genauer eingehen werden, nutzt zur Benutzerverwaltung Postfixadmin und zur Speicherung der Nutzerdaten eine MySQL-Datenbank. Alternativ kann man natürlich hierzu auch LDAP, Active Directory.

Die Konfiguration der Benutzer-Authentifizierung ist im Kapitel Dovecot, Authentifizierung(en) ausführlich beschrieben.

Speicherformat

Eine sehr technikgetriebene Überlegung, ist die Frage, welches Format verwenden wir beim Speichern der eMails auf unseren Festplatten bzw. Netzwerkspeichern. Theoretisch stehen uns drei Formate zur Verfügung - theoretisch aus dem Grund, da eine der drei Kandidaten keine ernsthafte Alternative (mehr) für den Einsatz auf unserem Dovecot IMAP-Server sein kann. Doch sehen wir uns erst einaml die drei Formate kurz an.

  1. mbox
    :NULL::NULL::DOWN: Pro IMAP-Verzeichnis werden alle Nachrichten in nur eine große Datei geschrieben.
    :NULL::NULL::DOWN: Geht die eine Datei verloren, sind alle (!) eMails verloren!
    :NULL::NULL::DOWN: Bei sehr vielen Nachrichten in einem Ordner werden die Dateien mit unter sehr groß und verursachen
    :NULL::NULL::NULL: daher eine höhere I/O-Last beim Verarbeiten.
    :NULL::NULL::DOWN: Write-Locks werden benötigt, da nur ein Prozess in ein mbox-Datei schreiben kann.

    Auf einem IMAP-Server ist mbox definitiv keine wirkliche ernstzunehmende Einsatzalternative!

  2. Maildir
    :NULL::NULL::UP: Jede einzelne Nachricht wird in einer eigenen Datei abgelegt. Daher sehr robustes und dennoch performantes Format!
    :NULL::NULL::UP: Einfache und schnelle (inkrementelle) Backupmöglichkeiten.
    :NULL::NULL::UP: Keine Write-Locks, da z.B. mehrere LMTP-Prozesse Nachrichten in die Inbox schreiben können.
    :NULL::NULL::UP: es wird keine Datenbank im Hintergrund zum Verwalten von Nachrichtenstati benötigt.
    :NULL::NULL::DOWN: Bei sehr vielen und kleinen Nachrichten belasten Filebasierte Sicherungen den Plattenspeicher.

    Auf Grund der Robustheit ein sehr verbreitetes und auch für mehrere Tausend Benutzer, die erste Wahl bei der Auswahl des Speicherformates.

  3. mdbox
    :NULL::NULL::UP: Properitäres „High-End Speicherformat“ für sehr große Installationen.
    :NULL::NULL::UP: Viele Nachrichten werden in mehrere größere Dateien geschrieben, daher sind inkrementelle Backups
    :NULL::NULL::NULL: weiterhin ohne großen Aufwand möglich.
    :NULL::NULL::DOWN: Ähnlich wie schon beim Cyrus-IMAP-Server wird eine eigene Datenbank zur Informationsspeicherung der
    :NULL::NULL::NULL: eMails benötigt. Daher können nicht mehr nur auf Dateiebene Nachrichten verarbeitet werden. Änderungen
    :NULL::NULL::NULL: im mdbox-Speicherbereich müssen ausschließlich über entsprechende doveadm-Befehle vorgenommen
    :NULL::NULL::NULL: werden! Ebenso muss bei Backups/Restores der Nachrichten muß die Datenbank mit ihren Abhängigkeiten
    :NULL::NULL::NULL: berücksichtigt werden. Entsprechendes Knowhow auf Seiten des Postmasters und Administrators ist
    :NULL::NULL::NULL: zwingend gegeben!

    Performantes „High-End Speicherformat“ für sehr große Installationen. Hinreichende Kenntnisse über das mbox-Format und die doveadm-Kommandos sind Grundvoraussetzung für den Einsatz. Für den Einsteiger und bei überschaubaren Menge an eMails und Postfächern, eher nicht zu empfehlen!

Komprimierung

In der Konfigurationsdatei /etc/dovecot/conf.d/90-plugin.conf wird dann das Komprimierungsverfahren und der Komprimierungsfaktor eingetragen. Laut dem Dovecot-Buch von Peer Heinlein ist das ältere gzip-Verfahren 3x schneller als der neuere bzip25).

 # vim  /etc/dovecot/conf.d/90-plugin.conf
/etc/dovecot/conf.d/90-plugin.conf
##
## Plugin settings
##
 
# All wanted plugins must be listed in mail_plugins setting before any of the
# settings take effect. See <doc/wiki/Plugins.txt> for list of plugins and
# their configuration. Note that %variable expansion is done for all values.
 
plugin {
  #setting_name = value
  # Django : 2014-08-05
  # default: unset
  zlib_save = gz
  # zlib_save = bz2
  # Komprimierungslevel Wert zwischen 1 und 9
  zlib_save_level = 6
}

Die Aktivierung der Komprimierung erfolgt dann nur noch durch anfügen des Mail-plugins zlib in der Konfigiurationsdatei /etc/dovecot/conf.d/10-mail.conf.

 # vim /etc/dovecot/conf.d/10-mail.conf
...
 
# Space separated list of plugins to load for all services. Plugins specific to
# IMAP, LDA, etc. are added to this list in their own .conf files.
# Django : 2014-08-05
# default: #mail_plugins =
mail_plugins = zlib
 
...

Zum Aktivieren führen wir nun kurz einen Reload der Konfigurationsdateien durch.

 # systemctl reload dovecot

Den erfolgreichen Reload der konfiguration sehen wir dann auch bei der Statusabfrage des Daemon.

 # systemctl status dovecot
dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; disabled)
   Active: active (running) since Tue 2014-08-05 13:00:00 CEST; 2h 15min ago
  Process: 5375 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 5247 ExecStartPre=/usr/libexec/dovecot/prestartscript (code=exited, status=0/SUCCESS)
 Main PID: 5251 (dovecot)
   CGroup: /system.slice/dovecot.service
           ├─5251 /usr/sbin/dovecot -F
           ├─5254 dovecot/anvil [0 connections]
           ├─5377 dovecot/log
           └─5379 dovecot/config

Aug 05 14:54:30 vml000070.dmz.nausch.org dovecot[5255]: imap(django@nausch.org): Debug: Namespace : type=private, prefix=, sep=, inbox=no, hidden=yes, list=no, subs...AYOUT=none
Aug 05 14:54:30 vml000070.dmz.nausch.org dovecot[5255]: imap(django@nausch.org): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
Aug 05 14:54:30 vml000070.dmz.nausch.org dovecot[5255]: imap-login: Login: user=<django@nausch.org>, method=PLAIN, rip=10.0.0.20, mpid=5349, TLS, TLSv1 with cipher .../ngAKAAAU>
Aug 05 15:14:54 vml000070.dmz.nausch.org systemd[1]: Reloading Dovecot IMAP/POP3 email server.
Aug 05 15:14:54 vml000070.dmz.nausch.org dovecot[5251]: master: Warning: SIGHUP received - reloading configuration
Aug 05 15:14:54 vml000070.dmz.nausch.org systemd[1]: Reloaded Dovecot IMAP/POP3 email server.
Aug 05 15:14:54 vml000070.dmz.nausch.org dovecot[5255]: imap: Server shutting down. in=319 out=1486
Aug 05 15:14:54 vml000070.dmz.nausch.org dovecot[5255]: imap: Server shutting down. in=107224 out=3408
Aug 05 15:14:54 vml000070.dmz.nausch.org dovecot[5255]: imap: Server shutting down. in=174 out=1137
Aug 05 15:14:54 vml000070.dmz.nausch.org dovecot[5255]: imap: Server shutting down. in=1675 out=4568
Hint: Some lines were ellipsized, use -l to show in full.

Im folgendem Beispiel wurde eine Nachricht in den Unterordner Test kopiert. Nach der aktivierung der Komprimierung wurde erneut die Nachricht in den gleichen Unterordner kopiert.

Auf Dateiebene sieht man dann sehr deutlich den Grad der Komprimierung. Hatte die eMail vor der Komprimierung noch 103.504 Bytes sind des bei aktivierter Komprimierung nur noch 16646 Bytes.

 # ll /srv/vmail/nausch.org/django/Maildir/.Test/cur/
-rw------- 1 vmail vmail 103504 Jul 18 20:19 1407243162.M32318P5341.vml000070.dmz.nausch.org,S=103504,W=106112:2,S
-rw------- 1 vmail vmail  16646 Jul 18 20:19 1407244896.M19043P5389.vml000070.dmz.nausch.org,S=16646,W=106112:2,S

Für unseren Mailserver mit seinen Mailboxen brauchen wir noch ein entsprechendes Verzeichnis, in dem Dovecot später die Nutzerkonten anlegen sowie die Nachrichten und ggf. die SIEVE-Scripte ablegen kann.

Haben wir das dovecot-Paket aus dem Repository mailserver.guru installiert, ist hierzu das Verzeichnis /srv/vmail angelegt und mit den richtigen Rechten ausgestattet worden. Weiterhin wurde auch schon der User vmail, mit dessen UID und GID die virtuellen Mailboxen benutzt werden, angelegt.

Ob dieser User bei anderen Paketen auch schon mitangelegt wurde, überprüfen wir bei Bedarf mit folgendem Aufruf:

 # grep vmail /etc/group /etc/passwd
 /etc/group:vmail:x:10000:
 /etc/passwd:vmail:x:10000:10000:virtueller Mailboxuser:/home/vmail:/sbin/nologin

Fehlt der Nutzer für die virtuellen Mailboxen, ist dies auch kein großer Act, mit den nachfolgenden beiden Befehlen ist dies schnell nachgeholt. Zunächst legen wir für unseren virtuellen Mailbox-User vmail eine Systemgruppe an:

 # groupadd -g 10000 vmail

Anschließend legen wir einen virtuellen Mailbox-User vmail einen Account an, der jedoch weder ein Homedirectory noch eine Login-Shell.

 # useradd -u 10000 -g 10000 -d /usr/libexec/dovecot -s /sbin/nologin -c "Dovecot's vmail systemuser" -M vmail

Fehlt das entsprechende Verzeichnis, ist auch dies kein allzugroßer Act, legen wir bei Bedarf dieses Verzeichnis einfach schnell an. Wir orientieren uns dabei an den FHS6), der für den Daten, die von Diensten angeboten werden, das Verzeichnis /srv vorsieht.

 # mkdir -m 770 -p /srv/vmail

Für die Berechtigungen wählen wir nun als User und als Gruppe jeweils vmail. Somit haben wir später keinen Streß wenn dovecot versucht ein Benutzerverzeichnis neu anzulegen!

 # chown vmail.vmail /srv/vmail

Wichtig:
Finden wir im maillog Einträge der Art:

Jul 30 20:49:02 vml000070 dovecot: imap(django@nausch.org): Error: user django@nausch.org: Initialization failed: Namespace 'INBOX/': mkdir(/srv/vmail/nausch.org/django/Maildir) failed: Permission denied (euid=10000(vmail) egid=10000(vmail) missing +w perm: /srv/vmail, dir owned by 0:12 mode=0755)

so haben wir ein Problem mit den Rechten am entsprechenden Verzeichnis. Ein bekanntes Phänomen, wenn man z.B. statt /srv/vmail das Verzeichnis /var/spool/mail verwendet und die Rechte an dem Verzeichnis nicht angepasst hat. Per default ist dies 775, dem User root und der Gruppe mail. Auch der Versuch über die Konfigurationsoption mail_privileged_group = mail ändert nichts an der Situation. Erst nach anpassen der Gruppenrechte klappt auch dieses Unterfangen.

 # chown vmail:vmail /var/spool/mail

Gleich zu Beginn in der Konfigurationsdatei /etc/dovecot/conf.d/10-mail.conf wird bei der Option mail_location dann festgelegt, wo genau die einelnen Postfächer der virtuellen Mailboxdomains und deren Nutzerpostfächern zu finden sind.

 # vim /etc/dovecot/conf.d/10-mail.conf
...
 
# Location for users' mailboxes. The default is empty, which means that Dovecot
# tries to find the mailboxes automatically. This won't work if the user
# doesn't yet have any mail, so you should explicitly tell Dovecot the full
# location.
#
# If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u)
# isn't enough. You'll also need to tell Dovecot where the other mailboxes are
# kept. This is called the "root mail directory", and it must be the first
# path given in the mail_location setting.
#
# There are a few special variables you can use, eg.:
#
#   %u - username
#   %n - user part in user@domain, same as %u if there's no domain
#   %d - domain part in user@domain, empty if there's no domain
#   %h - home directory
#
# See doc/wiki/Variables.txt for full list. Some examples:
#
#   mail_location = maildir:~/Maildir
#   mail_location = mbox:~/mail:INBOX=/var/mail/%u
#   mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
# <doc/wiki/MailLocation.txt>
#
# Django : 2014-07-30
# default: unset
# %d = domain, Domain-Part der eMailadresse
# %n = username, alles was links vom Domainpart @domain.tld steht
# Für den Nutzer django@nausch.org ergibt sich demnach folgender 
# Pfad: /srv/vmail/nausch.org/django/Maildir
mail_location = maildir:/srv/vmail/%d/%n/Maildir
 
...

Somit finden wir dann im Filespace folgende Ordner und Dateistruktur.

/srv/vmail/nausch.org/django/
├── Maildir
│   ├── cur
│   ├── dovecot.index.cache
│   ├── dovecot.index.log
│   ├── dovecot-uidlist
│   ├── dovecot-uidvalidity
│   ├── dovecot-uidvalidity.53da4a3b
│   ├── new
│   │   └── 1406814779.M450798P21809.vml000070.dmz.nausch.org,S=352,W=364
│   └── tmp
└── sieve
    ├── ingo.sieve
    └── tmp

Bei dem Konfigurationsparameter seperator beim Punkt namespace inbox wird definiert, wie im Dateisystem die Abtrennung der IMAP-(Unter-)Verzeichnisse auf Dateiebene erfolgen soll. In der Konfigurationsdatei /etc/dovecot/conf.d/10-mail.conf erfolgt genau diese Festlegung.

 # vim /etc/dovecot/conf.d/10-mail.conf
... 
 
  # Hierarchy separator to use. You should use the same separator for all
  # namespaces or some clients get confused. '/' is usually a good one.
  # The default however depends on the underlying mail storage format.
  # Django : 2014-07-30
  # default: unset
  separator = /
 
...

Doch wie wirkt sich die Wahl dieses Trennzeichens bei der Verzeichnisstruktur aus? Wählt man es ungünstig, kann das sehr schnell große Verwirrung stiften. Als Defaultwert nutzt Dovecot den Punkt „.“ als Trennzeichen. Diese Vorauswahl, macht auch solange keinen Stress, solange dieser Punkt definitiv nicht im Anmeldenamen vorkommt. Bei vielen meiner betreuten Systeme wird aber eben genau dieser Punkt oft als Trennzeichen beim Anmeldenamen genutzt. So lautet die für Lieschen Müller die eMail-Adresse eben lieschen.mueller@omni128.de. Teilt nun Lieschen Müller einen Teil Ihres Namespaces, würde beim Hierarchietrenner „.“ fälschlicher weise plötzlich aus einem einzigen Pfad lieschen.mueller@omni128.de ein ein Baum mit 3 Ästen werden!

Aus:

"shared namespace"
 └── lieschen.mueller@omni128.de
                               └── Freigegebener Namensraum

wird dann plötzlich:

"shared namespace"
 └── lieschen
            └── mueller@omni128
                              └── de
                                   └── Freigegebener Namensraum

Am wohl sichersten ist es, wenn man alle Zeichen, die in einer eMail-Adresse bzw. Anmeldenamen ausklammert. Im Detail bedeutet dies, kein Zeichen des Konfigurationsparameters auth_username_chars.

 # doveconf auth_username_chars
 auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@

Daher nutzt man zum Beispiel als seperator den „/„, der im Anmeldenamen, also der eMail-Adresse, nicht vorkommt, hat man bei shared namespaces kein Problem.

Auf der anderen Seite wird dann plötzlich beim Versuch das Verzeichnis AC/DC anzulegen, dann ein zweistufiges Verzeichnis daraus.

INBOX/
     └── AC
          └── DC

Hinweis:

Bei Abwägung aller Vor- und Nachteile, empfehle ich aber immer den “/„ als seperator zu verwenden!
Die Vorteile bei shared foldern überwiegen hier die Nachteile beim Anlegen des Heavy-Metall-Fanpage-Ordners. :-P

Eine Festlegung mit einem unscheinbaren Namen, aber mit weitreichenden Auswirkungen in Sachen Bedienbarkeit, ist das Thema IMAP-Namespace. Was versteckt sich nun hinter diesem unscheinbaren Begriff? Im Wesentlichen ist dabei gemeint, wo Im IMAP-Postfach sich die einzelnen Verzeichnisse befinden. Dabei gibt es zwei unterschiedliche Varianten, entweder unterhalb der Inbox oder parallel zur Inbox. Damit man sich von diesem abstrakten Thema ein Bild machen kann, werfen wir mal einen Blick auf die beiden Beispiele.

gleiche Ebene wie Inbox

Bild: Bildschirmhardcopy vom eMail-Client Thunderbird

Hat man die Ordner parallel zur INBOX und klappt die Ordner zu, sieht man dann leider keine INBOX selbst mehr.

unterhalb der INBOX

Bild: Bildschirmhardcopy vom eMail-Client Thunderbird

Hat mal in seinem eMail-Client mehrere Mailkonten und die Ordner werden unterhalb der INBOX angelegt, kann man die Ordner unterhalb der INBOX zuklappen, hat aber dann immer noch die INBOX des Mailkontos im Fokus.

Auf Grund der Erfahrungen und der Rückfragen meiner Endkunden, werden fast nur noch ausschließlich die Ordner Unterhalb des namespaces. Im Fall vom namespace INBOX setzen wir dann den prefix auf den Wert INBOX/.

 # vim /etc/dovecot/conf.d/10-mail.conf
...
 
  # Prefix required to access this namespace. This needs to be different for
  # all namespaces. For example "Public/".
  # Django : 2014-07-30
  # default: unset 
  prefix = INBOX/
 
...

In Summe ergibt sich nunmehr vorerst nachfolgender Endstand bei der Bearbeitung der Konfigurationsdatei /etc/dovecot/conf.d/10-mail.conf.

 # vim /etc/dovecot/conf.d/10-mail.conf
/etc/dovecot/conf.d/10-mail.conf
##
## Mailbox locations and namespaces
##
 
# Location for users' mailboxes. The default is empty, which means that Dovecot
# tries to find the mailboxes automatically. This won't work if the user
# doesn't yet have any mail, so you should explicitly tell Dovecot the full
# location.
#
# If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u)
# isn't enough. You'll also need to tell Dovecot where the other mailboxes are
# kept. This is called the "root mail directory", and it must be the first
# path given in the mail_location setting.
#
# There are a few special variables you can use, eg.:
#
#   %u - username
#   %n - user part in user@domain, same as %u if there's no domain
#   %d - domain part in user@domain, empty if there's no domain
#   %h - home directory
#
# See doc/wiki/Variables.txt for full list. Some examples:
#
#   mail_location = maildir:~/Maildir
#   mail_location = mbox:~/mail:INBOX=/var/mail/%u
#   mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
# <doc/wiki/MailLocation.txt>
#
# Django : 2014-07-30
# default: unset
# %d = domain, Domain-Part der eMailadresse
# %n = username, alles was links vom Domainpart @domain.tld steht
mail_location = maildir:/srv/vmail/%d/%n/Maildir
 
# If you need to set multiple mailbox locations or want to change default
# namespace settings, you can do it by defining namespace sections.
#
# You can have private, shared and public namespaces. Private namespaces
# are for user's personal mails. Shared namespaces are for accessing other
# users' mailboxes that have been shared. Public namespaces are for shared
# mailboxes that are managed by sysadmin. If you create any shared or public
# namespaces you'll typically want to enable ACL plugin also, otherwise all
# users can access all the shared mailboxes, assuming they have permissions
# on filesystem level to do so.
namespace inbox {
  # Namespace type: private, shared or public
  # Django : 2014-07-30
  # default: unset
  type = private
 
  # Hierarchy separator to use. You should use the same separator for all
  # namespaces or some clients get confused. '/' is usually a good one.
  # The default however depends on the underlying mail storage format.
  # Django : 2014-07-30
  # default: unset
  separator = / 
 
  # Prefix required to access this namespace. This needs to be different for
  # all namespaces. For example "Public/".
  # Django : 2014-07-30
  # default: unset 
  prefix = INBOX/ 
 
  # Physical location of the mailbox. This is in same format as
  # mail_location, which is also the default for it.
  #location =
 
  # There can be only one INBOX, and this setting defines which namespace
  # has it.
  inbox = yes
 
  # If namespace is hidden, it's not advertised to clients via NAMESPACE
  # extension. You'll most likely also want to set list=no. This is mostly
  # useful when converting from another server with different namespaces which
  # you want to deprecate but still keep working. For example you can create
  # hidden namespaces with prefixes "~/mail/", "~%u/mail/" and "mail/".
  #hidden = no
 
  # Show the mailboxes under this namespace with LIST command. This makes the
  # namespace visible for clients that don't support NAMESPACE extension.
  # "children" value lists child mailboxes, but hides the namespace prefix.
  #list = yes
 
  # Namespace handles its own subscriptions. If set to "no", the parent
  # namespace handles them (empty prefix should always have this as "yes")
  # Django : 2014-07-30
  # default: unset  
  subscriptions = yes
}
 
# Example shared namespace configuration
#namespace {
  #type = shared
  #separator = /
 
  # Mailboxes are visible under "shared/user@domain/"
  # %%n, %%d and %%u are expanded to the destination user.
  #prefix = shared/%%u/
 
  # Mail location for other users' mailboxes. Note that %variables and ~/
  # expands to the logged in user's data. %%n, %%d, %%u and %%h expand to the
  # destination user's data.
  #location = maildir:%%h/Maildir:INDEX=~/Maildir/shared/%%u
 
  # Use the default namespace for saving subscriptions.
  #subscriptions = no
 
  # List the shared/ namespace only if there are visible shared mailboxes.
  #list = children
#}
# Should shared INBOX be visible as "shared/user" or "shared/user/INBOX"?
#mail_shared_explicit_inbox = no
 
# System user and group used to access mails. If you use multiple, userdb
# can override these by returning uid or gid fields. You can use either numbers
# or names. <doc/wiki/UserIds.txt>
#mail_uid =
#mail_gid =
 
# Group to enable temporarily for privileged operations. Currently this is
# used only with INBOX when either its initial creation or dotlocking fails.
# Typically this is set to "mail" to give access to /var/mail.
#mail_privileged_group =
 
# Grant access to these supplementary groups for mail processes. Typically
# these are used to set up access to shared mailboxes. Note that it may be
# dangerous to set these if users can create symlinks (e.g. if "mail" group is
# set here, ln -s /var/mail ~/mail/var could allow a user to delete others'
# mailboxes, or ln -s /secret/shared/box ~/mail/mybox would allow reading it).
#mail_access_groups =
 
# Allow full filesystem access to clients. There's no access checks other than
# what the operating system does for the active UID/GID. It works with both
# maildir and mboxes, allowing you to prefix mailboxes names with eg. /path/
# or ~user/.
#mail_full_filesystem_access = no
 
# Dictionary for key=value mailbox attributes. Currently used by URLAUTH, but
# soon intended to be used by METADATA as well.
#mail_attribute_dict =
 
##
## Mail processes
##
 
# Don't use mmap() at all. This is required if you store indexes to shared
# filesystems (NFS or clustered filesystem).
#mmap_disable = no
 
# Rely on O_EXCL to work when creating dotlock files. NFS supports O_EXCL
# since version 3, so this should be safe to use nowadays by default.
#dotlock_use_excl = yes
 
# When to use fsync() or fdatasync() calls:
#   optimized (default): Whenever necessary to avoid losing important data
#   always: Useful with e.g. NFS when write()s are delayed
#   never: Never use it (best performance, but crashes can lose data)
#mail_fsync = optimized
 
# Locking method for index files. Alternatives are fcntl, flock and dotlock.
# Dotlocking uses some tricks which may create more disk I/O than other locking
# methods. NFS users: flock doesn't work, remember to change mmap_disable.
#lock_method = fcntl
 
# Directory in which LDA/LMTP temporarily stores incoming mails >128 kB.
#mail_temp_dir = /tmp
 
# Valid UID range for users, defaults to 500 and above. This is mostly
# to make sure that users can't log in as daemons or other system users.
# Note that denying root logins is hardcoded to dovecot binary and can't
# be done even if first_valid_uid is set to 0.
#first_valid_uid = 500
#last_valid_uid = 0
 
# Valid GID range for users, defaults to non-root/wheel. Users having
# non-valid GID as primary group ID aren't allowed to log in. If user
# belongs to supplementary groups with non-valid GIDs, those groups are
# not set.
#first_valid_gid = 1
#last_valid_gid = 0
 
# Maximum allowed length for mail keyword name. It's only forced when trying
# to create new keywords.
#mail_max_keyword_length = 50
 
# ':' separated list of directories under which chrooting is allowed for mail
# processes (ie. /var/mail will allow chrooting to /var/mail/foo/bar too).
# This setting doesn't affect login_chroot, mail_chroot or auth chroot
# settings. If this setting is empty, "/./" in home dirs are ignored.
# WARNING: Never add directories here which local users can modify, that
# may lead to root exploit. Usually this should be done only if you don't
# allow shell access for users. <doc/wiki/Chrooting.txt>
#valid_chroot_dirs = 
 
# Default chroot directory for mail processes. This can be overridden for
# specific users in user database by giving /./ in user's home directory
# (eg. /home/./user chroots into /home). Note that usually there is no real
# need to do chrooting, Dovecot doesn't allow users to access files outside
# their mail directory anyway. If your home directories are prefixed with
# the chroot directory, append "/." to mail_chroot. <doc/wiki/Chrooting.txt>
#mail_chroot = 
 
# UNIX socket path to master authentication server to find users.
# This is used by imap (for shared users) and lda.
#auth_socket_path = /var/run/dovecot/auth-userdb
 
# Directory where to look up mail plugins.
# Django : 2014-07-30
# Auswahl des Verzeichnisses mit dem Mail-Plugins
# default: #mail_plugin_dir = /usr/lib/dovecot
mail_plugin_dir = /usr/lib64/dovecot
 
# Space separated list of plugins to load for all services. Plugins specific to
# IMAP, LDA, etc. are added to this list in their own .conf files.
#mail_plugins = 
 
##
## Mailbox handling optimizations
##
 
# Mailbox list indexes can be used to optimize IMAP STATUS commands. They are
# also required for IMAP NOTIFY extension to be enabled.
#mailbox_list_index = no
 
# The minimum number of mails in a mailbox before updates are done to cache
# file. This allows optimizing Dovecot's behavior to do less disk writes at
# the cost of more disk reads.
#mail_cache_min_mail_count = 0
 
# When IDLE command is running, mailbox is checked once in a while to see if
# there are any new mails or other changes. This setting defines the minimum
# time to wait between those checks. Dovecot can also use dnotify, inotify and
# kqueue to find out immediately when changes occur.
#mailbox_idle_check_interval = 30 secs
 
# Save mails with CR+LF instead of plain LF. This makes sending those mails
# take less CPU, especially with sendfile() syscall with Linux and FreeBSD.
# But it also creates a bit more disk I/O which may just make it slower.
# Also note that if other software reads the mboxes/maildirs, they may handle
# the extra CRs wrong and cause problems.
#mail_save_crlf = no
 
# Max number of mails to keep open and prefetch to memory. This only works with
# some mailbox formats and/or operating systems.
#mail_prefetch_count = 0
 
# How often to scan for stale temporary files and delete them (0 = never).
# These should exist only after Dovecot dies in the middle of saving mails.
#mail_temp_scan_interval = 1w
 
##
## Maildir-specific settings
##
 
# By default LIST command returns all entries in maildir beginning with a dot.
# Enabling this option makes Dovecot return only entries which are directories.
# This is done by stat()ing each entry, so it causes more disk I/O.
# (For systems setting struct dirent->d_type, this check is free and it's
# done always regardless of this setting)
#maildir_stat_dirs = no
 
# When copying a message, do it with hard links whenever possible. This makes
# the performance much better, and it's unlikely to have any side effects.
#maildir_copy_with_hardlinks = yes
 
# Assume Dovecot is the only MUA accessing Maildir: Scan cur/ directory only
# when its mtime changes unexpectedly or when we can't find the mail otherwise.
#maildir_very_dirty_syncs = no
 
# If enabled, Dovecot doesn't use the S=<size> in the Maildir filenames for
# getting the mail's physical size, except when recalculating Maildir++ quota.
# This can be useful in systems where a lot of the Maildir filenames have a
# broken size. The performance hit for enabling this is very small.
#maildir_broken_filename_sizes = no
 
# Always move mails from new/ directory to cur/, even when the \Recent flags
# aren't being reset.
#maildir_empty_new = no
 
##
## mbox-specific settings
##
 
# Which locking methods to use for locking mbox. There are four available:
#  dotlock: Create <mailbox>.lock file. This is the oldest and most NFS-safe
#           solution. If you want to use /var/mail/ like directory, the users
#           will need write access to that directory.
#  dotlock_try: Same as dotlock, but if it fails because of permissions or
#               because there isn't enough disk space, just skip it.
#  fcntl  : Use this if possible. Works with NFS too if lockd is used.
#  flock  : May not exist in all systems. Doesn't work with NFS.
#  lockf  : May not exist in all systems. Doesn't work with NFS.
#
# You can use multiple locking methods; if you do the order they're declared
# in is important to avoid deadlocks if other MTAs/MUAs are using multiple
# locking methods as well. Some operating systems don't allow using some of
# them simultaneously.
#mbox_read_locks = fcntl
#mbox_write_locks = dotlock fcntl
mbox_write_locks = fcntl
 
# Maximum time to wait for lock (all of them) before aborting.
#mbox_lock_timeout = 5 mins
 
# If dotlock exists but the mailbox isn't modified in any way, override the
# lock file after this much time.
#mbox_dotlock_change_timeout = 2 mins
 
# When mbox changes unexpectedly we have to fully read it to find out what
# changed. If the mbox is large this can take a long time. Since the change
# is usually just a newly appended mail, it'd be faster to simply read the
# new mails. If this setting is enabled, Dovecot does this but still safely
# fallbacks to re-reading the whole mbox file whenever something in mbox isn't
# how it's expected to be. The only real downside to this setting is that if
# some other MUA changes message flags, Dovecot doesn't notice it immediately.
# Note that a full sync is done with SELECT, EXAMINE, EXPUNGE and CHECK 
# commands.
#mbox_dirty_syncs = yes
 
# Like mbox_dirty_syncs, but don't do full syncs even with SELECT, EXAMINE,
# EXPUNGE or CHECK commands. If this is set, mbox_dirty_syncs is ignored.
#mbox_very_dirty_syncs = no
 
# Delay writing mbox headers until doing a full write sync (EXPUNGE and CHECK
# commands and when closing the mailbox). This is especially useful for POP3
# where clients often delete all mails. The downside is that our changes
# aren't immediately visible to other MUAs.
#mbox_lazy_writes = yes
 
# If mbox size is smaller than this (e.g. 100k), don't write index files.
# If an index file already exists it's still read, just not updated.
#mbox_min_index_size = 0
 
# Mail header selection algorithm to use for MD5 POP3 UIDLs when
# pop3_uidl_format=%m. For backwards compatibility we use apop3d inspired
# algorithm, but it fails if the first Received: header isn't unique in all
# mails. An alternative algorithm is "all" that selects all headers.
#mbox_md5 = apop3d
 
##
## mdbox-specific settings
##
 
# Maximum dbox file size until it's rotated.
#mdbox_rotate_size = 2M
 
# Maximum dbox file age until it's rotated. Typically in days. Day begins
# from midnight, so 1d = today, 2d = yesterday, etc. 0 = check disabled.
#mdbox_rotate_interval = 0
 
# When creating new mdbox files, immediately preallocate their size to
# mdbox_rotate_size. This setting currently works only in Linux with some
# filesystems (ext4, xfs).
#mdbox_preallocate_space = no
 
##
## Mail attachments
##
 
# sdbox and mdbox support saving mail attachments to external files, which
# also allows single instance storage for them. Other backends don't support
# this for now.
 
# Directory root where to store mail attachments. Disabled, if empty.
#mail_attachment_dir =
 
# Attachments smaller than this aren't saved externally. It's also possible to
# write a plugin to disable saving specific attachments externally.
#mail_attachment_min_size = 128k
 
# Filesystem backend to use for saving attachments:
#  posix : No SiS done by Dovecot (but this might help FS's own deduplication)
#  sis posix : SiS with immediate byte-by-byte comparison during saving
#  sis-queue posix : SiS with delayed comparison and deduplication
#mail_attachment_fs = sis posix
 
# Hash format to use in attachment filenames. You can add any text and
# variables: %{md4}, %{md5}, %{sha1}, %{sha256}, %{sha512}, %{size}.
# Variables can be truncated, e.g. %{sha256:80} returns only first 80 bits
#mail_attachment_hash = %{sha1}

Damit nicht jeder User manuell sich Ordner für gesendet Nachrichten, Entwürfe oder den Postkorb anlegen muss, lassen wir diese automatisch erstellen. Die hierzu notwendigen Einstellungen werden in der Konfigurationsdatei /etc/dovecot/conf.d/15-mailboxes.conf vorgenommen.

 # vim /etc/dovecot/conf.d/15-mailboxes.conf
/etc/dovecot/conf.d/15-mailboxes.conf
##
## Mailbox definitions
##
 
# NOTE: Assumes "namespace inbox" has been defined in 10-mail.conf.
namespace inbox {
 
  #mailbox name {
    # auto=create will automatically create this mailbox.
    # auto=subscribe will both create and subscribe to the mailbox.
    #auto = no
 
    # Space separated list of IMAP SPECIAL-USE attributes as specified by
    # RFC 6154: \All \Archive \Drafts \Flagged \Junk \Sent \Trash
    #special_use =
  #}
 
  # These mailboxes are widely used and could perhaps be created automatically:
  mailbox Drafts {
    special_use = \Drafts
    # Django : 2014-07-31
    # default: unset
    auto = subscribe
  }
  # Django : 2014-07-31
  # Da unser Postfix-Mailserver eindeutige SPAM-Nachrichten erst gar nicht 
  # annimmt, brauchen wir auch keinen separaten SPAM-Ordner für solche
  # Nachrichten!
  # mailbox Junk {
  #   special_use = \Junk
  # }
  mailbox Trash {
    special_use = \Trash
    # Django : 2014-07-31
    # default: unset
    auto = subscribe
  }
 
  # For \Sent mailboxes there are two widely used names. We'll mark both of
  # them as \Sent. User typically deletes one of them if duplicates are created.
  mailbox Sent {
    special_use = \Sent
    # Django : 2014-07-31
    # default: unset
    auto = subscribe
  }
  # Django : 2014-07-31
  # wir beschränken uns auf einen Mülleimer und zwar den mit dem Namen "Trash"!
  # mailbox "Sent Messages" {
  #   special_use = \Sent
  # }
 
  # If you have a virtual "All messages" mailbox:
  #mailbox virtual/All {
  #  special_use = \All
  #}
 
  # If you have a virtual "Flagged" mailbox:
  #mailbox virtual/Flagged {
  #  special_use = \Flagged
  #}
}

Dovecot unterstützt uns bei der Fehlersuche mit aussagekräftigen Einträgen im Maillog unseres Servers. Zum Feinjustieren und individuellen Loggingverhalten bietet uns Dovecot mehrere Optionen.

dovecot.conf

Rufen wir die Prozessliste auf, sehen wir je nach Auslastung unseres Servers einen oder mehrere Dovecot-Prozesse.

 USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
 dovecot  19666  0.0  0.0  19204  2072 ?        S    18:40   0:00 dovecot/imap

Zieht jetzt ein Client mehr Ressourcen, als wir diesem zugestehen wollen, können wir so leider nicht ohne weiteres herausfinden, wer das ist.

Über den Konfigurationsparameter verbose_proctitle können wir definieren, dass uns neben den üblichen ps-Werten zusätzlich noch der Login-Name, die Client-IP-Adresse und auch noch der ausgeführte IMAP-Befehl angezeigt wird.

 USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
 dovecot  19907 66.6  0.0  18860  1684 ?        S    18:45   0:00 dovecot/imap [django@mailserver.guru 10.0.0.20]
 dovecot  19971  0.0  0.0  19204  2088 ?        S    18:46   0:00 dovecot/imap [django@nausch.org 109.43.1.83 IDLE]

Zum Aktivieren dieser Option tragen wir nun einfach ein verbose_proctitle=yes in der Konfigurationsdatei /etc/dovecot/dovecot.conf ein.

 # vim /etc/dovecot/dovecot.conf
/etc/dovecot/dovecot.conf
## Dovecot configuration file                                                                                                                                                    
 
# If you're in a hurry, see http://wiki2.dovecot.org/QuickConfiguration                                                                                                          
 
# "doveconf -n" command gives a clean output of the changed settings. Use it
# instead of copy&pasting files when posting to the Dovecot mailing list.
 
# '#' character and everything after it is treated as comments. Extra spaces
# and tabs are ignored. If you want to use either of these explicitly, put the
# value inside quotes, eg.: key = "# char and trailing whitespace  "
 
# Most (but not all) settings can be overridden by different protocols and/or
# source/destination IPs by placing the settings inside sections, for example:
# protocol imap { }, local 127.0.0.1 { }, remote 10.0.0.0/8 { }
 
# Default values are shown for each setting, it's not required to uncomment
# those. These are exceptions to this though: No sections (e.g. namespace {})
# or plugin settings are added by default, they're listed only as examples.
# Paths are also just examples with the real defaults being based on configure
# options. The paths listed here are for configure --prefix=/usr
# --sysconfdir=/etc --localstatedir=/var
 
# Protocols we want to be serving.
#protocols = imap pop3 lmtp
 
# A comma separated list of IPs or hosts where to listen in for connections. 
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
#listen = *, ::
 
# Base directory where to store runtime data.
#base_dir = /var/run/dovecot/
 
# Name of this instance. In multi-instance setup doveadm and other commands
# can use -i <instance_name> to select which instance is used (an alternative
# to -c <config_path>). The instance name is also added to Dovecot processes
# in ps output.
#instance_name = dovecot
 
# Greeting message for clients.
#login_greeting = Dovecot ready.
 
# Space separated list of trusted network ranges. Connections from these
# IPs are allowed to override their IP addresses and ports (for logging and
# for authentication checks). disable_plaintext_auth is also ignored for
# these networks. Typically you'd specify your IMAP proxy servers here.
#login_trusted_networks =
 
# Space separated list of login access check sockets (e.g. tcpwrap)
#login_access_sockets = 
 
# With proxy_maybe=yes if proxy destination matches any of these IPs, don't do
# proxying. This isn't necessary normally, but may be useful if the destination
# IP is e.g. a load balancer's IP.
#auth_proxy_self =
 
# Show more verbose process titles (in ps). Currently shows user name and
# IP address. Useful for seeing who are actually using the IMAP processes
# (eg. shared mailboxes or if same uid is used for multiple accounts).
# Django : 2014-07-21
# In der Prozessliste bei den POP3/IMAP-Prozessen zusätzlich den Usernamen, 
# die Client-IP-Adresse und den ausgeführten IMAP-Befehl anzeigen. 
# default: #verbose_proctitle = no
verbose_proctitle = yes
 
# Should all processes be killed when Dovecot master process shuts down.
# Setting this to "no" means that Dovecot can be upgraded without
# forcing existing client connections to close (although that could also be
# a problem if the upgrade is e.g. because of a security fix).
#shutdown_clients = yes
 
# If non-zero, run mail commands via this many connections to doveadm server,
# instead of running them directly in the same process.
#doveadm_worker_count = 0
# UNIX socket or host:port used for connecting to doveadm server
#doveadm_socket_path = doveadm-server
 
# Space separated list of environment variables that are preserved on Dovecot
# startup and passed down to all of its child processes. You can also give
# key=value pairs to always set specific settings.
#import_environment = TZ
 
##
## Dictionary server settings
##
 
# Dictionary can be used to store key=value lists. This is used by several
# plugins. The dictionary can be accessed either directly or though a
# dictionary server. The following dict block maps dictionary names to URIs
# when the server is used. These can then be referenced using URIs in format
# "proxy::<name>".
 
dict {
  #quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
  #expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext
}
 
# Most of the actual configuration gets included below. The filenames are
# first sorted by their ASCII value and parsed in that order. The 00-prefixes
# in filenames are intended to make it easier to understand the ordering.
!include conf.d/*.conf
 
# A config file can also tried to be included without giving an error if
# it's not found:
!include_try local.conf

10-logging.conf

Weitere Optionen zum Umfang beim Logging nehmen wir an Hand der Datei 10-logging.conf vor. Die einzelnen Parameter sind mit entsprechenden Kommentaren versehen.

 # vim /etc/dovecot/conf.d/10-logging.conf
/etc/dovecot/conf.d/10-logging.conf
##
## Log destination.
##
 
# Log file to use for error messages. "syslog" logs to syslog,
# /dev/stderr logs to stderr.
#log_path = syslog
 
# Log file to use for informational messages. Defaults to log_path.
#info_log_path = 
# Log file to use for debug messages. Defaults to info_log_path.
#debug_log_path = 
 
# Syslog facility to use if you're logging to syslog. Usually if you don't
# want to use "mail", you'll use local0..local7. Also other standard
# facilities are supported.
#syslog_facility = mail
 
##
## Logging verbosity and debugging.
##
 
# Log unsuccessful authentication attempts and the reasons why they failed.
#auth_verbose = no
# Django : 2014-07-21
# Detaillierte Loginformationen zum positiven Authentifizierungsprozess 
# bzw. im Fehlerfall mit Details zu den Fehlern
# default: auth_verbose = no
auth_verbose = no
 
# In case of password mismatches, log the attempted password. Valid values are
# no, plain and sha1. sha1 can be useful for detecting brute force password
# attempts vs. user simply trying the same password over and over again.
# You can also truncate the value to n chars by appending ":n" (e.g. sha1:6).
#auth_verbose_passwords = no
 
# Even more verbose logging for debugging purposes. Shows for example SQL
# queries.
#auth_debug = no
# Django : 2014-07-21
# Detaillierte Debug-Loginformationen zum Authentifizierungsprozess inkl.
# der SQL-Abfragen und deren Ergebnisse ins Logfile schreiben
 
# In case of password mismatches, log the passwords and used scheme so the
# problem can be debugged. Enabling this also enables auth_debug.
#auth_debug_passwords = no
# Django : 2014-07-21
# Passwort zum Debuggen mitloggen? 
 
# Enable mail process debugging. This can help you figure out why Dovecot
# isn't finding your mails.
#mail_debug = no
# Django : 2014-07-21
# Detailierte Loginformationen zur Verarbeitung der eMails durch Dovecot.
 
# Show protocol level SSL errors.
#verbose_ssl = no
# Django : 2014-07-21
# SSL-Debugmode aktivieren. 
 
# mail_log plugin provides more event logging for mail processes.
plugin {
  # Events to log. Also available: flag_change append
  #mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename
  # Available fields: uid, box, msgid, from, subject, size, vsize, flags
  # size and vsize are available only for expunge and copy events.
  #mail_log_fields = uid box msgid size
}
 
##
## Log formatting.
##
 
# Prefix for each line written to log file. % codes are in strftime(3)
# format.
#log_timestamp = "%b %d %H:%M:%S "
# Django : 2014-07-21
# default: unset
log_timestamp  = "%Y-%m-%d %H:%M:%S "
 
# Space-separated list of elements we want to log. The elements which have
# a non-empty variable value are joined together to form a comma-separated
# string.
#login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c
# Django : 2014-07-21
# default: unset
# Folgende Parameter wurden aktiviert:
# %u         : User/Login-Namen 
# %m         : Authentication-Methode
# %r         : Remote IP Adress
# %e         : Mail-Process-ID (imap/pop3) der post-login Verbindung
# %c         : "secured" String "SSL", "TLS" 
# %k         : SSL Protokoll und Cipher-Information  
# %{session} : Session-ID der Client-Verbindung
login_log_format_elements = user=<%u> method=%m rip=%r mpid=%e %c %k session=<%{session}>
 
# Login log format. %s contains login_log_format_elements string, %$ contains
# the data we want to log.
#login_log_format = %$: %s
 
# Log prefix for mail processes. See doc/wiki/Variables.txt for list of
# possible variables you can use.
#mail_log_prefix = "%s(%u): "
 
# Format to use for logging mail deliveries. You can use variables:
#  %$ - Delivery status message (e.g. "saved to INBOX")
#  %m - Message-ID
#  %s - Subject
#  %f - From address
#  %p - Physical size
#  %w - Virtual size
#deliver_log_format = msgid=%m: %$

Die benutzen Variablen in der Konfigurationsdatei /etc/dovecot/conf.d/10-logging.conf sind im Dovecot Wiki ausführlich beschrieben.

10-mail.conf

Normalerweise loggt Dovecot nur mit, wann sich ein Nutzer am server an und abmeldet. Möchte man darüber hinaus sehen, welche IMAP-Kommandos der eMail-Client abgesetzt hat, muß man auf die beiden plugins notify und mail_log zurückgreifen. Das Plugin mail_log schreibt dabei die Änderungen, die das notify-Plugin meldet, ins Maillog des Servers.

 # vim /etc/dovecot/conf.d/10-mail.conf
...
 
# Space separated list of plugins to load for all services. Plugins specific to
# IMAP, LDA, etc. are added to this list in their own .conf files.
# Django : 2014-08-05 - zlib-Kompremmierung der Mailkonten
# default: #mail_plugins =
#mail_plugins = zlib
# Django : 2014-08-06 - Quotaregelung aktiviert
# last   : mail_plugins = zlib
# mail_plugins = zlib quota
# Django : 2014-08-08 - ACL-Plugin für Shared Folders
# mail_plugins = zlib quota acl
# Django : 2014-08-10 - Loggen der IMAP-Kommandos im Maillog des Servers
mail_plugins = zlib quota acl notify mail_log
 
...

Welche IP-Adressen unser Dovecot-Server zur Verfügung stellt fragen wir mit dem Befehl netstat ab.

 # netstat -tulpen | grep dovecot
 tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      0          27433      2341/dovecot        
 tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      0          27408      2341/dovecot        
 tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      0          27406      2341/dovecot        
 tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      0          27431      2341/dovecot        
 tcp        0      0 10.0.0.70:24            0.0.0.0:*               LISTEN      0          27414      2341/dovecot        
 tcp6       0      0 :::993                  :::*                    LISTEN      0          27434      2341/dovecot        
 tcp6       0      0 :::995                  :::*                    LISTEN      0          27409      2341/dovecot        
 tcp6       0      0 :::110                  :::*                    LISTEN      0          27407      2341/dovecot        
 tcp6       0      0 :::143                  :::*                    LISTEN      0          27432      2341/dovecot

In dem Beispiel sehen wir folgende möglichen Verbindungen:

  • 10.0.0.70:24 das ist unser LMTP-Port für die Annahme der Nachrichten vom Frontendserver Postfix.
  • 110 und 995 : POP3 und POP3s Port unseres Dovecot-Servers
  • 143 und 993 : IMAP und IMAPs Port unseres Dovecot-Servers

Die gesetzte 0.0.0.0 bedeutet, dass auf allen IPv4 -Adressen auf dem jeweiligen Port Verbindungen angenommen werden. Die ::: wiederum bedeutet, dass auf allen IPv6-Adressen auf dem jeweiligen Port Verbindungen angenommen werden.

Da unser Dovecot-Server nur IPv4-Adressen hält, ändern wir noch kurzer Hand die dazu nötigen Konfigurationsoptionen. Hierzu stehen uns zwei Möglichkeiten offen:

  1. ein Netzwerk-Interface : Hat unser server nur ein Netzwerkinterface, so können wir in der Konfigurationsdatei /etc/dovecot/dovecot.conf einstellen, dass nur auf einer bestimmten IP-Adresse die Ports für die aktivierten Dienste geöffnet werden.
     # vim /etc/dovecot/dovecot.conf
    ...
    
    # A comma separated list of IPs or hosts where to listen in for connections. 
    # "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
    # If you want to specify non-default ports or anything more complex,
    # edit conf.d/master.conf.
    # Django : 2014-08-04
    # IPv6-Adressen deaktivieren, Server lauscht nur auf einem Netzwerkinterface
    # bzw. einer IPv4-Addresse
    # default: #listen = *, ::
    listen = 10.0.0.70
    
    ...

    anschließend starten wir den Daemon einmal durch.

     # systemctl restart dovecot

    Überprüfen woir jetzt die geöffneten Ports, sehen wir nur noch die IPv4-Adresse bei den betreffenden Ports.

     # netstat -tulpen | grep dovecot
    tcp        0      0 10.0.0.70:993           0.0.0.0:*               LISTEN      0          34979      2389/dovecot        
    tcp        0      0 10.0.0.70:995           0.0.0.0:*               LISTEN      0          34942      2389/dovecot        
    tcp        0      0 10.0.0.70:110           0.0.0.0:*               LISTEN      0          34941      2389/dovecot        
    tcp        0      0 10.0.0.70:143           0.0.0.0:*               LISTEN      0          34978      2389/dovecot        
    tcp        0      0 10.0.0.70:24            0.0.0.0:*               LISTEN      0          34951      2389/dovecot
  2. mehrer Netzwerkinterfaces/IP-Adressen Hat unser Dovecot-Server mehrere Netzwerkinterfaces und der Server soll bestimmte Dientse nur auf bestimmten IP-Adressen anbieten, so tragen wir diese nicht in der Konfigurationsdatei /etc/dovecot/dovecot.conf, sondern in der /etc/dovecot/conf.d/10-master.conf.
     # vim /etc/dovecot/conf.d/10-master.conf
    ...
    
    service imap-login {
      inet_listener imap {
        # Django : nur auf IPv4-Adresse lauschen
        # default: alle Adressen (IPv4 und IPv6)
        address = 10.0.0.70
        #port = 143
      }
      inet_listener imaps {
        # Django : nur auf IPv4-Adresse lauschen
        # default: alle Adressen (IPv4 und IPv6)
        address = 10.0.0.70
        #port = 993
        #ssl = yes
      }
    
      # Number of connections to handle before starting a new process. Typically
      # the only useful values are 0 (unlimited) or 1. 1 is more secure, but 0
      # is faster. <doc/wiki/LoginProcess.txt>
      #service_count = 1
    
      # Number of processes to always keep waiting for more connections.
      #process_min_avail = 0
    
      # If you set service_count=0, you probably need to grow this.
      #vsz_limit = $default_vsz_limit
    }
    
    service pop3-login {
      inet_listener pop3 {
        # Django : nur auf IPv4-Adresse lauschen
        # default: alle Adressen (IPv4 und IPv6)
        address = 10.0.0.71
        #port = 110
      }
      inet_listener pop3s {
        # Django : nur auf IPv4-Adresse lauschen
        # default: alle Adressen (IPv4 und IPv6)
        address = 10.0.0.71
        #port = 995
        #ssl = yes
      }
    }
    
    service lmtp {
      # Django : 2014-07-30
      # default:   unix_listener lmtp {
      #               #mode = 0666
      #            }
    
      # Create inet listener only if you can't use the above UNIX socket
      # Django : 2014-07-30
      # Einlieferung der Nachrichten vom Frontend Postfix-Mailserver via LMTP auf Port 24
      # default: unset
      inet_listener lmtp {
        # Avoid making LMTP visible for the entire internet
        address = 10.0.0.72
        port = 24
      }
    
    ...

    Anschließend starten wir den Daemon einmal durch.

     # systemctl restart dovecot

    Überprüfen woir jetzt die geöffneten Ports, sehen wir nur noch die IPv4-Adresse bei den betreffenden Ports.

     # netstat -tulpen | grep dovecot
    tcp        0      0 10.0.0.71:993           0.0.0.0:*               LISTEN      0          34979      2389/dovecot        
    tcp        0      0 10.0.0.71:995           0.0.0.0:*               LISTEN      0          34942      2389/dovecot        
    tcp        0      0 10.0.0.70:110           0.0.0.0:*               LISTEN      0          34941      2389/dovecot        
    tcp        0      0 10.0.0.70:143           0.0.0.0:*               LISTEN      0          34978      2389/dovecot        
    tcp        0      0 10.0.0.72:24            0.0.0.0:*               LISTEN      0          34951      2389/dovecot

Damit unsere Kunden mit Ihren Mailclients Verbindungen zu den geöffneten Ports unseres dovecot-server aufbauen können müssen wir für diese noch Änderungen am Paketfilter firewalld vornehmen.

Den Port 24 haben wir ja bereits bei der Konfiguration von LMTP geöffnet. Nun fehlen nur noch die Regeln für POP Port 110 und POP3s der port 995 sowie für IMAP die beiden Ports 143 und 993 (IMAPs)

 # firewall-cmd --permanent --zone=public --add-port=110/tcp
 success
 # firewall-cmd --permanent --zone=public --add-port=143/tcp
 success
 # firewall-cmd --permanent --zone=public --add-port=993/tcp
 success
 # firewall-cmd --permanent --zone=public --add-port=995/tcp
 success

Anschließend können wir den Firewall-Daemon einmal durchstarten und anschließend überprüfen, ob die Regeln auch entsprechend unserer Definition, gezogen haben.

 # firewall-cmd --reload
 success

Abschließend prüfen wir noch, ob die Erweiterung unseres Paketfilter aktiv ist.

 # iptables -nvL IN_public_allow
Chain IN_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     tcp  --  *      *       10.0.0.80            10.0.0.70            tcp dpt:24 ctstate NEW
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:110 ctstate NEW
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:143 ctstate NEW
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:993 ctstate NEW
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:995 ctstate NEW

Zum Aktivieren der Lucene Full Text Search Indexing nutzen wir die Mailplugins fta und fts_lucene. In der Konfigurationsdatei /etc/dovecot/conf.d/10-mail.conf tragen wir die nachfolgenden Zeilen nach.

 # vim /etc/dovecot/conf.d/10-mail.conf
...
 
# Space separated list of plugins to load for all services. Plugins specific to
# IMAP, LDA, etc. are added to this list in their own .conf files.
# Django : 2014-08-05
# default: #mail_plugins =
#mail_plugins = zlib
# Django : 2014-08-06 - Quotaregelung aktiviert
# last   : mail_plugins = zlib
# mail_plugins = zlib quota
# Django : 2014-08-08 - ACL-Plugin für Shared Folders
# mail_plugins = zlib quota acl
# Django : 2014-08-10 - Loggen der IMAP-Kommandos im Maillog des Servers
#mail_plugins = zlib quota acl notify mail_log 
# Django : 2014-08-12 - gesperrte Sonderzeichen im Verzeichnisnamen erlauben
#mail_plugins = zlib quota acl notify mail_log listescape
# Django : 2014-08-14 - Full text search indexing FTS
mail_plugins = zlib quota acl notify mail_log listescape fts fts_lucene
 
# Django : 2014-08-12
# Mailplugin FS und fts_lucene aktiviert
plugin {
  fts=lucene
  # Lucene-specific settings, good ones are:
  fts_lucene = whitespace_chars=@.
  # Index new messages immediately after they've been saved/copied. (v2.2.9+)
  fts_autoindex = yes
  # Skip autoindexing the mailbox if it has more than n \Recent messages (implying 
  # that the mailbox is never actually being accessed). (v2.2.9+)
  # fts_autoindex_max_recent_msgs = n
  # When SEARCH notices that index isn't up to date, it tells indexer to index the 
  # mails and waits until it is finished. This setting adds a maximum timeout to 
  # this wait. If the timeout is reached, the SEARCH fails with: NO [INUSE] Timeout 
  # while waiting for indexing to finish (v2.1+)
  # fts_index_timeout = n
}
 
...

Zum Aktivieren unserer Programmänderung führen wir einen Reload des Dovecot-Daemon durch.

Der Index wird übrigens automatisch bei jedem Suchvorgang auf dem Server aktualisiert.

Mit der Option fts_autoindex = yes werden die Nachrichten automatisch indiziert, wenn diese per LMTP eingeliefert werden.

Möchte man den Index für einen Benutzer neu anlegen benutzt man folgenden Aufruf:

 # doveadm index -u django@nausch.org -q 'INBOX'

Mit der Option -D kann man sich Debugmeldungen mit ausgeben lassen.

 # doveadm -D index -u django@nausch.org -q 'INBOX'
doveadm(root): Debug: Loading modules from directory: /usr/lib64/dovecot
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/lib01_acl_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/lib15_notify_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/lib20_fts_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/lib20_listescape_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/lib20_mail_log_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/lib20_zlib_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/lib21_fts_lucene_plugin.so
doveadm(root): Debug: Loading modules from directory: /usr/lib64/dovecot/doveadm
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/doveadm/lib10_doveadm_acl_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/doveadm/lib10_doveadm_quota_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/doveadm/lib10_doveadm_sieve_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/doveadm/lib20_doveadm_fts_lucene_plugin.so
doveadm(root): Debug: Module loaded: /usr/lib64/dovecot/doveadm/lib20_doveadm_fts_plugin.so
doveadm(django@nausch.org): Debug: auth input: django@nausch.org home=/srv/vmail/nausch.org/django/ uid=10000 gid=10000 quota_rule=*:bytes=10240000000
doveadm(django@nausch.org): Debug: Added userdb setting: plugin/quota_rule=*:bytes=10240000000
doveadm(django@nausch.org): Debug: Effective uid=10000, gid=10000, home=/srv/vmail/nausch.org/django/
doveadm(django@nausch.org): Debug: Quota root: name=User quota backend=maildir args=ignoreunlimited:noenforcing
doveadm(django@nausch.org): Debug: Quota rule: root=User quota mailbox=* bytes=10240000000 messages=0
doveadm(django@nausch.org): Debug: Quota rule: root=User quota mailbox=INBOX bytes=0 messages=+10240
doveadm(django@nausch.org): Debug: Quota rule: root=User quota mailbox=INBOX/Trash bytes=+131072000 messages=0
doveadm(django@nausch.org): Debug: Quota rule: root=User quota mailbox=INBOX/Sent ignored
doveadm(django@nausch.org): Debug: Quota rule: root=User quota mailbox=INBOX/Archiv bytes=+2560000000 (25%) messages=0
doveadm(django@nausch.org): Debug: Quota warning: bytes=10240000000 (100%) messages=0 reverse=no command=quota-warning 100 django@nausch.org
doveadm(django@nausch.org): Debug: Quota warning: bytes=9728000000 (95%) messages=0 reverse=no command=quota-warning 95 django@nausch.org
doveadm(django@nausch.org): Debug: Quota warning: bytes=8192000000 (80%) messages=0 reverse=no command=quota-warning 80 django@nausch.org
doveadm(django@nausch.org): Debug: Quota grace: root=User quota bytes=1024000000 (10%)
doveadm(django@nausch.org): Debug: Namespace inbox: type=private, prefix=INBOX/, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/srv/vmail/nausch.org/django/Maildir
doveadm(django@nausch.org): Debug: maildir++: root=/srv/vmail/nausch.org/django/Maildir, index=, indexpvt=, control=, inbox=/srv/vmail/nausch.org/django/Maildir, alt=
doveadm(django@nausch.org): Debug: acl: initializing backend with data: vfile
doveadm(django@nausch.org): Debug: acl: acl username = django@nausch.org
doveadm(django@nausch.org): Debug: acl: owner = 1
doveadm(django@nausch.org): Debug: acl vfile: Global ACLs disabled
doveadm(django@nausch.org): Debug: Namespace : type=shared, prefix=shared/%u/, sep=/, inbox=no, hidden=no, list=children, subscriptions=yes location=maildir:%h/Maildir:INDEX=/srv/vmail/nausch.org/django//shared/%u:CONTROL=/srv/vmail/nausch.org/django//shared/%u
doveadm(django@nausch.org): Debug: shared: root=/var/run/dovecot, index=, indexpvt=, control=, inbox=, alt=
doveadm(django@nausch.org): Debug: fts: Indexes disabled for namespace 'shared/%u/'
doveadm(django@nausch.org): Debug: acl: initializing backend with data: vfile
doveadm(django@nausch.org): Debug: acl: acl username = django@nausch.org
doveadm(django@nausch.org): Debug: acl: owner = 0
doveadm(django@nausch.org): Debug: acl vfile: Global ACLs disabled
doveadm(django@nausch.org): Debug: Namespace : type=private, prefix=, sep=, inbox=no, hidden=yes, list=no, subscriptions=no location=fail::LAYOUT=none
doveadm(django@nausch.org): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
doveadm(django@nausch.org): Debug: fts: Indexes disabled for namespace ''

Den Index aller Benutzer würde man mit folgendem Aufruf anstoßen:

 # doveadm index -A -q 'INBOX'

Mit dem nun vorhandenen Suchindex'n lucene-indexes in den Mail-Verzeichen der Nutzer, können nunmehr Volltextsuchen auf dem Server wesentlich effizienter und schneller ausgeführt werden.

 # systemctl start dovecot.service

Im Maillog wird der Start unseres IMAP-Servers entsprechend vermerkt.

 # less /var/log/maillog
 Jul 21 16:00:41 vml000070 dovecot: master: Dovecot v2.2.13 starting up for imap, pop3, lmtp (core dumps disabled)
 # systemctl status dovecot.service
dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; disabled)
   Active: active (running) since Mon 2014-07-21 16:00:41 CEST; 3min 19s ago
  Process: 10513 ExecStartPre=/usr/libexec/dovecot/prestartscript (code=exited, status=0/SUCCESS)
 Main PID: 10517 (dovecot)
   CGroup: /system.slice/dovecot.service
           ├─10517 /usr/sbin/dovecot -F
           ├─10520 dovecot/anvil
           ├─10521 dovecot/log
           └─10523 dovecot/config

Jul 21 16:00:41 vml000070.dmz.nausch.org systemd[1]: Started Dovecot IMAP/POP3 email server.
Jul 21 16:00:41 vml000070.dmz.nausch.org dovecot[10517]: master: Dovecot v2.2.13 starting up for ima...d)
Hint: Some lines were ellipsized, use -l to show in full.

Wollen wir den Daemon beim Hochfahren des Systems automatisch starten, greifen wir auf den Befehl systemctl zurück.

 # systemctl enable dovecot.service
 
 ln -s '/usr/lib/systemd/system/dovecot.service' '/etc/systemd/system/multi-user.target.wants/dovecot.service'

Möchten wir uns vergewissern, ob der Daemon beim Systemstart gestartet wird oder nicht, erfahren wir ebenfalls mit dem Befehl systemctl.

 # systemctl is-enabled dovecot.service
 enabled

Startet der Server nicht automatisch, wird uns ein „disabled“ zurückgemeldet.

Als erstes Testen wir die Einlieferung vom SMTP-Host aus via LMTP.

Die Eingaben am testenden Client sind in der Farbe blau und die Rückmeldungen unseres Dovecot-Servers in der Farbe grün gekennzeichnet. Die Ausgaben des Befehls telnet sind in der Farbe schwarz eingefärbt.

$ telnet 10.0.0.70 24
Trying 10.0.0.70...
Connected to 10.0.0.70.
Escape character is '^]'.
 220 imap.nausch.org Dovecot ready.
LHLO mx01.nausch.org
 250-imap.nausch.org
 250-8BITMIME
 250-ENHANCEDSTATUSCODES
 250 PIPELINING
mail from:<michael@nausch.org>
 250 2.1.0 OK
rcpt to:<django@nausch.org>
 250 2.1.5 OK
DATA
 354 OK
From: Michael Nausch 
To: Django [BOfH] 
Subject: erste Testmail
Date: Mon, 21 Jul 2014 09:00:36 -0000

Hello World!
Here's I am!
;)
.
 250 2.0.0  vYHwHSui31NaDwAAOs1BfA Saved
quit
 221 2.0.0 OK
Connection closed by foreign host.

Im Maillog wird die erfolgreiche Zustellung entsprechend dokumentiert.

 # less /var/log/maillog
Aug  4 17:09:31 vml000070 dovecot: lmtp(3930): Connect from 10.0.0.80
Aug  4 17:10:08 vml000070 dovecot: lmtp(3930): Debug: auth input: django@nausch.org uid=10000 gid=10000 home=/srv/vmail/nausch.org/django
Aug  4 17:11:39 vml000070 dovecot: lmtp(3930, django@nausch.org): Debug: Effective uid=10000, gid=10000, home=/srv/vmail/nausch.org/django
Aug  4 17:11:39 vml000070 dovecot: lmtp(3930, django@nausch.org): Debug: Namespace inbox: type=private, prefix=INBOX/, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/srv/vmail/nausch.org/django/Maildir
Aug  4 17:11:39 vml000070 dovecot: lmtp(3930, django@nausch.org): Debug: maildir++: root=/srv/vmail/nausch.org/django/Maildir, index=, indexpvt=, control=, inbox=/srv/vmail/nausch.org/django/Maildir, alt=
Aug  4 17:11:39 vml000070 dovecot: lmtp(3930, django@nausch.org): Debug: Namespace INBOX/: /srv/vmail/nausch.org/django/Maildir doesn't exist yet, using default permissions
Aug  4 17:11:39 vml000070 dovecot: lmtp(3930, django@nausch.org): Debug: Namespace INBOX/: Using permissions from /srv/vmail/nausch.org/django/Maildir: mode=0700 gid=default
Aug  4 17:11:39 vml000070 dovecot: lmtp(3930, django@nausch.org): Debug: Namespace : type=private, prefix=, sep=, inbox=no, hidden=yes, list=no, subscriptions=no location=fail::LAYOUT=none
Aug  4 17:11:39 vml000070 dovecot: lmtp(3930, django@nausch.org): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
Aug  4 17:11:39 vml000070 dovecot: lmtp(3930, django@nausch.org): vYHwHSui31NaDwAAOs1BfA: msgid=unspecified: saved mail to INBOX
Aug  4 17:11:41 vml000070 dovecot: lmtp(3930): Disconnect from 10.0.0.80: Successful quit

Im Verzeichnis /srv/vmail/ wurden die zugehörigen Verzeichnisse und die Nachricht selbst, also die Datei 1407165099.M887118P3930.vml000070.dmz.nausch.org,S=409,W=422 angelegt.

# tree /srv/vmail/nausch.org/django/ -alF
/srv/vmail/nausch.org/django/
└── Maildir/
    ├── cur/
    ├── dovecot.index.cache
    ├── dovecot.index.log
    ├── dovecot-uidlist
    ├── dovecot-uidvalidity
    ├── dovecot-uidvalidity.53dfa2ab
    ├── new/
    │   └── 1407165099.M887118P3930.vml000070.dmz.nausch.org,S=409,W=422
    └── tmp/

Wir können uns nun auch die Datei/eMail natürlich auch direkt auf der Konsole ansehen.

 # cat /srv/vmail/nausch.org/django/Maildir/new/1407165099.M887118P3930.vml000070.dmz.nausch.org\,S\=409\,W\=422 
Return-Path: <michael@nausch.org>
Delivered-To: <django@nausch.org>
Received: from mx01.nausch.org ([10.0.0.80])
        by imap.nausch.org (Dovecot) with LMTP id vYHwHSui31NaDwAAOs1BfA
        for <django@nausch.org>; Mon, 04 Aug 2014 17:10:10 +0200
From: Michael Nausch <michael@nausch.org>
To: Django [BOfH] <django@nausch.org>
Subject: erste Testmail
Date: Mon, 21 Jul 2014 09:00:36 -0000

Hello World!
Here's I am!
;)

Unsere Nachricht, die nun auf unserem Dovecot-Server frahgen wir nun via POP3 ab.

Auch hier verwenden wir den gewohnten Test via telnet von berechtigten SMTP-Host aus. Die Eingaben am testenden Client sind in der Farbe blau und die Rückmeldungen unseres Dovecot-Servers in der Farbe grün gekennzeichnet. Die Ausgaben des Befehls telnet sind in der Farbe schwarz eingefärbt.

Als erstes bauen wir eine Verbindung zu unserem Dovecot-Server auf, loggen uns ein und fragen die Anzahl der neuen Nachrichten ab.

$ telnet 10.0.0.70 110
Trying 10.0.0.70...
Connected to 10.0.0.70.
Escape character is '^]'.
 +OK Dovecot ready.
USER django@nausch.org
 +OK
PASS Dj4n90_d3r_G33k!
 +OK Logged in.
LIST
 +OK 1 messages:
 1 422
 .
Es ist also eine Nachricht vorhanden, die 422 Bytes groß ist. Als nächstes lassen wir uns die ersten 2 Zeilen der Nachricht 1 anzeigen, dazu benutzen wir den Aufruf TOP 1 2

TOP 1 2
 +OK
 Return-Path: 
 Delivered-To: 
 Received: from mx01.nausch.org ([10.0.0.80])
         by imap.nausch.org (Dovecot) with LMTP id vYHwHSui31NaDwAAOs1BfA
         for ; Mon, 04 Aug 2014 17:10:10 +0200
 From: Michael Nausch 
 To: Django [BOfH] 
 Subject: erste Testmail
 Date: Mon, 21 Jul 2014 09:00:36 -0000
 
 Hello World!
 Here's I am!
 .
Als nächstes holen wir uns die Nachricht mit der Nummer 1 vom Server ab.

RETR 1
 +OK 422 octets
 Return-Path: 
 Delivered-To: 
 Received: from mx01.nausch.org ([10.0.0.80])
         by imap.nausch.org (Dovecot) with LMTP id vYHwHSui31NaDwAAOs1BfA
         for ; Mon, 04 Aug 2014 17:10:10 +0200
 From: Michael Nausch 
 To: Django [BOfH] 
 Subject: erste Testmail
 Date: Mon, 21 Jul 2014 09:00:36 -0000
 
 Hello World!
 Here's I am!
 ;)
 .
Wollen wir die Nachricht löschen verwenden wir den Befehl DELE. Genauer gesagt wird die Nachricht nur zum Löschen markiert. Gelöscht wird erst, wenn die Verbindung vom Client mit dem Befehl QUIT beendet wird. Da wir die Nachricht mit der Nummer 1 als „zu löschen“ markieren wollen, lautet der Aufruf DELE 1.</font>

DELE 1
 +OK Marked to be deleted.

Mit dem Befehl NOOP können wir testen, ob die Verbindung noch vom Client zum Server noch steht.

NOOP
 +OK

Mit dem Befehl STAT fragen wir die Anzahl der Nachrichten, sowie die Größe der Nachrichten in der INBOX ab.

STAT
 +OK 0 0

Da wir zuvor die Nachrichten gelöscht haben, ist die INBOX nun leer. Wollen wir die als zu löschen markierten Nachricht wieder zurücksetzen, also quasi ein „undelete“ der Nachrichten, verwenden wir den Befehl RSET.

RSET
 +OK

fragen wir nun erneut die INBOX mit dem Befehl STAT ab, sehen wir wieder unsere Nachricht mit den 422 Bytes.

STAT
 +OK 1 422

Wir markieren nun unsere Nachricht 1 zum Löschen und beenden die Verbindung mit dem Befehl QUIT. Dabei werden die zu löschenden markierten Nachrichten endgültig gelöscht.

DELE 1
 +OK Marked to be deleted.
QUIT
+OK Logging out, messages deleted.
Connection closed by foreign host.

Unsere Aktionen via POP3 wurden im Maillog entsprechend vermerkt.

 # less /var/log/maillog
Aug  4 17:38:20 vml000070 dovecot: pop3-login: Login: user=<django@nausch.org>, method=PLAIN, rip=10.0.0.70, mpid=3948, secured, session=<U7JTh8//SgAKAABG>
Aug  4 17:38:20 vml000070 dovecot: pop3(django@nausch.org): Debug: Effective uid=10000, gid=10000, home=/srv/vmail/nausch.org/django
Aug  4 17:38:20 vml000070 dovecot: pop3(django@nausch.org): Debug: Namespace inbox: type=private, prefix=INBOX/, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/srv/vmail/nausch.org/django/Maildir
Aug  4 17:38:20 vml000070 dovecot: pop3(django@nausch.org): Debug: maildir++: root=/srv/vmail/nausch.org/django/Maildir, index=, indexpvt=, control=, inbox=/srv/vmail/nausch.org/django/Maildir, alt=
Aug  4 17:38:20 vml000070 dovecot: pop3(django@nausch.org): Debug: Namespace : type=private, prefix=, sep=, inbox=no, hidden=yes, list=no, subscriptions=no location=fail::LAYOUT=none
Aug  4 17:38:20 vml000070 dovecot: pop3(django@nausch.org): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
Aug  4 17:41:34 vml000070 dovecot: pop3(django@nausch.org): Disconnected: Logged out top=2/850, retr=1/438, del=1/1, size=422

Auf unserem Dovecot-Server ist die gelöschte Nachricht nunmehr auch nicht vorhanden, da diese ja beim LOGOUT des Client gelöscht wurde.

/srv/vmail/nausch.org/django/
└── Maildir/
    ├── cur/
    ├── dovecot.index.cache
    ├── dovecot.index.log
    ├── dovecot-uidlist
    ├── dovecot-uidvalidity
    ├── dovecot-uidvalidity.53dfa2ab
    ├── new/
    └── tmp/

Wie auch schon beim Protokoll POP3 testen wir jetzt unseren Dovecot-Server mit dem Protokoll IMAP via Telnet.

Auch hier verwenden wir den gewohnten Test via telnet von berechtigten SMTP-Host aus. Die Eingaben am testenden Client sind in der Farbe blau und die Rückmeldungen unseres Dovecot-Servers in der Farbe grün gekennzeichnet. Die Ausgaben des Befehls telnet sind in der Farbe schwarz eingefärbt.

Als erstes bauen wir eine Verbindung zu unserem Dovecot-Server auf und melden uns an.

$ telnet 10.0.0.70 143
Trying 10.0.0.70...
Connected to 10.0.0.70.
Escape character is '^]'.
 * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5 AUTH=CRAM-MD5] Dovecot ready.
001 LOGIN django@nausch.org Dj4n90_d3r_G33k!
 001 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE] Logged in

Als erstes rufen wir die Liste aller verfügbaren Verzeichnisse ab. Hierzu verwenden wir den Befehl LIST

002 LIST "" "*"
 * LIST (\HasChildren) "/" INBOX
 * LIST (\HasNoChildren \Drafts) "/" INBOX/Drafts
 * LIST (\HasNoChildren \Trash) "/" INBOX/Trash
 * LIST (\HasNoChildren \Sent) "/" INBOX/Sent
 002 OK List completed.

Mit dem Befehl SELECT wechseln wir explizit in den Ordner INBOX.

003 SELECT INBOX
 * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
 * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
 * 1 EXISTS
 * 1 RECENT
 * OK [UNSEEN 1] First unseen.
 * OK [UIDVALIDITY 1407165099] UIDs valid
 * OK [UIDNEXT 4] Predicted next UID
 003 OK [READ-WRITE] Select completed (0.000 secs).

Als nächstes rufen wir mit dem Befehl FETCH die folgenden Daten der eMail ab:

  • Flags
  • Ankunftszeit der eMail
  • die Größe der Nachricht
  • sowie die Header-Zeilen:
    • From:
    • To:
    • Cc:
    • Reply-to
    • Message-ID
    • Date
    • Subject

004 FETCH 1 ALL
 * 1 FETCH (FLAGS (\Recent) INTERNALDATE "04-Aug-2014 19:23:52 +0200" RFC822.SIZE 422 ENVELOPE ("Mon, 21 Jul 2014 09:00:36 -0000" "erste Testmail" (("Michael Nausch" NIL "michael" "nausch.org")) (("Michael Nausch" NIL "michael" "nausch.org")) (("Michael Nausch" NIL "michael" "nausch.org")) ((NIL NIL "Django" "MISSING_DOMAIN")) NIL NIL NIL NIL))
 004 OK Fetch completed.

Nun wollen wir uns unsere Testnachricht herunterladen/anzeigen.

005 FETCH 1 BODY[]
 * 1 FETCH (FLAGS (\Seen \Recent) BODY[] {422}
 Return-Path: 
 Delivered-To: 
 Received: from mx01.nausch.org ([10.0.0.80])
         by imap.nausch.org (Dovecot) with LMTP id uj2JEJjB31OsDwAAOs1BfA
         for ; Mon, 04 Aug 2014 19:23:46 +0200
 From: Michael Nausch 
 To: Django [BOfH] 
 Subject: erste Testmail
 Date: Mon, 21 Jul 2014 09:00:36 -0000
 
 Hello World!
 Here's I am!
 ;)
 )
 005 OK Fetch completed.

Genau auch wie bei POP3 kennt das IMAP-Protokoll den Befehl NOOP, mit dem die Verbindung aufrecht erhalten werden und/oder getestet werden kann.

006 NOOP
 006 OK NOOP completed.

Wollen wir unsere Nachricht löschen, markieren wir diese als zu löschen; hierzu setzen wir das Flag Deleted.

007 STORE 1 +FLAGS \Deleted
 * 1 FETCH (FLAGS (\Deleted \Seen \Recent))
 007 OK Store completed.

Zum Löschen der Nachricht vewenden wir nun entweder den Befehl EXPUNGE, SELECT oder CLOSE.

008 CLOSE
 008 OK Close completed.

Zu guter Letzt loggen wir uns noch von unserem IMAP-Server aus und beenden die Verbindung.

009 LOGOUT
 * BYE Logging out
 009 OK Logout completed.
Connection closed by foreign host.

Unsere Aktionen via POP3 wurden im Maillog entsprechend vermerkt.

 # less /var/log/maillog
Aug  4 19:27:33 vml000070 dovecot: imap-login: Login: user=<django@nausch.org>, method=PLAIN, rip=10.0.0.70, mpid=4020, secured, session=<C7fpDdH/uwAKAABG>
Aug  4 19:27:33 vml000070 dovecot: imap(django@nausch.org): Debug: Effective uid=10000, gid=10000, home=/srv/vmail/nausch.org/django
Aug  4 19:27:33 vml000070 dovecot: imap(django@nausch.org): Debug: Namespace inbox: type=private, prefix=INBOX/, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/srv/vmail/nausch.org/django/Maildir
Aug  4 19:27:33 vml000070 dovecot: imap(django@nausch.org): Debug: maildir++: root=/srv/vmail/nausch.org/django/Maildir, index=, indexpvt=, control=, inbox=/srv/vmail/nausch.org/django/Maildir, alt=
Aug  4 19:27:33 vml000070 dovecot: imap(django@nausch.org): Debug: Namespace : type=private, prefix=, sep=, inbox=no, hidden=yes, list=no, subscriptions=no location=fail::LAYOUT=none
Aug  4 19:27:33 vml000070 dovecot: imap(django@nausch.org): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
Aug  4 19:35:13 vml000070 dovecot: imap(django@nausch.org): Disconnected: Logged out in=173 out=2051

Auf unserem IMAP-Server ist die gelöschte Nachricht auch nichtmehr vorhanden, da diese ja mit dem Befehl CLOSE des Client gelöscht wurde.

/srv/vmail/nausch.org/django/
└── Maildir/
    ├── cur/
    ├── dovecot.index.cache
    ├── dovecot.index.log
    ├── dovecot-uidlist
    ├── dovecot-uidvalidity
    ├── dovecot-uidvalidity.53dfa2ab
    ├── new/
    └── tmp/

Links


1)
Small Office Home Office
2)
Mail User Agent
3)
Stand Januar 2019
4)
Keep It Stupid and Simple
5)
Dovecot Buch Seite 156
6)
Filesystem Hierarchy Standard
Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
  • centos/mail_c7/dovecot_1.txt
  • Zuletzt geändert: 15.10.2020 16:42.
  • von django