With v1.2 this would be somewhat easier I think, because it allows you to create new user structures, look up their home dirs (by querying dovecot-auth) and calculate their quotas. But you'd still need a way to get a list of usernames who share the quota.
All of this is actually related to "domain quotas" that I've been thinking about for a long time. If there was a way to recalculate the quota for multiple users I'd be interested in getting the code added to Dovecot.
"domain quotas" is a good way to describe it.
It would need some method to look up all mail-storage that is belong to the domain. In our case, we would look at an LDAP query, where uid=uid and gid=gid, but could be a literal search as well. (o=$domain, ...). Since the uids are the same (it is how you do shared quota with fs-quota after all), we do not have any uid/chown/chmod issues.
More generically, there needs to be some way to get the list of connected accounts, from any backends, not just LDAP. And the data relationship should be configurable.
After that, the recalculation would need to iterate said list. I presumed that Dovecot already had logic to deal with multiple accounts, since the wiki lead me to believe one could do shared quotas with symlinks. [1]
We would need this feature in the next 2 weeks, so I will most likely break-down and hack it in, but naturally it would be much better if it was done Officially for ease of future upgrades (and probably more reliable).
[1] Speaking of symlink-shared-quotas. If I create say 2 domain accounts, both which symlink to each other, I would guess it ends up in an infinite loop, or is it clever enough to break after depth of 1 symlink?
On Tue, 2009-03-10 at 11:59 +0900, Jorgen Lundman wrote:
Since I could issue an LDAP query for (&(uidNumber=%uid)(gidNumber=%gid)) for homeDirectory to retrieve all home directory paths, and associated mailDirSize files, I wonder if I could extend dovecot to allow us to handle shared quota like the fs-quota used to work.
Using symlinks between accounts would very quickly deteriorate.
Lund
Jorgen Lundman wrote:
Hello list,
We are in the process of exploring the idea of moving from UFS with fs-quota to using softquotas in Dovecot (probably Maildir type, stored in LDAP, all ontop of NFS).
I have it setup, and it works rather well so far.
But there is one situation we can currently support, which I can not see a solution for with soft-quotas.
Generally customers get 1 email, with 1 quota.
But it is also possible for customers to get 1 quota, but create multiple mail accounts, all sharing the same quota. This is done by using the same UID for each account when using fs-quota.
(It is not that each account gets a fraction of the quota, but that all accounts add up to the one quota).
Is this still possible to do with soft-quotas. To share one set. Dovecot would have to go count files in multiple mail-directories so I would guess no.
Lund
-- Jorgen Lundman | lundman@lundman.net Unix Administrator | +81 (0)3 -5456-2687 ext 1017 (work) Shibuya-ku, Tokyo | +81 (0)90-5578-8500 (cell) Japan | +81 (0)3 -3375-1767 (home)