Solved? - Re: Understanding quotas

Robert Moskowitz
2017-03-19T07:12:28Z

I spent an evening, again, reading up on quota.  This time I think my
search foo was strong enough.  I found guidance and came up with the
following:

     sed -i -e "s/#quota = /sqlquota = /w /dev/stdout"
/etc/dovecot/dovecot.conf

Sets up a dovecot dictionary of sqlquota to the default file of
/etc/dovecot/dovecot-dict-sql.conf.ext

     cat <<EOF>>/etc/dovecot/conf.d/90-quota.conf || exit 1
     plugin {
       quota = dict:user::proxy::sqlquota
     }
     EOF


Appends to the end of 90-quota.conf (tried to do with with a single SED,
but it was getting messy)

finally:

cat <<EOF>/etc/dovecot/dovecot-dict-sql.conf.ext || exit 1
connect = host=localhost dbname=postfix user=postfix
password=$Postfix_Database_Password
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
}
EOF

Please let me know if I missed something here.

Thanks

On 03/17/2017 09:08 AM, Robert Moskowitz wrote:
> Just to level-set, I am using Centos7-arm which supplies Dovecot
> 2.2.10.  I don't have access to a arm build or mock environment and
> use what is available (I DID try to install them but had dependency
> issues).
>
> Much of what I have is from campworld, but some I have picked up from
> other Centos mailserver builders.
>
> Also I am using Postfixadmin which provides quotas per user in mysql
> database.  To access those quotas for dovecot, I have the following
> script:
>
> cat <<EOF>/etc/dovecot/dovecot-dict-quota.conf || exit 1
> connect = host=localhost dbname=postfix user=postfix
> password=$Postfix_Database_Password
> 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
> }
> EOF
>
> Where $Postfix_Database_Password is an env variable in my install howto.
>
> I am setting up quota plugins as follows:
>
> sed -i "/#mail_plugins/ a  mail_plugins = quota sieve"
> /etc/dovecot/conf.d/15-lda.conf
> sed -i "/#mail_plugins / a  mail_plugins = quota imap_quota
trash"
> /etc/dovecot/conf.d/20-imap.conf
> sed -i "/#mail_plugins/ a  mail_plugins = quota"
> /etc/dovecot/conf.d/20-pop3.conf
>
> But I am having 'challenges' with how to actually enable quotas and
> understanding 90-quota.conf.  I am starting from campworld's
'reduced'
> dovecot.conf seeing:
>
> dict {
>   quotadict = mysql:/etc/dovecot/dovecot-dict-quota.conf
> }
>
> and
>
> plugin {
>   quota = dict:user::proxy::quotadict
>   acl = vfile:/etc/dovecot/acls
>   trash = /etc/dovecot/trash.conf
>   sieve_global_path = /home/sieve/globalfilter.sieve
>   sieve = ~/dovecot.sieve
>   sieve_dir = ~/sieve
>   sieve_global_dir = /home/sieve/
>   #sieve_extensions = +notify +imapflags
>   sieve_max_script_size = 1M
> }
>
>
>
> I have put the sieve plugin lines into the 90-sieve.conf and the acl
> into 10-acl.conf.  Trash is a separate matter for a later question...
>
> So I am looking for guidance as to how to integrate the Postfixadmin
> quota information properly into 90-quota.conf
>
> thank you
>