Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Dovecot2 Quota Issues

Sarge888
2012-10-07
2013-01-23
  • Sarge888
    Sarge888
    2012-10-07

    Iv tried looking around to find a fix but iv been unsuccessful. Im not sure how to explain this so il do the best i can. my apologies ahead of time if its not fully understandable.

    Iv setup quotas per wiki2 instructions and postfixadmins. i can set quotas for domains and mailboxes but they do not seem to carry over to the database. the quotas under database tables "domain" & "mailbox" do show the set quotas correctly under column "Quota". however the database table "Quota2" doesnt have any data added to it.
    also running

    doveadm quota -u user@domain.com
    

    shows the following

    Quota name                                         Type               Value            Limit     %
    storage=1024000                          STORAGE            20                  -          0
    

    The only thing that changes is the value of the following

    storage=[b]1024000[/b]
    

    Im guessing its just updating the wrong value or something. Hopefully someone can help me with this.

     
  • Sarge888
    Sarge888
    2012-10-07

    I cant edit this to change the formatting to better show but you should get the idea… Also i dont know what .conf file to show as i dont know what pertains to this. Il guess the following.

    DOVECOT-SQL.CONF

    driver = mysql
    connect = host=localhost dbname=NAME user=USER password=PASS
    # The new name for MD5 is MD5-CRYPT so you might need to change this depending on version
    default_pass_scheme = MD5
    # Get the mailbox
    user_query = SELECT '/var/vmail/%d/%n' as home, 'maildir:/var/vmail/%d/%n' as mail, 101 AS uid, 12 AS gid, concat('dirsize:storage=', quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
    # Get the password
    password_query = SELECT username as user, password, '/var/vmail/%d/%n' as userdb_home, 'maildir:/var/vmail/%d/%n' as userdb_mail, 101 as userdb_uid, 12 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
    # If using client certificates for authentication, comment the above and uncomment the following
    #password_query = SELECT null AS password, '%u' AS user
    iterate_query = SELECT username AS user FROM mailbox
    

    DOVECOT-DICTY-SQL.CONF

    connect = host=localhost dbname=NAME user=USER password=PASS
    map {
      pattern = priv/quota/storage
      table = quota2
      username_field = username
      value_field = bytes
    }
    map {
      pattern = priv/quota/messages
      table = quota2
      username_field = username
      value_field = messages
    }
    

    If you need more than this let me know.

     
  • Sarge888
    Sarge888
    2012-10-07

    ah never mind. i believe i have figured it out… to those of you with similar issues read on.

    I took another look at my logs and DOVECOT-SQL.CONF file and found that the following was the main issue-

    concat('dirsize:[b]storage=[/b]', quota) AS quota
    

    so i replaced it with

    concat('*:bytes=', quota) AS quota_rule
    

    and that solved my problem. I also had to change who owned the dovecot-dict-sql.conf file to dovecot as thats the default running user as found here - http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg934518.html

    After that everything is updating as it should.

    If i have a small error somewhere that i missed please let me know.