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

[Lateral Movement Detection] Add dashboard and release to production #4974

Merged
merged 19 commits into from
Jan 23, 2023

Conversation

sodhikirti07
Copy link
Contributor

@sodhikirti07 sodhikirti07 commented Jan 11, 2023

What does this PR do?

This PR adds the following enhancements in the Lateral Movement Detection package:

  • Dashboard
  • Updated README with instructions to add dashboard
  • Updated changelog and manifest yml files: added a new condition property for premium subscription, changed package version for production release and added license.
  • Added ML tags and bumped version in security rules

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

Refer to below comment for screenshots!

@sodhikirti07 sodhikirti07 requested a review from a team as a code owner January 11, 2023 22:19
@sodhikirti07
Copy link
Contributor Author

Lateral Movement Detection package updated for version 0.0.2 with dashboard asset:

image

Anomaly detection jobs created and started:

image

Detection rules enabled and started without warnings:

image

ML tag added to the detection rules using machine learning jobs:

image

Dashboard asset installed and available without any errors:

image

image

Copy link
Contributor

@szeitlin szeitlin left a comment

Choose a reason for hiding this comment

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

Looks great! Ship it!

Great work getting this done so fast! 🎉

@elasticmachine
Copy link

elasticmachine commented Jan 11, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-01-20T16:24:01.852+0000

  • Duration: 15 min 43 sec

Test stats 🧪

Test Results
Failed 0
Passed 1
Skipped 0
Total 1

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

Copy link
Member

@susan-shu-c susan-shu-c left a comment

Choose a reason for hiding this comment

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

🚀

@sodhikirti07
Copy link
Contributor Author

sodhikirti07 commented Jan 18, 2023

Screenshot of dashboard with data:

image

@andrewkroh andrewkroh added the Integration:lmd Lateral Movement Detection label Jan 18, 2023
@andrewkroh andrewkroh changed the title Add dashboard and release Lateral Movement Detection package in production [Lateral Movement Detection] Add dashboard and release to production Jan 18, 2023
packages/lmd/manifest.yml Outdated Show resolved Hide resolved
packages/lmd/manifest.yml Outdated Show resolved Hide resolved
Before going to the dashboard, make sure you have the following settings configured in your Kibana.
1. You have started the above anomaly detection jobs.
2. After enabling the jobs, go to **Management > Stack Management > Kibana > Data Views**.
3. Click on **Create data view** button and create a data view with an **Index pattern** of **.ml-anomalies***. Make sure you assign the same value to **Name** and **Custom data view ID** under **Show advanced settings**.
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed with @sodhikirti07, note that anyone viewing the dashboard will also need read access to the .ml-anomalies* index to be able to see the visualizations which query that index directly. To create the data view you also need to enable Allow hidden and system indices inside the Advanced settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for catching this. I've made the changes.

@@ -2,7 +2,8 @@ format_version: 2.2.0
name: lmd
title: "Lateral Movement Detection"
version: 1.0.0
license: "Elastic-2.0"
source:
license: "Elastic-2.0"
description: "ML package to detect lateral movement based on file transfer activity. Requires a Platinum subscription."
Copy link
Member

Choose a reason for hiding this comment

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

The package-spec [^1] appears to allow you to codify this with:

conditions:
  elastic:
    subscription: platinum

I'm not sure what the behavior is, but thought I would mention it.

https://github.com/elastic/package-spec/blob/60560379ad6ed5ffa6fc3beb13ec22ad89bdddc4/spec/integration/manifest.spec.yml#L42-L59

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!


The **Lateral Movement Detection Dashboard** is available under **Analytics > Dashboard**. This dashboard gives an overview of anomalies triggered for the lateral movement detection package.

Before going to the dashboard, make sure you have the following settings configured in your Kibana.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Before going to the dashboard, make sure you have the following settings configured in your Kibana.
For the dashboard to work as expected, the following settings need to be configured in Kibana.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

1. You have started the above anomaly detection jobs.
2. You have **read** access to **.ml-anomalies*** index or are assigned **machine_learning_user** role. For more information on roles, please refer to [Built-in roles in Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-roles.html).
3. After enabling the jobs, go to **Management > Stack Management > Kibana > Data Views**.
4. Click on **Create data view** button and create a data view with an **Index pattern** of **.ml-anomalies***. Make sure you assign the same value to **Name** and **Custom data view ID** under **Show advanced settings**. You also need to enable **Allow hidden and system indices** inside the **Advanced settings**.
Copy link
Contributor

Choose a reason for hiding this comment

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

Allow hidden and system indices should happen before they can proceed to naming the pattern, so maybe that should be the first sentence in the bullet.

Also maybe explicitly mention what the Name and Data View ID must be, since I'm guessing the dashboard is relying on a specific ID.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

},
"references": [
{
"id": ".ml-anomalies*",
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider making this index pattern more specific. I believe the job results go to .ml-anomalies-shared by default, unless you're specifying custom indices.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out! Changed the dashboard to include .ml-anomalies-shared index-pattern.

@@ -16,7 +16,8 @@
"tags": [
"Elastic",
"Lateral Movement Detection",
"host"
"host",
"ML"
],
"type": "machine_learning",
"version": 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Bump the version number since you're updating the rule.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@sodhikirti07 sodhikirti07 requested a review from a team as a code owner January 19, 2023 15:33
@sodhikirti07
Copy link
Contributor Author

@andrewkroh Thanks for mentioning this. Added the platinum subscription condition in manifest.yml and removed it from package description. @ajosh0504 @susan-shu-c We should do it for other packages as well.

image

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

manifest.yml changes LGTM,

Copy link
Contributor

@szeitlin szeitlin left a comment

Choose a reason for hiding this comment

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

lgtm!

packages/lmd/docs/README.md Outdated Show resolved Hide resolved
version: 1.0.0
source:
license: "Elastic-2.0"
description: "ML package to detect lateral movement based on file transfer activity."
Copy link
Contributor

Choose a reason for hiding this comment

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

I see Requires a Platinum subscription got removed <-- is this no longer true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is true for our package but I added it under condition property in manifest.yml. So, it will appear on right hand side of the package's main page (see the screenshot above).

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, I dislike how github doesn't have a way to insert screenshots into the code review view, so I was just looking at the code when I wrote that.

Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, in the future this is the kind of thing you could put in the description of the PR (it's ok to update that as you go along).

Co-authored-by: Sam Zeitlin <samantha.zeitlin@elastic.co>

For the dashboard to work as expected, the following settings need to be configured in Kibana.
1. You have started the above anomaly detection jobs.
2. You have **read** access to **.ml-anomalies*** index or are assigned the **machine_learning_user** role. For more information on roles, please refer to [Built-in roles in Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-roles.html).

Choose a reason for hiding this comment

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

Directly granting access to machine learning results indices has implications for using spaces to control ML job visibility. I think this should be made clear. Something along the lines of this:

Suggested change
2. You have **read** access to **.ml-anomalies*** index or are assigned the **machine_learning_user** role. For more information on roles, please refer to [Built-in roles in Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-roles.html).
2. You have **read** access to **.ml-anomalies*** index or are assigned the **machine_learning_user** role. For more information on roles, please refer to [Built-in roles in Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-roles.html). Please be aware that a user who has access to the underlying machine learning results indices can see the results of _all_ jobs in _all_ spaces. Do not grant these permissions if you use Kibana spaces to control which users can see which machine learning results. For more information on machine learning privileges see [here](https://www.elastic.co/guide/en/machine-learning/current/setup.html#setup-privileges).

Copy link
Contributor

@ajosh0504 ajosh0504 left a comment

Choose a reason for hiding this comment

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

Looking great! Nice work! 🚢

packages/lmd/docs/README.md Outdated Show resolved Hide resolved
sodhikirti07 and others added 4 commits January 19, 2023 12:13
Co-authored-by: Apoorva Joshi <30438249+ajosh0504@users.noreply.github.com>
Copy link

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

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

The ML permissions documentation LGTM.

@sodhikirti07 sodhikirti07 merged commit b87df11 into main Jan 23, 2023
@elasticmachine
Copy link

Package lmd - 1.0.0 containing this change is available at https://epr.elastic.co/search?package=lmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration:lmd Lateral Movement Detection
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants