View previous topic :: View next topic |
Author |
Message |
k00ma n00b
Joined: 22 Jul 2004 Posts: 65 Location: Finland
|
Posted: Fri Aug 05, 2005 7:12 am Post subject: Courier-imap+Postfix quota setup |
|
|
I have Courier-imap and Postfix installed and now I would like to assing quota to .maildir folders, what changes I have to for example to Postfix config files
Quote: |
How to implement the quota
The best way to do that is to modify your mail server to implement the protocol defined by this document. Not everyone, of course, has this ability. Therefore, an alternate approach is available.
This package builds two small utility programs: "maildirmake" and "deliverquota". maildirmake is an extended version of the Maildir creation utility, with some additional options, including quota support.
The -qoptions to maildirmake installs the maildirsize file in an existing Maildir, which enables quota support:
maildirmake -q 10000000S ./Maildir
./Maildir is an existing maildir, and this -q options sets a quota of about 10 megabytes.
deliverquota reads the message from standard input, then delivers it to the maildir specified by the first argument to deliverquota, observing any quota that's set for the maildir. If the maildir is over quota, deliverquota terminates with exit code 77. Otherwise, it delivers the message, updates the quota, and terminates with exit code 0.
You will need to configure your mail server to use deliverquota instead of delivering directly to maildirs. The instructions for doing so depends on which mail server you use. For example, if you use Qmail and your maildirs are all located in $HOME/Maildir, replace the './Maildir/' argument to qmail-start with the following:
'| /usr/local/bin/deliverquota ./Maildir'
Then, run maildirmake with the -q option to set up quotas on all the maildirs.
|
That example is about Qmail what changes I have make to Postfix config |
|
Back to top |
|
|
stealthy Tux's lil' helper
Joined: 08 Aug 2002 Posts: 118 Location: ONTARIO CANADA
|
Posted: Sat Aug 06, 2005 6:24 pm Post subject: |
|
|
For starters you need to have "vda" as one of your use flags when compiling postfix to enable quota support.
See:
http://web.onda.com.br/nadal/
http://brunny.com/content/view/9/50/
I personally use postfix, courier for email along with amavisd using spamassassin & clamav
All the front end is being managed by postfixadmin(not in portage, although I am lost as to why not)
http://high5.net/postfixadmin/ _________________ All your Gentoo are belong to us. |
|
Back to top |
|
|
hanj Veteran
Joined: 19 Aug 2003 Posts: 1500
|
Posted: Sat Feb 04, 2006 6:29 pm Post subject: |
|
|
Hello
I'm thinking of going with quota handling with postfix. I've been doing some research with vda, and found some older threads on the subject. I have a few questions.. maybe you or someone can help.
1. I see there is a vquota map file you can use in main.cf.
From the website (http://web.onda.com.br/nadal/)...
Code: | vquota maps file
This file contains in bytes the maximum diskspace authorised per emails.
# domain.com.br are unlucky one... they have a max to 2M diskquota
user1@domain.com.br 2048000
user2@domain.com.br 2048000
# domain.net.br are more lucky... and some don't have any limits (0 !)
user1@domain.net.br 5192000
user2@domain.net.br 0 |
Now.. Is it possible to hook into the quota field in the virtual-mail mysql user's table? Maybe create the wrapper...
Code: | # Maps of virtuals users
virtual_mailbox_maps = hash:/etc/postfix/vmailbox |
to
Code: | # Maps of virtuals users
virtual_mailbox_maps = mysql:/etc/postfix/mysql-userquota.cf |
mysql-userquota.cf would contain:
Code: | user = user
password = password
dbname = mailsql
table = users
select_field = quota
where_field = email
additional_conditions = and postfix = 'y'
hosts = 127.0.0.1
|
2. Also, I would like to have a 'global' quota, and then adjust it for per user. Would the best way be setting the quota in the database to the 'global' value, and then adjust specific values to specific users in the database? Or would I leave quota to 0 for everyone, and set it in main.cf (virtual_mailbox_limit = 100000000) but then adjust on a per user basis via the database?
3. Also, their documentation states:
Quote: | set the transport to VIRTUAL, or this patch not work!
transport_maps = hash:/etc/postfix/transport |
Now is this different than the virtual values we have set with virtmail?
Code: | virtual_transport = virtual
virtual_mailbox_domains = mysql:/etc/postfix/mysql-transport.cf |
My current MTA set up is as follows:
postfix-2.2.5
courier-imap-4.0.1
courier-authlib-0.58
spamassassin-3.1.0
amavisd-new-2.3.3-r2
clamav-0.88
mysql-4.1.14
Thanks in advance!
hanji |
|
Back to top |
|
|
hanj Veteran
Joined: 19 Aug 2003 Posts: 1500
|
Posted: Sat Feb 04, 2006 8:53 pm Post subject: |
|
|
Ok. I got things pretty well figured out. I'm having trouble with soft limits.. I'll provide what I did,...
emerge postfix with vda flag (either with USE or /etc/portage/package.use)
Code: | USE="vda" emerge -v postfix |
Edit authmysqlrc
/etc/courier/authlib/authmysqlrc
Code: | MYSQL_QUOTA_FIELD quota |
Edit /etc/postfix/main.cf
Code: | ##############################################
# VIRTMAIL QUOTA #
##############################################
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql-virtual-mailbox-limit-maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_extended = yes
virtual_create_maildirsize = yes
virtual_overquota_bounce = yes
virtual_mailbox_limit_override = yes
virtual_mailbox_limit = 30720000
virtual_mailbox_limit_inbox = no |
Create /etc/postfix/mysql-virtual-mailbox-limit-maps.cf
Code: | user = user
password = password
dbname = mailsql
table = users
select_field = quota
where_field = email
additional_conditions = and postfix = 'y'
hosts = 127.0.0.1 |
Make sure your permissions are set for that. Readable by your postfix user.
I see that leaving a 'blank' value in 'quota' field will default to 'no quota' which will work for me. I'm still having problems with bounces. Is there a way to have a 'soft' limit so message will be sent to sender with a 'warning'? I wasn't able to get that part to work. I was playing around with the virtual_overquota_bounce configuration option, but would always bounce at my quota value.
I was also successful with using the quota usage plugin for squirrelmail.
http://www.squirrelmail.org/plugin_download.php?id=59&rev=1114
Reference to the configuration changes above..
http://brunny.com/content/view/9/50/
http://web.onda.com.br/nadal/
Thanks!
hanji |
|
Back to top |
|
|
ebnerjoh Tux's lil' helper
Joined: 27 Oct 2006 Posts: 83
|
Posted: Fri May 04, 2007 11:46 am Post subject: |
|
|
Hi!
I am alos using postfix --> courier-imap --> squirrelmail and postfixadmin to manage mailboxes.
Quota is working for me, so when the mailbox is full additional mails will get bounced. But I can not display the quota in squirrelmail with the plugin "quota_usage". The debug shows:
Code: | IMAP command sent: a001 GETQUOTAROOT "INBOX"
IMAP response recieved:
Array
(
[0] => * QUOTAROOT "INBOX" "ROOT"
[1] => * QUOTA "ROOT"
)
Usage is:
Array
(
[0] => NOQUOTA
)
|
Any Ideas?
Regards,
Johannes |
|
Back to top |
|
|
hanj Veteran
Joined: 19 Aug 2003 Posts: 1500
|
Posted: Fri May 04, 2007 2:01 pm Post subject: |
|
|
Are you seeing your quota_usage 'box' at least? Also, have you confirmed that quotas are working on your system? I'm assuming so, just want to verify that it's working first.
hanji _________________ Server Admin Blog - Uno-Code.com |
|
Back to top |
|
|
ebnerjoh Tux's lil' helper
Joined: 27 Oct 2006 Posts: 83
|
Posted: Fri May 04, 2007 2:30 pm Post subject: |
|
|
No, I dont see any kind of box. Nothing is shown on the frontend.
Yes, quota is working. But I am not sure if it is the courier-imap-quota.
I followed the virtual-mailserver howto (postfix - courier -mysql) and the quota is stored in the mysql database (with postfixadmin).
When the mailbox-size is over the quota, no new mails are excepted.
Regards,
Johannes |
|
Back to top |
|
|
hanj Veteran
Joined: 19 Aug 2003 Posts: 1500
|
Posted: Fri May 04, 2007 2:51 pm Post subject: |
|
|
I'm wondering if the plugin hook is not working correctly. I might be wrong, but I think you should see the quota box regardless of no quota vs. a quota set. Do you have quota_plugin enabled in config.php?
I would look at the 'display_quota_usage_left_do()' in function.php and squirrelmail_plugin_init_quota_usage() in setup.php
hanji _________________ Server Admin Blog - Uno-Code.com |
|
Back to top |
|
|
|