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
Comments
Re: Domain wide maildir quota
By Benny Pedersen at 06/04/2012 - 09:47Den 2012-06-04 15:23, Elaconta.com Webmaster skrev:
desperate ?, but where is the sources ? :=)
with dovecot one could make dict in mysql, and then all thats left is a
drafted policyd that checks mysql dict live updated in policy protocol
in postfix, if one provide a policyd check policy service in dovecot it
would be nice
postfix dont need hacked virtual delivery :)
Re: Domain wide maildir quota
By webmaster at 06/04/2012 - 09:51Benny Pedersen escreveu:
Luis Oliveira
Elaconta
Re: Domain wide maildir quota
By Benny Pedersen at 06/04/2012 - 09:57Den 2012-06-04 15:51, Elaconta.com Webmaster skrev:
then make an perl policyd that checks imap protocol and reports back to
policy protocol in postfix, no scripting is needed
Re: Domain wide maildir quota
By webmaster at 06/04/2012 - 10:05Benny Pedersen escreveu:
Luis Oliveira
Elaconta
Re: Domain wide maildir quota
By Benny Pedersen at 06/04/2012 - 10:55Den 2012-06-04 16:05, Elaconta.com Webmaster skrev:
policy protocol in postfix is pr recipient user, no need to check
domain, if you really need pr domain qoutas the perl code must calc it
before report it to postfix in policy protocol, i wish i could make the
perl since i really want it myself
make the perl code a bridge from postfix policy protocol to imap quata
check, and if domain is needed check all domain users and add it
together before report it to postfix with accept or tempfails