Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

LDAP Sync should automatically disable users when account disabled LDAP attribute is set

Open gregs007 opened this issue 9 years ago • 16 comments

Rocket.Chat Version: 0.56.0 Running Instances: 1 DB Replicaset OpLog: Enabled Node Version: 4.8.1

When syncing LDAP database, RocketChat should disable user accounts with the proper LDAP attribute set. For example, in our LDAP environment the attribute is: nsAccountLock=true

In a typical AD environment it is userAccountControl = 514 or 66050.

This will make sure that even if a users session hasn't expired yet, they will not be able to continue to use RocketChat if their account is disabled by an administrator (for example if they leave the company)

There's another feature request for disabling deleted LDAP users instead of deleting them from RC: remove non existent LDAP users automatically #6174

gregs007 avatar Jun 13 '17 02:06 gregs007

Just one more comment--- This is a fairly big deal from a security standpoint because on the one hand, enterprises don't want to make people authenticate every day, but they also don't want people to be able to log in after their account is disabled. Scheduling an LDAP sync that behaves as above solves this issue.

gregs007 avatar Jun 13 '17 03:06 gregs007

Also related to #4554

gregs007 avatar Jun 13 '17 16:06 gregs007

Anything new?

ghost avatar Sep 29 '17 08:09 ghost

Hi guys, i'm fixing a lot of our LDAP issues as you can see on this PR https://github.com/RocketChat/Rocket.Chat/pull/8372

I did a local setup using OpenLDAP importing 500k users from one ldif file using this docker container https://github.com/jenkins-infra/mock-ldap/.

I'm accessing the LDAP container using Apache Directory Studio.

I want to know how to disable one user in my environment, then I'll be able to implement this and test.

Can someone help me?

Thanks

rodrigok avatar Oct 02 '17 21:10 rodrigok

Hi rodrigok,

Thanks for giving this issue your time, I can't assist directly with your question as we use Microsoft active directory for ldap and that will be somewhat different in execution.

One thing that I've noticed come up when implementing this is the difference between: deleted, expired, and disabled accounts.

Let me give an example: A contractor hired to work on a project will be created with an 'accountexpires' timestamp. After this time, the user should be assumed to be refused log-in. Our company policy is to never delete (or disable) those users. If they are required to work longer, the expire date will be extended.

Permanent staff will not have an expiry date set, but when they leave, will be set to disabled when they hand in their key cards etc. This is an account flag (bit mask on UserAccountControl attribute). Again we will never delete these users.

Hope that helps a little...

khobbits avatar Oct 03 '17 00:10 khobbits

@rodrigok This one is very important to me so will help any way I can. If you're using OpenLDAP you should be able to:

Disable: using the password-policy overlay, set pwdAccountLockedTime == Now Enable: clear or remove the above attribute.

Please let me know if you'd like to discuss more. I'm not a developer but understand well the implications of authentication.

Password policy overlay man page

gregs007 avatar Oct 03 '17 01:10 gregs007

@rodrigok Also keep in mind that different LDAP servers reference different attributes in their schema to signify account lockout. The feature will need a way to take this into account (maybe by allowing admin to use a boolean expression with javascript function: ex: nsAccountLock == 1; or pwdAccountLocketTime <= Date.Now();

gregs007 avatar Oct 03 '17 02:10 gregs007

The password-policy is something I need to install?

rodrigok avatar Oct 03 '17 02:10 rodrigok

@rodrigok Depends on the version-- you just have to load the module

gregs007 avatar Oct 03 '17 03:10 gregs007

Our enterprise version 3.0.2 covers this feature now.

rodrigok avatar Feb 27 '20 16:02 rodrigok

Rocketeers, after consideration, we will merge the code to fix these LDAP issues into the main repository. I am reopening a few of the LDAP issues to be resolved this week.

engelgabriel avatar Mar 17 '20 08:03 engelgabriel

Any news for this feature?

joaomezzari avatar Apr 06 '20 20:04 joaomezzari

Hey, I have FreeIPA, and I tried to configure the following filter to search the users:

 (&(!(nsaccountlock=true))(memberOf=cn=rocketchat-users,cn=groups,cn=accounts,dc=example,dc=org))

Unfortunately it is not working, by not allowing all any user to log on 🤨

kvaps avatar Jan 28 '21 15:01 kvaps

IMO this is basically the same as #4554, and I just commented there that, three years on, this still doesn't work in the CE version. This is clearly an "Enterprise Only" feature, regardless of what @engelgabriel said three years ago:

Rocketeers, after consideration, we will merge the code to fix these LDAP issues into the main repository. I am reopening a few of the LDAP issues to be resolved this week.

I encourage someone from the RC team, perhaps @engelgabriel, to at least acknowledge that decision and close this issue.

eengstrom avatar May 05 '23 22:05 eengstrom

Agreed, I had to script that specific function in our offboarding script.

Em sex., 5 de mai. de 2023 19:23, Eric Engstrom @.***> escreveu:

IMO this is basically the same as #4554 https://github.com/RocketChat/Rocket.Chat/issues/4554, and I just commented there that, three years on, this still doesn't work in the CE version https://github.com/RocketChat/Rocket.Chat/issues/4554#issuecomment-1536845876. This is clearly an "Enterprise Only" feature https://docs.rocket.chat/use-rocket.chat/workspace-administration/settings/ldap/ldap-enterprise-settings, regardless of what @engelgabriel https://github.com/engelgabriel said three years ago:

Rocketeers, after consideration, we will merge the code to fix these LDAP issues into the main repository. I am reopening a few of the LDAP issues to be resolved this week.

I encourage someone from the RC team, perhaps @engelgabriel https://github.com/engelgabriel, to at least acknowledge that decision and close this issue.

— Reply to this email directly, view it on GitHub https://github.com/RocketChat/Rocket.Chat/issues/7235#issuecomment-1536849538, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMUXECWNQAVJCWSJO425MC3XEV4U3ANCNFSM4DO7WM7Q . You are receiving this because you commented.Message ID: @.***>

joaomezzari avatar May 06 '23 15:05 joaomezzari

@joaomezzari - any chance you might share your script with the rest of us?

@caskelly - you closed the other two issues on this same topic, but you missed this one.

eengstrom avatar May 06 '23 16:05 eengstrom