Skip to content
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

[Security][Fleet] Install the security_detection_engine package automatically #97191

Merged
merged 21 commits into from
Apr 20, 2021
Merged

[Security][Fleet] Install the security_detection_engine package automatically #97191

merged 21 commits into from
Apr 20, 2021

Conversation

rw-access
Copy link
Contributor

@rw-access rw-access commented Apr 14, 2021

Summary

Related to https://github.com/elastic/security-team/issues/17
Continuation of #96698

Automatically install the security_detection_engine package alongside the Endpoint package. This will make security rule updates automatically available to users.

Screenshot from a fresh snapshot build:
image

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@rw-access rw-access added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Detection Rules Anything related to Security Solution's Detection Rules Team:Detections and Resp Security Detection Response Team v7.13.0 auto-backport Deprecated - use backport:version if exact versions are needed labels Apr 14, 2021
@rw-access rw-access requested a review from kevinlog April 14, 2021 21:55
@rw-access rw-access requested a review from a team as a code owner April 14, 2021 21:55
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Apr 14, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@@ -15,6 +15,7 @@ export const requiredPackages = {
System: 'system',
Endpoint: 'endpoint',
ElasticAgent: 'elastic_agent',
SecurityDetectionEngine: 'security_detection_engine',
Copy link
Member

Choose a reason for hiding this comment

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

What happens if this dependency is removed in the future -- is the package just gracefully uninstalled and SO's removed on upgrade?

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 you got it.
fleet manages all the SOs, so they will be removed during an upgrade/uninstall gracefully. the detection engine will then just use the rules compiled in

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe I misunderstood the question but if security_detection_engine is removed from this list of required packages in the future, Fleet will not automatically uninstall the package if it's already installed

Copy link
Member

Choose a reason for hiding this comment

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

Ahhh, so we can have lingering SO's from this package then? This would result in the rules installing from these SO's still, or would the fact the package is no-longer present short circuit that logic?

How can they be manually removed -- will it still show up in fleet until it's un-installed, or is there another way to perform this cleanup?

@rw-access rw-access enabled auto-merge (squash) April 15, 2021 07:25
@rw-access rw-access disabled auto-merge April 15, 2021 07:25
@rw-access rw-access enabled auto-merge (squash) April 15, 2021 07:25
Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

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

Code LGTM

@ruflin
Copy link
Member

ruflin commented Apr 15, 2021

Does this indirectly mean, the detection rules are also installed the first time the user visits the Fleet page or /setup is called? I'm ok to add this for now but I'm also concerned that /setup takes longer and longer: #96026

@jen-huang
Copy link
Contributor

jen-huang commented Apr 15, 2021

I had the same thought @ruflin, this will add overhead to /setup, we need to make /setup ops more performant outside of this PR.

@rw-access
Copy link
Contributor Author

so for this package in particular the only "install" is just the creation of the detection rules SOs. hopefully the overhead of that is smaller and not too obtrusive?

yeah I wish there was a way to make these dependencies conditional. requiring the user to navigate to a particular solution could be useful for both endpoint and this package

@rw-access
Copy link
Contributor Author

rw-access commented Apr 20, 2021

For some reason, pulling in the 0.18.0 endpoint package via the dockerImage update caused some failures for the endpoint list functional tests, which previously worked with 0.17.1.

At first, I thought it was just the destination_index changes, but changing that data caused some security_solution_endpoint_api_int failures.

Instead of fighting an unrelated change in this PR, I think it's most appropriate to change the KQL query acaa76a to something that allows the PR to pass tests. I switched to an agent.id filter, which is testing locally.

This will unblock the PR, and we can investigate a potential 7.12 bug where there appears to be an inconsistency with this particular combination of:

  • 0.18.0 endpoint package
  • 7.12+ endpoint metadata api logic
  • x-pack/test/functional/es_archives/endpoint/metadata/destination_index/data.json test data
  • testing logic

We can look into this in a follow on PR, since it's completely unrelated to the scope of the PR, and only surfaced when dockerImage was updated.

@rw-access rw-access disabled auto-merge April 20, 2021 11:44
@elastic elastic deleted a comment from kibanamachine Apr 20, 2021
@elastic elastic deleted a comment from kibanamachine Apr 20, 2021
@rw-access rw-access enabled auto-merge (squash) April 20, 2021 15:17
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 346.1KB 346.2KB +52.0B

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

@rw-access rw-access merged commit 1925cea into elastic:master Apr 20, 2021
@rw-access rw-access deleted the autoinstall-security-detection-pkg branch April 20, 2021 17:07
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 20, 2021
…atically (elastic#97191)

* Automatically install the security_detection_engine package via fleet
* Update dockerImage to include the security_detection_engine package
* Update api/fleet/setup install test
* Update test data for Endpoint package
* Fix JSON token
* Update firis json entry in destination_index
* Update destination_index structure
* Update destination_index structure
* Change KQL query to unblock testing
* Restore KQL and fix JSON instead
* update timestamps to pass tests
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Apr 20, 2021
…atically (#97191) (#97680)

* Automatically install the security_detection_engine package via fleet
* Update dockerImage to include the security_detection_engine package
* Update api/fleet/setup install test
* Update test data for Endpoint package
* Fix JSON token
* Update firis json entry in destination_index
* Update destination_index structure
* Update destination_index structure
* Change KQL query to unblock testing
* Restore KQL and fix JSON instead
* update timestamps to pass tests

Co-authored-by: Ross Wolf <31489089+rw-access@users.noreply.github.com>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 30, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 30, 2021
kibanamachine added a commit that referenced this pull request Apr 30, 2021
Co-authored-by: Ross Wolf <31489089+rw-access@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Apr 30, 2021
Co-authored-by: Ross Wolf <31489089+rw-access@users.noreply.github.com>
madirey pushed a commit to madirey/kibana that referenced this pull request May 11, 2021
…atically (elastic#97191)

* Automatically install the security_detection_engine package via fleet
* Update dockerImage to include the security_detection_engine package
* Update api/fleet/setup install test
* Update test data for Endpoint package
* Fix JSON token
* Update firis json entry in destination_index
* Update destination_index structure
* Update destination_index structure
* Change KQL query to unblock testing
* Restore KQL and fix JSON instead
* update timestamps to pass tests
madirey pushed a commit to madirey/kibana that referenced this pull request May 11, 2021
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 Feature:Detection Rules Anything related to Security Solution's Detection Rules release_note:skip Skip the PR/issue when compiling release notes Team:Detections and Resp Security Detection Response Team Team:Fleet Team label for Observability Data Collection Fleet team v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants