LDAP login not possible since 0.59.0-rc.13
Description:
LDAP login was possbile up until 0.59.0-rc.12, now it is not possible anymore (see logfiles below). My field mapping is like this: {"cn":"name", "mail":"email"}. I have set no default domain (and do not want to).
I suspect https://github.com/RocketChat/Rocket.Chat/pull/8457 to be the cause of this issue.
Server Setup Information:
- Version of Rocket.Chat Server: 0.59.0-rc.13
- Operating System: Oracle Linux 7.4
- Deployment Method(snap/docker/tar/etc): tar
- Number of Running Instances: 1
- DB Replicaset Oplog: false
- Node Version: 4.8.4
Steps to Reproduce:
- Login with LDAP flagged user
Expected behavior:
Login should be successful
Actual behavior:
Login is not successful
Relevant logs:
Oct 11 14:25:20 dev-chat RocketChat[72835]: {"name":"ldapjs","component":"client","hostname":"dev-chat","pid":72835,"clazz":"Client","ldap_id":"10__ldaps://my.ldap.host:636","level":20,"msg":"connected after 1 attempt(s)","time":"2017-10-11T12:25:20.462Z","v":0}
Oct 11 14:25:20 dev-chat RocketChat[72835]: rocketchat_logger rocketchat_logger.js:375 LDAPSync ➔ error { [Error: LDAP Authentication succeded, there is no email to create an account. Have you tried setting your Default Domain in LDAP Settings? [LDAP-login-error]]
Oct 11 14:25:20 dev-chat RocketChat[72835]: isClientSafe: true,
Oct 11 14:25:20 dev-chat RocketChat[72835]: error: 'LDAP-login-error',
Oct 11 14:25:20 dev-chat RocketChat[72835]: reason: 'LDAP Authentication succeded, there is no email to create an account. Have you tried setting your Default Domain in LDAP Settings?',
Oct 11 14:25:20 dev-chat RocketChat[72835]: details: undefined,
Oct 11 14:25:20 dev-chat RocketChat[72835]: message: 'LDAP Authentication succeded, there is no email to create an account. Have you tried setting your Default Domain in LDAP Settings? [LDAP-login-error]',
Oct 11 14:25:20 dev-chat RocketChat[72835]: errorType: 'Meteor.Error' }
I think this issue is caused by an empty email field for that user. You can either put add an email to their email field or add a default domain under LDAP settings.
Oh, I'm sorry, I should've mentioned this in the initial post: The user I am logging in with, has an email set in LDAP (attribute is called "mail") and I have set both sAMAccountName as well as mail as the fields the get queried when logging in. The login fails with both.
Cheers Thomas
I can confirm I have been having this issue.
Same problem here but seems that the revelant part of the logs is before :
Oct 12 16:57:14 rc03 nodejs-rocketchat0[31351]: rocketchat_logger rocketchat_logger.js:375 #033[34mLDAPHandler ➔ debug#033[39m userQuery { username: '' }
Oct 12 16:57:14 rc03 nodejs-rocketchat0[31351]: rocketchat_logger rocketchat_logger.js:375 #033[34mLDAPHandler ➔ info#033[39m User does not exist, creating
Oct 12 16:57:14 rc03 nodejs-rocketchat0[31351]: rocketchat_logger rocketchat_logger.js:375 #033[34mTemplateVarHandler ➔ debug#033[39m user does not have attribute: cn
Oct 12 16:57:14 rc03 nodejs-rocketchat0[31351]: rocketchat_logger rocketchat_logger.js:375 #033[34mLDAPSync ➔ debug#033[39m user does not have attribute: mail
Oct 12 16:57:14 rc03 nodejs-rocketchat0[31351]: rocketchat_logger rocketchat_logger.js:375 #033[31mLDAPSync ➔ error#033[39m { [Error: LDAP Authentication succeded, there is no email to create an account. Have you tried setting your Default Domain in LDAP Settings? [LDAP-login-error]]
Oct 12 16:57:14 rc03 nodejs-rocketchat0[31351]: isClientSafe: true,
Oct 12 16:57:14 rc03 nodejs-rocketchat0[31351]: error: 'LDAP-login-error',
Oct 12 16:57:14 rc03 nodejs-rocketchat0[31351]: reason: 'LDAP Authentication succeded, there is no email to create an account. Have you tried setting your Default Domain in LDAP Settings?',
For sure my user have cn and mail attributes set.
Cheers
+1 None of the usermappings come over, it isn't just email. If you setup a default domain it will then fail to find the givenName attribute (or whatever is set).
@magicbelette nope, not in my case. I have just verified, that the log parts I get in debug mode are the ones I posted above.
But seriously though: from 0.59-rc.12 to 0.59-rc.13 there was only one commit that comes with changes to LDAP thingies that could be the culprit, I guess...
Cheers Thomas
ldapUser.object[ldapField] will work better than ldapUser[ldapField]...
Yep here the same currently I switch to RC12
Could you maybe push a new update fixing this issue to the snap beta channel? Unfortunately I have updated without a backup and am now stuck at RC13, being unable to revert to RC12 (not in snap repositories anymore) or to stable (database level incompatible).
Could you maybe push a new update fixing this issue to the snap beta channel?
There is none, yet.
Unfortunately I have updated without a backup and am now stuck at RC13, being unable to revert to RC12 (not in snap repositories anymore) or to stable (database level incompatible).
This is your fault.
Cheers Thomas
Hopefully this will get fixed before the final release, LDAP integration is the sole reason we chose Rocket.Chat over other solutions.
(It is strange how after 14 "release candidates" core code is getting modified with what seems like no smoke testing.)
@itskenny0 .. I have the same situation here.. as a temporray fix I took this file: https://raw.githubusercontent.com/RocketChat/Rocket.Chat/bd16fa49d9f1ad4761fe078f41d915ad1e41949d/packages/rocketchat-ldap/server/sync.js
.. and rebuild the app
As @magicbelette said, it's something about ldapUser.Object
@alenkovich Did you rebuild the snap package? If so, any possibility you could share this package with me? Unfortunately, I'm unable to successfully build it. Building it will always fail with one of the npm dependencies.
no, I'm not using the snap pkgs. :/
@itskenny0 are you following https://github.com/RocketChat/Rocket.Chat/blob/0.59.0-rc.15/example-build-run.sh ?
Would you please clear that up somewhere else (for example here: https://open.rocket.chat/channel/support) instead of cluttering this issue with build instructions? Thank you :)
Cheers Thomas
@TomaszDom it was a small code change that looked good. They find bugs on RC and develop channel. Although most are found before RC that doesn't mean you should consider it as stable. If you're worried you should stay on official version.
Well you would expect some kind of testing suite to kick in even with release candidates (if not even every commit). And at least LDAP isn't covered by them as it seems. Actually I don't know if there are any tests.
But yeah. What to do with this bug at hand now? Would love to hear @rodrigok's opinion as I assume his commit (see above) to be the cause for this regression.
Cheers Thomas
This bug is still active with 0.59.0 release version.
34mI20171019-08:53:04.420(3) Exception while invoking method 'login' TypeError: Cannot read property 'value' of undefined at addLdapUser (/opt/rocket.chat/programs/server/packages/rocketchat_ldap.js:1270:43) at [object Object].
(/opt/rocket.chat/programs/server/packages/rocketchat_ldap.js:773:9) at /opt/rocket.chat/programs/server/packages/accounts-base.js:925:30 at tryLoginMethod (/opt/rocket.chat/programs/server/packages/accounts-base.js:753:14) at AccountsServer.Ap._runLoginHandlers (/opt/rocket.chat/programs/server/packages/accounts-base.js:924:18) at AccountsServer.Accounts.runLoginHandlers (/opt/rocket.chat/programs/server/packages/rocketchat_lib.js:1951:33) at [object Object].methods.login (/opt/rocket.chat/programs/server/packages/accounts-base.js:982:27) at [object Object].methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30) at maybeAuditArgumentChecks (/opt/rocket.chat/programs/server/packages/ddp-server.js:1857:12) at /opt/rocket.chat/programs/server/packages/ddp-server.js:903:20 at [object Object].EVp.withValue (packages/meteor.js:1134:15) at /opt/rocket.chat/programs/server/packages/ddp-server.js:902:47 at [object Object].EVp.withValue (packages/meteor.js:1134:15) at /opt/rocket.chat/programs/server/packages/ddp-server.js:901:46 at [object Object]..extend.protocol_handlers.method (/opt/rocket.chat/programs/server/packages/ddp-server.js:874:21) at /opt/rocket.chat/programs/server/packages/ddp-server.js:753:85
This update may ruin the day of many poor admins. At least put a big red notification on the Downloads page to warn people.