[Dovecot] Custom quota setup

Timo Sirainen tss at iki.fi
Fri Aug 2 18:34:09 EEST 2013


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

> We have a weird quota requirement, we have file storage that we manage through our own APIs but want that usage to come out of the user's mail quota.

I've been thinking something like that as well for various other things: IMAP METADATA/ANNOTATE extension data, Sieve scripts, and also the actual file storage once Dovecot implements WebDAV. The quota plugin probably needs to be made extensible in some way to allow calculation of quota from multiple data sources. Or maybe lib-storage API needs to be made more aware of quota. I'm not entirely sure yet.

> The usage is in a maildirsize like file uncreatively called filestoresize in the user's maildir.  
> 
> In the past we've been doing this by modifying the quota plugin and re-compiling, but it seems like it should be possible to do this via configuration.
> 
> Is there a way to add a quota setting pointing at this file for additional usage (not limits)?

I can't think of any good way to do that.

> The feature is used infrequently so it would probably be acceptable use the dirsize backend, but I can't figure out how to configure that to point at a certain directory.

I guess if you had a hidden non-listable namespace pointing to your file storage, the dirsize would find it and count them. The problem is, you would have to use dirsize backend for the Maildir as well, which is too slow. (Using a separate dirsize quota for files wouldn't then share the mail quota.) And the Maildir++ backend reads only new/ and cur/ directories.

> We pass custom quota rules for each user in our userdb, and use a custom dict proxy program, so that program could read the file and pass a setting at log in time too (if, for example, there was a setting that said "offset the user's quota usage by X amount")

That I think would work.



More information about the dovecot mailing list