Hello

This has been a nut that i haven't been able to crack for a long time now and i was wondering how one would solve this problem.
My setup is the following:

a) Multiple domains hosted in a single box
b) Postfix delivers emails to virtual mailboxes (so all the domains run under the same virtual UID/GID).
c) Users are stored in a MySQL database
d) I'm currently using the Postfix VDA quota patch, but it only limits quota for a single email.
e) The objective is to limit the quota domain wide. For instance:

The domain quota is 50 MB, there are two users on the domain (user A and user B).
User A has 40 MB of used quota, user B has 0 MB of used quota.
If someone sends an email sized 20 MB to user B, the email must be rejected because it would exceed the available quota for the domain (10 MB)

I'm getting kind of desperate so i'm probably going to do something very hacky like running a routine every 10 minutes or so that does the following:

a) Read all domains and users from the database
b) For each domain, add the quota in the IMAP maildirsize file for each email in the domain to get the total used quota for the entire domain
c) Save the total used quota for each domain in the database.

Then i must add some kind of check to Postfix that rejects the email if it exceeds the available quota.

But this is really ugly and slow. Has anyone come up with a better solution for this? If not, how would i add to Postfix a check that would reject an email if it exceeds quota (i can check using an SQL query).

Luis Oliveira
Elaconta

Reply via email to