Hm, it looks very straighforward and not so flexible. i want get this string get working. some missconfiguration of arguments and syntax. i dont wanna mannually insert amount of message or bytes, if it's possible i would like everything to be read from database quota.conf Hope developers would see this thread and help also i understood aalmost all strings in query concat('/home/vmail/', maildir) as home - virtual users home directory concat('maildir:/home/vmail/', maildir) as mail - virtualusers maildirectory floor(quota/1000) - seems to be minimal quota for user. users quota devided by 1000
so for now i've tried to do next query string changed quota to quota_rule user_query = SELECT concat('/home/vmail/', maildir) as home, concat('maildir:/home/vmail/', maildir) as mail, 1001 AS uid, 12 AS gid, concat('dict:storage=',floor(quota/1000),' proxy::quotadict') AS quota_rule FROM mailbox WHERE username = '%u' AND active = '1'
plugin { quota = dict:User quota::proxy::quotadict quota_rule = *:storage=1G quota_rule2 = Trash:storage=+100M }
dict { quotadict = mysql:/etc/dovecot/conf.d/sql/dovecot-dict-sql.conf # expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf }
and now error
Jun 24 13:19:59 imap: Debug: Added userdb setting: mail=maildir:/home/vmail/office.dev/test/ Jun 24 13:19:59 imap: Debug: Added userdb setting: plugin/quota_rule=dict:storage=10240 proxy::quotadict Jun 24 13:19:59 imap(test@office.dev): Debug: Effective uid=1001, gid=12, home=/home/vmail/office.dev/test/ Jun 24 13:19:59 imap(test@office.dev): Debug: Quota root: name=User quota backend=dict args=:proxy::quotadict Jun 24 13:19:59 imap(test@office.dev): Warning: quota root User quota rule dict:storage=10240 proxy::quotadict: obsolete configuration for rule 'storage=10240 proxy' should be changed to 'storage=+10240 proxy' Jun 24 13:19:59 imap(test@office.dev): Debug: Quota rule: root=User quota mailbox=dict bytes=+10240 messages=0 Jun 24 13:19:59 imap(test@office.dev): Error: user test@office.dev: Initialization failed: Failed to initialize quota: Invalid quota root quota: Invalid rule dict:storage=10240 proxy::quotadict: Invalid rule limit value: storage=10240 proxy Jun 24 13:19:59 imap(test@office.dev): Error: Invalid user settings. Refer to server log for more information. Jun 24 13:19:59 imap-login: Info: Login: user=test@office.dev, method=PLAIN, rip=192.168.0.11, lip=192.168.0.31, mpid=5742, TLS Jun 24 13:19:59 imap-login: Warning: SSL alert: where=0x4008, ret=256: warning close notify [192.168.0.11]
Here it is.
# Database driver: mysql, pgsql driver = mysql
# Currently supported schemes include PLAIN, PLAIN-MD5, DIGEST-MD5, and CRYPT. default_pass_scheme = CRYPT
# Database options connect = host=192.xxx.xxx.xxx dbname=postfix user=postfix password=mypostfixpassword
password_query = select password
from mailbox where username = '%u'
and active = '1'user_query = select maildir,
concat('*:messages=50000:bytes=', quota) as quota_rule
from mailbox where username = '%u' and active = '1'Gr Johan