[GH-ISSUE #1273] Webmail authentication failed by LDAP user #1029

Closed
opened 2026-02-27 11:14:49 +03:00 by kerem · 7 comments
Owner

Originally created by @yiminfantw on GitHub (Oct 12, 2017).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1273

Impacted versions

  • Modoboa: 1.9.0
  • installer used: Yes
  • Webserver: Nginx
  • Ubuntu 16.04 (Xenial)

Steps to reproduce

Fresh installation, following http://modoboa.readthedocs.io/en/latest/configuration.html to enable LDAP authentication, filling out LDAP settings and rebooting server, logging in by LDAP user and switching to webmail page.

Current behavior

Getting "Error: ['[AUTHENTICATIONFAILED] Authentication failed.']" when switching to webmail page.

Expected behavior

Normal webmail page as non-LDAP user has.

More info

Through admin account I can see the LDAP user mailbox has been created in Identities page. The user role is "Simple user", quota is disabled by "Use domain default value" checkbox ticked. User name and email are [name]@[domain].

Originally created by @yiminfantw on GitHub (Oct 12, 2017). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1273 # Impacted versions * Modoboa: 1.9.0 * installer used: Yes * Webserver: Nginx * Ubuntu 16.04 (Xenial) # Steps to reproduce Fresh installation, following http://modoboa.readthedocs.io/en/latest/configuration.html to enable LDAP authentication, filling out LDAP settings and rebooting server, logging in by LDAP user and switching to webmail page. # Current behavior Getting "Error: ['[AUTHENTICATIONFAILED] Authentication failed.']" when switching to webmail page. # Expected behavior Normal webmail page as non-LDAP user has. # More info Through admin account I can see the LDAP user mailbox has been created in Identities page. The user role is "Simple user", quota is disabled by "Use domain default value" checkbox ticked. User name and email are [name]@[domain].
kerem closed this issue 2026-02-27 11:14:49 +03:00
Author
Owner

@tonioo commented on GitHub (Oct 12, 2017):

Have you configured dovecot too? (https://wiki.dovecot.org/HowTo/DovecotOpenLdap)

<!-- gh-comment-id:336108115 --> @tonioo commented on GitHub (Oct 12, 2017): Have you configured dovecot too? (https://wiki.dovecot.org/HowTo/DovecotOpenLdap)
Author
Owner

@yiminfantw commented on GitHub (Oct 13, 2017):

Hi @tonioo, I haven't configured dovecot yet, will get on that. Thx for pointing this out.

<!-- gh-comment-id:336349772 --> @yiminfantw commented on GitHub (Oct 13, 2017): Hi @tonioo, I haven't configured dovecot yet, will get on that. Thx for pointing this out.
Author
Owner

@yiminfantw commented on GitHub (Oct 13, 2017):

Hi @tonioo,

I managed to configure dovecot-ldap.conf.ext and now the authentication seems passing through, but I got the following error:

Error: ['[SERVERBUG] Internal error occurred. Refer to server log for more information. [2017-10-13 07:20:04] (0.000 + 0.000 secs).']

By checking dovecot status, I got the following info(cuz I set debug_level=-1):

Oct 13 07:32:10 localhost dovecot[9774]: auth: Error: ldap_chkResponseList returns ld 0x555f5009f7a0 NULL
Oct 13 07:32:10 localhost dovecot[9774]: auth: Error: ldap_int_select
Oct 13 07:32:10 localhost dovecot[9774]: imap-login: Login: user=<ldapservice@yiminfan.tech>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=9814, TLS, session=<KeeVp2hbhoZ/AAAB>
Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: net_connect_unix(/var/run/dovecot/dict) failed: Permission denied (euid=5006(<unknown>) egid=5006(<unknown>) ...0:0 mode=0755)
Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: Failed to autocreate mailbox Drafts: Permission denied
Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: Failed to autocreate mailbox Junk: Permission denied
Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: Failed to autocreate mailbox Trash: Permission denied
Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: Failed to autocreate mailbox Sent: Permission denied
Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: mkdir(/home/ldapservice/Maildir/cur) failed: Permission denied (euid=5006(<unknown>) egid=5006(<unknown>) mis...0:0 mode=0755)
Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: mkdir(/home/ldapservice/Maildir/cur) failed: Permission denied (euid=5006(<unknown>) egid=5006(<unknown>) mis...0:0 mode=0755)

Although I'm not sure what does the auth: error mean for the first two lines, but it seems passing through and encountering permission issue on modoboa(or dovecot?) admin side. Should it create user folder in /home? Creating local user(say domain admin) doesn't create user folder in /home though...

Any suggestion? FYI, I upgraded to v1.9.1.

Cheers,
YiMin

<!-- gh-comment-id:336372895 --> @yiminfantw commented on GitHub (Oct 13, 2017): Hi @tonioo, I managed to configure dovecot-ldap.conf.ext and now the authentication seems passing through, but I got the following error: ``` Error: ['[SERVERBUG] Internal error occurred. Refer to server log for more information. [2017-10-13 07:20:04] (0.000 + 0.000 secs).'] ``` By checking dovecot status, I got the following info(cuz I set debug_level=-1): ``` Oct 13 07:32:10 localhost dovecot[9774]: auth: Error: ldap_chkResponseList returns ld 0x555f5009f7a0 NULL Oct 13 07:32:10 localhost dovecot[9774]: auth: Error: ldap_int_select Oct 13 07:32:10 localhost dovecot[9774]: imap-login: Login: user=<ldapservice@yiminfan.tech>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=9814, TLS, session=<KeeVp2hbhoZ/AAAB> Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: net_connect_unix(/var/run/dovecot/dict) failed: Permission denied (euid=5006(<unknown>) egid=5006(<unknown>) ...0:0 mode=0755) Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: Failed to autocreate mailbox Drafts: Permission denied Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: Failed to autocreate mailbox Junk: Permission denied Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: Failed to autocreate mailbox Trash: Permission denied Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: Failed to autocreate mailbox Sent: Permission denied Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: mkdir(/home/ldapservice/Maildir/cur) failed: Permission denied (euid=5006(<unknown>) egid=5006(<unknown>) mis...0:0 mode=0755) Oct 13 07:32:10 localhost dovecot[9774]: imap(ldapservice@yiminfan.tech): Error: mkdir(/home/ldapservice/Maildir/cur) failed: Permission denied (euid=5006(<unknown>) egid=5006(<unknown>) mis...0:0 mode=0755) ``` Although I'm not sure what does the **auth: error** mean for the first two lines, but it seems passing through and encountering permission issue on modoboa(or dovecot?) admin side. Should it create user folder in /home? Creating local user(say domain admin) doesn't create user folder in /home though... Any suggestion? FYI, I upgraded to v1.9.1. Cheers, YiMin
Author
Owner

@ProCreator commented on GitHub (Oct 14, 2017):

@tonioo,

I am having the same problem. So if I understand correctly what is being said is that the Modoboa ldap authentication only work for the Modoboa administration and now webmail? I am running my Modoboa config on Ubuntu and am having a real difficult time following the complexities of of the dovecot wiki for setting up the authentication even though I have successfully setup the Modoboa authentication. Is there any way you could assist by simplifying the implementation?

<!-- gh-comment-id:336602730 --> @ProCreator commented on GitHub (Oct 14, 2017): @tonioo, I am having the same problem. So if I understand correctly what is being said is that the Modoboa ldap authentication only work for the Modoboa administration and now webmail? I am running my Modoboa config on Ubuntu and am having a real difficult time following the complexities of of the dovecot wiki for setting up the authentication even though I have successfully setup the Modoboa authentication. Is there any way you could assist by simplifying the implementation?
Author
Owner

@yiminfantw commented on GitHub (Oct 14, 2017):

Ya, the Modoboa ldap only works for Modoboa administration and has nothing to do with webmail (because dovecot takes different ldap config). Here is how I set it up, took me a while and looked up many internet resources though:

  • Editing /etc/dovecot/conf.d/10-auth.conf
#!include auth-sql.conf.ext
!include auth-ldap.conf.ext 
  • Editing /etc/dovecot/dovecot-ldap.conf.ext
hosts = ldap.jumpcloud.com
dn = uid=samplebinduser,ou=Users,o=sampleorganizationid,dc=jumpcloud,dc=com
dnpass = samplebinduser
tls = yes
debug_level = -1
auth_bind = yes
ldap_version = 3
base = o=sampleorganizationid,dc=jumpcloud,dc=com
deref = never
scope = subtree
user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid
user_filter = (&(objectClass=posixAccount)(uid=%n))
pass_attrs = mail=user,userPassword=password
pass_filter = (&(objectClass=posixAccount)(uid=%n))
default_pass_scheme = BLF-CRYPT

Btw, I just figured that the internal error is due the fact that I commented !include auth-sql.conf.ext in 10-auth.conf. After uncommenting it, my ldap user can open webmail page and send/receive emails. I thought sql and ldap are different authentication mechanism(sql is for local user?) and shouldn't affect each other. Do you have any idea why commenting !include auth-sql.conf.ext makes IMAP try to create user folder in /home?

Oct 14 07:15:24 localhost dovecot[5022]: imap(tester@yiminfan.tech): Error: User initialization failed: Namespace '': mkdir(/home/tester/Maildir) failed: Permission denied (euid=5007(<unk...0:0 mode=0755)

Also, even though the ldap user can now log in to Modoboa administration and webmail, I can still notice some ldap errors from dovecot status:

● dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/lib/systemd/system/dovecot.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2017-10-14 07:35:51 UTC; 37s ago
     Docs: man:dovecot(1)
           http://wiki2.dovecot.org/
  Process: 6959 ExecStop=/usr/bin/doveadm stop (code=exited, status=0/SUCCESS)
  Process: 6964 ExecStart=/usr/sbin/dovecot (code=exited, status=0/SUCCESS)
 Main PID: 6966 (dovecot)
   CGroup: /system.slice/dovecot.service
           ├─6966 /usr/sbin/dovecot
           ├─6984 dovecot/anvil
           ├─6985 dovecot/log
           ├─6987 dovecot/config
           ├─7059 dovecot/imap-login
           ├─7060 dovecot/auth
           ├─7063 dovecot/ssl-params
           └─7064 dovecot/imap postlogin

Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ** ld 0x55b2b02e01d0 Outstanding Requests:
Oct 14 07:36:28 localhost dovecot[6985]: auth: Error:    Empty
Oct 14 07:36:28 localhost dovecot[6985]: auth: Error:   ld 0x55b2b02e01d0 request count 0 (abandoned 0)
Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ** ld 0x55b2b02e01d0 Response Queue:
Oct 14 07:36:28 localhost dovecot[6985]: auth: Error:    Empty
Oct 14 07:36:28 localhost dovecot[6985]: auth: Error:   ld 0x55b2b02e01d0 response count 0
Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ldap_chkResponseList ld 0x55b2b02e01d0 msgid -1 all 0
Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ldap_chkResponseList returns ld 0x55b2b02e01d0 NULL
Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ldap_int_select
Oct 14 07:36:28 localhost dovecot[6985]: imap-login: Login: user=<tester@yiminfan.tech>, method=PLAIN, rip=70.79.37.210, lip=23.92.24.49, mpid=7064, TLS, session=<oRTT1HxbytNGTyXS>

Any idea what is going on?

Thanks,
YiMin

<!-- gh-comment-id:336617131 --> @yiminfantw commented on GitHub (Oct 14, 2017): Ya, the Modoboa ldap only works for Modoboa administration and has nothing to do with webmail (because dovecot takes different ldap config). Here is how I set it up, took me a while and looked up many internet resources though: - Editing /etc/dovecot/conf.d/10-auth.conf ``` #!include auth-sql.conf.ext !include auth-ldap.conf.ext ``` - Editing /etc/dovecot/dovecot-ldap.conf.ext ``` hosts = ldap.jumpcloud.com dn = uid=samplebinduser,ou=Users,o=sampleorganizationid,dc=jumpcloud,dc=com dnpass = samplebinduser tls = yes debug_level = -1 auth_bind = yes ldap_version = 3 base = o=sampleorganizationid,dc=jumpcloud,dc=com deref = never scope = subtree user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid user_filter = (&(objectClass=posixAccount)(uid=%n)) pass_attrs = mail=user,userPassword=password pass_filter = (&(objectClass=posixAccount)(uid=%n)) default_pass_scheme = BLF-CRYPT ``` Btw, I just figured that the internal error is due the fact that I commented `!include auth-sql.conf.ext` in 10-auth.conf. After uncommenting it, my ldap user can open webmail page and send/receive emails. I thought sql and ldap are different authentication mechanism(sql is for local user?) and shouldn't affect each other. Do you have any idea why commenting `!include auth-sql.conf.ext` makes IMAP try to create user folder in /home? ``` Oct 14 07:15:24 localhost dovecot[5022]: imap(tester@yiminfan.tech): Error: User initialization failed: Namespace '': mkdir(/home/tester/Maildir) failed: Permission denied (euid=5007(<unk...0:0 mode=0755) ``` Also, even though the ldap user can now log in to Modoboa administration and webmail, I can still notice some ldap errors from dovecot status: ``` ● dovecot.service - Dovecot IMAP/POP3 email server Loaded: loaded (/lib/systemd/system/dovecot.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2017-10-14 07:35:51 UTC; 37s ago Docs: man:dovecot(1) http://wiki2.dovecot.org/ Process: 6959 ExecStop=/usr/bin/doveadm stop (code=exited, status=0/SUCCESS) Process: 6964 ExecStart=/usr/sbin/dovecot (code=exited, status=0/SUCCESS) Main PID: 6966 (dovecot) CGroup: /system.slice/dovecot.service ├─6966 /usr/sbin/dovecot ├─6984 dovecot/anvil ├─6985 dovecot/log ├─6987 dovecot/config ├─7059 dovecot/imap-login ├─7060 dovecot/auth ├─7063 dovecot/ssl-params └─7064 dovecot/imap postlogin Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ** ld 0x55b2b02e01d0 Outstanding Requests: Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: Empty Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ld 0x55b2b02e01d0 request count 0 (abandoned 0) Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ** ld 0x55b2b02e01d0 Response Queue: Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: Empty Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ld 0x55b2b02e01d0 response count 0 Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ldap_chkResponseList ld 0x55b2b02e01d0 msgid -1 all 0 Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ldap_chkResponseList returns ld 0x55b2b02e01d0 NULL Oct 14 07:36:28 localhost dovecot[6985]: auth: Error: ldap_int_select Oct 14 07:36:28 localhost dovecot[6985]: imap-login: Login: user=<tester@yiminfan.tech>, method=PLAIN, rip=70.79.37.210, lip=23.92.24.49, mpid=7064, TLS, session=<oRTT1HxbytNGTyXS> ``` Any idea what is going on? Thanks, YiMin
Author
Owner

@tonioo commented on GitHub (Oct 27, 2017):

I think your LDAP config file does not declare any userdb lookup. So, if you deactivate the sql default one, there is no userdb at all. In this case, and because the authentication works, dovecot tries to initiate a mailbox in the user home directory (default behaviour).

<!-- gh-comment-id:340041178 --> @tonioo commented on GitHub (Oct 27, 2017): I think your LDAP config file does not declare any userdb lookup. So, if you deactivate the sql default one, there is no userdb at all. In this case, and because the authentication works, dovecot tries to initiate a mailbox in the user home directory (default behaviour).
Author
Owner

@tonioo commented on GitHub (Oct 27, 2017):

And regarding your errors, I don't know. I think you should ask on dovecot mailing list, you'll certainly have a better answer there.

<!-- gh-comment-id:340041367 --> @tonioo commented on GitHub (Oct 27, 2017): And regarding your errors, I don't know. I think you should ask on dovecot mailing list, you'll certainly have a better answer there.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1029
No description provided.