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

Create initialization service #7133

Closed
2 tasks done
Tracked by #408
asteriscos opened this issue Oct 28, 2024 · 5 comments · Fixed by #7145
Closed
2 tasks done
Tracked by #408

Create initialization service #7133

asteriscos opened this issue Oct 28, 2024 · 5 comments · Fixed by #7145
Assignees
Labels
level/task Task issue type/enhancement Enhancement issue

Comments

@asteriscos
Copy link
Member

asteriscos commented Oct 28, 2024

Description

In Wazuh 4.x the health-check process is executed after each login to ensure the application has the necessary conditions to work properly. In Wazuh 5.0 we want to make this process transparent for the user and run initialization and status validation process in the backend. To achieve this we propose to create a specific service without user interface to run as a background task.

image

Objective

Tasks

The steps that have to be completed in order to close the issue.

  • Identify the tasks run by the health-check and plan the steps to migrate the process
  • Create a service to achieve this
@asteriscos asteriscos added type/enhancement Enhancement issue level/task Task issue labels Oct 28, 2024
@asteriscos asteriscos changed the title Migrate health check process Create initialization plugin Oct 28, 2024
@wazuhci wazuhci moved this to Backlog in Release 5.0.0 Nov 4, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 5.0.0 Nov 4, 2024
@Desvelao
Copy link
Member

Desvelao commented Nov 5, 2024

Current application

The current healthcheck is a centralized path of each application that checks and creates the minimal items to work: such as index patterns (alerts, monitoring, statistics), edits some settings, checks the connection with Wazuh API server and version compatibility.

Some of these checks (index patterns and settings), create/edit items that depend on the selected tenant of the logged user.

Some checks are done when changing the URL path and could cause a redirection to the healthcheck. The http client can capture errors related to Wazuh server API connection and redirect to the heatlhcheck too.

Migration ideas

Localized checks

Run the localized checks in the application, page, or tab level that allows to decouple the checks but could increase the time between navigation. Implementing a cache system for the checks could reduce the check frequency.

Parallel process

Run the checks in a parallel way. Display the status with bottom bar, notifications.

Job in the backend side of Wazuh dashboard

Create items on the backend side when the Wazuh dashboard starts.

New store system for saved objects

Store the saved objects (index patterns, settings, future dashboards) into a new store. This could allow the initialization of the items as a job in the backend side of the Wazuh dashboard, but creates a different way to manage similar items. To solve this problem, maybe we could customize the items that are returned when fetching items related to an specific tenant: tenant + Wazuh central items info.

@Desvelao
Copy link
Member

Desvelao commented Nov 5, 2024

Meeting

We have decided to run a backend job to initialize the minimal items to work (TBD) when the Wazuh dashboard starts in the global tenant.

The setup of other tenants could need some manual step.

We should explore the possibility to setup the items depending on the tenant. This could allow to setup other tenants on demand.

@Desvelao
Copy link
Member

Desvelao commented Nov 5, 2024

Initialization service

I created a new service to manage the initiation tasks. This provides a mechanism to register tasks that will be run when the wazuCore plugin starts (plugin lifecycle). This approach allows the tasks can be registered by other plugins. Moreover I added some execution data that could be used in the future to display the task information in the UI.

Migrate health check tasks

The checks done in the health check of the frontend side must be migrated to the backend side as initiation tasks:

  • Ensure the existence of index patterns (alerts, statistics, vulnerabilities-states, etc...)
  • Check external index pattern templates
  • Check connection and compatibility of the Wazuh server API with the Wazuh dashboard versions

Tasks tenant-dependant

For the tasks that manage data in the tenant, these will store data in the internal repository (global tenant when multitenancy is enabled).

For other tenants:
The tasks can be executed through API endpoints.

@Desvelao
Copy link
Member

Desvelao commented Nov 7, 2024

Checks

  • Check connection with the Wazuh server API
  • Check compatibility with the Wazuh server API
  • Check existence of alerts index pattern (create if this does not exist)
  • Check existence of monitoring index pattern (create if this does not exist)
  • Check existence of statistics index pattern (create if this does not exist)
  • Check existence of vulnerabilities-states index pattern (create if this does not exist)
  • Check existence of defined template for the alerts index pattern

@Desvelao
Copy link
Member

Update

I am working into adding some API endpoints to retrieve data or run initialization task user-scoped that could replace the current health check done in the frontend side.

@Desvelao Desvelao linked a pull request Nov 11, 2024 that will close this issue
6 tasks
@wazuhci wazuhci moved this from In progress to On hold in Release 5.0.0 Nov 20, 2024
@wazuhci wazuhci moved this from On hold to In progress in Release 5.0.0 Nov 26, 2024
@Desvelao Desvelao changed the title Create initialization plugin Create initialization service Nov 27, 2024
@wazuhci wazuhci moved this from In progress to Pending review in Release 5.0.0 Nov 27, 2024
@wazuhci wazuhci moved this from Pending review to Done in Release 5.0.0 Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/enhancement Enhancement issue
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants