Skip to content

[Security solution][Endpoint] Add Host Isolation related data to the endpoint generator and test data loader#100727

Merged
paul-tavares merged 8 commits intoelastic:masterfrom
paul-tavares:task/olm-1117-add-host-isolation-to-generator
May 27, 2021
Merged

[Security solution][Endpoint] Add Host Isolation related data to the endpoint generator and test data loader#100727
paul-tavares merged 8 commits intoelastic:masterfrom
paul-tavares:task/olm-1117-add-host-isolation-to-generator

Conversation

@paul-tavares
Copy link
Contributor

Summary

  • new data generator for both Isolate and UnIsolate Fleet actions
  • Endpoint test/dev data loader was enhanced to load actions for each endpoint (aka: agent) when run with the --fleet option

Load Data

node x-pack/plugins/security_solution/scripts/endpoint/resolver_generator.js --auth elastic:changeme --delete --numHosts=10 --numDocs=2 --fleet

After running the above, Actions and Action Responses would be added for each host:

GET .fleet-actions/_search
[
    {
      "_index" : ".fleet-actions-7",
      "_id" : "dc869626-107b-43ff-b079-fbb6ae243951",
      "_score" : 1.0,
      "_source" : {
        "@timestamp" : "2021-05-24T13:11:17.625Z",
        "expiration" : "2021-06-23T13:11:17.625Z",
        "agents" : [
          "01c42a3f-5935-40ef-992d-f27434910427"
        ],
        "action_id" : "dc869626-107b-43ff-b079-fbb6ae243951",
        "type" : "POLICY_REASSIGN"
      }
    },
    {
      "_index" : ".fleet-actions-7",
      "_id" : "RcHdnnkBA_1gpn-NujXN",
      "_score" : 1.0,
      "_source" : {
        "action_id" : "1a11fcb3-ef4c-48bf-a3a8-5f57e85b4a95",
        "@timestamp" : "2021-05-24T14:53:21.996Z",
        "expiration" : "2021-06-07T14:53:21.996Z",
        "type" : "INPUT_ACTION",
        "input_type" : "endpoint",
        "agents" : [
          "a90b5ff6-9a9d-4a2c-863d-724587cbef48"
        ],
        "user_id" : "elastic",
        "data" : {
          "command" : "isolate",
          "comment" : ""
        }
      }
    },
    {
      "_index" : ".fleet-actions-7",
      "_id" : "RsHdnnkBA_1gpn-N1TVC",
      "_score" : 1.0,
      "_source" : {
        "action_id" : "3305c14e-7262-4018-9082-5c2b0d09e555",
        "@timestamp" : "2021-05-24T14:53:28.769Z",
        "expiration" : "2021-06-07T14:53:28.769Z",
        "type" : "INPUT_ACTION",
        "input_type" : "endpoint",
        "agents" : [
          "a90b5ff6-9a9d-4a2c-863d-724587cbef48"
        ],
        "user_id" : "elastic",
        "data" : {
          "command" : "isolate",
          "comment" : ""
        }
      }
    }
]

@paul-tavares paul-tavares added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v7.14.0 auto-backport Deprecated - use backport:version if exact versions are needed labels May 26, 2021
@paul-tavares paul-tavares requested a review from a team as a code owner May 26, 2021 19:29
@paul-tavares paul-tavares self-assigned this May 26, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt)

};
}

export interface EndpointActionResponse {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this already exist anywhere else? @ashokaditya maybe in your PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might exist in Ash's draft. Does not exist anywhere else yet, since we don't really know what the success structure looks like (or even failure when it comes from the endpoint).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was wondering that as well. Feels like the Agent should know what an error/success looks like since they are the ones writing this to es. (just by looking at the schema, I thought that if error was populated, then it "failed", else, it was "success" 🤷‍♂️ )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent knows about the fields it writes. It does not know about the fields Endpoint writes (and vice versa).

AFAIK it treats the response given via endpoint as a total unparsed black box, wraps it with its own fields, and then passes to fleet server (where maybe more fields are written? no? who knows?).

that error field is coming from either fleet-server or agent who have a failure in their system before being able to deliver to endpoint.

Copy link
Member

@pzl pzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. had thoughts, but nothing big

};
}

export interface EndpointActionResponse {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might exist in Ash's draft. Does not exist anywhere else yet, since we don't really know what the success structure looks like (or even failure when it comes from the endpoint).

},
state: {
isolation: false,
isolation: isIsolated,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

future improvement: Math.random() < 0.2 ? !isIsolated : isIsolated perhaps

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

References to deprecated APIs

id before after diff
ml 121 115 -6
securitySolution 386 342 -44
total -50

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @paul-tavares

@paul-tavares paul-tavares merged commit 57f59bd into elastic:master May 27, 2021
@paul-tavares paul-tavares deleted the task/olm-1117-add-host-isolation-to-generator branch May 27, 2021 15:55
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 27, 2021
…endpoint generator and test data loader (elastic#100727)

* Generate random isolation values for endpoint metadata
* Generator for Fleet Actions
* Added creation of actions to the index test data loader
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

jbudz added a commit that referenced this pull request May 27, 2021
… to the endpoint generator and test data loader (#100727)"

This reverts commit 57f59bd.
@jbudz
Copy link
Contributor

jbudz commented May 27, 2021

paul-tavares added a commit to paul-tavares/kibana that referenced this pull request May 27, 2021
…endpoint generator and test data loader (elastic#100727)

* Generate random isolation values for endpoint metadata
* Generator for Fleet Actions
* Added creation of actions to the index test data loader

(cherry picked from commit 57f59bd)
paul-tavares added a commit that referenced this pull request May 28, 2021
…ort for Host Isolation (#100813)

Re-introduces the changes from #100727 which was backed out due to a bug. Changes included:

* Generate random isolation values for endpoint metadata
* Generator for Fleet Actions
* Added creation of actions to the index test data loader

Plus:

* Fix generator `randomBoolean()` to ensure it works with seeded random numbers
* Update resolver snapshots due to additional call to randomizer
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 28, 2021
…ort for Host Isolation (elastic#100813)

Re-introduces the changes from elastic#100727 which was backed out due to a bug. Changes included:

* Generate random isolation values for endpoint metadata
* Generator for Fleet Actions
* Added creation of actions to the index test data loader

Plus:

* Fix generator `randomBoolean()` to ensure it works with seeded random numbers
* Update resolver snapshots due to additional call to randomizer
kibanamachine added a commit that referenced this pull request May 28, 2021
…ort for Host Isolation (#100813) (#100904)

Re-introduces the changes from #100727 which was backed out due to a bug. Changes included:

* Generate random isolation values for endpoint metadata
* Generator for Fleet Actions
* Added creation of actions to the index test data loader

Plus:

* Fix generator `randomBoolean()` to ensure it works with seeded random numbers
* Update resolver snapshots due to additional call to randomizer

Co-authored-by: Paul Tavares <56442535+paul-tavares@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v7.14.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants