[Dovecot] Custom quota setup

Timo Sirainen tss at iki.fi
Fri Aug 2 19:28:16 EEST 2013


On 2.8.2013, at 19.18, Richard Platel <rplatel at tucows.com> wrote:

>> I'm not exactly sure what you thought of, but my idea was simply that you'd add your own dict proxy in the middle which hooks into the GET command, and increases its value by reading the filestoresize. You can already do that by pointing to a UNIX socket different from the normal dict server socket, similar as in http://wiki2.dovecot.org/AuthDatabase/Dict
> 
> If, for example, the user has 2GB quota, and 750MB of mail, and 500MB of files, we'd like the mail client to show that the user has 2GB quota, and 1.25GB used, .75GB free.
> 
> I see how via the dict userdb proxy I could reduce the user's quota allowance by the filestorage amount:
> quota_rule=*:storage=<user allowed storage - filestore size>, 
> and the client would show the correct free amount, but not the correct total or used amount. 
> 
> Is this what you mean, or is there some other setting or some other dict proxy entirely that I'm missing?

I didn't mean userdb dict proxy. I meant you'd use dict backend for calculating quota instead of Maildir++. http://wiki2.dovecot.org/Quota/Dict

So for example you could still keep using the file based quota and first step would be to configure:

plugin {
  quota = dict:User quota::file:%h/Maildir/dovecot-quota
}

Next I thought you could have configured dict proxy to access the file, but %h or ~/ don't actually work there.. So you'd probably have to implement the whole file access via your dict server:

plugin {
  quota = dict:User quota::proxy:/var/run/dovecot/tucows-quota:quota
}

Then you'd have a process listening on tucows-quota UNIX socket that handles the get/set/unset/atomic-inc dict commands. Or alternatively implement a new dict backend as a Dovecot plugin that does the same thing:

plugin {
  quota = dict:User quota::proxy::quota
}
dict {
  quota = tucowsquota:
}



More information about the dovecot mailing list