[Dovecot] SOLVED for me: how to setup different quota for multiple namespaces
Andreas Oster
aoster at novanetwork.de
Mon Jul 29 13:05:47 EEST 2013
Am 04.02.2013 12:08, schrieb Steffen Kaiser:
> On Tue, 22 Jan 2013, Timo Sirainen wrote:
>
> Hey, it works (for me) now:
>
> namespace {
> type = private
> separator = .
> prefix = archive.
> location = mdbox:/home/%u/archive
> #subscriptions = no
> #list = children
> }
>
> plugin {
> quota = dict:User quota::ns=:proxy::quota
> quota2 = dict:Archive quota:%u.archive:ns=archive.:proxy::quota
> quota2_rule = *:storage=1048576
> }
>
> Note the %u.archive _and_ ns=archive. ! The "%u.archive" is used as
> "username" in the SQL table and you require another name (primary key)
> there for both namespaces, see below. Seems to work for any type of
> namespace.
>
> @Timo: I will going to document this setup in the Wiki unless you say
> the syntax is wrong and/or works because of a bug only.
>
> :-)
>
> ==================================
>
> Old response with my debugging/findings for information only.
>
> ====
>
> all the name spaces use one entry in the quota dict table, hence,
> it does not work.
>
>> On 17.1.2013, at 16.58, Andreas Oster <aoster at novanetwork.de> wrote:
>
>>>> I just saw on important difference in the doc and this configuration:
>>>>
>>>> see
>>>> http://wiki2.dovecot.org/Quota/Configuration#Quota_for_public_namespaces
>>>>
>>>>
>>>> the ns=name syntax is for _public_ namespaces only. I just tested it
>>>> with this setup and every message is counted for both namespaces, if
>>>> delivered into INBOX or a mailbox of the Archive namespace.
>
>> It should work for all namespaces.
>
>>>>> plugin {
>>>>> quota = dict:User quota::proxy::quota
>>>>> quota2 = dict:Archive quota:ns=Archive.:proxy::quota
>
>> quota = dict:User quota::ns=:proxy::quota
>> quota2 = dict:Archive quota::ns=Archive.:proxy::quota
>
>> That should work? Worked at least in latest v2.1 hg.
>
> I use these settings now:
>
> # 2.1.14 (ea7e45c1da72+):
> /usr/local/dovecot-2.1.14/etc/dovecot/dovecot.conf
> # OS: Linux 2.6.32-5-amd64 x86_64 Debian 6.0.6
>
> [snip]
>
> dict {
> quota =
> pgsql:/usr/local/dovecot-2.1.14/etc/dovecot/dovecot-dict-sql.conf.ext
> }
> namespace {
> location = mdbox:/home/%u/archive
> prefix = archive.
> separator = .
> type = private
> }
> plugin {
> quota = dict:User quota::ns=:proxy::quota
> quota2 = dict:Archive quota::ns=archive.:proxy::quota
> quota2_rule = *:storage=1048576
> quota_rule = *:storage=300MB
> quota_rule2 = Trash:storage=+30M
> }
>
> The problem is now, that there is one row in the quota dict SQL table,
> that holds the quota of an user, e.g. doveadm quota recalc executes
> these SQL statements:
>
> 2013-02-04 11:52:07 CET LOG: statement: BEGIN
> 2013-02-04 11:52:07 CET LOG: statement: DELETE FROM quota WHERE
> username = 'dvtest1'
> 2013-02-04 11:52:07 CET LOG: statement: DELETE FROM quota WHERE
> username = 'dvtest1'
> 2013-02-04 11:52:07 CET LOG: statement: INSERT INTO quota
> (bytes,username) VALUES ('2173894','dvtest1')
> 2013-02-04 11:52:07 CET LOG: statement: INSERT INTO quota
> (messages,username) VALUES ('89','dvtest1')
> 2013-02-04 11:52:07 CET LOG: statement: COMMIT
> 2013-02-04 11:52:07 CET LOG: statement: BEGIN
> 2013-02-04 11:52:07 CET LOG: statement: DELETE FROM quota WHERE
> username = 'dvtest1'
> 2013-02-04 11:52:07 CET LOG: statement: DELETE FROM quota WHERE
> username = 'dvtest1'
> 2013-02-04 11:52:07 CET LOG: statement: INSERT INTO quota
> (bytes,username) VALUES ('2582','dvtest1')
> 2013-02-04 11:52:07 CET LOG: statement: INSERT INTO quota
> (messages,username) VALUES ('2','dvtest1')
> 2013-02-04 11:52:07 CET LOG: statement: COMMIT
>
> Deliveries to INBOX or a folder of "archive." yields:
>
> UPDATE quota SET bytes=bytes+1220,messages=messages+1 WHERE username =
> 'dvtest1'
>
> This is true if I change the type of name spaces "archive" from "private"
> into "shared" or "public".
>
> -- Steffen Kaiser
>
Hello Steffen, hello all
I am still struggling to setup quota for multiple namespaces.
In addition to the "INBOX" namespace I have created a namespaces
called MailArchive which should have its own quota value of 5G per user.
At first I configured quota2 like this:
quota2 = maildir:MailArchive quota:ns=MailArchive/
quota2_rule = *:storage=5G
and this seemd to work quite well. Users, accessing the MailArchive
namespace can see the 5G limit in thair mail client, unfortunately in
mail.err errors like these repeatedly appear:
Jul 29 11:40:24 mailserver dovecot: imap(testuser): Error: quota:
Unknown namespace: MailArchive/
Jul 29 11:41:43 dovecot: last message repeated 47 times
In the WIKI I have read, that in order to have quota for different
namespaces one would have to use different quota backends so I changed
the quota config for the MailArchive namespace to SQL.
namespace inbox {
disabled = no
hidden = no
ignore_on_failure = no
inbox = yes
list = yes
location =
mailbox Drafts {
auto = subscribe
driver =
special_use = \Drafts
}
mailbox Junk {
auto = subscribe
driver =
special_use = \Junk
}
mailbox Sent {
auto = subscribe
driver =
special_use = \Sent
}
mailbox "Sent Messages" {
auto = no
driver =
special_use = \Sent
}
mailbox Trash {
auto = subscribe
driver =
special_use = \Trash
}
prefix =
separator = /
subscriptions = yes
type = private
}
namespace {
disabled = no
hidden = no
ignore_on_failure = no
inbox = no
list = yes
location = maildir:/var/vmail/archive/%Ln/Maildir
mailbox "Archived Mails" {
auto = subscribe
driver =
}
prefix = MailArchive/
separator = /
subscriptions = yes
type = private
}
plugin {
quota = maildir:User quota:ns=
quota2 = dict:User quota:%u.mailarchive:ns=MailArchive/:proxy::sqlquota
quota2_rule = *:storage=5G
quota_rule = *:storage=1G
quota_rule2 = Trash:storage=+200M
}
dict {
sqlquota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
}
Unfortunately this did not change anything. Quota is working like
expected but I still get the same errors in mail.err.
I am currently using dovecot version 2.2.4.
Thank you for your kind help
best regards
Andreas
More information about the dovecot
mailing list