LDAP Allow For Authenticated Binding
Does the current release allow for us to use authenticated binding?
We've been tinkering with the bind search and passing in the username and password but with no luck so it leaves us wondering if it is possible.
Definitely possible, if anything it is not so good at supporting unauthenticated LDAP. This is an example filter that will do authenticated search:
{"filter": "(&(objectclass=person)(uid=#{username}))", "scope": "sub", "userDN": "cn=someAdmin,ou=admins,ou=some,o=domain", "password": "test"}
Replace cn=account,ou=admins,ou=some,o=domain with the account you want to authenticate as then replace test with the password for that account(that final O could well be an OU in your ldap setup.
How do disable LDAP auth?
I killed the admin session I was using to make changes to the Admin/LDAP.
If you have access to the terminal of the box type mongo and hopefully after a few messages your terminal will read 001-rs:PRIMARY> if so enter the following to turn ldap off:
db.rocketchat_settings.update({_id: "LDAP_Enable"},{$set: {value: false}})
If something else happens when you enter mongo post the message. having said this if you are using docker there is a different way to access the terminal so hopefully you know that, cos I don't. If not sure someone who does will be along soon. The mongo part is the same either way.
Thanks mcguinness! It seems to want to work but we are getting the error below. It seems related to the method used to pass the credentials.. We are currently using FreeIPA v3.0.1
Based on the error .. rocket.chat returns simple credentials when strong credentials are required. or rocket.chat returns a DN and a password for a simple bind when the entry does not have a password defined.
Below is the error from the log ..
Bind before search uid=ro-ldap-account,cn=users,cn=accounts,dc=example,dc=com ro-ldap-password
LDAP search dn dc=example,dc=com
LDAP search options { filter: '(&(objectCategory=person)(objectclass=user)(uid=ldap_uid))',
scope: 'sub' }
Attempt to bind dc=example,dc=com
{ [InappropriateAuthenticationError: Inappropriate Authentication]
dn: [Getter],
code: [Getter],
name: [Getter],
message: [Getter] }
{ [Error: Inappropriate Authentication [48]]
error: 48,
reason: 'Inappropriate Authentication',
details: undefined,
message: 'Inappropriate Authentication [48]',
errorType: 'Meteor.Error' }
The 4th line Attempt to bind dc=example,dc=com is what you would see when the LDAP search returned no match, else you would see the full dn of the user. Do you have access to a linux box by chance? If so if you could try an ldap search like so:
ldapsearch -Wx -LLL -H ldap://ip:port -b dc=example,dc=com -D 'uid=ro-ldap-account,cn=users,cn=accounts,dc=example,dc=com' '(&(objectCategory=person)(objectclass=user)(uid=ldap_uid))'
I have build it using the example you provided, so if you censored before posting just correct it before running. Just interested to see if you get a match doing it that way to see if it is how rocket chat handles the search or just a bad filter(it looks fine but every ldap is slightly different). I will also do a quick look into the LDAp server you mentioned.
Thanks for help emcguinness! It was an error on my end .. I missed updating the filter .. from.. &(objectCategory=person)(objectclass=user) to .. &(objectClass=inetorgperson)(objectclass=person)
For those that use FreeIPA, here is the filter I'm using. {"filter": "(&(objectClass=inetorgperson)(objectClass=person)(uid=#{username}))", "scope": "sub", "userDN": "uid=ro-service-account,cn=users,cn=accounts,dc=example,dc=com", "password": "xxxx"}
Closing this issue now. Thanks!