Re: dovecot Apple Mail maildir lots of Mail

2014-12-07 Thread Thomas Klausner
On Fri, Nov 21, 2014 at 10:52:38PM +0100, Thomas Klausner wrote:
 I have dovecot 2.1.12 running on a mail server, and recently
 configured Apple Mail to connect to it using secure IMAP, for the
 first time.
 
 At the beginning it just showed the inbox and everything was fine, but
 then I wanted to look at some of my folders and found the 'subscribe'
 menu. When I opened it, Apple Mail went to discover what mailboxes
 there are, and that's where my trouble began.
 
 It seemed to make good progress for some time (though slow -- over
 days), and now lists the mailboxes from starting with letters a to d
 on the left hand side (filling all the visible space, so there might
 be more). However, whenever Apple Mail gets focus, the cursor becomes
 a spinning rainbow circle and I can't interact with it.
 
 I tried deleting the mail account and setting it up again. The inbox
 was shown again immediately and Apple Mail was usable, but the first
 time the cursor moved over the mailboxes on the left hand side, it
 froze again.
 
 There were two imap processes on the server, one rather idle, the
 other eating CPU for about two minutes, then idling, and some time
 later it disappeared too.
 
 My Mail directory is 31G with about 180 directories, each containing
 mails in maildir format.

One thing that happened twice now is that files like these appear:
/home/user/Mail/dir/cur/.imap/1312388125.11233_28123.host:2,S/dovecot.index.log
but they don't go away for days.

How can that happen?
Can/should I delete these files?
 Thomas


Re: userdb lookup not possible with only userdb prefetch

2014-12-07 Thread Yves Goergen

Am 07.12.2014 um 00:56 schrieb Alexander Dalloz:

You did fulfill the requzirements for prefetch to work documented in the
wiki?

http://wiki2.dovecot.org/UserDatabase/Prefetch


Ehm, this is my SQL configuration 'dovecot-sql.conf.ext':


driver = mysql
connect = host= user= password= dbname=
default_pass_scheme = PLAIN
password_query = \
  SELECT \
local AS username, domain, clearpass AS password, \
concat(maildir, '/home') AS home, maildir AS mail \
  FROM mailusers \
  WHERE local = '%n' AND domain = '%d' AND forward = '' AND NOT locked


Now that I've found the page you gave me (didn't see it before, but I 
must say that wiki is not easily readable, pretty confusing) I think the 
column names must be different.


Instead of: username, domain, password, home, mail
Should I return: username, domain, password, userdb_home, userdb_mail?

And what does that comment in the example mean? # The userdb below is 
used only by lda. Should I use only userdb:driver=prefetch, or should I 
include a separate userdb section as if I wouldn't use prefetch? Again, 
confusing. Why does it have to be two separate queries at all? Just use 
one and take what you get. If some required column is missing and the 
value isn't set in the configuration, you can still throw an error.


--
Yves Goergen
http://unclassified.de
http://dev.unclassified.de


Re: userdb lookup not possible with only userdb prefetch

2014-12-07 Thread deoren
On 12/7/2014 5:04 AM, Yves Goergen wrote:
 Am 07.12.2014 um 00:56 schrieb Alexander Dalloz:
 You did fulfill the requzirements for prefetch to work documented in the
 wiki?

 http://wiki2.dovecot.org/UserDatabase/Prefetch
 
 Ehm, this is my SQL configuration 'dovecot-sql.conf.ext':
 
 driver = mysql
 connect = host= user= password= dbname=
 default_pass_scheme = PLAIN
 password_query = \
   SELECT \
 local AS username, domain, clearpass AS password, \
 concat(maildir, '/home') AS home, maildir AS mail \
   FROM mailusers \
   WHERE local = '%n' AND domain = '%d' AND forward = '' AND NOT locked
 
 Now that I've found the page you gave me (didn't see it before, but I 
 must say that wiki is not easily readable, pretty confusing) I think the 
 column names must be different.
 
 Instead of: username, domain, password, home, mail
 Should I return: username, domain, password, userdb_home, userdb_mail?

I too made a similar mistake and struggled for a while to understand why
my attempts were failing. If using the prefetch userdb driver you have
to return values from your database using appropriate aliases to match
the expected names.

Here is what I'm using for the 'password_query':

password_query = \
  SELECT email AS user, password, \
  'vmail' AS userdb_uid, \
  'vmail' AS userdb_gid, \
  '/var/vmail/%d/%n' as userdb_home \
  FROM virtual_users \
  WHERE email = '%u' \
  AND enabled = '1';

Depending on your db layout you'll have different source values, but as
long as you end up returning the values under the right column names (or
aliases) it should work. My current db design needs improvement (as the
static placeholder values in the above query shows), but it works as-is
for now.


 And what does that comment in the example mean? # The userdb below is 
 used only by lda. Should I use only userdb:driver=prefetch, or should I 
 include a separate userdb section as if I wouldn't use prefetch? Again, 
 confusing. Why does it have to be two separate queries at all? Just use 
 one and take what you get. If some required column is missing and the 
 value isn't set in the configuration, you can still throw an error.

I can't speak to the design, but from what I've read the userdb sections
have a fall through approach. If one doesn't provide the sought after
information the next userdb section is used.

From the http://wiki2.dovecot.org/UserDatabase/Prefetch wiki page:

 Prefetch userdb can be used to combine passdb and userdb lookups into
a single lookup. It's usually used with SQL, LDAP and checkpassword passdbs.

 Prefetch basically works by requiring that the passdb returns the
