-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Security Solution][Endpoint] Update response action creation so that it store policy information when action is created #218175
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
Conversation
…ng the `agent.policy` info only if FF is enabled
…e-policy-id-in-action-request-for-spaces
This reverts commit 7366645.
… Endpoint to use it when returning agent info.
unable to test it at this time - role needs additional privileges
… against specific indexes rather than index patterns
|
/ci |
|
/ci |
|
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
…gating to core server
…n-action-request-for-spaces' into task/olm-11225-store-policy-id-in-action-request-for-spaces
szwarckonrad
left a comment
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.
Code and logic behind it LGTM!
| }; | ||
| microsoft: { | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| defender_endpoint: Record<string, any>; |
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.
Maybe we can go with an unknown?
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.
I'll check if unknown will work as well.
x-pack/solutions/security/plugins/security_solution/server/endpoint/mocks/utils.mock.ts
Outdated
Show resolved
Hide resolved
...tion/server/endpoint/services/actions/clients/crowdstrike/crowdstrike_actions_client.test.ts
Outdated
Show resolved
Hide resolved
...curity_solution/server/endpoint/services/actions/clients/endpoint/endpoint_actions_client.ts
Show resolved
Hide resolved
...solution/server/endpoint/services/actions/clients/sentinelone/sentinel_one_actions_client.ts
Outdated
Show resolved
Hide resolved
...solution/server/endpoint/services/actions/clients/sentinelone/sentinel_one_actions_client.ts
Outdated
Show resolved
Hide resolved
| connectorActions.setup(SENTINELONE_CONNECTOR_ID); | ||
| } | ||
|
|
||
| private async fetchSentinelOneAgentIndexNames(): Promise<string[]> { |
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.
Feels like this could be abstracted in the base class — just caching and retrieving, right? I think you're already doing something similar for other connectors. Ignore this if that’s not the case.
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.
I usually push methods/logic to the base class only if its something that applies to all EDR types (generic). In this case, the index names will be different depending on the EDR type, so I felt like it was most appropriate for it to live in each respective sub-class.
From konrad Co-authored-by: Konrad Szwarc <[email protected]>
…e-policy-id-in-action-request-for-spaces
|
|
||
| // Kibana CORE will take care of `500` errors when the handler `throw`'s, including logging the error | ||
| throw error; | ||
| // Kibana core server handling of `500` errors does not actually return the `error.message` encountered, |
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.
🔥
| const doc: LogsEndpointAction<TParameters, TOutputContent, TMeta> = { | ||
| '@timestamp': new Date().toISOString(), | ||
| // Need to suppress this TS error around `agent.policy` not supporting `undefined`. | ||
| // It will be removed once we enable the feature and delete the feature flag checks. |
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.
Maybe add a // TODO here for visibility
| ], | ||
| crowdstrike: ['device.id'], | ||
| microsoft_defender_endpoint: [ | ||
| 'cloud.instance.id', |
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.
🙇🏼 Thanks for sorting!
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.
😄
FYI:
I actually did not sort it on purpose. I only moved cloud.instance.id up so that it is the first one we try to find in MS documents. thats because I'm still not 100% sure of the other fields defined below because we never really set up the M365 integration. I got these values from an Env. that Raquel has where she did setup M365.
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.
Ah I see. Well, sorted values are always nice to maintain. 🌞
...ions/security/plugins/security_solution/common/endpoint/types/microsoft_defender_endpoint.ts
Outdated
Show resolved
Hide resolved
x-pack/solutions/security/plugins/security_solution/common/endpoint/types/sentinel_one.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Ash <[email protected]>
…point/types/sentinel_one.ts
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]Unknown metric groupsESLint disabled in files
Total ESLint disabled count
History
|
… it store policy information when action is created (elastic#218175) ## Summary The following changes are in support of space awareness for response actions (currently behind feature flag: `endpointManagementSpaceAwarenessEnabled`). All response actions will now start to store agent policy information. - A new property will be stored in the Action Request document that captures policy information about each agent the action was sent to (`agent.policy: []`). - All response action client instances must now be initiated with a `spaceId` - A new method was added to the internal Fleet Services to retrieve all `namespace`'s in use by a given integration type in the active space - The SentinelOne and Microsoft run host scripts were enhaced so that the host VM name includes the space id
Summary
The following changes are in support of space awareness for response actions (currently behind feature flag:
endpointManagementSpaceAwarenessEnabled). All response actions will now start to store agent policy information.agent.policy: []).spaceIdnamespace's in use by a given integration type in the active spaceTesting space awareness setup
Warning
Microsoft Defender response actions will fail with a message indicating that it was unable to find elastic agens for the MS agent ids provided on input. This error will persist until a new build of Elsaticsearch is released. A change was needed to the
kibana_systemroleEnable feature flags
Switch Fleet to Space aware
Add additional mappings for response actions
Note
Only needed until the Endpoint Package is updated with these mappings
Ensure that the Endpoint package is installed
Best way to do this is to create at least one integration policy in fleet.
Add mappings if not already included in index mapping
Tip
These instructions can be done from the Kibana Dev tools console
Ensure index exists:
Check to see if the mapping is already present:
If the response returns an empty
mappings, then mappings need to be addedAdd mappings to the index:
Add data
You should now be all setup to load data for testing. Remember that space data visibility is mostly driven by Fleet and how Policies are setup and shared between spaces - Agent Policies now have a Space ID field to manage this.
Our scripts that run live VMs for each type o9f EDR have been updated to support a
--spaceIdCLI argument and thus can be used to target specific spaces.Checklist