[Dovecot] Trash and quota
I can't seem to find the magic combination to get dovecot to ignore the trash folder when counting quota. I've got 1.0rc15 and using maildir quotas. Not being able to trash messages when over quota is quite annoying.
the docs suggest the following: plugin { quota = maildir:storage=10240:ignore=Trash } but as my quotas are defined per user via mysql DB, I'm thinking that I need a modified version such as: plugin { quota = maildir:ignore=Trash } Which does not work. just in case it's a semantic problem, I also tried: plugin { quota = maildir:ignore=INBOX.Trash } which also doesn't work.
I need other ideas of what to try to make it work if you please.
Kenny Dail kend@amigo.net
Hi,
Have you tried concat'ng the data in yourMySQL statement?
Eg. user_query = SELECT home, uid, gid, concat('maildir:storage=', quota_kb,':ignore=Trash') AS quota FROM users WHERE userid = '%u'
Kind Regards Richard
-----Original Message----- From: dovecot-bounces@dovecot.org [mailto:dovecot-bounces@dovecot.org] On Behalf Of Kenny Dail Sent: 12 December 2006 09:43 PM To: dovecot@dovecot.org Subject: [Dovecot] Trash and quota
I can't seem to find the magic combination to get dovecot to ignore the trash folder when counting quota. I've got 1.0rc15 and using maildir quotas. Not being able to trash messages when over quota is quite annoying.
the docs suggest the following: plugin { quota = maildir:storage=10240:ignore=Trash } but as my quotas are defined per user via mysql DB, I'm thinking that I need a modified version such as: plugin { quota = maildir:ignore=Trash } Which does not work. just in case it's a semantic problem, I also tried: plugin { quota = maildir:ignore=INBOX.Trash } which also doesn't work.
I need other ideas of what to try to make it work if you please.
Kenny Dail kend@amigo.net
Have you tried concat'ng the data in yourMySQL statement?
Eg. user_query = SELECT home, uid, gid, concat('maildir:storage=', quota_kb,':ignore=Trash') AS quota FROM users WHERE userid = '%u' An interesting thought indeed. I gave it a shot, but from what I can tell, setting quota in the query has no effect on the quota setting from the plugin block.
so that leaves me with 3 questions:
- Is there a way define per user quotas? and the original question:
- Is Dovecot's maildir quota support currently broken, or am I setting it up wrong? I am frequently getting quotas returned that do not match reality.
Current dovecot.conf: protocols = imap imaps pop3 pop3s disable_plaintext_auth = no login_greeting = amigo.net ready. mail_location = maildir:%h/Maildir namespace private { separator = . prefix = INBOX. inbox = yes hidden = no } mail_extra_groups = mail mmap_disable = yes lock_method = dotlock first_valid_uid = 465 valid_chroot_dirs = /var/mail/virtual maildir_copy_with_hardlinks = yes protocol imap { mail_plugins = quota imap_quota login_greeting_capability = yes imap_client_workarounds = outlook-idle } protocol pop3 { pop3_uidl_format = %08Xu%08Xv mail_plugins = quota pop3_client_workarounds = outlook-no-nuls oe-ns-eoh } protocol lda { postmaster_address = postmaster@amigo.net } auth_default_realm = amigo.net auth_username_translation = %@ auth_username_format = %Ln@%d auth_worker_max_count = 60 auth default { mechanisms = plain login apop digest-md5 cram-md5 passdb sql { args = /etc/dovecot/dovecot-sql.conf } userdb prefetch { } user = vmail count = 1 socket listen { master { path = /var/run/dovecot/auth-master mode = 0660 user = postfix group = mail } client { path = /var/run/dovecot/auth-client mode = 0660 } } } plugin { quota = maildir }
-- Kenny Dail kend@amigo.net
Hi,
From what I understand, you need to include a 'quota' field in your database authentication table, to include per user quota's. Only then will the query I specified really work. In your present database, add the quota field and insert a KB value. This value will then be used when the authentication query is executed. In the example SQL query I posted, I used a tabled called quota_kb.
One way to test the whole setup is to enable all the debug and verbose option in your config file, and then check the logs to see what its doing.
Maybe including your sql.conf file will help solve your problem. From what I see your quota config is correct, you just need to add the quota field in to your DB, and it should work for you.
Regards Richard
-----Original Message----- From: dovecot-bounces@dovecot.org [mailto:dovecot-bounces@dovecot.org] On Behalf Of Kenny Dail Sent: 13 December 2006 08:04 PM To: dovecot@dovecot.org Subject: Re: [Dovecot] Trash and quota
Have you tried concat'ng the data in yourMySQL statement?
Eg. user_query = SELECT home, uid, gid, concat('maildir:storage=', quota_kb,':ignore=Trash') AS quota FROM users WHERE userid = '%u' An interesting thought indeed. I gave it a shot, but from what I can tell, setting quota in the query has no effect on the quota setting from the plugin block.
so that leaves me with 3 questions:
- Is there a way define per user quotas? and the original question:
- Is Dovecot's maildir quota support currently broken, or am I setting it up wrong? I am frequently getting quotas returned that do not match reality.
Current dovecot.conf: protocols = imap imaps pop3 pop3s disable_plaintext_auth = no login_greeting = amigo.net ready. mail_location = maildir:%h/Maildir namespace private { separator = . prefix = INBOX. inbox = yes hidden = no } mail_extra_groups = mail mmap_disable = yes lock_method = dotlock first_valid_uid = 465 valid_chroot_dirs = /var/mail/virtual maildir_copy_with_hardlinks = yes protocol imap { mail_plugins = quota imap_quota login_greeting_capability = yes imap_client_workarounds = outlook-idle } protocol pop3 { pop3_uidl_format = %08Xu%08Xv mail_plugins = quota pop3_client_workarounds = outlook-no-nuls oe-ns-eoh } protocol lda { postmaster_address = postmaster@amigo.net } auth_default_realm = amigo.net auth_username_translation = %@ auth_username_format = %Ln@%d auth_worker_max_count = 60 auth default { mechanisms = plain login apop digest-md5 cram-md5 passdb sql { args = /etc/dovecot/dovecot-sql.conf } userdb prefetch { } user = vmail count = 1 socket listen { master { path = /var/run/dovecot/auth-master mode = 0660 user = postfix group = mail } client { path = /var/run/dovecot/auth-client mode = 0660 } } } plugin { quota = maildir }
-- Kenny Dail kend@amigo.net
Richard wrote:
From what I understand, you need to include a 'quota' field in your database authentication table, to include per user quota's. Only then will the query I specified really work. In your present database, add the quota field and insert a KB value. This value will then be used
when the authentication query is executed. In the example SQL query I
posted, I used a tabled called quota_kb.
Yeah, I've had quotas in my DB since using Courier. However I could
find no evidence that Dovecot used the quota value returned by the
query. as evidenced by:
the db.
- if there is a setting in dovecot.conf for quota, that was the
value used for calculating quota, regardless of what is returned by
- if you remove the quota=maildir from dovecot.conf and have the
query return "maildir" as quota, Dovecot will no longer calculate
quotas. - If you leave quota=maildir with no storage value in dovecot.conf
and return a quota value from the query as below, the value present
in the maildirsize file takes precedence.
One way to test the whole setup is to enable all the debug and verbose option in your config file, and then check the logs to see what its doing.
I will give that a try today.
Maybe including your sql.conf file will help solve your problem. From what I see your quota config is correct, you just need to add the
quota field in to your DB, and it should work for you.
Your query worked quite fine with my db setup with only minor
modification, as I store the quotas in the DB with a trailing S that
is required by Courier:
concat('maildir:storage=',TRIM(TRAILING 'S' FROM
quota_kb),':ignore=Trash') AS quota
Everything points to quota being a variable that can't be modified by
the extra fields option. Unfortunately, I think I will not have too
much more time for random testing, I think I will have to wait for an
authoritative answer, from somebody who can read (or has written) the
code.
Has anybody out there successfully mixed Maildrop with Dovecot using
per user maildir quotas?
Thanks for the ideas Richard!
Current dovecot.conf: protocols = imap imaps pop3 pop3s disable_plaintext_auth = no login_greeting = amigo.net ready. mail_location = maildir:%h/Maildir namespace private { separator = . prefix = INBOX. inbox = yes hidden = no } mail_extra_groups = mail mmap_disable = yes lock_method = dotlock first_valid_uid = 465 valid_chroot_dirs = /var/mail/virtual maildir_copy_with_hardlinks = yes protocol imap { mail_plugins = quota imap_quota login_greeting_capability = yes imap_client_workarounds = outlook-idle } protocol pop3 { pop3_uidl_format = %08Xu%08Xv mail_plugins = quota pop3_client_workarounds = outlook-no-nuls oe-ns-eoh } protocol lda { postmaster_address = postmaster@amigo.net } auth_default_realm = amigo.net auth_username_translation = %@ auth_username_format = %Ln@%d auth_worker_max_count = 60 auth default { mechanisms = plain login apop digest-md5 cram-md5 passdb sql { args = /etc/dovecot/dovecot-sql.conf } userdb prefetch { } user = vmail count = 1 socket listen { master { path = /var/run/dovecot/auth-master mode = 0660 user = postfix group = mail } client { path = /var/run/dovecot/auth-client mode = 0660 } } } plugin { quota = maildir }
-- Kenny Dail kend@amigo.net
On Tue, 2006-12-12 at 12:42 -0700, Kenny Dail wrote:
I can't seem to find the magic combination to get dovecot to ignore the trash folder when counting quota. I've got 1.0rc15 and using maildir quotas. Not being able to trash messages when over quota is quite annoying.
the docs suggest the following: plugin { quota = maildir:storage=10240:ignore=Trash }
I was going to release rc16 the next day after writing that to wiki, but looks like I didn't. So, updated the wiki now:
"This feature works only with v1.0rc16 and later."
You could get the latest nightly snapshot already.
participants (4)
-
Ken Dail
-
Kenny Dail
-
Richard Mayhew - Nashua Mobile Broadband Division
-
Timo Sirainen