Mail-Quotas (Ubuntu 18.04): Unterschied zwischen den Versionen
| Zeile 148: | Zeile 148: | ||
== Ablehnung durch Postfix, wenn Postfach voll == | == Ablehnung durch Postfix, wenn Postfach voll == | ||
=== 91-quota-status.conf === | |||
Die Datei | |||
<pre> | |||
sudo vi /etc/dovecot/conf.d/91-quota-status.conf | |||
</pre> | |||
erstellen (ist momentan nicht vorbereitet) und mit folgenden Inhalt befüllen: | |||
<pre> | <pre> | ||
| Zeile 153: | Zeile 163: | ||
executable = quota-status -p postfix | executable = quota-status -p postfix | ||
inet_listener { | inet_listener { | ||
address = 127.0.0.1 | |||
port = 12345 | port = 12345 | ||
} | } | ||
client_limit = 1 | client_limit = 1 | ||
} | } | ||
plugin { | plugin { | ||
quota_status_success = DUNNO | quota_status_success = DUNNO | ||
| Zeile 166: | Zeile 174: | ||
quota_status_overquota = "552 5.2.2 Mailbox is over quota / Mailbox ist voll" | quota_status_overquota = "552 5.2.2 Mailbox is over quota / Mailbox ist voll" | ||
} | } | ||
</pre> | |||
=== main.cf === | |||
<pre> | |||
sudo vi /etc/postfix/main.cf | |||
</pre> | </pre> | ||
Version vom 18. Januar 2020, 19:47 Uhr
Noch in Bearbeitung
Konfiguration
Per-user quota
Dazu ist wichtig, dass in der Datei /etc/dovecot/conf.d/auth-sql.conf.ext (siehe Dovecot#Benutzer_Authentifizierung) folgende Zeilen einkommentiert werden:
sudo vi /etc/dovecot/conf.d/auth-sql.conf.ext
userdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf.ext
}
Und in der Datei /etc/dovecot/dovecot-sql.conf.ext
sudo vi /etc/dovecot/dovecot-sql.conf.ext
folgende Zeile hinzugefügt / angepasst wird:
user_query = SELECT concat('*:storage=', quota, 'M') AS quota_rule FROM mailbox WHERE local_part = '%n' AND domain = '%d'
10-mail.conf
In der Datei /etc/dovecot/conf.d/10-mail.conf folgene Zeilen erweitern:
sudo vi /etc/dovecot/conf.d/10-mail.conf
mail_plugins = $mail_plugins quota
20-imap.conf
In der Datei /etc/dovecot/conf.d/20-imap.conf folgene Zeilen erweitern:
sudo vi /etc/dovecot/conf.d/20-imap.conf
protocol imap {
mail_plugins = $mail_plugins imap_quota
}
90-quota.conf
In der Datei /etc/dovecot/dovecot.conf folgene Zeilen hinzufügen:
sudo vi /etc/dovecot/conf.d/90-quota.conf
##
## Quota limits
##
plugin {
quota = maildir:User quota
quota_grace = 10%%
quota_exceeded_message = Benutzer %u hat das Speichervolumen überschritten. / User %u has exhausted allowed storage space.
}
Warnungen bei Überschreiten der Quote
90-quota.conf
In der Datei /etc/dovecot/dovecot.conf
sudo vi /etc/dovecot/conf.d/90-quota.conf
folgene Zeilen hinzufügen:
##
## Quota warnings
##
plugin {
quota_warning = storage=66%% quota-warning 66 %u
quota_warning2 = storage=80%% quota-warning 80 %u
quota_warning3 = storage=95%% quota-warning 95 %u
}
service quota-warning {
executable = script /usr/local/bin/quota-warning.sh
user = vmail
unix_listener quota-warning {
group = vmail
mode = 0660
user = vmail
}
}
quota-warning.sh
Die Datei
sudo vi /usr/local/bin/quota-warning.sh
mit folgenden zeilen befüllen:
#!/bin/sh
PERCENT=$1
USER=$2
ADMIN="admin@<domain>"
FROM="postmaster@<domain>"
msg="From: $FROM
To: $USER
Bcc: $ADMIN
Subject: Quota-Warnung $PERCENT%
Lieber Nutzer,
das Postfach $USER ist derzeit zu
$PERCENT% gefuellt.
Bitte einige Mails loeschen.
Herzlichen Dank
Ihr Mail-Service Team."
echo -e "$msg" | /usr/sbin/sendmail -t -f $FROM "$USER"
exit 0
Ablehnung durch Postfix, wenn Postfach voll
91-quota-status.conf
Die Datei
sudo vi /etc/dovecot/conf.d/91-quota-status.conf
erstellen (ist momentan nicht vorbereitet) und mit folgenden Inhalt befüllen:
service quota-status {
executable = quota-status -p postfix
inet_listener {
address = 127.0.0.1
port = 12345
}
client_limit = 1
}
plugin {
quota_status_success = DUNNO
quota_status_nouser = DUNNO
quota_status_overquota = "552 5.2.2 Mailbox is over quota / Mailbox ist voll"
}
main.cf
sudo vi /etc/postfix/main.cf
smtpd_recipient_restrictions = erweitert werden um eine Zeile wie: check_policy_service inet:127.0.0.1:12345,
Links
https://doc.dovecot.org/configuration_manual/quota_plugin/
https://wiki.dovecot.org/Quota/Configuration
https://www.debacher.de/wiki/Mail-Quotas_mit_Dovecot
https://dokuwiki.tachtler.net/doku.php?id=tachtler:dovecot_quotas
https://thomas-leister.de/mailserver-debian-stretch/
Zurück zu Mailserver einrichten