Hi all,
First post here so hopefully I get all the required information correct.
I am running a mail server on Debian, its consists of Postfix (2.9.6-2), Dovecot (2.1.7) and MySQL (5.5). Basic stuff is all working find so I decided to try and implement quotas. This is working to an extent but not properly and I am a little lost so looking for some help.
In my configuration the default mailbox quota is set to "*:storage=100M". When I create a mailbox with 250M specified in the database, dovecot is applying the default quota rather than that specified in the database. So in the database I have a test user with the following entry
password,email,quota_kb [hash], test@example.org, 25000
If I turn debugging on for mail and auth I see the following logged when the user logs in (logs pasted at the end in a bid to maintain some readability)
If I check the quota with doveadm I get the limit back of 102400 which is the default mailbox size rather than that from the database.
doveadm quota get -u test@example.org Quota, name, Type, Value, Limit, % User quota, STORAGE, 19139, 102400, 18 User quota, MESSAGE, 567, -
I can't quite figure out where I am going wrong in terms of getting the database value to supersede the default value set in 90-quota.conf. I did read one thing in the quota documentation on the dovecot website (http://wiki2.dovecot.org/Quota/Configuration) that I didn't get and this might be where I am going wrong but can't check. It says "Check that dovecot-lda is called with -d parameter." Where would this be configured and where could I check?
Below are some other inputs - hopefully they help.
### Debug logs at login
Aug 14 14:06:24: auth: Debug: Loading modules from
directory: /usr/lib/dovecot/modules/auth
Aug 14 14:06:24: auth: Debug: Module
loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
Aug 14 14:06:24: auth: Debug: auth client connected (pid=8090)
Aug 14 14:06:24: auth: Debug: auth client connected (pid=8093)
Aug 14 14:06:24: auth: Debug: client in:
AUTH#0111#011PLAIN#011service=imap#011secured#011session=2QDLu5UAKAAuBSdf#011lip=99.99.99.99#011rip=55.55.55.55#011lport=993#011rport=50216
Aug 14 14:06:24: auth: Debug: client out: CONT#0111#011
Aug 14 14:06:24: auth: Debug: client in:
AUTH#0111#011PLAIN#011service=imap#011secured#011session=ZBnLu5UAKQAuBSdf#011lip=99.99.99.99#011rip=55.55.55.55#011lport=993#011rport=50217
Aug 14 14:06:24: auth: Debug: client out: CONT#0111#011
Aug 14 14:06:24: auth: Debug: client in: CONT<hidden>
Aug 14 14:06:24: auth-worker(8095): Debug: Loading modules from
directory: /usr/lib/dovecot/modules/auth
Aug 14 14:06:24: auth-worker(8095): Debug: Module
loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
Aug 14 14:06:24: auth-worker(8095): mysql(127.0.0.1): Connected to
database mailserver
Aug 14 14:06:24: auth-worker(8095): Debug:
sql(test.example.org,55.55.55.55): query: SELECT email as user, password
FROM users WHERE email='test.example.org';
Aug 14 14:06:24: auth: Debug: client out:
OK#0111#011user=test.example.org
Aug 14 14:06:24: auth: Debug: master in:
REQUEST#0111720057857#0118090#0111#0114bf45b372441751900d7d967578b0e03
Aug 14 14:06:24: auth-worker(8095): Debug:
sql(test.example.org,55.55.55.55): SELECT
CONCAT('/var/vmail/',CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1))) AS home, 5000 AS uid, 5000 AS gid, CONCAT('maildir:storage=+',quota_kb) AS quota_rule FROM users WHERE email='test.example.org';
Aug 14 14:06:24: auth: Debug: master out:
USER#0111720057857#011test.example.org#011home=/var/vmail/contriveit.com/test#011uid=5000#011gid=5000#011quota_rule=maildir:storage=+250000
Aug 14 14:06:24: imap-login: Login: user=
### doveconf -n
# 2.1.7: /etc/dovecot/dovecot.conf # OS: Linux 2.6.32-042stab084.17 x86_64 Debian 7.6 simfs auth_debug = yes auth_mechanisms = plain login dict { quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext } mail_debug = yes mail_location = maildir:/var/vmail/%d/%n/Maildir mail_plugins = " quota" managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave namespace inbox { inbox = yes location = mailbox Drafts { auto = subscribe special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { auto = subscribe special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Spam { auto = create special_use = \Junk } mailbox Trash { auto = subscribe special_use = \Trash } prefix = separator = / } passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { quota = maildir:User quota quota_rule = *:storage=100M quota_rule2 = Trash:storage=+10M sieve = ~/.dovecot.sieve sieve_dir = ~/sieve } postmaster_address = postmaster@example.org protocols = " imap sieve" service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } } ssl_cert =
### /etc/dovecot/dovecot-dict-sql.conf.ext
connect = host=127.0.0.1 dbname=db user=user password=password
map { pattern = priv/quota/storage table = virtual_users username_field = email value_field = quota_kb } map { pattern = priv/quota/messages table = quota username_field = username value_field = messages } map { pattern = shared/expire/$user/$mailbox table = expires value_field = expire_stamp fields { username = $user mailbox = $mailbox } }
#### /etc/dovecot/dovecot-sql.conf.ext
default_pass_scheme = PLAIN-MD5 password_query = SELECT email as user, password FROM users WHERE email='%u'; user_query = SELECT CONCAT('/var/vmail/',CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1))) AS home, 5000 AS uid, 5000 AS gid, CONCAT('maildir:storage=+',quota_kb) AS quota_rule FROM users WHERE email='%u';
Any help appreciated.