[Dovecot] Maildirquota
Hi,
I'd like to use dovecot+postfix (with Maildir) for several virtual email servers, but one requirement is quota support. I'm aware about the lack of maildirquota support in dovecot, and I found a patch in the "unofficial patches" section which is said to provide maildirquota support to dovecot. How stable is this patch?, is it usable with dovecot 1.0b2?. And, is there any plan to support maildirquota natively in the near future?, I'd like to replace courier-imap in my setup.
Thanks. Rodolfo.
On 2006-01-24 10:42:23 -0600, Rodolfo Gonzalez Gonzalez wrote:
I'd like to use dovecot+postfix (with Maildir) for several virtual email servers, but one requirement is quota support. I'm aware about the lack of maildirquota support in dovecot, and I found a patch in the "unofficial patches" section which is said to provide maildirquota support to dovecot. How stable is this patch?, is it usable with dovecot 1.0b2?. And, is there any plan to support maildirquota natively in the near future?, I'd like to replace courier-imap in my setup.
1.0.beta2 has a quota plugin.
see the wiki about it.
darix
On Tue, 2006-01-24 at 21:24 +0100, Marcus Rueckert wrote:
On 2006-01-24 10:42:23 -0600, Rodolfo Gonzalez Gonzalez wrote:
I'd like to use dovecot+postfix (with Maildir) for several virtual email servers, but one requirement is quota support. I'm aware about the lack of maildirquota support in dovecot, and I found a patch in the "unofficial patches" section which is said to provide maildirquota support to dovecot. How stable is this patch?, is it usable with dovecot 1.0b2?. And, is there any plan to support maildirquota natively in the near future?, I'd like to replace courier-imap in my setup.
1.0.beta2 has a quota plugin.
see the wiki about it.
But it doesn't really work, especially not with maildir. Better to wait for the proper Maildir++ quota support, which will be implemented some day in February.
On Thu, 26 Jan 2006, Timo Sirainen wrote:
1.0.beta2 has a quota plugin. see the wiki about it.
But it doesn't really work, especially not with maildir. Better to wait for the proper Maildir++ quota support, which will be implemented some day in February.
Kewl! thanks Timo :)
Regards, Rodolfo.
Timo Sirainen wrote:
On Tue, 2006-01-24 at 21:24 +0100, Marcus Rueckert wrote:
On 2006-01-24 10:42:23 -0600, Rodolfo Gonzalez Gonzalez wrote:
I'd like to use dovecot+postfix (with Maildir) for several virtual email servers, but one requirement is quota support. I'm aware about the lack of maildirquota support in dovecot, and I found a patch in the "unofficial patches" section which is said to provide maildirquota support to dovecot. How stable is this patch?, is it usable with dovecot 1.0b2?. And, is there any plan to support maildirquota natively in the near future?, I'd like to replace courier-imap in my setup. 1.0.beta2 has a quota plugin.
see the wiki about it.
But it doesn't really work, especially not with maildir. Better to wait for the proper Maildir++ quota support, which will be implemented some day in February.
I assume this has been done by now? Could someone post a link to the wiki page that shows exactly how this has been implemented? I really can't find anything - just old pages from 2005 saying coming soon! Thanks, Dan
On Fri, May 26, 2006 8:38, Daniel Watts said:
Timo Sirainen wrote:
But it doesn't really work, especially not with maildir. Better to wait for the proper Maildir++ quota support, which will be implemented some day in February.
I assume this has been done by now? Could someone post a link to the wiki page that shows exactly how this has been implemented? I really can't find anything - just old pages from 2005 saying coming soon! Thanks, Dan
Yes. Here are the relevant settings, and you can return "imap_quota" for the quota value in userDB lookups:
default_mail_env = maildir:~/ protocol imap { mail_plugins = imap_quota quota mail_plugin_dir = /usr/lib/dovecot/imap } plugin { quota = maildir:%h imap_quota = maildir:%h }
http://www.google.com/search?as_q=maildir&as_eq=dovecot-cvs&as_qdr=m3&as_sitesearch=www.dovecot.org
So does this mean that Maildir++ does or doesn't work? Do we need CVS or will beta8 work?
Yes. Here are the relevant settings, and you can return "imap_quota" for the quota value in userDB lookups:
default_mail_env = maildir:~/ protocol imap { mail_plugins = imap_quota quota mail_plugin_dir = /usr/lib/dovecot/imap } plugin { quota = maildir:%h imap_quota = maildir:%h }
I'm trying with beta8, using these settings (mail_plugin_dir is different as I'm installed in /usr/local) and static userdb.
userdb static { args = uid=112 gid=112 home=/var/mail/%1n/%n imap_quota=10485760 }
Yet when I try to get the Quota, i get the following. (using SM debug)
IMAP command sent: a001 GETQUOTAROOT "INBOX" IMAP response recieved:
Array( [0] => Array( [0] => * QUOTAROOT "INBOX" "" [1] => * QUOTA "" () )
Which clearly shows no quota.
What am I doing wrong?
Thanks
Tim
Linux Counter user #273956
On Sun, May 28, 2006 8:43, Timothy White said:
So does this mean that Maildir++ does or doesn't work? Do we need CVS or will beta8 work?
It does work with both the latest CVS and with beta8.
I'm trying with beta8, using these settings (mail_plugin_dir is different as I'm installed in /usr/local) and static userdb.
userdb static { args = uid=112 gid=112 home=/var/mail/%1n/%n imap_quota=10485760 }
Yet when I try to get the Quota, i get the following. (using SM debug)
IMAP command sent: a001 GETQUOTAROOT "INBOX" IMAP response recieved:
Array( [0] => Array( [0] => * QUOTAROOT "INBOX" "" [1] => * QUOTA "" () )
Which clearly shows no quota.
What am I doing wrong?
The GETQUOTAROOT command will show an empty value if the user's maildir does not have a maildirsize file. And for some reason Dovecot does not always automatically create that file. It will create the file if during an IMAP session you call GETQUOTAROOT, then delete maildirsize, then call GETQUOTAROOT again; but if the file did not exist when the IMAP session began, calling GETQUOTAROOT will not create it... strange.
Here is an example of the format of the maildirsize file, where the first line is the quota, and the next lines are the message size and message count columns which get summed together to calculate how much is used:
5368709120S 314229571 71340 564 1 569 1 569 1
I hope this helps.
Bill
The GETQUOTAROOT command will show an empty value if the user's maildir does not have a maildirsize file. And for some reason Dovecot does not always automatically create that file. It will create the file if during an IMAP session you call GETQUOTAROOT, then delete maildirsize, then call GETQUOTAROOT again; but if the file did not exist when the IMAP session began, calling GETQUOTAROOT will not create it... strange.
Timo, is this a bug? Is it planned to be fixed? What about the first time dovecot creates a maildir, will it also create the maildirsize file if the quota plugin is loaded?
Here is an example of the format of the maildirsize file, where the first line is the quota, and the next lines are the message size and message count columns which get summed together to calculate how much is used:
Can I just touch the file, and allow dovecot to fill it in? I'm returning the quota size from database, why then does it need to be in the maildirsize file?
When I get back onto the server, I'll have a play around and see if I can work it out. I'm looking at deploying this system for ~10,000 users, so don't want to have to write scripts to create that many maildirsize files, when dovecot will happily create their maildirs for me.
I'll give it a try. Thanks Bill.
Tim
Linux Counter user #273956
On Tue, May 30, 2006 5:24, Timothy White said:
Here is an example of the format of the maildirsize file, where the first line is the quota, and the next lines are the message size and message count columns which get summed together to calculate how much is used:
Can I just touch the file, and allow dovecot to fill it in?
No, Dovecot won't fill it in that case either. At least the IMAP server won't. Not sure about the LDA.
I'm returning the quota size from database, why then does it need to be in the maildirsize file?
The logic is: use the values in maildirsize whenever possible since that contains the current space used in addition to the quota limit, then if maildirsize does not exist or is too old or known to be wrong, recreate it by scanning the maildir and querying the database. Dovecot should always create it if it does not exist, but it is not.
Bill
I'm returning the quota size from database, why then does it need to be in the maildirsize file?
The logic is: use the values in maildirsize whenever possible since that contains the current space used in addition to the quota limit, then if maildirsize does not exist or is too old or known to be wrong, recreate it by scanning the maildir and querying the database. Dovecot should always create it if it does not exist, but it is not.
How does it define "too old"??? As in, what if I set a 10Mb limit on my users, then get some new drives, and upgrade the limit in the database to 100Mb. How then does dovecot 'upgrade' the users quota's? How would someone force an upgade? Delete all the maildirsize files (when dovecot creates them properly)?
Tim
Linux Counter user #273956
On Tue, May 30, 2006 8:08, Timothy White said:
I'm returning the quota size from database, why then does it need to be in the maildirsize file?
The logic is: use the values in maildirsize whenever possible since that contains the current space used in addition to the quota limit, then if maildirsize does not exist or is too old or known to be wrong, recreate it by scanning the maildir and querying the database. Dovecot should always create it if it does not exist, but it is not.
How does it define "too old"??? As in, what if I set a 10Mb limit on my users, then get some new drives, and upgrade the limit in the database to 100Mb. How then does dovecot 'upgrade' the users quota's? How would someone force an upgade? Delete all the maildirsize files (when dovecot creates them properly)?
If the file size exceeds 5120 bytes it will be recreated. maildrop had some logic such as if the file is over 2 hours old recreate it (or something like that). Most importantly though, Dovecot knows the quota value from your DB because it got that in the auth query, and if Dovecot sees a different quota value in maildirsize that what the DB reported, Dovecot will recreate the maildirsize file - because at that point the maildirsize file is known to be wrong. So your quota changes should take effect immediately.
The only missing piece to the puzzle is handling the case where the maildirsize file doesn't exist when GETQUOTAROOT is called.
Bill
On Sun, 2006-05-28 at 20:43 +0800, Timothy White wrote:
userdb static { args = uid=112 gid=112 home=/var/mail/%1n/%n imap_quota=10485760 }
"imap_quota" does nothing. Use "quota" instead. Also its contents should be something like:
quota=maildir:storage=10485760
If that's correctly configured, then Dovecot creates and updates the maildirsize file's quota information. Also the GETQUOTAROOT problem Bill was describing doesn't seem to happen with me if this is correct..
On 5/30/06, Timo Sirainen <tss@iki.fi> wrote:
On Sun, 2006-05-28 at 20:43 +0800, Timothy White wrote:
userdb static { args = uid=112 gid=112 home=/var/mail/%1n/%n imap_quota=10485760 }
"imap_quota" does nothing. Use "quota" instead. Also its contents should be something like:
quota=maildir:storage=10485760
If that's correctly configured, then Dovecot creates and updates the maildirsize file's quota information. Also the GETQUOTAROOT problem Bill was describing doesn't seem to happen with me if this is correct..
Well, it 'works' better with those settings... Except with 10485760, it gives the user a 10Gb quota! (0.0% of 10,240.0M) I changed it to 10240, which suggests that the storage size is in Kilobyes, and not bytes.
Maybe the wiki needs updating? If I get a chance, I'll try and find the correct wiki pages and update them to be correct.
Thanks a heap!
Tim
Linux Counter user #273956
participants (7)
-
Bill Boebel
-
Daniel Watts
-
Marcus Rueckert
-
Rodolfo Gonzalez Gonzalez
-
Timo Sirainen
-
Timothy White
-
Timothy White