Problems with qouta_clone plugin

Aki Tuomi
Mon, 15 Oct 2018 12:36:04 -0000

On 15.10.2018 15:34, Christian Ejlertsen wrote:
> On Mon, 2018-10-15 at 15:31 +0300, Aki Tuomi wrote:
>> You should add quota_clone to mail plugins.
>>
>> Aki
>>
>>
>> On 15.10.2018 15:28, Christian Ejlertsen wrote:
>>> Hello
>>>
>>> I'm having troubles getting the quota_clone plugin to work for
me.
>>> i?, trying to put the quota values into to to fields, messages and
>>> usage_in_bytes, in the mysql database.
>>>
>>> The quotas are getting written to the maildirsize file and can be
>>> updated with the doveadm quota recalc -A or -u "*"
command
>>>
>>> But i can't seem to get it to trigger the quota_clone plugin,
not
>>> even
>>> an error or a warning.. At this point a crash would be preferred
>>> since
>>> it might yield some information :)
>>>
>>> It is probably something simple but apparantly i'm failing to
see
>>> it :)
>>>
>>> Hope someone can help.
>>>
>>> -------------
>>>
>>> dovecot --version
>>> 2.3.2.1 (0719df592)
>>>
>>> cat dovecot-quota-clone-sql.conf.ext
>>> connect = ****
>>>
>>> map {
>>>    pattern = priv/quota/storage
>>>    table = virtual_users
>>>    value_field = usage_in_bytes
>>>    username_field = email
>>> }
>>>
>>> map {
>>>    pattern = priv/quota/messages
>>>    table = virtual_users
>>>    value_field = messages
>>>    username_field = email
>>> }
>>>
>>> # 2.3.2.1 (0719df592): /etc/dovecot/dovecot.conf
>>> # OS: Linux 3.10.0-862.11.6.el7.x86_64 x86_64 CentOS Linux release
>>> 7.5.1804 (Core)  nfs4
>>> # Hostname: imap01.ltmail.dk
>>> auth_debug = yes
>>> dict {
>>>   lastlogin = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
>>>   quotaclone = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
>>> }
>>> doveadm_password =  # hidden, use -P to show it
>>> lock_method = dotlock
>>> login_trusted_networks = 192.168.100.11/32 192.168.100.16/32
>>> mail_fsync = always
>>> mail_location = maildir:/storage/vmail/%d/%n
>>> mail_nfs_index = yes
>>> mail_nfs_storage = yes
>>> mail_plugins = " quota notify replication"
>>> mmap_disable = yes
>>> namespace inbox {
>>>   inbox = yes
>>>   location =
>>>   mailbox Drafts {
>>>     special_use = \Drafts
>>>   }
>>>   mailbox Junk {
>>>     special_use = \Junk
>>>   }
>>>   mailbox Sent {
>>>     special_use = \Sent
>>>   }
>>>   mailbox "Sent Messages" {
>>>     special_use = \Sent
>>>   }
>>>   mailbox Trash {
>>>     special_use = \Trash
>>>   }
>>>   prefix =
>>> }
>>> passdb {
>>>   args = /etc/dovecot/dovecot-sql.conf.ext
>>>   driver = sql
>>> }
>>> plugin {
>>>   last_login_dict = proxy::lastlogin
>>>   last_login_key = last-login/%u
>>>   mail_replica = tcp:imapb01.litmail.dk:12345
>>>   quota = maildir:User quota
>>>   quota_clone_dict = proxy::quotaclone
>>>   quota_grace = 10%%
>>>   quota_status_nouser = DUNNO
>>>   quota_status_overquota = 552 5.2.2 Mailbox is full
>>>   quota_status_success = DUNNO
>>> }
>>> protocols = imap
>>> replication_max_conns = 100
>>> service aggregator {
>>>   fifo_listener replication-notify-fifo {
>>>     mode = 0666
>>>     user = vmail
>>>   }
>>>   unix_listener replication-notify {
>>>     mode = 0666
>>>     user = vmail
>>>   }
>>> }
>>> service auth-worker {
>>>   user = $default_internal_user
>>> }
>>> service auth {
>>>   unix_listener /var/spool/postfix/private/auth {
>>>     group = postfix
>>>     mode = 0666
>>>     user = postfix
>>>   }
>>>   unix_listener auth-userdb {
>>>     group = vmail
>>>     mode = 0666
>>>     user = vmail
>>>   }
>>>   user = $default_internal_user
>>> }
>>> service config {
>>>   unix_listener config {
>>>     user = vmail
>>>   }
>>> }
>>> service dict {
>>>   unix_listener dict {
>>>     group = vmail
>>>     mode = 0600
>>>     user = vmail
>>>   }
>>> }
>>> service doveadm {
>>>   group = vmail
>>>   inet_listener {
>>>     port = 12345
>>>   }
>>>   user = vmail
>>> }
>>> service imap-login {
>>>   inet_listener imap {
>>>     port = 143
>>>   }
>>>   process_min_avail = 10
>>>   service_count = 0
>>> }
>>> service quota-status {
>>>   client_limit = 1
>>>   executable = /usr/libexec/dovecot/quota-status -p postfix
>>>   inet_listener {
>>>     port = 12340
>>>   }
>>> }
>>> service replicator {
>>>   process_min_avail = 1
>>>   unix_listener replicator-doveadm {
>>>     mode = 0666
>>>   }
>>> }
>>> service stats {
>>>   unix_listener stats-writer {
>>>     mode = 0600
>>>     user = vmail
>>>   }
>>> }
>>> ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
>>> ssl_dh =  # hidden, use -P to show it
>>> ssl_key =  # hidden, use -P to show it
>>> userdb {
>>>   args = /etc/dovecot/dovecot-sql.conf.ext
>>>   driver = sql
>>> }
>>> protocol imap {
>>>   mail_max_userip_connections = 1000
>>>   mail_plugins = " quota notify replication imap_quota
last_login
>>> quota_clone"
>>> }
>>> protocol submission {
>>>   mail_max_userip_connections = 1000
>>> }
>>>
>>>
>>> --
>>>
>>> Christian Ejlertsen
>>
> It is :)
>
>> protocol imap {
>>   mail_max_userip_connections = 1000
>>   mail_plugins = " quota notify replication imap_quota last_login
>> quota_clone"
>> }

But that will only affect imap protocol. You should add it globally,
otherwise quota updates do not happen for LMTP/LDA.

Aki