imap qmail does not authenticate in ldap

Rejaine Monteiro <[email protected]> Tue, 26 Dec 2017 15:36:12 -0200
Newsgroups gmane.mail.qmail.general
Message-ID <[email protected]>
Hi,

I'm having some trouble getting qmai-IMAP authenticated on ldap.

  I already have anothers servers installed with the same  OS version 
and  qmail + patches,  configured in much the same way and works 
normally, but in this new one, but in this new server the  IMAP is not 
authenticating correctly in LDAP (everything else is OK, just IMAP that 
is in trouble)

I did a test using dovecot and with it everything works normally. I know 
that migrating to Dovecot solves my problem, but I would like to find 
out why Courier is no longer working, because I've always used it (and 
still use it on others servers)...


My qmail-imapd/run  looks like this:

#!/bin/sh
exec 2>&1
#
# IMAP service: this script is for courier-imap
#
QMAIL="/var/qmail"
ME="`head -1 $QMAIL/control/me`"
if [ -e $QMAIL/control/defaultdelivery ]; then
         ALIASEMPTY=`head -1 $QMAIL/control/defaultdelivery 2> /dev/null`
else
         ALIASEMPTY=`head -1 $QMAIL/control/aliasempty 2> /dev/null`
fi
ALIASEMPTY=${ALIASEMPTY:="./Maildir/"}

PATH="$QMAIL/bin:$PATH"

# source the environemt in ./env
eval `env - PATH=$PATH envdir ./env awk '\
         BEGIN { for (i in ENVIRON) \
                 if (i != "PATH") { \
                         printf "export %s=\"%s\"\\n", i, ENVIRON[i] \
                 } \
         }'`

# enforce some sane defaults
COURIER=${COURIER:="/usr"}
PBSTOOL=${PBSTOOL:="$QMAIL/bin/pbsadd"}

if [ X${NOPBSR+"true"} = X"true" ]; then
         unset PBSTOOL
fi

exec \
         tcpserver -v -HRl $ME -x$QMAIL/control/qmail-imapd.cdb \
             ${CONCURRENCY:+"-c$CONCURRENCY"} ${BACKLOG:+"-b$BACKLOG"} 0 
imap \
         $COURIER/sbin/imaplogin \
         $QMAIL/bin/auth_imap ${PBSTOOL:+"-d$PBSTOOL"} \
         $COURIER/sbin/imapd "$ALIASEMPTY"

And here are the qmail-ldap/control settings (some information has been 
changed to post in the list):


/var/qmail/control/ldapbasedn:dc=domain,dc=domain
/var/qmail/control/ldapdefaultdotmode:both
/var/qmail/control/ldaplocaldelivery:0
/var/qmail/control/ldaplogin:cn=admldap,c=domain,dc=domain
/var/qmail/control/ldapobjectclass:qmailUser
/var/qmail/control/ldappassword:*******
/var/qmail/control/ldaprebind:0
/var/qmail/control/ldapserver:myldapserver.mydomain

Look what appears when I test using telnet.

# telnet myserver 143
Trying a.b.c.d
Connected to myserver
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT 
THREAD=REFERENCES SORT QUOTA ACL ACL2=UNION] Courier-IMAP ready. 
Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution 
information.
? login someuser somepassword
? NO Login failed.

I have already checked and compared settings and permissions with others 
servers I have here that work normally and I can not find the problem.

Any tips?