memberOf attribute in Active Directory does not contain all user groups - active-directory

I have made an application, where I want to bring all the user accounts and their memberships in the Active Directory Environment. I came to know that a user in Active Directory has memberOf attribute which stores the distinguishedName of the groups of which a user is a member.
However, when I checked out and found the memberOf isn't all the groups of which user is a member of. For example, it only contains few distinguishedName of the groups in other domain of same forest.
Am I missing something ? Is there some configuration which has to be done on Active Directory.
Please note, I am using Java JNDI for bringing the users form the active directory.

Related

What Fields in Active Directory Are Not Only Unique, But Also Immutable (ADFS)

I've been looking for a way to identify a user in Active Directory without fail. I found this article which explains which fields are unique. It's a good starting point, but doesn't identify which fields are non-mutable. Further google queries result in AzureAD results on immutableId, which is what I want, but for regular AD. The case I'm trying to prevent is I use sAMAccountName (which is unique) to identify a user, but an admin decides to change the sAMAccountName for some reason (perhaps for uniformity) and I identify the same old user (with now a new sAMAccountName as a new user.
A few contenders from the article:
DN
UPN
sAMAccountName
ObjectGUID
Is there anything I'm missing? Is there an immutableId equivalent in pure AD (Not AzureAD)?
What you likely want is objectGUID. As "GUID" suggests, it is "globally unique". It doesn't change, even when the account is moved to another domain.
There is also objectSid (SID = Security Identifier), which is what Windows permissions use (the SID is stored in the permissions). It is also globally unique, but part of the SID is the SID of the domain. So if the account is moved to another AD domain, a new SID is generated on that domain, and the old objectSid is put in the sIDHistory of the new account.
There is some extra reading about that here: Security identifiers and globally unique identifiers
The distinguishedName changes whenever the account is renamed or moved to a new OU.
As you noted, both userPrincipalName and sAMAccountName can change too.

LDAP filter to exclude admins group from GAL (on Zimbra)

I'm trying to set up an external active directory GAL on zimbra 8.8.7; My current working filter is
(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(givenName=*%s*)(mail=*%s*))(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))
autocomplete filter is
(|(cn=%s*)(sn=%s*)(gn=%s*)(mail=%s*))
LDAP search base
dc=sub,dc=domain,dc=com
search and autocomplete returns all AD users, including admin accounts. What is a correct way to exclude administrators group from ldap search?
the accounts I need to exclude are in OU "Admins" and are members of couple of groups like Buildin "Administrators" and users "Domain Admins", "Enterprise admins", etc
I've tried adding (&(objectCategory=group)(!cn=Admin) but it doesn't seem to be valid.
Decided to post my workaround that is already in production. Couldn't make exclusion rule to work and another task required the real employees group to be created on AD anyway, so ended up adding all people accounts to group Staff and domain GAL search looks like this:
LDAP filter: (&(objectCategory=Person)(sAMAccountName=*)(memberOf=cn=Staff,ou=Groups,dc=dc1,dc=domainname,dc=com))
Autocomplete filter: (|(cn=%s*)(sn=%s*)(gn=%s*)(mail=%s*))
LDAP search base: dc=dc1,dc=domainname,dc=com

UnboundID LDAP: memberOf filter not synchronising users

Apologies for the newbie question, fairly new to LDAP and UnboundID.
I currently have an UnboundID filter that synchronises users who belong to an Active Directory group.
--set include-base-dn:cn=Users,dc=testdomain,dc=net --add "include-filter:(memberOf=CN=Application Access,CN=Users,DC=testdomain,DC=net)
The behaviour I am seeing is that when I add a user to the group "Application Access", no Synchronisation occurs.
However if I edit the users AD profile whilst they are a memberOf "Application Access" then the user profile is synchronised.
Is is possible to synchronise users when they join a group?
Thanks in advance.
In Microsoft Active Directory the MemberOf value is the DN of an entry that the current entry is a member in a Group and is referred to as a Forward Reference.
A Pseudo Attribute Microsoft Active Directory
MemberOf is a Pseudo Attribute. This implies You can not monitor the MemberOf attribute for changes (Like with DirXML)
Within Microsoft Active Directory MemberOf is flagged as "NO-USER-MODIFICATION" (or System-Only)[1]; This means you can NOT update the attribute. In order to add a user to a group you have to write the user's dn to the member attribute on the group object.
-jim

Nested groups in active directory and permissions?

Here are some groups and permissions that apply to a user named ALI.
These are simple groups created in Active directory. Will ALI receive Full Control or Read Only permissions??

Active Directory (LDAP) query or filter to get users with closed mailboxes?

I use Exchange 2003 and I have been searching a lot and found related queries like
(&(UserAccountControl:1.2.840.113556.1.4.803:=2)(msExchHomeServerName=*)(objectClass=User))
Which enumerates disabled user accounts with mailboxes, but what I want is quite the opposite, user accounts (enabled or disabled) with CLOSED mailboxes. Thanks beforehand for any help!
Exchange and Active Directory are separate, if user is created on AD doesn’t mean that it will have mailbox account too but usually both are used together.
You can use any LDAP browser like JXplorer or LDAPadmin to check the settings for your users on Active Directory. You will find disabled users on AD moved to different OU or there should be some attribute which will differentiate it from active users.
You can export LDIF file (by LDAP browser like LDAPadmin) for one active user and one disabled user and compare both to find relevant attribute for disabled entity and use it for your query filter. You can consult your IT team also who is managing Active directory for more details. HTH :)

Resources