Implementing secondary quota w/ "Archive" namespace

Mark Moseley moseleymark at gmail.com
Tue Nov 22 22:49:02 UTC 2016


On Mon, Nov 21, 2016 at 6:20 PM, Fred Turner <fred at c5consulting.net> wrote:

> Yeah, I gradually figured out it wouldn't work yesterday when delving back
> into this and testing. No separate quotas per namespaces until 2.1 or
> something, I think?
>
> So, got any suggestions on getting it to work with v2.x? I found an old
> thread from 2013 by Andreas (I think?) and he didn't seem to quite be able
> to get it to work. Actually, though, I'd be happy to even be able to apply
> a quota to the primary Inbox namespace and none to the secondary "Archive"
> namespace, but my testing on a 10.10 Server wasn't having much success
> either.
>
> Thanks for the responses and input!
> Fred
>
> > On Nov 21, 2016, at 17:53, Timo Sirainen <tss at iki.fi> wrote:
> >
> >> On 20 Sep 2016, at 21.28, Fred Turner <fred at c5consulting.net> wrote:
> >>
> >> Mac Pro Server 2012
> >> Mac OS X Server 10.6.8
> >> Dovecot 1.1.20apple0.5
> >
> > That's an old one..
> >
> >> quota = maildir:User quota:ns=
> >>
> >> quota2 = maildir:ns=testArchive/
> >> quota2_rule = *:storage=20G
> >>
> >> The first line is already in the default config, with the exception of
> the added “:ns=“ at the end. The 2nd line in the examples I saw had a
> middle component w/ the quota name, but when I tried that, like so:
> >>
> >> quota2 = maildir:Archive quota:ns=testArchive/
> >>
> >> my server fails and shows this in the logs:
> >>
> >>> Fatal: IMAP(*): Quota root test backend maildir: Unknown parameter:
> ns=testArchive/
> >>
> >>
> >> Any idea why it doesn’t like that? Also, do I need to add a quota_rule
> for the primary quota? It does not have one normally in the Mac OS X Server
> config…
> >
> > You're trying to use Dovecot v2.x configuration in Dovecot v1.x. Sorry,
> won't work without upgrade.
>


So I've been playing with this and I mostly have things working. It's
2.2.26.0, btw. In all the below, both namespaces are working and I can
copy/move messages back and forth between them.

One thing that I've not figured out yet (though I'm sure I'm just missing
something scouring the docs):

If I move messages between namespaces, it appears to ignore the quotas I've
set on them. A *copy* will trigger the quota error. But a *move* just
happily piles on to the overquota namespace. Is that normal?

E.g., here's the maildirsize from the 'archive' namespace (with quotas set
absurdly low for testing) and I just moved some messages into it from INBOX:

20000S,10C
32252 31
2809 1

and it'll just keep tacking on. As you can see it's over on bytes and # of
messages. But it will successfully block a copy. This behavior of ignoring
the quota for moves goes in both directions, from INBOX to 'archive' and
vice versa.

And note that the values above are what I set, so it *is* seeing the quota
just fine (and like I said, when I copy a message, it gets appropriately
blocked due to quota).

Is this the normal behavior for message moves?

Oh, and it's definitely a move:

  A0004 UID MOVE 180 Archive.archive1..
* OK [COPYUID 1268932143 180 53] Moved UIDs...* 69 EXPUNGE..A0004 OK Move
completed (0.042 + 0.000 + 0.041 secs)...




BTW, since I spent a good deal of time before I figured this out, if you're
using SQL prefetch, the syntax for overrding the location in passdb
password_query becomes (with the example ns of 'archive'):

userdb_namespace/archive/location

instead of

namespace/archive/location


I couldn't for the life of me figure out why dovecot was
ignoring 'namespace/archive/location'. Writing this email helped me figure
it out, as usual :)


=====================================

doveconf -n:

# 2.2.26 (54d6540): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
# OS: Linux 3.14.77 x86_64 Ubuntu 12.04.5 LTS
auth_cache_negative_ttl = 1 mins
auth_cache_size = 10 M
auth_cache_ttl = 10 mins
auth_debug = yes
auth_debug_passwords = yes
auth_mechanisms = plain login
base_dir = /var/run/dovecot/
debug_log_path = /var/log/dovecot/debug.log
default_client_limit = 3005
default_internal_user = doveauth
default_process_limit = 1500
deliver_log_format = M=%m, F=%f, S="%s" B="%p/%w" => %$
disable_plaintext_auth = no
first_valid_uid = 199
imap_capability = +UNSELECT
last_valid_uid = 201
listen = *
log_path = /var/log/dovecot/mail.log
mail_debug = yes
mail_location = maildir:~/Maildir
mail_nfs_storage = yes
mail_privileged_group = mail
mail_uid = 200
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 index ihave
duplicate mime foreverypart extracttext
namespace {
  hidden = no
  inbox = yes
  list = yes
  location =
  prefix = INBOX.
  separator = .
  subscriptions = yes
  type = private
}
namespace archive {
  inbox = no
  list = children
  location = maildir:~/Archive
  prefix = Archive.
  separator = .
  subscriptions = yes
  type = private
}
passdb {
  args = /etc/dovecot/include/sql.conf
  driver = sql
}
plugin {
  quota = maildir:User quota
  quota2 = maildir:User2 quota:ns=Archive.
  quota2_rule = *:bytes=20000
  quota2_rule2 = *:messages=10
  quota_rule = *:bytes=400000
  quota_rule2 = INBOX.Trash:bytes=+10%%
  quota_rule3 = *:messages=2000
}
protocols = imap sieve
service auth-worker {
  unix_listener auth-worker {
    mode = 0666
  }
  user = doveauth
}
service auth {
  client_limit = 8000
  unix_listener login/auth {
    mode = 0666
  }
  user = doveauth
}
service imap-login {
  inet_listener imap {
    port = 143
  }
  process_min_avail = 20
  service_count = 1000
  vsz_limit = 256 M
}
service imap {
  client_limit = 10
  idle_kill = 5 mins
  process_limit = 2000
  process_min_avail = 10
  service_count = 1000
  vsz_limit = 512 M
}
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
}
ssl = no
userdb {
  driver = prefetch
}
userdb {
  args = /etc/dovecot/include/sql.conf
  driver = sql
}
verbose_proctitle = yes
protocol imap {
  mail_max_userip_connections = 10000
  mail_plugins = zlib quota imap_quota  stats imap_stats
}
protocol lda {
  debug_log_path = /var/log/dovecot/lda/lda-quotawarning.log
  log_path = /var/log/dovecot/lda/lda-quotawarning.log
}


More information about the dovecot mailing list