[Dovecot] [SOLVED] quota with: postfixadmin, postfix, mysql & dovecot
Marcus Jodorf
dovecot at killfile.de
Sun Oct 1 05:47:43 EEST 2006
Peter Veerman wrote:
> The notes I want to make is about this page: http://
> wiki.dovecot.org/Quota
[...]
> nowhere is mentioned that this should also! be set:
>
> ===========
> protocol imap {
> mail_plugins = quota imap_quota
> }
> protocol pop3 {
> mail_plugins = quota
> }
> ===========
To quote the second paragraph of http://wiki.dovecot.org/Quota:
--->8---
The quota backends are implemented as plugins for Dovecot. There is
also a plugin named "quota" which does the actual work. For reporting
quota information via IMAP, there is the "imap_quota" plugin. Usually
you'd enable these by adding them to the mail_plugins settings in
config file:
protocol imap {
mail_plugins = quota imap_quota
}
protocol pop3 {
mail_plugins = quota
}
# In case you're using Dovecot-LDA:
protocol lda {
mail_plugins = quota
}
--->8---
> the second point I want to make is that the mysqlquery is incorrect as
> || does not do the job of joining the two strings.
The page solely states this as "an example using a SQL-based user
database". No word about mysql.
You just ran into the problem that mysql isn't following the
standards concerning the ||-operator (as it is by the way documented
in the mysql manuals).
But maybe there should simply be a small note that this doesn't work
with mysql because it is broken in this part and that one should use
concat instead.
> Secondly is dovecot
> making use of kilobytes instead of bytes like postfix (and
> postfixadmin)
> does.
Which is also documented on the wiki page. But I agree - this
behaviour is in contrast to about all other programs and IMHO this is
very annoying.
> user_query = SELECT maildir, 125 AS uid, 125 AS gid,\
> CONCAT('dirsize:storage=', ROUND( mailbox.quota / 1024 ) ) AS quota \
> FROM mailbox WHERE username = '%u' AND active = '1'
I solved this in a similar way using views with postgresql.
But the real problem IMHO is not bytes vs. kilobytes (solution is
very simple as you showed above) but dovecot treating '0' values in
the database literally. All the other programs take '0' as unlimited
quota and therefore it's very easy to experience an unpleasant
surprise with dovecot-lda.
If you run postfixadmin as mentioned above you will probably
completely lock out all your users with unlimited quota. I could be
wrong here but IIRC postfixadmin uses '0' for unlimited/unset quota,
too.
Marcus
More information about the dovecot
mailing list