Dovecot, RoundCube and Quota display?

Bschneider

Verified User
Joined
Sep 22, 2007
Messages
20
I am at my wits end. I am looking to see if anyone can assist me. I am having diffuiculty trying to get roundcube to display individual quota in roundcube. I've edited /etc/dovecot.conf with the following:

Code:
protocol imap {
  mail_plugins = quota imap_quota
}
Once I restated Dovecot, the following below did appear at the bottom of RoundCube but it's wrong.

Code:
Disk usage: unlimited
Am I trying to do something that can't be done? Or am I just missing a setting?

Thanks in advance.

Bryan
 

Bschneider

Verified User
Joined
Sep 22, 2007
Messages
20
So after a little more research I discovered that RoundCube is looking for a standard dovecot file in the Maildir root directory for each user called maildirsize.

http://wiki.dovecot.org/Quota/Maildir

I've also discovered that dovecot.conf needed one more section besides what I listed above for quotas to work:

Code:
plugin {
  quota = maildir
}

After I manually created the file, my quota display goes from unlimited to a graph size I arbitrarily entered into the file. So basically it works. It's exactly what my clients need and want.

Now my questions are why isn't DA creating and updating the maildirsize file for each user? Along with that, why didn't DA added the quota plugin section in dovecot.conf?

Lastly, how can I get DA to work with the maildirsize file?
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,961
Back when we implemented dovecot, I don't believe the quota plugin for dovecot existed yet.

As a workaround for now, you can use the post.sh scripts to manage this file for you.

http://www.directadmin.com/features.php?id=298

eg, for both files:
/usr/local/directadmin/scripts/custom/email_create_post.sh
/usr/local/directadmin/scripts/custom/email_change_pass_post.sh
Code:
#!/bin/sh
if [ "$quota" != "" ] && [ "$username" != "" ]; then
    MDPATH=/home/$username/imap/$domain/$user/Maildir/maildirsize
    if [ "$quota" = "0" ]; then
        echo -n '' > $MDPATH
    else
        VALUE=`echo "$quota * 1024 * 1024" | bc`S
        echo $VALUE > $MDPATH
    fi
    chown -R $username:mail $MDPATH || error "chown"
    chmod 660 $MDPATH || error "chmod"
fi
John
 

Bschneider

Verified User
Joined
Sep 22, 2007
Messages
20
Thanks John!

As I indicted in my email. This works great with the addition of two lines that are needed.

Code:
chown -R $username:mail $MDPATH || error "chown"
chmod 660 $MDPATH || error "chmod"
 

tafaz

Verified User
Joined
Apr 9, 2008
Messages
12
there's a way to create the maildirsize file for existing users?
 

tafaz

Verified User
Joined
Apr 9, 2008
Messages
12
thank you ... but if i ask if there's a way to solve this, probably i don't know how to get the list of the accounts ....
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
A simple way to do find all the folders where you should put the quota file
Code:
 # find /home/*/imap/*/* -name Maildir
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
There are 2 problems with the maildirsize approach:
1) Quotas are not regularely updated by Dovecot, so information contained in the file may be wrong until the next refresh
2) Users can manipulate the file and thus get whatever quota they want.
 

tafaz

Verified User
Joined
Apr 9, 2008
Messages
12
users usually don't have shell access and ftp starts in the root of the domain htdocs, so file modifications are impossible
i noticed instead the problem of dovecot refresh on quotas ... the question now is, are there other better ways to show quotas in roundcube?
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
users usually don't have shell access and ftp starts in the root of the domain htdocs, so file modifications are impossible
This statement is wrong with the DA version I'm using. My users end up in /home/username

I have no idea about roundcube or any other webmail for that matter. There is a quota API provided by DA, but it sounds like it would introduce too much overhead for large folder operations.
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
Solutions to my 2 previous problems:
1) Use Dovecot as the LDA
2) Run a cron that re-applies quotas every x hours
 

IMcomGuy

Verified User
Joined
Feb 26, 2007
Messages
37
Any chance at making this a standard feature with Roundcube 0.4 now officially released?

It's great to setup custom scripts and all, but this would be a feature that could potentially benefit all users.
 

a.cirelli

New member
Joined
Sep 30, 2011
Messages
2
maildir_use_size_file parameter

Hi I'm new in the forum and this is my first post ...
I've try your solution but the maildir file is not updated and the quota occupation still 0%.

I've read the exim documentation ad I find in this page
http://www.exim.org/exim-html-current/doc/html/spec_html/ch26.html
this parameter : maildir_use_size_file;
I've insert in the virtual_localdirectory section with value: true.
I've insert the previous configuration in /etc/dovecot.conf to enable quota plugin.

I've restarted exim and dovecot, I sent an email to an user and the file maildirsize was created and in the roundcube the quota level in correctly displayed.

I've make some test to check that's the email system work correcly.

You know if there are problems with this configurations?

Thank's
Alessandro
 

a.cirelli

New member
Joined
Sep 30, 2011
Messages
2
Hi I'm new in the forum and this is my first post ...
I've try your solution but the maildir file is not updated and the quota occupation still 0%.

I've read the exim documentation ad I find in this page
http://www.exim.org/exim-html-current/doc/html/spec_html/ch26.html
this parameter : maildir_use_size_file;
I've insert in the virtual_localdirectory section with value: true.
I've insert the previous configuration in /etc/dovecot.conf to enable quota plugin.

I've restarted exim and dovecot, I sent an email to an user and the file maildirsize was created and in the roundcube the quota level in correctly displayed.

I've make some test to check that's the email system work correcly.

You know if there are problems with this configurations?

Thank's
Alessandro
Hi guys, after few week's system work correctly only one thing, if you use pop3 access you have to enable quota plugin in pop3 protocol:
protocol pop3 {
mail_plugins = quota
}

If you don't insert this users that can access mail by webmail and mail client with pop3 don't see real mailbox occupation.
Bye Ale
 

Morala

New member
Joined
Jul 27, 2010
Messages
4
We are trying to do the same... but doesn't work yet

We tried:

exim.conf -> On virtual_localdelivery section maildir_use_size_file = true

dovecot.conf ->

protocol imap {
mail_plugins = quota imap_quota
}

plugin {
quota = maildir
}

Restart both services and the result show on RoudCube is always 0% used of space...

Any idea?
 

pnymat

New member
Joined
May 21, 2012
Messages
1
We tried:

exim.conf -> On virtual_localdelivery section maildir_use_size_file = true

dovecot.conf ->

protocol imap {
mail_plugins = quota imap_quota
}

plugin {
quota = maildir
}

Restart both services and the result show on RoudCube is always 0% used of space...

Any idea?

Same problem for me, i do the configuration, but it say that only 0% is occupied.

Somebody can help me ?
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Thanks for that. I've moved your thread to our How-Tos section. All links will continue to work.

Jeff
 
Top