Sunday 10 July 2011

Postfix Quota for redhat mail user

Postfix does not support mailbox quota. But thanks to Anderson Nadal’s Postfix Virtual Delivery Agent (VDA) patches, it can. To use the Postfix VDA requires two things, first Postfix must be built with the VDA patches and second, virtual user accounts must be used. You can get the Postfix RPM with VDA patches here.
Here are some configuration you can use for your virtual accounts.

Configure Postfix VDA

Edit main.cf1. Edit the postfix configuration file /etc/postfix/main.cf and add the lines below
virtual_mailbox_limit_override = yes
virtual_overquota_bounce = yes
virtual_mailbox_limit_maps = hash:/etc/postfix/vquota
Edit main.cf2. Create the file /etc/postfix/vquota containing the mapping from an email address to the maximum mailbox quota in bytes. If you wish to be exact, 1KB equals 1024 bytes while 1MB equals 1024KB or 1048576 bytes.
johndoe@acme.local 10485760
janedoe@acme.local 2097152
John Doe got a 10MB quota while Jane Doe got 2MB.
After creating this file, execute postmap /etc/postfix/vquota. This will generate /etc/postfix/vquota.db, the actual file that will be used for the lookup.
NoteIf you use Active Directory as your Postfix virtual user accounts source, you can use the maxStorage attribute instead to store the quota. Just copy your ldap-users.cf configuration and save it as ldap-quota.cf. Next change samaccountname to maxstorage in the result_attribute line and remove the result_format line. In your main.cf, use ldap:/etc/postfix/ldap-quota.cf as your virtual_mailbox_limit_maps. In Windows, you can use ADSI Edit to access and modify the value of maxStorage.
Service Configuration3. Restart the Postfix or MailScanner service if you have installed MailScanner. Learn how to start and stop services here.
Terminal4. Test Postfix using Telnet. Try using a very small quota limit so you can test the quota feature.

No comments: