# Active directory Group integration V2.0.0

**URL:** <https://forums.rocket.chat/t/active-directory-group-integration-v2-0-0/4664>\
**Category:** Community Support\
**Created:** [September 24, 2019, 6:44am UTC](https://forums.rocket.chat/t/active-directory-group-integration-v2-0-0/4664 "2019-09-24T06:44:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thoeck](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@thoeck](https://forums.rocket.chat/u/thoeck)\
**Post date:** [September 24, 2019, 6:44am UTC](https://forums.rocket.chat/t/active-directory-group-integration-v2-0-0/4664/1 "2019-09-24T06:44:52Z")

</div>

### Description

Hello all,

i want to use the new Sync LDAP Grous function and i can’t figure out how to set it up.  
The system is currently configured to let map all users of a group using the old search user tab with the filter:  
(memberOf=cn=Rocket\_Chat,ou=Group,ou=base,ou=rocket,dc=test,dc=net)  
scope: sub  
search: sAMAccountName

i tried to set up the new Sync option like this:

User Group Filter: (&(cn=#{groupName})(description=#{username}))  
LDAP GROUP BaseDN ou=Group,ou=base,ou=rocket,dc=test,dc=net

User Data Group Map  
{  
“rockettest”: “Moderator”,  
“Rocket\_Admin”: “admin”  
“Rocket\_crm”: “livechat-agent”  
}

It does not work with this configuration and i can’t figure out the problem.  
If someone could please help me with this problem it would be super nice 😃

Thanks a lot and Best Regards

### Server Setup Information

- Version of Rocket.Chat Server: 2.0.0
- Operating System: linux
- Deployment Method: tar
- Number of Running Instances: 1
- DB Replicaset Oplog: active
- NodeJS Version: v8.11.3
- MongoDB Version: 4.0.12

### Any additional Information

Members of the ldap groups seem to be identified by an attribute with the name “member” and a value that looks like the distinguishedName of the user  
(CN=Max Mustermann,ou=Group,ou=base,ou=rocket,dc=test,dc=net ).  
All Groups are global security group and i’m using active directory on a WindowsServer 2016.

---

<div class="post-metadata">

**Author:** ![nitrox007](https://avatars.discourse-cdn.com/v4/letter/n/3da27b/32.png) [@nitrox007](https://forums.rocket.chat/u/nitrox007)\
**Post date:** [October 11, 2019, 2:27pm UTC](https://forums.rocket.chat/t/active-directory-group-integration-v2-0-0/4664/2 "2019-10-11T14:27:36Z")

</div>

I partially got it to work with Active Directory.

I’m running RocketChat version 2.1.0 in CentOS. My AD is Windows Server 2012

These are my settings under Sync / Import section of LDAP configuration:

Username Field: sAMAccountName

Unique Identifier Field: name,sAMAccountName,userPrincipalName,mail

Default Domain: [my.domain.com](http://my.domain.com)

Merge Existing Users: True

Sync User Data: True

User Data Field Map: {“displayName”:“name”, “mail”:“email”}

Sync LDAP Groups: True

Auto Remove User Roles: True

User Group Filter:  
(&(sAMAccountName=#{username})(memberOf=CN=#{groupName},OU=Groups,OU=My\_Dept,DC=my,DC=domain,DC=com))

LDAP Group BaseDN: OU=Users,DC=my,DC=domain,DC=com

User Data Group Map: {“rocket\_test”:“user”}

Auto Sync LDAP Groups Channels: True

Channel Admin: rocket.cat

LDAP Group Channel Map: {“rocket\_test”:“test\_channel”}

Auto Remove Users from Channels: True

Sync User Avatar: False

Background Sync: False

* * *

Notes:

#test\_channel I set as public

With this configuration, I’m able to login with an AD account and properly assign the role and join a channel. The problem now is that when I login with the AD account for the first time I get a “user not found or incorrect password” message on the login screen. At this point, the user did successfully authenticate and the new user is created in Rocketchat, but the authentication does not complete. If I click the login button a second time, then everything works fine. That’s what I’m troubleshooting now.

Some of the issues I found was that the JSON string in User Data Group Map and LDAP Group Channel Map is very sensitive and triggers errors in the debug log. For example, if you hit enter after { , it caused issues or if I had a comma at the tend of a mapping “something”:“something”,. Sometimes even without the comma it triggered errors.

To figure out exactly what filter to use, I downloaded a tool called: JXplorer. With this tool I connected to my AD and I found the user I was testing. When I found the user, there is a list of groups the user is a member of. Then I took the value of the group’s memberOf and replaced" CN=Group\_Name with CN=#{groupName} the full path of the group.

The LDAP Group BaseDN, I used the same BaseDN from the main LDAP configuration section.

Hopefully this will help you or someone. If I find a solution to the “user not found or incorrect password” issue i’m now having, I will post the solution.

---

<div class="post-metadata">

**Author:** ![thoeck](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@thoeck](https://forums.rocket.chat/u/thoeck)\
**Post date:** [January 30, 2020, 12:04pm UTC](https://forums.rocket.chat/t/active-directory-group-integration-v2-0-0/4664/3 "2020-01-30T12:04:06Z")

</div>

the Problem has been solved. The key in this case was the inclusion of the nesting Filter to get nested Groups working.

The format looks like this:  
(&(sAMAccountName=#{username})(memberof:1.2.840.113556.1.4.1941:=CN=#{groupName},DC=_your domain_ (objectCategory=person)(objectClass=user))

We included the category and class filter to rule out false positives like the nested security groups.

---

<div class="post-metadata">

**Author:** ![phatair](https://avatars.discourse-cdn.com/v4/letter/p/94ad74/32.png) [@phatair](https://forums.rocket.chat/u/phatair)\
**Post date:** [February 4, 2020, 8:17pm UTC](https://forums.rocket.chat/t/active-directory-group-integration-v2-0-0/4664/4 "2020-02-04T20:17:18Z")

</div>

Hi,  
i have the same problem but with rocket chat version 2.4.2

> [@Login after using LDAP Group Channel Map not possible](https://forums.rocket.chat/t/login-after-using-ldap-group-channel-map-not-possible/5724):
>
> Description We are using Rocket Chat with AD Integration and AD Sync. We also use User Data Group Map and LDAP Group Channel Map. We have two existing LDAP Group Channel Map entrys and that is working fine. If we add Users to the AD Group where the user search filter is set to, these users are created correctly. Now i add a third LDAP Group Channel Map entry. After that i can not login anymore in Rocket Chat.The new LDAP Group is created in Rocket Chat but no user can login. If i delete this …

The Group Mapping was working a few week ago and now i have a lot of problems.  
If i use the LDAP Group Channel Map the channels are created but i can not login anymore. I got for existing users that the password is wroing or the user does not exists.

If i delete the LDAP Group Channel Map i can login again with my users.  
If i only delete the channels that are created through the LDAP Group Channel Map i can login one time with a user, then the channels are created and after that i can not login anymore.  
That is really strange.  
If someone can help me with this, it would be great.

My ldap config looks like this:

Username Field: sAMAccountName

Unique Identifier Field: objectGUID,ibm-entryUUID,GUID,dominoUNID,nsuniqueId,uidNumber

Merge Existing Users: No

Sync User Data: Yes

User Data Field Map: {“cn”:“name”, “mail”:“email”}

Sync LDAP Groups: Yes

Auto Remove User Roles: Yes

User Group Filter: (&(sAMAccountName=#{username})(memberOf:1.2.840.113556.1.4.1941:=CN=#{groupName},OU=RocketChat,DC=my,DC=domain,DC=com))

LDAP Group BaseDN: OU=RocketChat,DC=my,DC=domain,DC=com

User Data Group Map:  
{  
“RC\_Admins”:“admin”  
}

Auto Sync LDAP Groups to Channels: Yes  
Channel Admin: admin  
LDAP Group Channel Map:  
{  
“RC\_IT”: “IT”,  
“RC\_Test”: “Test”  
}

Auto Remove Users from Channels: Yes  
Sync User Avatar: No  
Background Sync: Yes  
Background Sync Intervall: 24 hours  
Background Sync Import New Users: yes  
Background Sync Update Existing Users: yes

---

<div class="post-metadata">

**Author:** ![luiz.dias](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/luiz.dias/32/1540_2.png) [@luiz.dias](https://forums.rocket.chat/u/luiz.dias)\
**Post date:** [February 28, 2020, 7:58pm UTC](https://forums.rocket.chat/t/active-directory-group-integration-v2-0-0/4664/5 "2020-02-28T19:58:06Z")

</div>

Hi @phatair…

I have the exactly the same problem.

I already use nested groups rules to search for users inside groups.

My RocketChat is version 3.0.0.

any help…???
