Hi there,

    I set-up Postfix to enforce quotas using this in the main.cf:

postconf -n | grep virtual
virtual_alias_maps =
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_domains =
proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/sql/mysql-virtual-mailbox-maps.cf
virtual_transport = dovecot-spamass

Strangly, the entries in the main.cf contain more details but these are
omitted in the o/p of postconf -n for some reason?! :
virtual_mailbox_domains =
proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/sql/mysql-virtual-mailbox-maps.cf
virtual_alias_maps =
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_transport = dovecot-spamass
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps =
mysql:/etc/postfix/sql/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn
his diskspace quota, please try again later.
virtual_overquota_bounce = yes


The query is:
cat /etc/postfix/sql/mysql_virtual_mailbox_limit_maps.cf
## For quota support
user = 1234566
password = 123456
hosts = localhost
dbname = mailserver
query = SELECT quota FROM mailbox WHERE username='%s' AND active = '1

The user can log into mysql and access the database, and the query
returns the correct data:
select quota from mailbox where username='t...@test.info' and active =1;
+---------+
| quota   |
+---------+
| 1024000 |
+---------+
1 row in set (0.00 sec)

I have sent in excess of 2,000 emails with 0.5 Mb payloads into the
email account, yet Postfix won't reject these for being over quota.

select * from quota ;
+-----------------------------+-----------+----------+
| username                    | bytes     | messages |
+-----------------------------+-----------+----------+
| t...@test.info      | 187985500 |     6409 |


I think that Postfix is missing a query to verify that the quota has
actually been exceeded.  If I am rigth then,
i) which entry in the main.cf should  be added
ii) what should the sql query format resemble

Or, the quota entries I have in the main.cf are not recognised by
postfix, and therefore not being used :-{

Does any one know which of the above, or if none of the above then would
point me in the right direction (or tell me what went wrong :)  )
Best wishes.



Reply via email to