-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add input for Azure AD Entity Analytics #34305
Add input for Azure AD Entity Analytics #34305
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
7b962f4
to
e03d43d
Compare
- Add new generic input for Entity Analytics. The input can be extended further through providers, which interface with an external identity provider, such as Azure Active Directory. - Add new Azure AD provider for Entity Analytics - Add docs
e03d43d
to
e266ca4
Compare
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
This should be ready for general review now. A couple of notes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial review. From a maintenance perspective, it would be helpful to have more godoc in this.
x-pack/filebeat/input/entityanalytics/internal/collections/set.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/collections/set.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/collections/tree.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/collections/tree.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/provider/azure/fetcher/mock/mock.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/provider/azure/metrics.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/provider/azure/metrics.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/provider/azure/metrics.go
Outdated
Show resolved
Hide resolved
This pull request is now in conflicts. Could you fix it? 🙏
|
@taylor-swanson |
- Fixed issue where group relationship tree was being passed by value and not pointer to marshaling functions - Changed behavior of full sync so it will force a fresh sync from Azure AD rather than try to use existing state via the delta link token. It was observed in testing that the API sometimes doesn't report proper group membership information and never seems to come back into alignment. Forcing a fresh sync corrects this issue, and also aligns better with the concepts mentioned in the RFC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thank you for adding all the docs. Just a couple of queries.
x-pack/filebeat/input/entityanalytics/internal/collections/tree.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/collections/uuid_set_test.go
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/collections/uuid_tree.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/collections/set.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/collections/tree.go
Outdated
Show resolved
Hide resolved
This pull request is now in conflicts. Could you fix it? 🙏
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after conflict is resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing the input outside of unit tests requires access to Azure Active Directory.
I assume it was actually tested manually with AD, could you confirm that and describe the test steps and the example of the output?
Having just unit tests is not enough in this case.
x-pack/filebeat/input/entityanalytics/internal/kvstore/input_test.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/kvstore/input_test.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/kvstore/input_test.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/internal/kvstore/input_test.go
Outdated
Show resolved
Hide resolved
x-pack/filebeat/input/entityanalytics/provider/azuread/authenticator/oauth2/oauth2.go
Show resolved
Hide resolved
Yes, this was tested manually with Azure AD. For a list of test cases, I ran through the following scenarios (this was linked in the related issue): Test Criteria
It takes a while to get everything set up, and I just returned from traveling, so it may take me a bit to get sample documents. |
- Switch from assert to require, interrupts tests in case of failure - Remove panics from test setup and replace with require.NoError - Use t.TempDir instead of os.MkdirTemp
Here are some sample documents: {
"@timestamp": "2023-02-02T15:18:08.691Z",
"@metadata": {
"beat": "filebeat",
"type": "_doc",
"version": "8.7.0"
},
"labels": {
"identity_source": "azure-1"
},
"event": {
"start": "2023-02-02T15:18:08.691Z",
"action": "started"
},
"input": {
"type": "entity-analytics"
},
"ecs": {
"version": "8.0.0"
},
"host": {
"hostname": "agent1",
"architecture": "x86_64",
"name": "agent1",
"os": {
"codename": "jammy",
"type": "linux",
"platform": "ubuntu",
"version": "22.04.1 LTS (Jammy Jellyfish)",
"family": "debian",
"name": "Ubuntu",
"kernel": "5.15.0-58-generic"
},
"id": "c7e8e9335ba042fabbbe850aa104d692",
"containerized": false,
"ip": [
"10.0.2.15",
"fe80::a00:27ff:fe88:e72a"
],
"mac": [
"08-00-27-88-E7-2A"
]
},
"agent": {
"id": "28e36fc0-551b-4ac2-95f0-4ed66455756e",
"name": "agent1",
"type": "filebeat",
"version": "8.7.0",
"ephemeral_id": "c53ad281-54db-4263-87bf-b6da287bfd9c"
}
} User document: {
"@timestamp": "2023-02-02T15:18:08.693Z",
"@metadata": {
"beat": "filebeat",
"type": "_doc",
"version": "8.7.0"
},
"ecs": {
"version": "8.0.0"
},
"host": {
"mac": [
"08-00-27-88-E7-2A"
],
"name": "agent1",
"hostname": "agent1",
"architecture": "x86_64",
"os": {
"platform": "ubuntu",
"version": "22.04.1 LTS (Jammy Jellyfish)",
"family": "debian",
"name": "Ubuntu",
"kernel": "5.15.0-58-generic",
"codename": "jammy",
"type": "linux"
},
"id": "c7e8e9335ba042fabbbe850aa104d692",
"containerized": false,
"ip": [
"10.0.2.15",
"fe80::a00:27ff:fe88:e72a"
]
},
"agent": {
"version": "8.7.0",
"ephemeral_id": "c53ad281-54db-4263-87bf-b6da287bfd9c",
"id": "28e36fc0-551b-4ac2-95f0-4ed66455756e",
"name": "agent1",
"type": "filebeat"
},
"azure_ad": {
"surname": "User1",
"userPrincipalName": "test.user1@azure2elasticsearch.onmicrosoft.com",
"displayName": "Test User1",
"givenName": "Test"
},
"labels": {
"identity_source": "azure-1"
},
"user": {
"id": "aeb2dc6a-797d-4e6d-8552-df43e4200f79",
"group": [
{
"id": "a36ac877-d4e4-41d2-b2f8-5895c1ec3eb5",
"name": "Test Group 1"
},
{
"id": "3ef344f3-3cb9-45ba-b997-057b76b3c1f7",
"name": "Test Group 2"
},
{
"id": "6e47d59e-9e02-4c6b-bbb9-43ee57637619",
"name": "Test Group 3"
}
]
},
"event": {
"action": "user-discovered"
},
"input": {
"type": "entity-analytics"
}
} End write marker: {
"@timestamp": "2023-02-02T15:18:08.693Z",
"@metadata": {
"beat": "filebeat",
"type": "_doc",
"version": "8.7.0"
},
"labels": {
"identity_source": "azure-1"
},
"event": {
"action": "completed",
"end": "2023-02-02T15:18:08.693Z"
},
"input": {
"type": "entity-analytics"
},
"agent": {
"version": "8.7.0",
"ephemeral_id": "c53ad281-54db-4263-87bf-b6da287bfd9c",
"id": "28e36fc0-551b-4ac2-95f0-4ed66455756e",
"name": "agent1",
"type": "filebeat"
},
"ecs": {
"version": "8.0.0"
},
"host": {
"containerized": false,
"name": "agent1",
"ip": [
"10.0.2.15",
"fe80::a00:27ff:fe88:e72a"
],
"mac": [
"08-00-27-88-E7-2A"
],
"hostname": "agent1",
"architecture": "x86_64",
"os": {
"type": "linux",
"platform": "ubuntu",
"version": "22.04.1 LTS (Jammy Jellyfish)",
"family": "debian",
"name": "Ubuntu",
"kernel": "5.15.0-58-generic",
"codename": "jammy"
},
"id": "c7e8e9335ba042fabbbe850aa104d692"
}
} Incremental update to user (removed group memberships): {
"@timestamp": "2023-02-02T15:27:17.543Z",
"@metadata": {
"beat": "filebeat",
"type": "_doc",
"version": "8.7.0"
},
"labels": {
"identity_source": "azure-1"
},
"user": {
"id": "aeb2dc6a-797d-4e6d-8552-df43e4200f79"
},
"event": {
"action": "user-modified"
},
"input": {
"type": "entity-analytics"
},
"ecs": {
"version": "8.0.0"
},
"host": {
"hostname": "agent1",
"architecture": "x86_64",
"os": {
"family": "debian",
"name": "Ubuntu",
"kernel": "5.15.0-58-generic",
"codename": "jammy",
"type": "linux",
"platform": "ubuntu",
"version": "22.04.1 LTS (Jammy Jellyfish)"
},
"id": "c7e8e9335ba042fabbbe850aa104d692",
"containerized": false,
"ip": [
"10.0.2.15",
"fe80::a00:27ff:fe88:e72a"
],
"mac": [
"08-00-27-88-E7-2A"
],
"name": "agent1"
},
"agent": {
"id": "28e36fc0-551b-4ac2-95f0-4ed66455756e",
"name": "agent1",
"type": "filebeat",
"version": "8.7.0",
"ephemeral_id": "619d854f-1882-41b2-a189-9a914e068236"
},
"azure_ad": {
"surname": "User1",
"userPrincipalName": "test.user1@azure2elasticsearch.onmicrosoft.com",
"displayName": "Test User1",
"givenName": "Test"
}
} |
- Lone vertices aren't included in the group relationship tree, so they won't be included in the expansion from the group tree. Direct members are inserted into the transitiveMemberOf set first, then expansion occurs.
- Add new generic input for Entity Analytics. The input can be extended further through providers, which interface with an external identity provider, such as Azure Active Directory. - Add new Azure AD provider for Entity Analytics - Add docs for the new input/provider
What does this PR do?
Why is it important?
Supports the greater Entity Analytics project by ingesting user and group identities from Azure Active Directory into Elasticsearch.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
x-pack/filebeat/input/entityanalytics
Related issues
Use cases