Re: [Dovecot] SOLVED for me: how to setup different quota for multiple namespaces

2013-07-29 Thread Andreas Oster
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  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 =
  

Re: [Dovecot] SOLVED for me: how to setup different quota for multiple namespaces

2013-02-04 Thread Andreas Oster
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  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,

I do not use a SQL backend to store the quota information, so I guess
the %u parameter is of little use with my setup.

I have also tried to configure quota with dict and flat file, but this
also did seem not work.

Thanks

best regards

Andreas



Re: [Dovecot] SOLVED for me: how to setup different quota for multiple namespaces

2013-02-04 Thread Steffen Kaiser

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

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  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

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBUQ+Wyl3r2wJMiz2NAQL2fwf/SV2SAl+lvzwN9TEEZfwtsHwTb9D7W1QH
wfoMEJLWBFp8/i+gpjhbGNWbi9P5ogqljuJvALYVIXFNfoGllJBlAEStxBhpv5Z/
xQCY5lB9nCbnGa0g2MA0DMLF+dCmQrUdP0kl7R6moXaa4tn/C40pmkxvGSJjQsFk
qMESy+cuREBSJq3SRP5g8tnlBC14dgoVfg+cWPVzOd/iQatIVQGghC5PqtLj36g3
rYJNvMZ8inGSf9pui21F9rHaN1RLeeACkAEF256Pt1lHBWKaecAhlvK+e3Ps1vru
mssHT+z50T7jee8pwjMK6NMW4IbDgeU8wv9yaf4/c5LmfVPHP6E2cA==
=D38F
-END PGP SIGNATURE-