[Dovecot] How to prevent delivery to mailboxes over quota at SMTP-time
Hi!
I wrote a little something about how to prevent delivery to mailboxes over quota while still being in the SMTP dialogue: http://sys4.de/en/blog/2013/04/08/postfix-dovecot-mailbox-quota/ (Postfix/Dovecot-2.2)
-- [*] sys4 AG
http://sys4.de, +49 (89) 30 90 46 64 Franziskanerstraße 15, 81669 München
Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263 Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer Aufsichtsratsvorsitzender: Joerg Heidrich
- Ralf Hildebrandt <r@sys4.de> 2013.04.11 23:00:
http://sys4.de/en/blog/2013/04/08/postfix-dovecot-mailbox-quota/
Hi Ralf,
played around with it a bit. There is another thread here which indicates people couldn't get it to work. With the latest and greatest it seems to have some query issue:
[...] Apr 12 09:22:04 spectre postfix/smtpd[18355]: warning: access table inet:127.0.0.1:10027 entry has empty value [...]
Regards Thomas
# 2.2.rc7 (cf898dbcbffb): /etc/dovecot/dovecot.conf # OS: Linux 3.2.0-0.bpo.4-amd64 x86_64 Debian 6.0.7 auth_cache_size = 16 k auth_verbose = yes mail_location = mdbox:~/mdbox mail_plugins = acl quota stats mailbox_list_index = yes namespace { list = yes location = mdbox:/var/vmail/public:INDEXPVT=~/mdbox/public prefix = Public/ separator = / subscriptions = no type = public } namespace inbox { hidden = no inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = separator = / type = private } passdb { args = username_format=%u /var/vmail/auth.d/%d/passwd driver = passwd-file } plugin { acl = vfile:/var/vmail/conf.d/%d/acls:cache_secs=300 mail_log_events = expunge mailbox_delete quota = dict:user::file:%h/mdbox/dovecot-quota quota_grace = 10%% quota_rule = *:storage=1GB quota_rule2 = Trash:storage=+10%% quota_status_nouser = DUNNO quota_status_success = DUNNO sieve = ~/.dovecot.sieve sieve_dir = ~/sieve sieve_global_dir = /var/vmail/conf.d/%d/sieve stats_refresh = 30s stats_track_cmds = yes } protocols = " imap lmtp" quota_full_tempfail = yes service auth-worker { unix_listener auth-worker { user = doveauth } user = doveauth } service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } user = doveauth } service imap-login { inet_listener imap { address = 1.2.3.4 port = 143 } inet_listener imaps { port = 0 } } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0660 user = postfix } } service quota-status { client_limit = 1 executable = quota-status -p postfix inet_listener { address = 127.0.0.1 port = 10027 } } service stats { fifo_listener stats-mail { mode = 0600 user = vmail } } ssl_ca = </etc/ssl/certs/SSL123_CA_Bundle.pem ssl_cert = </etc/ssl/certs/host_domain_tld_2012.crt ssl_key = </etc/ssl/private/host_domain_tld_2012.key syslog_facility = local1 userdb { args = username_format=%u /var/vmail/auth.d/%d/passwd driver = passwd-file } verbose_proctitle = yes protocol lmtp { mail_plugins = acl quota stats sieve } protocol imap { mail_max_userip_connections = 20 mail_plugins = acl quota stats mail_log notify imap_acl imap_quota imap_stats }
- Thomas Leuxner <tlx@leuxner.net> 2013.04.12 09:33:
[...] Apr 12 09:22:04 spectre postfix/smtpd[18355]: warning: access table inet:127.0.0.1:10027 entry has empty value [...]
After some mails have been accepted it starts to reject like this:
==> /var/log/dovecot/dovecot.log <== Apr 12 09:46:30 spectre dovecot: quota-status(tlx@leuxner.net): Error: user tlx@leuxner.net: Error reading configuration: net_connect_unix(/var/run/dovecot/config) failed: Permission denied
==> /var/log/mail.log <== Apr 12 09:46:31 spectre postfix/smtpd[18494]: NOQUEUE: reject: RCPT from duonullaocto.xi.ecm-cluster.com[91.192.42.208]: 450 4.7.1 <tlx@leuxner.net>: Recipient address rejected: Internal error occurred. Refer to server log for more information.; from=<g-2111333234-2080-200833342-1365752783888@bounce.newsletter.frontlineshop.com> to=<tlx@leuxner.net> proto=ESMTP helo=<duonullaocto.xi.ecm-cluster.com>
- Thomas Leuxner <dovecot@dovecot.org>:
- Ralf Hildebrandt <r@sys4.de> 2013.04.11 23:00:
http://sys4.de/en/blog/2013/04/08/postfix-dovecot-mailbox-quota/
Hi Ralf,
played around with it a bit. There is another thread here which indicates people couldn't get it to work. With the latest and greatest it seems to have some query issue:
[...] Apr 12 09:22:04 spectre postfix/smtpd[18355]: warning: access table inet:127.0.0.1:10027 entry has empty value [...]
Try testing it manually, like this:
# telnet localhost 12340 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. request=smtpd_access_policy sender=sentto-19572345-3526-1365773584-mateusz.xxxxx=charite.de@returns.groups.yahoo.com recipient=mateusz.xxxxx@charite.de size=100
action=552 5.2.2 Quota exceeded (mailbox for user is full)
-- [*] sys4 AG
http://sys4.de, +49 (89) 30 90 46 64 Franziskanerstraße 15, 81669 München
Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263 Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer Aufsichtsratsvorsitzender: Joerg Heidrich
- Ralf Hildebrandt <r@sys4.de> 2013.04.12 15:40:
[...] Apr 12 09:22:04 spectre postfix/smtpd[18355]: warning: access table inet:127.0.0.1:10027 entry has empty value [...]
Try testing it manually, like this:
# telnet localhost 12340 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. request=smtpd_access_policy sender=sentto-19572345-3526-1365773584-mateusz.xxxxx=charite.de@returns.groups.yahoo.com recipient=mateusz.xxxxx@charite.de size=100
action=552 5.2.2 Quota exceeded (mailbox for user is full)
That seems to work. Created local over usage and can query that:
$ doveadm quota get -u tlx@leuxner.net Quota name Type Value Limit % user STORAGE 317790 204800 155 user MESSAGE 5181
$ telnet localhost 10027 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. request=smtpd_access_policy sender=noreply@example.org recipient=tlx@leuxner.net size=100
action=552 5.2.2 Quota exceeded (mailbox for user is full)
Still when I point Postfix to use it, it creates the error above and the strange config socket issue in Dovecot:
Apr 12 09:46:30 spectre dovecot: quota-status(tlx@leuxner.net): Error: user tlx@leuxner.net: Error reading configuration: net_connect_unix(/var/run/dovecot/config) failed: Permission denied
Ralf Hildebrandt wrote:
Hi!
I wrote a little something about how to prevent delivery to mailboxes over quota while still being in the SMTP dialogue: http://sys4.de/en/blog/2013/04/08/postfix-dovecot-mailbox-quota/ (Postfix/Dovecot-2.2)
Cool, thanks for posting that. I guess I'll have to upgrade, I think we're dovecot 2.0.
-- Per Jessen, Zürich (9.6°C) http://www.dns24.ch/ - free DNS hosting, made in Switzerland.
participants (3)
-
Per Jessen
-
Ralf Hildebrandt
-
Thomas Leuxner