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

[ML] Adds Authentication module with six ML jobs for ECS data (Auditbeat, Winlogbeat, Filebeat and Logs) #101840

Merged
merged 14 commits into from
Jun 14, 2021

Conversation

ajosh0504
Copy link
Contributor

@ajosh0504 ajosh0504 commented Jun 9, 2021

Summary

This PR adds a security_auth module for use within the Security app. Detailed information, stats, and screenshots are here: https://github.com/elastic/mechagodzilla/issues/35

It contains 1 Module called security_auth consisting of:

  • ML Job configurations for 6 jobs:
    • auth_high_count_logon_events_for_a_source_ip
    • auth_high_count_logon_events
    • auth_high_count_logon_fails
    • auth_rare_hour_for_a_user
    • auth_rare_source_ip_for_a_user
    • auth_rare_user
  • Corresponding datafeed configurations
  • Logo
  • Descriptions coming soon

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@randomuserid
Copy link
Contributor

I tested the module on a local dev instance
image

@randomuserid randomuserid added release_note:feature Makes this part of the condensed release notes auto-backport Deprecated - use backport:version if exact versions are needed and removed release_note:enhancement labels Jun 9, 2021
@ajosh0504 ajosh0504 requested a review from a team as a code owner June 10, 2021 01:41
@@ -0,0 +1,77 @@
{
"id": "security_auth",
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the expected response for the auditbeat data set used in the x-pack/test/api_integration/apis/ml/modules/recognize_module·ts test needs editing, to add in the ID of the new module security_auth which also now matches our test data set. This block here

    {
      testTitleSuffix: 'for auditbeat dataset',
      sourceDataArchive: 'x-pack/test/functional/es_archives/ml/module_auditbeat',
      indexPattern: 'ft_module_auditbeat',
      user: USER.ML_POWERUSER,
      expected: {
        responseCode: 200,
        moduleIds: ['auditbeat_process_hosts_ecs', 'security_linux', 'siem_auditbeat'],
      },
    },

moduleIds: ['auditbeat_process_hosts_ecs', 'security_linux', 'siem_auditbeat'],
moduleIds: [
'auditbeat_process_hosts_ecs',
'security_auth',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@peteharverson I noticed that in the testing output, but security_auth has been added to the auditbeat testset and yet that test still fails.

Copy link
Member

Choose a reason for hiding this comment

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

@ajosh0504 From what I can see in the test log it looks like we're now expecting the security_auth module to be recognized in the ft_module_auditbeat index pattern, but it is not. If we think that it's ok it's not recognized there, we can remove it from the expected modules for this dataset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pheyos Any idea it might not be recognizing the module?

Copy link
Member

Choose a reason for hiding this comment

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

@ajosh0504 I'd need to double check the dataset. But the new module checks for "event.category": "authentication". And it it is not recognized in an index pattern, it means that the documents don't have this field or have a different value for this field. I'll take a closer look and report back here.

Copy link
Member

Choose a reason for hiding this comment

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

@ajosh0504 I've checked the ft_module_auditbeat dataset and it has "event.category": "audit-rule" (see screenshot), so it's ok that it doesn't match.
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes event.category was added last year and this Auditbeat data may be from 2019 so that test will have to be skipped until we have newer data.

Copy link
Member

Choose a reason for hiding this comment

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

I've created a reminder issue to decide whether or not to update the dataset, see #101910.
For now it's fine to not have the security_auth in the list of expected modules for the "old" auditbeat dataset.

this test modules uses older Auditbeat data which predates the event.category field so the test has to be skipped per https://elastic.zoom.us/j/93000943632?pwd=TmpvNWhtYUNzMUc0c0N6Tlc2QlVPZz09
Craig added 2 commits June 10, 2021 11:08
needs to be a single line
Some linters want spaces and some linters want no spaces. This linter wants spaces.
Craig and others added 3 commits June 10, 2021 15:03
added description text
removed a wayward newline char
@ajosh0504
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@blaklaybul blaklaybul left a comment

Choose a reason for hiding this comment

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

Jobs and datafeed configs look good, but I am a bit concerned about the low model memory limits. For auth_high_count_logon_events_for_a_source_ip we have a limit of 12mb. In other modules we've used 128, 256, or 512 mb for jobs with by or partition fields that could have high cardinality - can we bump these up a bit here?

@ajosh0504
Copy link
Contributor Author

@blaklaybul We'll update that. Is there a standard limit for low cardinality jobs as well? I have seen 16/32 mb in some of the jobs.

@blaklaybul
Copy link
Contributor

blaklaybul commented Jun 14, 2021

@ajosh0504 for the existing jobs, we did thorough testing on live systems to arrive at the memory limits we ship with. Fields with a potential for higher cardinality warrant higher limits. source.ip can really get up there in cardinality! For example, this job uses a simple count detector, but we still have the limit set fairly high since the systems these are meant to be run on can be quite large.

I would suggest testing these new jobs on live system to get better memory estimates, or at least setting them
conservatively to > 128mb

@randomuserid
Copy link
Contributor

randomuserid commented Jun 14, 2021

@ajosh0504 for the existing jobs, we did thorough testing on live systems to arrive at the memory limits we ship with. Fields with a potential for higher cardinality warrant higher limits. source.ip can really get up there in cardinality! For example, this job uses a simple count detector, but we still have the limit set fairly high since the systems these are meant to be run on can be quite large.

I would suggest testing these new jobs on live system to get better memory estimates, or at least setting theme conservatively to > 128mb

They were tested on a medium sized prod cluster and we set the memory minimums to a multiple of what we saw there. We can increase it again though

@blaklaybul
Copy link
Contributor

@randomuserid Ok, but 6mb seems fairly low for this job which uses source.ip as a by field and has a partition field of user.name. I would think that this config when run on a large system would require significantly more memory than that.

Using another example - high_count_by_destination_country uses a relatively simple config with a known number of potential by field values and we set the memory limit to 32mb.

raised memory limits to 128mb which is larger than the highest observed peak model bytes for the most memory hungry jobs in this event class.
@randomuserid
Copy link
Contributor

@randomuserid Ok, but 6mb seems fairly low for this job which uses source.ip as a by field and has a partition field of user.name. I would think that this config when run on a large system would require significantly more memory than that.

Using another example - high_count_by_destination_country uses a relatively simple config with a known number of potential by field values and we set the memory limit to 32mb.

How's this: I increased each to 128MB which is a bit more then the largest observed peak model bytes for any job in this event class. That should be sufficient for most data sets.

Copy link
Contributor

@blaklaybul blaklaybul left a comment

Choose a reason for hiding this comment

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

New mem limits LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 6.9MB 6.9MB +16.0B

History

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

cc @ajosh0504

Copy link
Contributor

@randomuserid randomuserid left a comment

Choose a reason for hiding this comment

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

:shipit:

@ajosh0504 ajosh0504 merged commit 35f9625 into master Jun 14, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Jun 14, 2021
…eat, Winlogbeat, Filebeat and Logs) (elastic#101840)

* Adding Security Authentication jobs in 7.14

* Renamed some jobs

* Changing memory limits and linting change

* Linting fix

* Changed the order

* Adding module to ml_modules.tsx

* Update recognize_module.ts

this test modules uses older Auditbeat data which predates the event.category field so the test has to be skipped per https://elastic.zoom.us/j/93000943632?pwd=TmpvNWhtYUNzMUc0c0N6Tlc2QlVPZz09

* Update recognize_module.ts

needs to be a single line

* Update recognize_module.ts

Some linters want spaces and some linters want no spaces. This linter wants spaces.

* descriptions

added description text

* Update auth_rare_hour_for_a_user.json

removed a wayward newline char

* Minor nitpicking

* memory limits

raised memory limits to 128mb which is larger than the highest observed peak model bytes for the most memory hungry jobs in this event class.

Co-authored-by: Craig <mailredirector36@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@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 Jun 14, 2021
…eat, Winlogbeat, Filebeat and Logs) (#101840) (#102127)

* Adding Security Authentication jobs in 7.14

* Renamed some jobs

* Changing memory limits and linting change

* Linting fix

* Changed the order

* Adding module to ml_modules.tsx

* Update recognize_module.ts

this test modules uses older Auditbeat data which predates the event.category field so the test has to be skipped per https://elastic.zoom.us/j/93000943632?pwd=TmpvNWhtYUNzMUc0c0N6Tlc2QlVPZz09

* Update recognize_module.ts

needs to be a single line

* Update recognize_module.ts

Some linters want spaces and some linters want no spaces. This linter wants spaces.

* descriptions

added description text

* Update auth_rare_hour_for_a_user.json

removed a wayward newline char

* Minor nitpicking

* memory limits

raised memory limits to 128mb which is larger than the highest observed peak model bytes for the most memory hungry jobs in this event class.

Co-authored-by: Craig <mailredirector36@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Apoorva Joshi <30438249+ajosh0504@users.noreply.github.com>
Co-authored-by: Craig <mailredirector36@gmail.com>
cuff-links pushed a commit to cuff-links/kibana that referenced this pull request Jun 15, 2021
…eat, Winlogbeat, Filebeat and Logs) (elastic#101840)

* Adding Security Authentication jobs in 7.14

* Renamed some jobs

* Changing memory limits and linting change

* Linting fix

* Changed the order

* Adding module to ml_modules.tsx

* Update recognize_module.ts

this test modules uses older Auditbeat data which predates the event.category field so the test has to be skipped per https://elastic.zoom.us/j/93000943632?pwd=TmpvNWhtYUNzMUc0c0N6Tlc2QlVPZz09

* Update recognize_module.ts

needs to be a single line

* Update recognize_module.ts

Some linters want spaces and some linters want no spaces. This linter wants spaces.

* descriptions

added description text

* Update auth_rare_hour_for_a_user.json

removed a wayward newline char

* Minor nitpicking

* memory limits

raised memory limits to 128mb which is larger than the highest observed peak model bytes for the most memory hungry jobs in this event class.

Co-authored-by: Craig <mailredirector36@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@spalger spalger deleted the security_auth_jobs branch May 8, 2022 22:01
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 :ml release_note:feature Makes this part of the condensed release notes v7.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants