Skip to content

Add global FIM and system inventories #7368

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

Open
wants to merge 227 commits into
base: 4.13.0
Choose a base branch
from

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented Mar 21, 2025

Description

This pull request adds global FIM and system inventories.

Changes:

  • Add FIM and system inventory data sources
  • Add new app IT Hygiene to Security operations category
  • Add IT Hygiene to agent menu
  • Add new settings to define the new index patterns:
    • system_inventory.pattern
    • fim.pattern
  • Add reusable components related to explore indexer data in tables to use in different use cases
  • Move hardware/software information from Inventory data to agent overview
  • Replace the FIM file details based on Wazuh server API data to Wazuh indexer in the agent welcome
  • Enhance useDataGrid to manage error on initialization
  • Add some reusable HOCs and hooks related to data source, index pattern and wrap component
  • Add sample data generator for FIM and system inventory states
  • Remove GET /api/syscollector endpoint
  • Remove POST /reports/agents/{agentID}/inventory API endpoint and extended reporting information related to syscollector
  • Remove Inventory data views and button from agent overview
    • Remove reporting
  • Remove example request related to syscollector from Dev Tools
  • Fix the validation of data source repository for vulnerabilities to use the vulnerabilities.pattern setting.
  • Add title prop to WzRibbon
  • Enhance useValueSuggestion hook to support boolean fields and add a workaround (:warning: low performance) to fetch suggestions for fields different to boolean or string
  • @guidomodarelli Sets the size property of the filter button component to 's' for a smaller appearance. (f6e2ebe)
Screen.Recording.2025-04-30.162009.mp4

Side changes

  • Fix the selection of index pattern for vulnerabilities inventory data using a related index pattern to the defined in vulnerabilities.pattern setting instead of searching index pattern with title/id that contains vulnerabilities.
  • Unused side changes that could be useful in the future and were developed in the different iterations of the issue:
    • "Flex" layout to workaround a problem with EuiDataGrid and flex containr based in the usage of display:table
    • Create hook to create new filter manager instance
    • Create unfinished custom combo box input for using as filter in the WzSearchBar
    • Create hook to split the user and managed filter for using in the WzSearchBar
    • Create component to wrap the custom filter in the WzSearchBar

Issues Resolved

#27903

Evidence

FIM > Inventory
image
image

IT Hygiene > Dashboard

  • Overview
    image

  • Agent

image

IT Hygiene > Inventory
image
image
image

Agent overview
image
image
image

Dev Tools
image

New settings
image
image

Test

This pull request adds a sample data generator, see scripts/sample-data/README.md. The indexed sample data expects you use the imposter API.

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

Test Chrome Firefox Safari
Go to agent welcome and the hardware/system information should be displayed in a new panel
Go to agent welcome and click on in a FIM file and it should open a flyout with the inventory details related to the selected file
Go to Server management > Dev Tools and it should not have any request related to syscollector (clean browser)
Go to File integrity monitoring > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected.
Go to System inventory > IT Hygiene > Dashboard and test the queries, filters and the dashboard represents the expected data.
Go to System inventory > IT Hygiene > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected.
With no FIM indices and no index pattern, go to File integrity monitoring > Inventory and this should display a prompt
With no System inventory indices and no index pattern, go to IT Hygiene > Inventory and this should display a prompt
With no System inventory indices and no index pattern, go to IT Hygiene > Dashboard and this should display a prompt
With no FIM indices and index pattern, go to File integrity monitoring > Inventory and this should display a prompt related to data source was not initialized
With no System inventory indices and index pattern, go to IT Hygiene > Inventory and this should display a prompt related to data source was not initialized

Details

⚫ Go to agent welcome and the hardware/system information should be displayed in a new panel

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to agent welcome and click on in a FIM file and it should open a flyout with the inventory details related to the selected file

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to Server management > Dev Tools and it should not have any request related to syscollector (clean browser)

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to File integrity monitoring > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to System inventory > IT Hygiene > Dashboard and test the queries, filters and the dashboard represents the expected data.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to System inventory > IT Hygiene > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no FIM indices and no index pattern, go to File integrity monitoring > Inventory and this should display a prompt

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no System inventory indices and no index pattern, go to IT Hygiene > Inventory and this should display a prompt

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no System inventory indices and no index pattern, go to IT Hygiene > Dashboard and this should display a prompt

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no FIM indices and index pattern, go to File integrity monitoring > Inventory and this should display a prompt related to data source was not initialized

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With no System inventory indices and index pattern, go to IT Hygiene > Inventory and this should display a prompt related to data source was not initialized

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Desvelao added 20 commits March 11, 2025 08:58
- Replace FIM inventory table based on indexer data
- Add `fim.pattern` setting to define the FIM index pattern
…based on indexer data

- Replace the tables of agent system inventory based on indexer data
- Create sample datasets for system inventory
- Create a OpenSearch Dashboards client with ability to:
  - Saved objects/index patterns: create, delete, get all, exists
- Add the ability to create the index pattern into Wazuh dashboard
- Move repeated logic from datasets to common file
…licts because the this was created due to component is mounted 2 times triggering the creation 2 times in parallel
- Add useNewFilterManager hook
- Add additional tabs for document details
- Add data sources
- Add system inventory apps:
  - Hosts
  - Network
  - Software
  - Processes
- Split FIM inventory into files and registries
Removes options from suggestion hook dependencies to avoid re-fetching when only options change.
Desvelao and others added 13 commits April 30, 2025 10:09
Remove console.log

Co-authored-by: Guido Modarelli <[email protected]>
…to change/wz-27903-fim-system-inventory-tables-indexer-data
…e problem with embedables destroyed and unable to create dashboards
…te the problem with embedables destroyed and unable to create dashboards
Sets the size property of the filter button component to 's' for a smaller appearance.
@guidomodarelli
Copy link
Contributor

guidomodarelli commented Apr 30, 2025

Legend:
⚫ => The test hasn't started yet.
🟢 => All checks passed.
🟡 => There is at least one expected fail or skipped test and no failures.
🔴 => There is at least one failed check.
⚪ => Doesn't apply.
🔧 => Request changes.
❓ => Needs more information.

🧪 Test 2025/04/30

Test Chrome
Go to agent welcome and the hardware/system information should be displayed in a new panel 🟢
Go to agent welcome and click on in a FIM file and it should open a flyout with the inventory details related to the selected file
Go to Server management > Dev Tools and it should not have any request related to syscollector (clean browser) 🟢
Go to File integrity monitoring > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected. 🟢
Go to System inventory > IT Hygiene > Networks > Networks and test the queries, filters and the dashboard represents the expected data. 🟢
With no FIM indices and no index pattern, go to File integrity monitoring > Inventory and this should display a prompt 🟢
With no System inventory indices and no index pattern, go to IT Hygiene > Inventory and this should display a prompt 🟢
With no FIM indices and index pattern, go to File integrity monitoring > Inventory and this should display a prompt related to data source was not initialized 🟢

Details

🟢 Go to agent welcome and the hardware/system information should be displayed in a new panel

Chrome - 🟢

image

❓ Go to agent welcome and click on in a FIM file and it should open a flyout with the inventory details related to the selected file

Chrome - ❓ I loaded the SampleData both from the UI and from the SampleData script, and I can't see the details related to the selected file.

$ py script.py states-fim-files
INFO:configuration:Loaded configuration from file [config.json]
INFO:configuration:Configuration for [indexer]: [{'ip': '0.0.0.0', 'password': 'admin', 'port': '9200', 'username': 'admin'}]
Configuration is valid for [indexer], do you want to use it? [Y/n]:
INFO:configuration:Configuration for [dashboard]: [{'password': 'admin', 'url': 'https://localhost:5601', 'username': 'admin'}]
Configuration is valid for [dashboard], do you want to use it? [Y/n]:
INFO:opensearch:HEAD https://0.0.0.0:9200/ [status:200 request:0.052s]
INFO:__main__:Running dataset [states-fim-files]
INFO:configuration:Configuration for [dataset/states-fim-files/index]: [{'count': '10000', 'index_name': 'wazuh-states-fim-files-sample'}]
Configuration is valid for [dataset/states-fim-files/index], do you want to use it? [Y/n]:
INFO:opensearch:HEAD https://0.0.0.0:9200/wazuh-states-fim-files-sample [status:200 request:0.003s]
INFO:states-fim-files:Index found [wazuh-states-fim-files-sample]
Remove the [wazuh-states-fim-files-sample] index? [Y/n]
INFO:opensearch:DELETE https://0.0.0.0:9200/wazuh-states-fim-files-sample [status:200 request:0.053s]
INFO:states-fim-files:Index [wazuh-states-fim-files-sample] deleted
INFO:opensearch:PUT https://0.0.0.0:9200/wazuh-states-fim-files-sample [status:200 request:0.117s]
INFO:states-fim-files:Index [wazuh-states-fim-files-sample] created
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.036s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.036s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.036s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.054s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.038s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.038s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.036s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.034s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.033s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.033s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.046s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.042s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.055s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.037s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.035s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.034s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.043s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.037s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.034s]
INFO:opensearch:POST https://0.0.0.0:9200/wazuh-states-fim-files-sample/_bulk [status:200 request:0.038s]
INFO:states-fim-files:Data was indexed into [wazuh-states-fim-files-sample]
INFO:configuration:Configuration for [dataset/states-fim-files/index_pattern]: [{'create_index_pattern': 'n', 'index_pattern_name': ''}]
Configuration is valid for [dataset/states-fim-files/index_pattern], do you want to use it? [Y/n]:

image

🟢 Go to Server management > Dev Tools and it should not have any request related to syscollector (clean browser)

Chrome - 🟢

image

🟢 Go to File integrity monitoring > Inventory and test the queries, filters and the table represents the expected data. Ensure the document details is working as expected.

Chrome - 🟢

Screen.Recording.2025-04-30.174606.mp4
🟢 Go to System inventory > IT Hygiene > Networks > Networks and test the queries, filters and the dashboard represents the expected data.

Chrome - 🟢

Screen.Recording.2025-04-30.175553.mp4
🟢 With no FIM indices and no index pattern, go to File integrity monitoring > Inventory and this should display a prompt

Chrome - 🟢

image

🟢 With no System inventory indices and no index pattern, go to IT Hygiene > Inventory and this should display a prompt

Chrome - 🟢

image

🟢 With no FIM indices and index pattern, go to File integrity monitoring > Inventory and this should display a prompt related to data source was not initialized

Chrome - 🟢

image

@Desvelao
Copy link
Member Author

Desvelao commented May 2, 2025

@guidomodarelli , regarding the test:

❓ Go to agent welcome and click on in a FIM file and it should open a flyout with the inventory details related to the selected file

That displayed message in the flyout indicates that could not find data related to that file in the FIM files indices. The table that opens the flyout is related to alerts data, so in some cases or using the sample data that does not match the sample file paths in alerts and files inventory, you could have alerts related to a file, but there is no data in the FIM files. If you click in a file path (alert data) that you has information in the FIM inventory states, you should see that information. I will add a fix to ensure the sample data path in the FIM files inventory and alerts match, so this can be tested.

Copy link
Contributor

github-actions bot commented May 5, 2025

Wazuh Core plugin code coverage (Jest) test % values
Statements 45.41% ( 411 / 905 )
Branches 41.09% ( 157 / 382 )
Functions 41.84% ( 136 / 325 )
Lines 45.59% ( 409 / 897 )

Copy link
Contributor

github-actions bot commented May 5, 2025

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 78.72% ( 185 / 235 )
Branches 62.72% ( 69 / 110 )
Functions 61.7% ( 29 / 47 )
Lines 78.72% ( 185 / 235 )

Copy link
Contributor

github-actions bot commented May 5, 2025

Main plugin code coverage (Jest) test % values
Statements 16.92% ( 5083 / 30039 )
Branches 10.37% ( 1990 / 19174 )
Functions 17.63% ( 1287 / 7300 )
Lines 17.18% ( 4970 / 28927 )

@guidomodarelli
Copy link
Contributor

@guidomodarelli , regarding the test:

❓ Go to agent welcome and click on in a FIM file and it should open a flyout with the inventory details related to the selected file

That displayed message in the flyout indicates that could not find data related to that file in the FIM files indices. The table that opens the flyout is related to alerts data, so in some cases or using the sample data that does not match the sample file paths in alerts and files inventory, you could have alerts related to a file, but there is no data in the FIM files. If you click in a file path (alert data) that you has information in the FIM inventory states, you should see that information. I will add a fix to ensure the sample data path in the FIM files inventory and alerts match, so this can be tested.

🟢 image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Global queries - Dashboard add sections for fim and system inventory data (dashboard, inventory, events)
2 participants