Re: Help with installing Apache Solr with Dovecot 2.2

2015-01-03 Thread Kev Lau
Dear Marc,
Thanks for your feedback!

1. I store it in MySQL.

2. I will add a cronjob to run Solr if I can figure out why its not working
on test runs. Maybe I might try to setup a cronjob for solr to avoid having
to manually start it everytime.

3. Will turn on the mail_debug in dovecot.conf . Where will it log the
problems?

Thanks
Kevin

On Sat, Jan 3, 2015 at 4:45 PM, Marc Stürmer m...@marc-stuermer.de wrote:


 Zitat von Kev Lau superinterstel...@gmail.com:

  Hi,
 I am relatively new to Apache Solr and I am trying to get it to integrate
 with Dovecot 2.2 running on Ubuntu 14.04 and needed a little help with
 configuration.


 How do you store your user data?

 Aside that, you should later setup the necessary cronjobs for Solr to run
 smoothly.

 If unsure what's the problem turn on mail_debug=yes in your dovecot.conf .



Re: Help with installing Apache Solr with Dovecot 2.2

2015-01-03 Thread Kev Lau
Dear Marc,
Found the log for mail-debug. Apologies for the bad question.
Thanks
Kevin

On Sat, Jan 3, 2015 at 5:27 PM, Kev Lau superinterstel...@gmail.com wrote:

 Dear Marc,
 Thanks for your feedback!

 1. I store it in MySQL.

 2. I will add a cronjob to run Solr if I can figure out why its not
 working on test runs. Maybe I might try to setup a cronjob for solr to
 avoid having to manually start it everytime.

 3. Will turn on the mail_debug in dovecot.conf . Where will it log the
 problems?

 Thanks
 Kevin

 On Sat, Jan 3, 2015 at 4:45 PM, Marc Stürmer m...@marc-stuermer.de
 wrote:


 Zitat von Kev Lau superinterstel...@gmail.com:

  Hi,
 I am relatively new to Apache Solr and I am trying to get it to integrate
 with Dovecot 2.2 running on Ubuntu 14.04 and needed a little help with
 configuration.


 How do you store your user data?

 Aside that, you should later setup the necessary cronjobs for Solr to run
 smoothly.

 If unsure what's the problem turn on mail_debug=yes in your dovecot.conf .





Re: Help with installing Apache Solr with Dovecot 2.2

2015-01-03 Thread Kev Lau
Hi Marc,

I have debug turned on but i keep getting this in my logs:-


Jan 03 17:36:41 imap(u...@mydomain.com): Info: Disconnected: Logged out
in=478 out=4938
Jan 03 17:37:41 imap-login: Info: Login: user=u...@mydomain.com,
method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=20247, secured,
session=WDhzE8ILHQB/AAA$
Jan 03 17:37:41 imap(u...@mydomain.com): Info: Disconnected: Logged out
in=478 out=4938
Jan 03 17:38:41 imap-login: Info: Login: user=u...@mydomain.com,
method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=20255, secured,
session=Z8EHF8ILIQB/AAA$
Jan 03 17:38:41 imap(t...@sicl.net): Info: Disconnected: Logged out in=478
out=4938
Jan 03 17:38:45 imap-login: Info: Login: user=t...@sicl.net,
method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=20259, secured,
session=OwdFF8ILJAB/AAA$
Jan 03 17:38:47 imap(u...@mydomain.com): Info: Disconnected: Logged out
in=752 out=42154
Jan 03 17:39:38 imap(u...@mydomain.com): Info: Disconnected: Logged out
in=70 out=34565


Also my search is showing the following. And when I try to do full-text
searches on Roundcube, it does not return the results, it just searches and
stops in the middle. However when I try through telnet it gives this long
search time duration.

. search text passport
* OK Searched 5% of the mailbox, ETA 2:37
* OK Searched 12% of the mailbox, ETA 2:11
* OK Searched 20% of the mailbox, ETA 1:55
* OK Searched 26% of the mailbox, ETA 1:51
* OK Searched 32% of the mailbox, ETA 1:42
* OK Searched 39% of the mailbox, ETA 1:32
* OK Searched 46% of the mailbox, ETA 1:19
* OK Searched 54% of the mailbox, ETA 1:07
* OK Searched 60% of the mailbox, ETA 0:57
* OK Searched 67% of the mailbox, ETA 0:47
* OK Searched 74% of the mailbox, ETA 0:37
* OK Searched 84% of the mailbox, ETA 0:21
* OK Searched 92% of the mailbox, ETA 0:10
* OK Searched 98% of the mailbox, ETA 0:01

Appreciate if someone could provide me guidance/help/support on this.
Really in need of help here.

Thanks
Kevin



On Sat, Jan 3, 2015 at 7:19 PM, Kev Lau superinterstel...@gmail.com wrote:

 Dear Marc,
 Found the log for mail-debug. Apologies for the bad question.
 Thanks
 Kevin

 On Sat, Jan 3, 2015 at 5:27 PM, Kev Lau superinterstel...@gmail.com
 wrote:

 Dear Marc,
 Thanks for your feedback!

 1. I store it in MySQL.

 2. I will add a cronjob to run Solr if I can figure out why its not
 working on test runs. Maybe I might try to setup a cronjob for solr to
 avoid having to manually start it everytime.

 3. Will turn on the mail_debug in dovecot.conf . Where will it log the
 problems?

 Thanks
 Kevin

 On Sat, Jan 3, 2015 at 4:45 PM, Marc Stürmer m...@marc-stuermer.de
 wrote:


 Zitat von Kev Lau superinterstel...@gmail.com:

  Hi,
 I am relatively new to Apache Solr and I am trying to get it to
 integrate
 with Dovecot 2.2 running on Ubuntu 14.04 and needed a little help with
 configuration.


 How do you store your user data?

 Aside that, you should later setup the necessary cronjobs for Solr to
 run smoothly.

 If unsure what's the problem turn on mail_debug=yes in your dovecot.conf
 .






dovecot-lda segfaults with replication

2015-01-03 Thread Stefan Le Breton

Hi,

I have set up replication, but dovecot-lda now fails with a segmentation 
fault.


Problem seems to be in replication/replication-plugin.c line 253:
  struct replication_user *ruser =
REPLICATION_USER_CONTEXT(ctx-ns-user);

resulting in ruser = 0x0

# 2.2.15: /usr/local/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.6 (3e924b1b6c5c+)
# OS: FreeBSD 10.0-RELEASE amd64

gdb Backtrace + doveconf -n below.

Regards

Stefan


gdb backtrace:

#0  0x000802001bc4 in replication_mail_transaction_commit 
(txn=0x801c811b0,

changes=0x7fffd3d0) at replication-plugin.c:258
ctx = (struct replication_mail_txn_context *) 0x801c811b0
ruser = (struct replication_user *) 0x0
priority = REPLICATION_PRIORITY_NONE
#1  0x000801490749 in notify_contexts_mail_transaction_commit 
(t=0x801c24600,

changes=0x7fffd3d0) at notify-plugin.c:132
ctx = (struct notify_context *) 0x801c8d020
mail_txn = (struct notify_mail_txn *) 0x801c282b0
#2  0x000801491a53 in notify_transaction_commit (t=0x801c24600,
changes_r=0x7fffd3d0) at notify-storage.c:182
lt = (struct notify_transaction_context *) 0x0
lbox = (union mailbox_module_context *) 0x801cade50
#3  0x000800ae1ff9 in mailbox_transaction_commit_get_changes 
(_t=0x801ce01b0,

changes_r=0x7fffd3d0) at mail-storage.c:1916
_data_stack_cur_id = 3
t = (struct mailbox_transaction_context *) 0x801c24600
box = (struct mailbox *) 0x801cad840
save_count = 1
ret = -128
#4  0x000800ae1f49 in mailbox_transaction_commit (t=0x801ce01b0)
at mail-storage.c:1897
changes = {pool = 0x801cd5420, uid_validity = 1234722882, 
saved_uids = {

arr = {buffer = 0x801cd5440, element_size = 8}, v = 0x801cd5440,
v_modifiable = 0x801cd5440}, ignored_modseq_changes = 0, changed = 
true,

  no_read_perm = false}
ret = 8
#5  0x00080244bfb2 in sieve_action_opr_optional_read ()
   from /usr/local/lib/dovecot-2.2-pigeonhole/libdovecot-sieve.so.0
No symbol table info available.
#6  0x000802443924 in sieve_result_implicit_keep ()
   from /usr/local/lib/dovecot-2.2-pigeonhole/libdovecot-sieve.so.0
No symbol table info available.
#7  0x000802443dcd in sieve_result_execute ()
   from /usr/local/lib/dovecot-2.2-pigeonhole/libdovecot-sieve.so.0
No symbol table info available.
#8  0x000802452f1c in sieve_execute ()
   from /usr/local/lib/dovecot-2.2-pigeonhole/libdovecot-sieve.so.0
No symbol table info available.
#9  0x000802205912 in sieve_plugin_init ()
   from /usr/local/lib/dovecot/lib90_sieve_plugin.so

No symbol table info available.
#10 0x000800829104 in mail_deliver (ctx=0x7fffda08, 
storage_r=0x7fffd960)

at mail-deliver.c:400
ret = 8
#11 0x00402f2e in main (argc=7, argv=0x7fffdb08) at 
main.c:437

set_roots = {0x604970, 0x0}
ctx = {pool = 0x801c29420, set = 0x801c67988, session = 
0x801c29440,

  dup_ctx = 0x801c237c0, session_id = 0x0, src_mail = 0x801c48840,
  src_envelope_sender = 0x0, dest_user = 0x801c87040,
  dest_addr = 0x7fffddaf m...@maserver.de,
  final_dest_addr = 0x7fffddaf m...@maserver.de,
  dest_mailbox_name = 0x403d68 INBOX, dest_mail = 0x0, 
var_expand_table = 0x0,

  tempfail_error = 0x0, tried_default_save = false, saved_mail = false,
  save_dest_mail = false, mailbox_full = false, dsn = false}
service_flags = 1027
user = 0x7fffdd9e m...@maserver.de
errstr = 0x37f Error reading address 0x37f: Bad address
path = 0x7fffddc0 /tmp/mail
lda_set = (struct lda_settings *) 0x801c67988
storage_service = (struct mail_storage_service_ctx *) 
0x801c46840

service_user = (struct mail_storage_service_user *) 0x801c67190
service_input = {module = 0x403d55 lda, service = 0x403d55 
lda,
  username = 0x7fffdd9e m...@maserver.de, session_id = 0x0, 
local_ip = {
family = 0, u = {ip6 = {__u6_addr = {__u6_addr8 = '\0' repeats 15 
times,
  __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 
0, 0}}},
  ip4 = {s_addr = 0}}}, remote_ip = {family = 0, u = {ip6 = 
{__u6_addr = {
  __u6_addr8 = '\0' repeats 15 times, __u6_addr16 = {0, 0, 0, 
0, 0, 0, 0,
0}, __u6_addr32 = {0, 0, 0, 0}}}, ip4 = {s_addr = 0}}}, 
local_port = 0,

  remote_port = 0, userdb_fields = 0x0, flags_override_add = 0,
  flags_override_remove = 0, no_userdb_lookup = 0}
storage = (struct mail_storage *) 0x0
user_source = 0x404090 
destaddr_source = 0x403d73 -a parameter
process_euid = 0
stderr_rejection = false
ret = 1
c = -1
error = MAIL_ERROR_NONE


# 2.2.15: /usr/local/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.6 (3e924b1b6c5c+)
# OS: FreeBSD 10.0-RELEASE amd64
auth_mechanisms = plain login digest-md5
doveadm_password = welcomemyguest
first_valid_gid = 0
first_valid_uid = 125
listen = *
login_greeting 

dovecot and ntlm_auth through winbind

2015-01-03 Thread Jason Gunthorpe
Hi all,

I am upgrading a dovecot 1.2 installation to a 2.2 installation and
have found and fixed a number of problems..

I've seen several postings in the archive about ntlm_auth not working,
and it is true, there are several regressions in dovecot here.

The first and simplest is that the enablement instructions in the
wikki are wrong. ntlm_auth must be called as root, which is what 1.2
did.

2.2 defaults to calling it as the auth user which subtly doesn't work:

Dec 30 20:30:21 quartz dovecot[8439]: auth: Error: Login for user 
[]\[jgg]@[wakko] failed due to [Reading winbind reply failed!]
Dec 30 20:30:21 quartz dovecot[8439]: auth: Error: 
../auth/ntlmssp/ntlmssp_server.c:454: Checking NTLMSSP password for \jgg 
failed: NT_STATUS_UNSUCCESSFUL
Dec 30 20:30:21 quartz dovecot[8439]: auth: Error: GENSEC login failed: 
NT_STATUS_UNSUCCESSFUL
Dec 30 20:30:21 quartz dovecot[8439]: auth: Error: winbind: ntlm_auth exited 
with exit code 0

The fix is simple, run auth as root:

service auth {
  user = root
}

This ended up as debian bug #774263 which has a few more details.

Regards,
Jason


[PATCH] LAYOUT=imapdir is broken in v2.2

2015-01-03 Thread Jason Gunthorpe
The next thing I noticed in my v1.2 - 2.2 upgrade is that

mail_location = maildir:[..]:LAYOUT=imapdir

is broken, the symptom is dovecot returning this to the client when
requesting any mailbox beyond INBOX:

  Character not allowed in mailbox name: '

Which is actually trying to say Character not allowed in mailbox name: '\0',
but since the %c is not escaped it ends up with the truncated string.

This patch fixes it:

diff --git a/src/lib-storage/list/mailbox-list-maildir.c 
b/src/lib-storage/list/mailbox-list-maildir.c
index c99a2900a6d6..ae5f35d955ac 100644
--- a/src/lib-storage/list/mailbox-list-maildir.c
+++ b/src/lib-storage/list/mailbox-list-maildir.c
@@ -46,6 +46,7 @@ static struct mailbox_list *imapdir_list_alloc(void)
list = p_new(pool, struct maildir_mailbox_list, 1);
list-list = imapdir_mailbox_list;
list-list.pool = pool;
+   list-sep = '.';
 
