Hello, I've got quotas set up on an all-user basis on my system, it's a Postfix, Dovecot, Mysql virtual users setup. Currently I have each user getting a 1GB quota with these settings in 90-quota.conf: plugin { quota_rule = *:storage=1G quota_rule2 = Trash:storage=+100M } plugin { quota = maildir:User quota } While this works it's not what I want for all users. Say I add a virtual user called user1 to the mysql database but he's a test user and I only want that user to have 25 megabytes of storage, reading the wiki on quotas per-user items such as for example in a database overrides the global items above, is this right? If so, I'm hoping I'm not going to have to redo my entire user database, some users will have per-user quotas while I'll let others have the global quota. Thanks. Dave.
Hello! What's the version of your dovecot? 1.2.X ? or 2.0 ? Tibby On Oct 11, 2012, at 10:40 PM, David Mehler wrote:> Hello, > > I've got quotas set up on an all-user basis on my system, it's a > Postfix, Dovecot, Mysql virtual users setup. Currently I have each > user getting a 1GB quota with these settings in 90-quota.conf: > > plugin { > quota_rule = *:storage=1G > quota_rule2 = Trash:storage=+100M > } > plugin { > quota = maildir:User quota > } > > While this works it's not what I want for all users. Say I add a > virtual user called user1 to the mysql database but he's a test user > and I only want that user to have 25 megabytes of storage, reading the > wiki on quotas per-user items such as for example in a database > overrides the global items above, is this right? > > If so, I'm hoping I'm not going to have to redo my entire user > database, some users will have per-user quotas while I'll let others > have the global quota. > > Thanks. > Dave.
Hi Dave, David Mehler wrote:> I've got quotas set up on an all-user basis on my system, it's a > Postfix, Dovecot, Mysql virtual users setup. Currently I have each > user getting a 1GB quota with these settings in 90-quota.conf: > > plugin { > quota_rule = *:storage=1G > quota_rule2 = Trash:storage=+100M > } > plugin { > quota = maildir:User quota > } > > While this works it's not what I want for all users. Say I add a > virtual user called user1 to the mysql database but he's a test user > and I only want that user to have 25 megabytes of storage, reading the > wiki on quotas per-user items such as for example in a database > overrides the global items above, is this right? > > If so, I'm hoping I'm not going to have to redo my entire user > database, some users will have per-user quotas while I'll let others > have the global quota.You can just make your SQL query a bit more sophisticated in order to fit your needs. MySQL supports SQL CASE statement and default value with ELSE: http://dev.mysql.com/doc/refman/5.1/en/case.html This example sets quota to unlimited if mail comes in via port 20025, otherwise is uses the quota_bytes and quota_message columns: user_query = SELECT username AS user, \ home as home, \ uid as uid, \ gid as gid, \ CASE '%a' \ WHEN '20025' THEN '*:bytes=0:messages=0' \ ELSE \ CONCAT('*:bytes=', CAST(quota_bytes AS CHAR), ':messages=', CAST(quota_message AS CHAR)) \ END AS `quota_rule` \ FROM dovecot_users \ WHERE username='%u' Regards Daniel -- https://plus.google.com/103021802792276734820
Hello, Thanks for your replies so far. Still having issues with per-user quotas. To my Mysql virtual_users table I've added a column quota_kb and for a test user I've added in a value of 250000 going for a 250 megabyte quota. I've tried various sql queries they're returning empty sets not pulling out the information needed. Thanks. Dave. On 10/12/12, Daniel Parthey <daniel.parthey at informatik.tu-chemnitz.de> wrote:> Hi Dave, > > David Mehler wrote: >> Thanks for your reply. I've written you directly as it is sounding >> like at least for now this isn't dovecot it's well a mysql issue with >> design. I don't have anything in my database setup with regards quota >> I've included it below. I've got one virtual mail user called vmail >> with UID/GID of 5000 who owns all the virtual mailboxes. If I'm >> understanding what I've read in the link, the dovecot wiki and your >> message since anything in a user section of Mysql will override the >> global configuration in 90-quota.conf, that being the case I should >> add an extra column to virtual users? Once that's done adjust the >> userdb query for dovecot to return quota information? > > Yes, the quota should be stored in an additional userdb column, > or you need at least an SQL statement which takes a username > and returns a quota rule. > > Quota of 0 is interpreted as "unlimited" by dovecot. > As already said, if the value in the quota column for the > user is 0, your SQL statement could also return a different > value (default quota) instead of 0 (using MySQL CASE/ELSE statement). > > Here is a short documentation on how it is done with Tine 2.0 Groupware: > http://www.tine20.org/wiki/index.php/Admins/Mailserver_integration > (it is a simple example which does not support a default quota fallback, > since Tine 2.0 writes the default quota as a value into the column > when the user is created) > > Regards > Daniel > -- > https://plus.google.com/103021802792276734820 >