Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:mail_c7:dovecot_8 [06.08.2014 10:13. ] – [Rahmenbedingungen] django | centos:mail_c7:dovecot_8 [18.11.2024 07:09. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 19: | Zeile 19: | ||
{{ : | {{ : | ||
- | Mit der Definition des möglichen Speicherbedarfs ist es natürlich noch nicht getan. Unser Dovecot-Server muss natürlich auch den aktuellen und tatsächlichen Platzbedarf eines jeden // | + | Mit der Definition des möglichen Speicherbedarfs ist es natürlich noch nicht getan. Unser Dovecot-Server muss natürlich auch den aktuellen und tatsächlichen Platzbedarf eines jeden // |
* **maildir** Im Homeverzeichnis legt der Dovecot-Server eine Datei Namens // | * **maildir** Im Homeverzeichnis legt der Dovecot-Server eine Datei Namens // | ||
* **dict** Man kann zu Verwaltung der Quotas natürlich auch auf sog. **// | * **dict** Man kann zu Verwaltung der Quotas natürlich auch auf sog. **// | ||
- | FIXME | + | Je Verzeichnis in einem Namensraum auf dem Dovecot-Server können eigene **// |
+ | |||
+ | Mit **// | ||
+ | |||
+ | Seit Version **2.2** von Dovecot kann mit der Definition von // | ||
+ | |||
+ | ===== Konfiguration ===== | ||
+ | ==== Quota-Limits ==== | ||
+ | Die Definition der Quota-Limits erfolgt mit Hilfe der **Quota-Rules** in der Konfigurationsdatei // | ||
+ | |||
+ | |||
+ | # vim / | ||
+ | <code bash> | ||
+ | |||
+ | ## | ||
+ | ## Quota limits | ||
+ | ## | ||
+ | |||
+ | # Quota limits are set using " | ||
+ | # limits, you can set/ | ||
+ | # from userdb. It's also possible to give mailbox-specific limits, for example | ||
+ | # to give additional 100 MB when saving to Trash: | ||
+ | |||
+ | plugin { | ||
+ | #quota_rule = *: | ||
+ | # | ||
+ | |||
+ | # LDA/LMTP allows saving the last mail to bring user from under quota to | ||
+ | # over quota, if the quota doesn' | ||
+ | # long as quota will stay under 10% above the limit. Also allowed e.g. 10M. | ||
+ | # | ||
+ | # Django : 2014-08-06 | ||
+ | # default: unset | ||
+ | # jeder User bekommt im 1GB Mailstorage zugewiesen | ||
+ | quota_rule = *: | ||
+ | # jeder User kann 10k = 10.240 Nachrichten in der INBOX liegen haben | ||
+ | quota_rule2 = INBOX: | ||
+ | # jeder User darf im Unterverzeichnis Trash zusätzlich 125 MB haben | ||
+ | quota_rule3 = INBOX/ | ||
+ | # der Sent-Ordner wird bei der Bewertung ausgenommen | ||
+ | quota_rule4 = INBOX/ | ||
+ | # das Verzeichnis Order darf 25% overquota liegen | ||
+ | quota_rule5 = INBOX/ | ||
+ | # | ||
+ | # jeder user darf die Quota-Limitierung einmalig um 10% überschreiten | ||
+ | quota_grace = 10%% | ||
+ | } | ||
+ | </ | ||
+ | Die einzelnen Konfigurationsparameter sind in dem Konfigurationsbeispiel ausreichend beschrieben. | ||
+ | |||
+ | ==== Quota-Backend ==== | ||
+ | Beim Backend verwenden wir das äußerst robuste und stabile Maildir-Backend. Dovecot wird dabei die Quota-Definition und die aktuellen Werte in eine Datei **maildirsize** im Userverzeichnis verwenden. | ||
+ | |||
+ | Die Auswahl des Quota-Backends erfolgt am Ende der Konfigurationsdatei // | ||
+ | |||
+ | # vim / | ||
+ | <code bash>## | ||
+ | ## Quota backends | ||
+ | ## | ||
+ | |||
+ | # Multiple backends are supported: | ||
+ | # | ||
+ | # Extremely SLOW with Maildir. It'll eat your CPU and disk I/O. | ||
+ | # dict: Keep quota stored in dictionary (eg. SQL) | ||
+ | # | ||
+ | # fs: Read-only support for filesystem quota | ||
+ | |||
+ | plugin { | ||
+ | #quota = dirsize: | ||
+ | #quota = maildir: | ||
+ | #quota = dict:User quota:: | ||
+ | #quota = fs:User quota | ||
+ | # Django : 2014-08-06 | ||
+ | # default: unset | ||
+ | # Quota-Backend Maildir++ aktiviert | ||
+ | # ignoreunlimited : Für Benutzer ohne einem Quota-Limit wird keine Quota-Berechnung durchgeführt | ||
+ | # noenforcing | ||
+ | # | ||
+ | # ns=< | ||
+ | # | ||
+ | quota = maildir: | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Quota-Plugin ==== | ||
+ | |||
+ | Da unsere Quota-Überprüfung nicht nur beim Eingang via **LMTP**, sondern auch beim Kopieren oder Verschieben durch den Endnutzer via **POP3** oder **IMAP**, stattfinden soll, aktivieren wir das Plugin **quota** in der Konfigurationsdatei // | ||
+ | # vim / | ||
+ | <code bash> | ||
+ | |||
+ | # 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 = zlib | ||
+ | # Django : 2014-08-06 - Quotaregelung aktiviert | ||
+ | # last : mail_plugins = zlib | ||
+ | mail_plugins = zlib quota | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | Somit ergibt sich folgendes komplettes Konfigurationsdatei **// | ||
+ | <file bash / | ||
+ | ## 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' | ||
+ | # location. | ||
+ | # | ||
+ | # If you're using mbox, giving a path to the INBOX file (eg. / | ||
+ | # isn't enough. You'll also need to tell Dovecot where the other mailboxes are | ||
+ | # kept. This is called the "root mail directory", | ||
+ | # 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, | ||
+ | # %d - domain part in user@domain, | ||
+ | # %h - home directory | ||
+ | # | ||
+ | # See doc/ | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # < | ||
+ | # | ||
+ | # 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:/ | ||
+ | |||
+ | # 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. '/' | ||
+ | # 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 " | ||
+ | # Django : 2014-07-30 | ||
+ | # default: unset | ||
+ | prefix = INBOX/ | ||
+ | |||
+ | # Physical location of the mailbox. This is in same format as | ||
+ | # mail_location, | ||
+ | #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 " | ||
+ | #hidden = no | ||
+ | |||
+ | # Show the mailboxes under this namespace with LIST command. This makes the | ||
+ | # namespace visible for clients that don't support NAMESPACE extension. | ||
+ | # " | ||
+ | #list = yes | ||
+ | |||
+ | # Namespace handles its own subscriptions. If set to " | ||
+ | # namespace handles them (empty prefix should always have this as " | ||
+ | # Django : 2014-07-30 | ||
+ | # default: unset | ||
+ | subscriptions = yes | ||
+ | } | ||
+ | |||
+ | # Example shared namespace configuration | ||
+ | #namespace { | ||
+ | #type = shared | ||
+ | #separator = / | ||
+ | |||
+ | # Mailboxes are visible under " | ||
+ | # %%n, %%d and %%u are expanded to the destination user. | ||
+ | #prefix = shared/ | ||
+ | |||
+ | # 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: | ||
+ | |||
+ | # Use the default namespace for saving subscriptions. | ||
+ | # | ||
+ | |||
+ | # List the shared/ namespace only if there are visible shared mailboxes. | ||
+ | #list = children | ||
+ | #} | ||
+ | # Should shared INBOX be visible as " | ||
+ | # | ||
+ | |||
+ | # 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. < | ||
+ | #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 " | ||
+ | # | ||
+ | |||
+ | # 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 " | ||
+ | # set here, ln -s /var/mail ~/mail/var could allow a user to delete others' | ||
+ | # mailboxes, or ln -s / | ||
+ | # | ||
+ | |||
+ | # Allow full filesystem access to clients. There' | ||
+ | # 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/. | ||
+ | # | ||
+ | |||
+ | # Dictionary for key=value mailbox attributes. Currently used by URLAUTH, but | ||
+ | # soon intended to be used by METADATA as well. | ||
+ | # | ||
+ | |||
+ | ## | ||
+ | ## Mail processes | ||
+ | ## | ||
+ | |||
+ | # Don't use mmap() at all. This is required if you store indexes to shared | ||
+ | # filesystems (NFS or clustered filesystem). | ||
+ | # | ||
+ | |||
+ | # 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. | ||
+ | # | ||
+ | |||
+ | # When to use fsync() or fdatasync() calls: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #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' | ||
+ | # | ||
+ | |||
+ | # Directory in which LDA/LMTP temporarily stores incoming mails >128 kB. | ||
+ | # | ||
+ | |||
+ | # 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' | ||
+ | # be done even if first_valid_uid is set to 0. | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Valid GID range for users, defaults to non-root/ | ||
+ | # 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. | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Maximum allowed length for mail keyword name. It's only forced when trying | ||
+ | # to create new keywords. | ||
+ | # | ||
+ | |||
+ | # ':' | ||
+ | # processes (ie. /var/mail will allow chrooting to / | ||
+ | # This setting doesn' | ||
+ | # settings. If this setting is empty, "/ | ||
+ | # 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' | ||
+ | # allow shell access for users. < | ||
+ | # | ||
+ | |||
+ | # Default chroot directory for mail processes. This can be overridden for | ||
+ | # specific users in user database by giving /./ in user's home directory | ||
+ | # (eg. / | ||
+ | # need to do chrooting, Dovecot doesn' | ||
+ | # their mail directory anyway. If your home directories are prefixed with | ||
+ | # the chroot directory, append "/ | ||
+ | # | ||
+ | |||
+ | # UNIX socket path to master authentication server to find users. | ||
+ | # This is used by imap (for shared users) and lda. | ||
+ | # | ||
+ | |||
+ | # Directory where to look up mail plugins. | ||
+ | # Django : 2014-07-30 | ||
+ | # Auswahl des Verzeichnisses mit dem Mail-Plugins | ||
+ | # default: # | ||
+ | mail_plugin_dir = / | ||
+ | |||
+ | # 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 = zlib | ||
+ | # Django : 2014-08-06 - Quotaregelung aktiviert | ||
+ | # last : mail_plugins = zlib | ||
+ | mail_plugins = zlib quota | ||
+ | |||
+ | ## | ||
+ | ## 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. | ||
+ | # | ||
+ | |||
+ | # The minimum number of mails in a mailbox before updates are done to cache | ||
+ | # file. This allows optimizing Dovecot' | ||
+ | # the cost of more disk reads. | ||
+ | # | ||
+ | |||
+ | # 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. | ||
+ | # | ||
+ | |||
+ | # 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/ | ||
+ | # the extra CRs wrong and cause problems. | ||
+ | # | ||
+ | |||
+ | # Max number of mails to keep open and prefetch to memory. This only works with | ||
+ | # some mailbox formats and/or operating systems. | ||
+ | # | ||
+ | |||
+ | # 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. | ||
+ | # | ||
+ | |||
+ | ## | ||
+ | ## 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-> | ||
+ | # done always regardless of this setting) | ||
+ | # | ||
+ | |||
+ | # 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. | ||
+ | # | ||
+ | |||
+ | # 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. | ||
+ | # | ||
+ | |||
+ | # If enabled, Dovecot doesn' | ||
+ | # 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. | ||
+ | # | ||
+ | |||
+ | # Always move mails from new/ directory to cur/, even when the \Recent flags | ||
+ | # aren't being reset. | ||
+ | # | ||
+ | |||
+ | ## | ||
+ | ## mbox-specific settings | ||
+ | ## | ||
+ | |||
+ | # Which locking methods to use for locking mbox. There are four available: | ||
+ | # dotlock: Create < | ||
+ | # | ||
+ | # will need write access to that directory. | ||
+ | # dotlock_try: | ||
+ | # | ||
+ | # fcntl : Use this if possible. Works with NFS too if lockd is used. | ||
+ | # flock : May not exist in all systems. Doesn' | ||
+ | # lockf : May not exist in all systems. Doesn' | ||
+ | # | ||
+ | # You can use multiple locking methods; if you do the order they' | ||
+ | # 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_write_locks = fcntl | ||
+ | |||
+ | # Maximum time to wait for lock (all of them) before aborting. | ||
+ | # | ||
+ | |||
+ | # If dotlock exists but the mailbox isn't modified in any way, override the | ||
+ | # lock file after this much time. | ||
+ | # | ||
+ | |||
+ | # 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' | ||
+ | # how it's expected to be. The only real downside to this setting is that if | ||
+ | # some other MUA changes message flags, Dovecot doesn' | ||
+ | # Note that a full sync is done with SELECT, EXAMINE, EXPUNGE and CHECK | ||
+ | # commands. | ||
+ | # | ||
+ | |||
+ | # Like mbox_dirty_syncs, | ||
+ | # EXPUNGE or CHECK commands. If this is set, mbox_dirty_syncs is ignored. | ||
+ | # | ||
+ | |||
+ | # 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. | ||
+ | # | ||
+ | |||
+ | # 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. | ||
+ | # | ||
+ | |||
+ | # 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 " | ||
+ | #mbox_md5 = apop3d | ||
+ | |||
+ | ## | ||
+ | ## mdbox-specific settings | ||
+ | ## | ||
+ | |||
+ | # Maximum dbox file size until it's rotated. | ||
+ | # | ||
+ | |||
+ | # Maximum dbox file age until it's rotated. Typically in days. Day begins | ||
+ | # from midnight, so 1d = today, 2d = yesterday, etc. 0 = check disabled. | ||
+ | # | ||
+ | |||
+ | # 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). | ||
+ | # | ||
+ | |||
+ | ## | ||
+ | ## 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. | ||
+ | # | ||
+ | |||
+ | # Attachments smaller than this aren't saved externally. It's also possible to | ||
+ | # write a plugin to disable saving specific attachments externally. | ||
+ | # | ||
+ | |||
+ | # 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 | ||
+ | # | ||
+ | |||
+ | # 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: | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== Quota-Warnung via eMail ==== | ||
+ | Zur Information der Endnutzer bei Überschreiten der Quota-Warnschwellen, | ||
+ | |||
+ | Die Definition der Warnschwellen **quota_warning** und des Service **quota-warning** erfolgt über die Konfigurationsdatei // | ||
+ | |||
+ | # vim / | ||
+ | <code bash> | ||
+ | |||
+ | # You can execute a given command when user exceeds a specified quota limit. | ||
+ | # Each quota root has separate limits. Only the command for the first | ||
+ | # exceeded limit is excecuted, so put the highest limit first. | ||
+ | # The commands are executed via script service by connecting to the named | ||
+ | # UNIX socket (quota-warning below). | ||
+ | # Note that % needs to be escaped as %%, otherwise "% " expands to empty. | ||
+ | |||
+ | plugin { | ||
+ | # | ||
+ | # | ||
+ | # Django : 2014-08-06 | ||
+ | # default: unset | ||
+ | # Quotawarnings aktiviert | ||
+ | quota_warning = storage=100%% quota-warning 100 %u | ||
+ | quota_warning2 = storage=95%% quota-warning 95 %u | ||
+ | quota_warning3 = storage=80%% quota-warning 80 %u | ||
+ | } | ||
+ | |||
+ | # Example quota-warning service. The unix listener' | ||
+ | # set in a way that mail processes can connect to it. Below example assumes | ||
+ | # that mail processes run as vmail user. If you use mode=0666, all system users | ||
+ | # can generate quota warnings to anyone. | ||
+ | # Django : 2014-08-06 | ||
+ | # default: unset | ||
+ | service quota-warning { | ||
+ | executable = script / | ||
+ | user = vmail | ||
+ | unix_listener quota-warning { | ||
+ | user = vmail | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Beim Shell-Script orientieren wir uns an dem Musterbeispiel aus dem [[http:// | ||
+ | # vim / | ||
+ | |||
+ | <file bash / | ||
+ | PERCENT=$1 | ||
+ | USER=$2 | ||
+ | cat << EOF | / | ||
+ | From: postmaster@nausch.org | ||
+ | To: $USER | ||
+ | Date: `date +"%a, %d %b %Y %H:%M:%S %z"` | ||
+ | Subject: Quota Warnung zu Ihrem eMailkonto! | ||
+ | Content-Type: | ||
+ | Content-Transfer-Encoding: | ||
+ | |||
+ | Ihr Postkorb $USER ist aktuell zu $PERCENT% gefüllt. | ||
+ | |||
+ | Bitte archivieren oder löschen Sie alte, nicht mehr benötige Nachrichten. Andernfalls | ||
+ | könnte es vorkommen, dass Sie keine neuen Nachrichten mehr empfangen könnten! | ||
+ | |||
+ | Ihr Postmaster! | ||
+ | EOF | ||
+ | </ | ||
+ | |||
+ | Damit der Service **quota-warning** das Shell-Script als User **vmail** starten kann, setzen wir noch die Datei-(ausführungs)-Rechte des Scripts. | ||
+ | # chmod 700 / | ||
+ | |||
+ | # chown vmail:vmail / | ||
+ | |||
+ | |||
+ | ==== Quota-Informationen via IMAP ==== | ||
+ | Den Konfigurationsparameter **imap_quota** haben wir bereits in der Konfigurationsdatei // | ||
+ | # vim / | ||
+ | <code bash> | ||
+ | |||
+ | protocol imap { | ||
+ | # Space separated list of plugins to load (default is global mail_plugins). | ||
+ | # | ||
+ | # Django : 2014-08-06 Quota-Informationen via IMAP zur Verfügung stellen | ||
+ | mail_plugins = $mail_plugins imap_quota | ||
+ | |||
+ | |||
+ | # Maximum number of IMAP connections allowed for a user from each IP address. | ||
+ | # NOTE: The username is compared case-sensitively. | ||
+ | # | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Somit werden dem Client während seiner Verbindung zu unserem IMAP-Server Informationen bei Quota-Überschreitungen zur Verfügung gestellt. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Diese Meldung können wir noch individualisieren, | ||
+ | # vim / | ||
+ | <code bash> | ||
+ | |||
+ | # Django : 2014-08-07 | ||
+ | # default: quota_exceeded_message = | ||
+ | # Individuelle Over-Quota-Nachricht mit link zum Wiki mit weiteren Informationen, | ||
+ | # der Client während der IMAP-Sitzung bei Überschreitung der gesetzten Schwellen erhält. | ||
+ | plugin { | ||
+ | quota_exceeded_message = Quota überschritten, | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | Zum Aktivieren der individualisierten Meldung muss noch ein **Reload** des **Dovecot-Daemon** durchgeführt werden. | ||
+ | # systemctl reload dovecot | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== 90-quota.conf Gesamtkonfigurationsdatei ==== | ||
+ | In Summe ergibt sich also folgende Gesamtkonfigurationsdatei unserer Quota-Einstellungen. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | ## Quota configuration. | ||
+ | ## | ||
+ | |||
+ | # Note that you also have to enable quota plugin in mail_plugins setting. | ||
+ | # < | ||
+ | |||
+ | ## | ||
+ | ## Quota limits | ||
+ | ## | ||
+ | |||
+ | # Quota limits are set using " | ||
+ | # limits, you can set/ | ||
+ | # from userdb. It's also possible to give mailbox-specific limits, for example | ||
+ | # to give additional 100 MB when saving to Trash: | ||
+ | |||
+ | plugin { | ||
+ | #quota_rule = *: | ||
+ | # | ||
+ | |||
+ | # LDA/LMTP allows saving the last mail to bring user from under quota to | ||
+ | # over quota, if the quota doesn' | ||
+ | # long as quota will stay under 10% above the limit. Also allowed e.g. 10M. | ||
+ | # | ||
+ | # Django : 2014-08-06 | ||
+ | # default: unset | ||
+ | # jeder User bekommt im 1GB Mailstorage zugewiesen | ||
+ | quota_rule = *: | ||
+ | # jeder User kann 10k = 10.240 Nachrichten in der INBOX liegen haben | ||
+ | quota_rule2 = INBOX: | ||
+ | # jeder User darf im Unterverzeichnis Trash zusätzlich 125 MB haben | ||
+ | quota_rule3 = INBOX/ | ||
+ | # der Sent-Ordner wird bei der Bewertung ausgenommen | ||
+ | quota_rule4 = INBOX/ | ||
+ | # das Verzeichnis Order darf 25% overquota liegen | ||
+ | quota_rule5 = INBOX/ | ||
+ | # | ||
+ | # jeder user darf die Quota-Limitierung einmalig um 10% überschreiten | ||
+ | quota_grace = 10%% | ||
+ | } | ||
+ | |||
+ | ## | ||
+ | ## Quota warnings | ||
+ | ## | ||
+ | |||
+ | # You can execute a given command when user exceeds a specified quota limit. | ||
+ | # Each quota root has separate limits. Only the command for the first | ||
+ | # exceeded limit is excecuted, so put the highest limit first. | ||
+ | # The commands are executed via script service by connecting to the named | ||
+ | # UNIX socket (quota-warning below). | ||
+ | # Note that % needs to be escaped as %%, otherwise "% " expands to empty. | ||
+ | |||
+ | plugin { | ||
+ | # | ||
+ | # | ||
+ | # Django : 2014-08-06 | ||
+ | # default: unset | ||
+ | # Quotawarnings aktiviert | ||
+ | quota_warning = storage=100%% quota-warning 100 %u | ||
+ | quota_warning2 = storage=95%% quota-warning 95 %u | ||
+ | quota_warning3 = storage=80%% quota-warning 80 %u | ||
+ | } | ||
+ | |||
+ | # Example quota-warning service. The unix listener' | ||
+ | # set in a way that mail processes can connect to it. Below example assumes | ||
+ | # that mail processes run as vmail user. If you use mode=0666, all system users | ||
+ | # can generate quota warnings to anyone. | ||
+ | # Django : 2014-08-06 | ||
+ | # default: unset | ||
+ | service quota-warning { | ||
+ | executable = script / | ||
+ | user = vmail | ||
+ | unix_listener quota-warning { | ||
+ | user = vmail | ||
+ | } | ||
+ | } | ||
+ | |||
+ | # Django : 2014-08-07 | ||
+ | # default: quota_exceeded_message = | ||
+ | # Individuelle Over-Quota-Nachricht mit link zum Wiki mit weiteren Informationen, | ||
+ | # der Client während der IMAP-Sitzung bei Überschreitung der gesetzten Schwellen erhält. | ||
+ | plugin { | ||
+ | quota_exceeded_message = Quota überschritten, | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | ## | ||
+ | ## Quota backends | ||
+ | ## | ||
+ | |||
+ | # Multiple backends are supported: | ||
+ | # | ||
+ | # Extremely SLOW with Maildir. It'll eat your CPU and disk I/O. | ||
+ | # dict: Keep quota stored in dictionary (eg. SQL) | ||
+ | # | ||
+ | # fs: Read-only support for filesystem quota | ||
+ | |||
+ | plugin { | ||
+ | #quota = dirsize: | ||
+ | #quota = maildir: | ||
+ | #quota = dict:User quota:: | ||
+ | #quota = fs:User quota | ||
+ | # Django : 2014-08-06 | ||
+ | # default: unset | ||
+ | # Quota-Backend Maildir++ aktiviert | ||
+ | # ignoreunlimited : Für Benutzer ohne einem Quota-Limit wird keine Quota-Berechnung durchgeführt | ||
+ | # noenforcing | ||
+ | # | ||
+ | # ns=< | ||
+ | # | ||
+ | quota = maildir: | ||
+ | } | ||
+ | |||
+ | # Multiple quota roots are also possible, for example this gives each user | ||
+ | # their own 100MB quota and one shared 1GB quota within the domain: | ||
+ | plugin { | ||
+ | #quota = dict: | ||
+ | #quota2 = dict: | ||
+ | #quota_rule = *: | ||
+ | # | ||
+ | } | ||
+ | </ | ||
+ | ==== Individuelle Quotas ==== | ||
+ | In den seltensten Fällen werden wir nicht alle Mailbox-Inhalber über einen Kamm scheren können, wenn es um Speicherkontingenzte geht. So werden diejenigen, die mehr bezahlen mehr Speicherplatz zur Verfügung gestellt bekommen. Auch ist klar dass der **BOfH**((**B**astard **O**perator **f**rom **H**ell)) unlimitierten Platz bekommt, wie der Datenmessie eben weniger. | ||
+ | |||
+ | Abhängig von unserem **[[centos: | ||
+ | |||
+ | === passwd === | ||
+ | Nutzen wir die passwd-Datei // | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # Musterbeispiel eines Eintrages für den passdb-file Authentifizierungsmechanismus | ||
+ | # | ||
+ | # Beispiel für einen Nutzer " | ||
+ | # | ||
+ | django@nausch.org: | ||
+ | </ | ||
+ | |||
+ | === SQL === | ||
+ | Bei Nutzung eines MySQL-Backends zur Authentifikation können wir die Quota-Definition der eMail-Konten aus der Userverwaltung von **[[centos: | ||
+ | * < | ||
+ | | ||
+ | * < | ||
+ | | ||
+ | AND active = ' | ||
+ | |||
+ | Zum Testen, ob unser SQL-Statement das gewünschte Ergebnis liefert, verbinden wir uns von unserem Dovecot-Host aus mit unserer Datenbank. | ||
+ | Die Eingaben am Client sind in der Farbe < | ||
+ | |||
+ | < | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | You can turn off this feature to get a quicker startup with -A | ||
+ | |||
+ | < | ||
+ | Your MySQL connection id is 58334 | ||
+ | Server version: 5.1.73 Source distribution | ||
+ | |||
+ | Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. | ||
+ | |||
+ | Type ' | ||
+ | |||
+ | MySQL [postfix]> | ||
+ | <font style=" | ||
+ | | home | uid | gid | quota_rule | ||
+ | +-------------------------------+-------+-------+--------------------+ | ||
+ | | / | ||
+ | +-------------------------------+-------+-------+--------------------+ | ||
+ | <b>1 row in set (0.00 sec)</ | ||
+ | |||
+ | MySQL [postfix]> | ||
+ | <font style=" | ||
+ | | user | password | ||
+ | +-------------------+------------------+------------+------------+--------------------+ | ||
+ | | django@nausch.org | Dj4n90_d3r_G33k! | 10000 | 10000 | *: | ||
+ | +-------------------+------------------+------------+------------+--------------------+ | ||
+ | <b>1 row in set (0.00 sec)</ | ||
+ | |||
+ | MySQL [postfix]> | ||
+ | <font style=" | ||
+ | </ | ||
+ | |||
+ | ===== Quotas und doveadm ===== | ||
+ | ==== Neuberechnung mit recalc ==== | ||
+ | Hat man größere Migrationsarbeiten an einem Dovecot-Server hinter sich, oder musste auf ein Backup mehrerer User oder Maildomänen zurückgreifen, | ||
+ | Die Quota-Neuberechnung des User-Kontos // | ||
+ | # doveadm quota recalc -u django@nausch.org | ||
+ | |||
+ | Die Neuberechung aller Nutzrkonten würde dann mit folgendem Aufruf erfolgen: | ||
+ | # doveadm quota recalc -A | ||
+ | |||
+ | ==== Abfrage mit get ==== | ||
+ | Genau so, wie wir die Neuberechnung eines einzelnen Nutzerkontos anstossen können, ist auch die Abfrage der Quota-Daten eines Nutzers möglich. | ||
+ | # doveadm quota get -u django@nausch.org | ||
+ | |||
+ | Quota name Type Value Limit % | ||
+ | User quota STORAGE | ||
+ | User quota MESSAGE | ||
+ | |||
+ | Einen Überblick über alle Nutzerkonten erhält man mit der Option **-A**. | ||
+ | |||
+ | # doveadm quota get -A | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | ... | ||
+ | |||
+ | ===== Quota-Status für den Frontend-Mailserver (Postfix-SMTP-Server) ===== | ||
+ | Unser Prontend-Mailserver nimmt eMails entgegen, sofern der postfix-Mailserver sich für die Maildomain zuständig, ein gültiges Userpostfach vorhanden sowie die ganzen SPAM- und AV((Anti Virus))-Maßnahmen überstanden wurden. Wird das Frontend-System anschließend die Post nicht beim Backendsystem los, bleibt ihm nichts anderes übrig, als die Nachricht zum Absender zurückzuschicken - ein sog. **// | ||
+ | |||
+ | Dovecot kann **Quota-Stati** unserem Frontend-Mailserver **[[centos: | ||
+ | |||
+ | ==== Dovecot Konfiguration ==== | ||
+ | Die Konfiguration des Quota-Policy-Daemon nehmen wir am Ende der Konfigurationsdatei // | ||
+ | |||
+ | # vim / | ||
+ | <code bash> | ||
+ | |||
+ | ## | ||
+ | ## Quota Policy Daemon | ||
+ | ## | ||
+ | |||
+ | # Django : 2014-08-07 | ||
+ | # Policy-Daemon für Postfix Frontend-Mailserver (MTA) | ||
+ | # Kapitel 11.11 "Der Quota-Policy-Server für Postfix" | ||
+ | # Dovecotbuch (ISBN 978-3-95539-74-7) Seite 219 ff. | ||
+ | # | ||
+ | service quota-status { | ||
+ | executable = quota-status -p postfix | ||
+ | inet_listener { | ||
+ | address = 10.0.0.70 | ||
+ | port = 10000 | ||
+ | } | ||
+ | client_limit = 1 | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # quota_status_success | ||
+ | # quota_status_nouser | ||
+ | # könnte dafür ev. zuständig sein. | ||
+ | # quota_status_overquota : Errorcode und Fehlermeldung, | ||
+ | # Frontend-Mailserver (MTA) Postfix zurückgemeldet wird. | ||
+ | plugin { | ||
+ | quota_status_success = DUNNO | ||
+ | quota_status_nouser = DUNNO | ||
+ | quota_status_overquota = "552 5.2.2 Mailbox is over quota / Mailbox ist voll" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Zur Aktivierung der Konfigurationsänderung führen wir einen **Reload** unseres Dovecot-Servers durch. | ||
+ | # systemctl reload dovecot | ||
+ | |||
+ | Überprüfen wir nun die offenen Ports unseres Dovecot-Servers, | ||
+ | # netstat -tulpen | grep dovecot | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | ==== Paketfilter Konfiguration ==== | ||
+ | Damit nun nicht jeder fremde Host sich mit dem Port **10000** verbinden kann, regeln wir den Zugriff über eine Firewall-Regel so, dass nur der vorgeschaltete **MTA** Postfix-Mailserver sich mit unserem **Dovecot-Server** auf Port **10000** verbinden kann. | ||
+ | |||
+ | Unter **CentOS 7** wird als Standard-Firewall die dynamische **firewalld** verwendet. Ein großer Vorteil der dynamischen Paketfilterregeln ist unter anderem, dass zur Aktivierung der neuen Firewall-Regel(n) nicht der Daemon durchgestartet werden muss und somit alle aktiven Verbiundungen kurz getrennt werden. Sondern unsere Änderungen können **// | ||
+ | |||
+ | In unserem Konfigurationsbeispiel hat unser Postfix-Server die IP-Adresse 10.0.0.80 und unser Dovecot-Server die 10.0.0.70. Wir brauchen also eine Firewall-Definition, | ||
+ | |||
+ | Mit Hilfe des Programms **firewall-cmd** legen wir nun eine **permanente** Regel in der Zone **public**, dies entspricht in unserem Beispiel das Netzwerk-Interface **eth0** mit der IP **10.0.0.70** an. Als Source-IP geben wir die IP-Adresse unseres Postfix-Servers also die **10.0.0.80** an. Genug der Vorrede, mit nachfolgendem Befehl wird diese restriktive Regel angelegt. | ||
+ | # firewall-cmd --permanent --zone=public --add-rich-rule=" | ||
+ | |||
+ | Zum Aktivieren brauchen wir nun nur einen reload des Firewall-Daemon vornehmen. | ||
+ | # firewall-cmd --reload | ||
+ | |||
+ | Fragen wir nun den Regelsatz unserer **iptables**-basieten Firewall ab, finden wir in der Chain **IN_public_allow** unsere aktive Regel. | ||
+ | # iptables -nvL IN_public_allow | ||
+ | |||
+ | < | ||
+ | pkts bytes target | ||
+ | 0 0 ACCEPT | ||
+ | 0 0 ACCEPT | ||
+ | 0 0 ACCEPT | ||
+ | 0 0 ACCEPT | ||
+ | 0 0 ACCEPT | ||
+ | 0 0 ACCEPT | ||
+ | 0 0 ACCEPT | ||
+ | 0 0 ACCEPT | ||
+ | </ | ||
+ | |||
+ | ==== Postfix Konfiguration ==== | ||
+ | Wie schon angesprochen, | ||
+ | |||
+ | Bei der Installation und **[[centos: | ||
+ | # vim / | ||
+ | <code bash> | ||
+ | |||
+ | # | ||
+ | # Django : 2012-02-06 | ||
+ | # Schutz durch Restrictions für unseren Postfix-Mailserver | ||
+ | # | ||
+ | |||
+ | smtpd_recipient_restrictions = | ||
+ | # Postmaster, abuse und andere aufgaben- oder funktionsgebundene E-Mail-Adressen (Role-Accounts) whitelisten | ||
+ | check_recipient_access btree:/ | ||
+ | # Black- und Whitelisting | ||
+ | check_client_access cidr:/ | ||
+ | check_helo_access btree:/ | ||
+ | check_sender_access btree:/ | ||
+ | check_recipient_access btree:/ | ||
+ | # Unsauberer eMails nicht annehmen | ||
+ | reject_non_fqdn_sender, | ||
+ | reject_non_fqdn_recipient, | ||
+ | reject_unknown_sender_domain, | ||
+ | reject_unknown_recipient_domain, | ||
+ | # Unsere eigenen Nutzer zulassen-/ | ||
+ | permit_sasl_authenticated, | ||
+ | permit_mynetworks, | ||
+ | # RBL überprüfen | ||
+ | reject_rbl_client zen.spamhaus.org, | ||
+ | reject_rbl_client ix.dnsbl.manitu.net, | ||
+ | reject_rbl_client bl.spamcop.net, | ||
+ | reject_rhsbl_client multi.uribl.com, | ||
+ | # Greylisting via postgrey checken via Unix-Socket | ||
+ | check_policy_service unix: | ||
+ | # Policyd-Weight check over TCP-Connection | ||
+ | check_client_access btree:/ | ||
+ | check_policy_service inet: | ||
+ | # Dynamische Prüfung auf existente Relay-Empfänger | ||
+ | reject_unverified_recipient, | ||
+ | # Backupserver (MX) erlauben | ||
+ | permit_mx_backup, | ||
+ | # alles andere an relaying verbieten | ||
+ | reject_unauth_destination, | ||
+ | # Quota-Status-Policy-Daemon am Dovecot-Backend-System | ||
+ | # Dovecotbuch (ISBN 978-3-95539-74-7) Seite 219 ff. | ||
+ | check_policy_service inet: | ||
+ | # Zu guter Letzt alles durchlassen, | ||
+ | permit | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Zum Aktivieren der Konfigurationsänderung starten wir den Postfix-Mailserver einmal durch. | ||
+ | # systemctl restart postfix | ||
+ | |||
+ | |||
+ | ===== Mailclient auf Benutzerseite ===== | ||
+ | Mailclients haben bisweilen sehr unterschiedliche Arten, die Informationen aus dem **imap_quota** Plugin darzustellen. | ||
+ | ==== kMail ==== | ||
+ | kMail stelle die Informationen des **imap_quota-// | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Wir die Quota überschritten wir zusätzlich der Ordner-Name mit der Schriftfarbe **rot** dargestellt. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== Thunderbird ==== | ||
+ | Im Gegensatz zum Mailclient kMail, stellt Thunderbird keine Informationen zur Quota-Auslastung in der Statuszeile an, wenn der Schwellwert noch nicht errreicht wurde. | ||
+ | |||
+ | Ist die Quota-Informationsgrenze noch nicht erreicht, wird in der Statusleiste keine Information zum aktuellen Stand der Quota zur Verfügung gestellt. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Erst bei erreichen der Schwelle wir eine Information angezeigt. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Abhilfe schafft da das **[[https:// | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Wird es installiert, | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Entsprechend ist hier die Anzeige bei Überschreitung der Quota-Einstellungen. | ||
+ | |||
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== Horde Framework/ | ||
+ | Auch die Nutzer des Webmailers **IMP** unserer Horde-Framework-Installation kommen natürlich in den Genuß der Quota-Anzeige. Wir müssen diese lediglich in der Konfig aktivieren. Hierzu öffnen wir die **backends.local.php** und tragen nachfolgende Zeilen nach. | ||
+ | # vim / | ||
+ | <code php> | ||
+ | |||
+ | $servers[' | ||
+ | // Disabled by default | ||
+ | // Django : 2013-02-01 | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ), | ||
+ | // Django : 2014-08-11 | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ) | ||
+ | ), | ||
+ | // | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Sobald wir uns bei unserem Horde-Webmailer anmelden und die Applikation **IMP** auswählen, wird der aktuelle Status zur Quota-Belegung in der Statuszeile angezeigt. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | |||
+ | |||
+ | ====== Links ====== | ||
+ | * **[[centos: | ||
+ | * **[[wiki: | ||
+ | * **[[http:// | ||
+ |