does postfix 2.11 needs to be patched with VDA patch for per user or domain Quota support, when dovecot 2.2.x is used as imap server?

1

does postfix 2.11 needs to be patched with VDA patch for per user or domain Quota support, when dovecot 2.2.x is used as imap server ? Im using ubuntu 14.04 LTS with postfixadmin 2.3. i appreciate any useful working guides. thank you

dovecot -n output

http://pastebin.com/LCPmQ5Th

master.cf

http://pastebin.com/db6B2uMP

cat dovecot-sql.conf.ext

driver = mysql connect = host=127.0.0.1 dbname=postfixadmin user=postfixadmin password=XXXXXXXX default_pass_scheme = MD5-CRYPT

password_query = SELECT username as user, password FROM mailbox WHERE username='%u'; user_query = SELECT maildir AS home,5000 AS uid,5000 AS gid, CONCAT("*:bytes=",quota) AS quota_rule FROM mailbox WHERE username = '%n@%d' AND active=1;

satch_boogie

Posted 2015-06-03T08:14:06.430

Reputation: 143

Put four blank spaces at the beginning of each line to format as a code block. You can select in the edit window and use the {} button for this. – a CVn – 2015-06-03T11:38:19.107

i used pastebin link, ithink that would be readable – satch_boogie – 2015-06-03T11:40:57.707

#main.cf http://pastebin.com/H9HEmzkP

– satch_boogie – 2015-06-03T11:52:40.390

Answers

0

If postfix do not attempt to perform LDA itself and invoke dovecot's deliver instead, then postfix do not need to know about quotas at all.

If you have used postfixadmin for virtual domains management, then you already have everything you need for quota restrictions. You have to modify dovecot's SQL query to fetch user's quotas:

user_query = SELECT maildir AS home, \
                    26 AS uid, \
                    26 AS gid, \
                    CONCAT("*:bytes=",quota) AS quota_rule \
               FROM mailbox \
              WHERE username = '%n@%d' \
                AND active=1;

(do not blindly copy-paste that example, use it as template)

Then you have to setup quota plugin and warning service in the dovecot.conf

UPDATED:

. . . . . .
# this line enable quota plugin!
mail_plugins            = quota

# here is the plugin's configuration
plugin {
  quota                 = maildir:User quota
  quota_rule            = Junk:ignore
  quota_rule2           = Trash:storage=+100M
  quota_warning         = storage=90%% quota-warning 90 %u %d
  quota_warning2        = storage=80%% quota-warning 80 %u %d
  quota_exceeded_message = ERROR:422 - Mailbox full, sorry.
. . . . .
}
. . . . .
service quota-warning {
  executable    = script /path/to/the/overquota.sh
  user          = $mail_uid
  group         = $mail_gid
  unix_listener quota-warning {
    user        = $mail_uid
    group       = $mail_gid
  }
}
. . . . .

overquota.sh should look like that:

#!/bin/sh
cat << EOT | /usr/local/libexec/dovecot/dovecot-lda -d $2 -o "plugin/quota=maildir:User quota:noenforcing"
From: postmaster@$3
To: $2
Subject: == Quota warning ==
Content-Type: text/plain; charset="UTF-8"

Your mailbox is $1% full, so clean up your mess, please!

EOT
exit 0
####

When dovecot's deliver try to store the message into inbox, it check whether the quota was reached predefined thresholds 80% and 90% or no. If so - quota-warning service is invoked and script is launched, that place a warning message into mailbox - without further quota checkout.

Kondybas

Posted 2015-06-03T08:14:06.430

Reputation: 499

hi thank for reply, im using dovecot as lda ,the emails seem to send/receive successfully but i cant implement per user quota, i also implemented your suggestion but dovecot quota didnt work, heres my #dovecot -n in the original post – satch_boogie – 2015-06-03T11:30:10.100

@satriani_sherpa I've update my answer – Kondybas – 2015-06-03T12:16:18.050