list-global_temp_prefix = IMAPDIR_GLOBAL_TEMP_PREFIX;
list-temp_prefix = p_strconcat(pool, list-global_temp_prefix,

Analysis:

I noticed this while upgrading a dovecot install from 1.2.15 (squeeze) to
2.2.13 (jessie).

This upstream commit

author  Timo Sirainen t...@iki.fi
Thu Jan 20 20:59:07 2011 +0200 (2011-01-20)
changeset 12586 a2780b694b2d
parent 12585b748c622e896
child 12587 c3a258ee96c4

lib-storage: mailbox_alloc() now takes a virtual mailbox name and other 
related API changes.
All storage_name - vname conversions now go through the same two
mailbox_list methods. This has many benefits, such as:

* listescape plugin is now much simpler and bugfree
* allows changing lib-storage API to use UTF-8 mailbox names in future
* allows creation of mailbox aliases plugin

Restructed the _alloc functions to move the hierarchy_sep from the initializer
into the _alloc call itself:

@@ -29,6 +30,7 @@ static struct mailbox_list *maildir_list_alloc(void)
list = p_new(pool, struct maildir_mailbox_list, 1);
list-list = maildir_mailbox_list;
list-list.pool = pool;
+   list-sep = '.';

list-global_temp_prefix = MAILDIR_GLOBAL_TEMP_PREFIX;
list-temp_prefix = p_strconcat(pool, list-global_temp_prefix,
[..]
 struct mailbox_list maildir_mailbox_list = {
.name = MAILBOX_LIST_NAME_MAILDIRPLUSPLUS,
-   .hierarchy_sep = '.',
.props = MAILBOX_LIST_PROP_NO_MAILDIR_NAME |
MAILBOX_LIST_PROP_NO_ALT_DIR |
MAILBOX_LIST_PROP_NO_NOSELECT,
[..]
 struct mailbox_list imapdir_mailbox_list = {
.name = MAILBOX_LIST_NAME_IMAPDIR,
-   .hierarchy_sep = '.',
.props = MAILBOX_LIST_PROP_NO_MAILDIR_NAME |
MAILBOX_LIST_PROP_NO_ALT_DIR |
MAILBOX_LIST_PROP_NO_NOSELECT,

Noting that heierarchy_sep was removed from maildir_mailbox_list and
imapdir_mailbox_list but only added to maildir_list_alloc(), and not
imapdir_list_alloc(). This ultimately results in
mailbox_list_get_hierarchy_sep() returning '\0' and mailbox_verify_name()
failing everything (all strings contain '\0' according to strchr).

This ended up as debian bug #774533

Regards,
Jason


ntlm_auth random failures with dovecot

2015-01-03 Thread Jason Gunthorpe
I'm still a bit fuzzy on exactly what has blown up here since my 1.2
install (or maybe it was broken then and I never noticed), but it
looks like the way dovecot is calling out to ntlm_auth is violating
the --helper-protocol=squid-2.5-ntlmssp scheme.

The issue is how it handles simultaneous clients connecting - for
instance launching thunderbird with NTLM auth creates multiple imapds
that all have to be auth'd.

Since dovecot doesn't (and apparrently didn't in 1.2?) serialize this
it ends up sending a jumble to ntlm_auth. Strace sayth, as example:

read(0, YR xxx=\n, 4096) = 48
read(0, YR xxx=\n, 4096) = 48
read(0, KK xxx=\n,4096) = 176
read(0, KK xxx=\n,4096) = 176

That is two clients connecting at once, and the sequence has become
jumbled.

Fiddling around with ntlm_auth manually I can get it to give me this:

YR xxx # 1
TT xxx # 1
YR xxx # 2
TT xxx # 2
KK xxx # 2
AF jgg # 2
KK xxx # 1
Called NTLMSSP after state machine was 'done'
GENSEC login failed: NT_STATUS_INVALID_PARAMETER
NA NT_STATUS_INVALID_PARAMETER

Ie, reordering the sequence (# 1 and # 2) causes it to tell you that,
no, the sequence cannot be reordered.

To me this says the samba folks expect that the YY/TT/KK/AF sequence
is *NOT* reordered.

The implication is that the mech-winbind in dovecot must seralize
everything, and it doesn't!

So, this is fairly broken, I can hit these failure causes with a high
probability when using thunderbird.

Any thoughts on how to repair this?

The simplest answer would be to pool and assign a ntlm_auth process to
each incoming auth context, or to actually serialize auth. But it
can't treat ntlm_auth as a stateless helper.

Jason