userdb information in extra fields with userdb_ prefixes. For example if
a userdb typically returns uid, gid and home fields, the passdb would
have to return userdb_uid, userdb_gid and userdb_home fields.

 If you're using LDA, you still need a valid userdb which can be used
to locate the users. You can do this by adding a normal SQL/LDAP userdb
after the userdb prefetch. The order of definitions is significant. See
below for examples.

 LDAP: auth_bind=yes with auth_bind_userdn-template is incompatible
with prefetch, because no passdb lookup is done then. If you want zero
LDAP lookups, you might want to use static userdb instead of prefetch.

Here are my values for the auth-sql.conf.ext file (comments removed):

passdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf.ext
}
userdb {
  driver = prefetch
}
userdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf.ext
}

Here are my comments for the last userdb entry as a reminder to myself:

 Based on my readings this is used for doveadm queries which returns a
list of all users, LDA (which we don't use) and LMTP (which we do). I
believe the prefetch entry above will be used before this one, which
would leave this entry to be used only for for doveadm queries that
request a list of all users

To circle back, here are the remaining two queries from my copy of
dovecot-sql.conf.ext:

# NEEDED for LDA/LMTP if we don't include a static userdb entry
user_query = SELECT email as user, \
   '/var/vmail/%d/%n' as home \
   FROM virtual_users \
   WHERE email = '%u' \
   AND enabled = '1';

iterate_query = SELECT email AS user \
  FROM virtual_users \
  WHERE enabled='1';

My comments for the last query:

 Query to get a list of all usernames. Requires a 'userdb' entry in
# auth-sql.conf.ext that refers back to this file. Normally it matches
the 'passdb' stanza aside from the name.

P.S.

The substitution used ('%u' vs '%n') will depend on how you have your
user information stored. The comments in dovecot-sql.conf.ext provide
some sample queries to illustrate that.

As my queries suggest, my db setup uses the 'usern...@example.org'
format for user names. Had I thought about it a little more I might have
opted to instead store the user and domain values in separate fields,
but then again maybe not. Something to be aware of anyway.


Missing metadata on Dovecot 2.2.14, on Kolab 3.3, Centos 6.6

2014-12-07 Thread Max Raafat
Hello everyone,

We were trying to provision a system with Dovecot instead of another
working cyrus kolab system.

I am stuck with a problem with the metadata, especially when it comes to
the Special Folders in Kolab 3.3, like Calenders, Tasks, etc, as well as
any user created Folders.

Emails work perfectly, and all the types are correct. But for example, If I
try to change the type of Calenders, or create a new folder from inside
roundcube and set it to type  Calenders, it stays at the default which is
mail. Therefore it causes problems, when sharing events, since they are
displayed as mail type and not event type. We've tracked the problem
down to the metadata not existing for special folders. A simple search only
shows the default mail metadata, but nothing for shared folders, or
special folders, etc.

Here is the doveconf -n

-

[root@m3 ~]# doveconf -n
# 2.2.14: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-504.el6.x86_64 x86_64 CentOS release 6.6 (Final)
imap_metadata = yes
mail_attribute_dict = file:Maildir/dovecot-metadata
mail_gid = 5000
mail_location = maildir:~/Maildir
mail_plugins =  acl
mail_uid = 5000
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
mbox_write_locks = fcntl
namespace {
  list = children
  location = maildir:%%h/Maildir:INDEX=~/Maildir/shared/%%u
  prefix = shared/%%u/
  separator = /
  type = shared
}
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 =
  separator = /
}
passdb {
  args = /etc/dovecot/master-users
  driver = passwd-file
  master = yes
  pass = yes
}
passdb {
  driver = shadow
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
plugin {
  acl = vfile
  acl_shared_dict = file:/var/lib/dovecot/db/shared-mailboxes.db
  sieve = ~/.dovecot.sieve
  sieve_dir = ~/sieve
}
protocols = imap pop3 lmtp sieve
service auth {
  unix_listener /var/spool/postfix/private/auth {
mode = 0666
  }
  unix_listener auth-userdb {
group = vmail
user = vmail
  }
}
service dict {
  unix_listener dict {
group = vmail
mode = 0666
user = vmail
  }
}
service lmtp {
  executable = lmtp
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0660
user = postfix
  }
}
service managesieve-login {
  inet_listener sieve {
address = 127.0.0.1 ::1
port = 4190
  }
}
service managesieve {
  process_limit = 1024
}
ssl = required
ssl_cert = /etc/ssl/m3.company.includingchain.crt
ssl_key = /etc/ssl/m3.company.de.key
userdb {
  driver = passwd
}
userdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
protocol lmtp {
  mail_plugins =  acl sieve
}
protocol lda {
  mail_plugins =  acl sieve
}
protocol imap {
  mail_plugins =  acl imap_acl
}



Would appreciate any help or ideas as to what I can do to fix this.

Thanks
Max


Error: mremap_anon(###) failed: Cannot allocate memory

2014-12-07 Thread Andy Dills

We're running dovecot 2.2.15 with pigeonhole 0.4.6, in a clustered 
environment, nfs with proxy and backend on all servers.

I've been seeing some odd errors from lmtp:

Error: mremap_anon(127930368) failed: Cannot allocate memory

It seems to affect specific users, but it doesn't seem to manifest in any 
particular way; no user complaints. Just the occasional log message.

I would guess this is a bug? I'm open to suggestions and I'd be happy to 
post config if somebody has an idea.

Thanks,
Andy

---
Andy Dills
Xecunet, Inc.
www.xecu.net
301-682-9972
---