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

The host configuration of GitHub and Office 365 modules is not kept when upgrading the plugin #5367

Closed
Desvelao opened this issue Apr 13, 2023 · 3 comments · Fixed by #5376, #5388 or #5389
Assignees
Labels
level/task Task issue type/bug Bug issue

Comments

@Desvelao
Copy link
Member

Desvelao commented Apr 13, 2023

Wazuh
4.4

Description
The host configuration for GitHub and Office 365 modules is not kept when the plugin is upgraded.

Steps to reproduce

  1. Enable the GitHub modules and Office365 from Settings/Modules and verify these sections appear in the menu or Modules directory
  2. Change the installed plugin to another compatible with the plugin platform and restart the plugin platform.
  3. The mentioned modules don't appear in the Modules directory

Expected Result

  1. The mentioned modules must keep the previous configuration to an upgrade

Actual Result

  1. The mentioned modules don't keep the previous configuration to an upgrade
@Desvelao
Copy link
Member Author

Desvelao commented Apr 13, 2023

Research

The configuration of the host modules is saved in the wazuh-registry.json file.

When the plugin is changed, the current Wazuh plugins have a mechanism to rebuild the wazuh-registry.json from the previous configuration.

For each API host present in the wazuh-registry.json file, the modules (called extensions in the file) are migrated following the next process:

  1. Get the modules from the previous configuration
  2. Remove all the modules that are not expected
  3. Merge the default module configuration with the result of the step 2

The problem is caused because the configuration of GitHub and Office365 modules are removed in the step 2 due to the resolution of the all supported modules don't contain it. This resolution of the all supported modules is coming from the plugin settings definition. I saw that the extensions.github and extensions.office is not present. This seems a side effect of when these modules were added in 4.3.0 that these settings were not added to the default wazuh.yml file.

Moreover, this could be causing the extensions.github and extensions.office don't appear in the default wazuh.yml configuration file.

Adding the extensions.github and extensions.office to the plugin settings should solve both problems.

@Desvelao
Copy link
Member Author

Desvelao commented Apr 13, 2023

Suggestion

It will be interesting to extend the issue to:

Tasks

  • [x ] Review all the modules that have the extension.<extension_id> setting
    • Review the default wazuh.yml file contains all the extensions.<extension_id> settings

    Some settings has not the related extensions.<module_id> setting.

  • Enhance tests related to the migration of API host extensions configuration of wazuh-registry.yml (server/start/initialize/index.test.ts)

@Desvelao Desvelao added the type/bug Bug issue label Apr 13, 2023
@Desvelao Desvelao self-assigned this Apr 14, 2023
@Desvelao
Copy link
Member Author

Desvelao commented Apr 14, 2023

Changes

  • Fixed the problem about the host module configuration is not kept for the GitHub and Office 365 modules.
  • Enhance related tests
  • Fix typos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment