You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[filebeat][entityanalytics] - Fix AD Entity Analytics failing to fetch users when Base DN contains a group CN (#48395)
entityAnalytics: Fix AD Entity Analytics not returning users when Base DN contains group (CN)
Groups are leaf objects in LDAP - users are members of groups, not children.
When Base DN includes a group CN (e.g., CN=Admin Users,OU=Groups,DC=...),
the search now validates the CN against LDAP and uses a memberOf filter
instead of subtree search. Containers like CN=Users continue to work normally.
(cherry picked from commit cdc7276)
Copy file name to clipboardExpand all lines: x-pack/filebeat/input/entityanalytics/provider/activedirectory/internal/activedirectory/activedirectory.go
+172-3Lines changed: 172 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,141 @@ var (
23
23
ErrUsers=errors.New("failed to get user details")
24
24
)
25
25
26
+
// parsedBaseDN holds the result of parsing a base DN for potential group components.
27
+
typeparsedBaseDNstruct {
28
+
// containerBaseDN is the container portion of the DN (OU/DC components).
29
+
containerBaseDNstring
30
+
// potentialGroupDNs are CN components that might be groups (need validation).
31
+
potentialGroupDNs []string
32
+
// originalBaseDN is the original base DN string.
33
+
originalBaseDNstring
34
+
}
35
+
36
+
// parseBaseDN analyzes a distinguished name and separates potential group (CN)
37
+
// components from container components (OU, DC). CN components that appear
38
+
// before container components are extracted as potential group references
39
+
// that need to be validated against LDAP.
40
+
//
41
+
// For example, given:
42
+
//
43
+
// CN=Admin Users,OU=Groups,DC=example,DC=com
44
+
//
45
+
// This returns:
46
+
// - containerBaseDN: "OU=Groups,DC=example,DC=com" (the container path)
Copy file name to clipboardExpand all lines: x-pack/filebeat/input/entityanalytics/provider/activedirectory/internal/activedirectory/activedirectory_test.go
+135Lines changed: 135 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,141 @@ import (
17
17
18
18
varlogResponses=flag.Bool("log_response", false, "use to log users/groups returned from the API")
19
19
20
+
funcTestParseBaseDN(t*testing.T) {
21
+
// The ldap library normalizes attribute types to lowercase when
22
+
// serializing DNs, so expected values use lowercase cn, ou, dc.
// AD_BASE=CN=Users,DC=<servername>,DC=local AD_URL=ldap://<ip> AD_USER=CN=Administrator,CN=Users,DC=<servername>,DC=local AD_PASS=<passwort> go test -v -log_response
0 commit comments