Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the management of plugins configuration (#6337)
* feat(logging): remove plugin logger from start tasks of main plugin - Enhance the logging messages - Minor enhancements * feat(logging): minor fixes to logging messages in the main plugin * feat(logging): remove custom logger from endpoints of main plugin * fix(logging): remove parameter of addJobToQueue * feat(core): replace the loggin service and move services to core plugin - Replace the logging services - Move services to core plugin - CacheAPIUserAllowRunAs - ManageHosts - ServerAPIClient (aka api-interceptor) - ServerAPIHostEntries (aka ) - UpdateConfigurationFile - UpdateRegistry - Adapt the usage of services in the main and check updates plugin from core plugin - Remove plugin logger from main and core plugins - Remove API endpoint - GET /utils/logs/ui - Remove unused code - Adapt the test suites * feat(logging): removed constants related to log files path * fix(dependency): removed winston dependency of plugins and update the yarn.lock files * fix(logging): removed logs.level plugin setting * fix(logging): fixed monitoring and statistics backend tasks * fix(monitoring): manage API host entries * feat(core): add description to core services classes * feat(docs): add docs to core plugin * feat(docs): add description to core services * test: fix of check updates plugin * test: fix of check updates plugin * feat(logging): remove the App logs application - Remove GET /utils/logs endpoint - Remove related tests - Remove App logs application * fix: typo in UpdateRegistry service * feat: add InputFormPassword component * feat: add Configuration and ConfigurationStore services for core plugin - Create Configuration service - Create ConfigurationStore (backend and frontend side) - Register the plugin settings in the configuration services * feat: adapt API endpoints related to configuration to use the Configuration service - API endpoints: - GET /utils/configuration - PUT /utils/configuration - PUT /utils/configuration/files/{key} - DELETE /utils/configuration/files/{key} * feat: adapt the monitoring task of main plugin to use the Configuration service * fix: remove unwanted log * feat: adapt API endpoints related to sample data to the configuration service * feat: enhance plugin settings to define the mapping in the saved object * remove: remove buildIndexSettings service * feat(configuration): remove reference to configuration file in App Settings * feat(uilib): create buttons that opens flyouts * fix: plugin settings definition * feat(configuration): manage API host entries from the Server APIs application - Create API endpoints to manage the API host entries - PUT /hosts/apis/{id} - DELETE /hosts/apis/{id} - Replace the Add new button on Server APIs application. Now it opens a flyout with a form to add the new API host - Add edit and delete buttons to the table in Server APIs application - Remove the render of old AddAPI component through AngularJS - Remove deprecated methods of AngularJS controller related to Server APIs application - Extend the definition of routes of main plugin to accept and use the configuration to validate the related endpoints * feat(configuration): minor fixes and rename field in the settings definition - Rename the `persistence` field to `store` in the settings definition to define how to store in the backend side - Add readme files related to Configuration and ConfigurationStore services - Add test for Configuration service - Minor fixes in the Configuration service - Define new methods for the Configuration instance of the frontend for the core plugin * feat(configuration): code format to categories * feat(configuration): renamed persistence to store in the setting definition of main plugin * feat(configuration): workaround for cron.statistics.interval validation funtions * fix(configuration): remove validation of body to delete API host entry from configuration * feat(configuration): refactor ManageHosts service - Refactor ManageHosts service: - Integrate the services within the ManageHosts service: - CacheAPIUserAllowRunAs - ServerAPIHostEntries - Renamed: - `serverAPIHostEntries.getHostsEntries` to `.getEntries` - `.getHostById` to `.get` - Adapted the usage of previous separated services - Replaced the logic in the `DELETE /hosts/apis/{id}` by the usage of ManageHosts.delete instead of using the Configuration service - Adapted the export types in the setup and start plugin life cycle methods - Removed ServerAPIHostEntries: the methods were moved to ManageHosts service * feat(configuration): remove unused UpdateConfigurationFile service * fix(configuration): remove API host entry from the Server APIs table * feat(configuration): remove getConfiguration service - Remove getConfiguration service from the core and main plugins - Replace partially the usage of getConfiguration service by Configuration - Add configuration dependency to the ReportPrinter and adapt when getting the configuration - Replace the usage on GET /api/logos - Replace some usages on the monitoring and statistics jobs - Enhance the backend Configuration service with a .getCustomizationSetting method (replace the logic of old getCustomizationSetting) - Remove the getCustomizationSetting service * feat(configuration): enhance .getEntries method of ManageHost service - Enhance .getEntries method of ManageHost service - Adapt usage - Enhance IConfiguration type * feat(configuration): Close flyout of adding/editing API host entry when applying the configuration - Close flyout of adding/editing API host entry when applying the configuration * fix(configuration): enhance the WzButtonOpenFlyout and WzButtonPermissionsOpenFlyout buttons * fix(configuration): remove some unused services related to settings * fix(configuration): workaround-to-be-adapted to display the Server API tables despite the current API is down * fix(configuration): adapt the App Settings applications to the new Configuration service * fix(configuration): add support to the useForm for arrayOf field type * test: fix tests of check-updates plugin * test(configuration): fix some tests * feat(configuration): remove usage of getConfiguration deprecated service * feat(configuration): remove deprecated services - Remove deprecated services: - getCategorySettingByTitle - getSettingDefaultValue - getSettingsDefault - getSettingsByCategories - getSettingsDefaultList - groupSettingsByCategory - getPluginSettingDescription - services related to the creation of the initial file configuration * feat(configuration): enhance Configuration.get method cloning the value to return * remove(configuration): commented validations * remove(configuration): category settings defition in the main plugin * fix(configuration): enhance configuration store - Enhance ConfigurationStore services (frontend and backend side) - Some replacements of the usage of configuration service * fix(test): fix tests related to configuration * fix(test): fix some tests * test: enhance tests * feat(configuration): remove reference to wazuh.yml file path * feat(configuration): add Encryptation backend service - Add Encryptation backend service - Create tests - Add new `wazuh_core.encryptation.password` plugin config to be used by this service - Create instance of this within the ConfigurationStore of the backend side - Enhance the docs * feat(security): add new DashboardSecurity service to frontend - Add new DashboardSecurity service to frontend - Moved the logic of checkCurrentSecurityPlatform service to a method of the new service. Adapt its usage. - Replace the logic in the Server API table to use the new service to manage the button permissions - Create instance in the core plugin and expose to rest of plugins - Move routeDecoratorProtectedAdministratorRoleValidToken to a new routeDecoratorProtectedAdministrator route decorator to protect the routes related to manage the configuration. - Affected endpoints: - PUT /hosts/apis/{id} - DELETE /hosts/apis/{id} - PUT /utils/configuration - PUT /utils/configuration/files/{key} - DELETE /utils/configuration/files/{key} - Adapted related tests - Enhance types of public in core plugin - Add new method isAdministrator to the security factories in the backend side * feat(configuration): error when updating partial configuration in App Settings * git(configuration): rename Encryptation to Encryption service - Rename Encryptation to Encryption service - Moved the enhancement of Configuration service of the core plugin in the frontend side * feat(encryption): moved the default value to constants * todo: add todo * docs(configuration): add a configuration readme file - Create `user-manual` folder on `docs` of core plugin * feat(configuratio): move the API is down view - Move the API is down view - Remove render through AngularJS template - Remove properties defined in controller - Add a new callout to render in Server APIs - Include a button that opens a flyout with a basic troubleshooting * fix(configuration): conditional view API is down callout * feat(configuration): remove references to wazuh.yml * feat(configuration): add a task to migrate the configuration file - Add a task to migrate the configuration file > After the migration, the configuration file is renamed to avoid the future updates * feat(configuration): rename plugin settings properties - Rename setting property: isConfigurableFromFile to isConfigurableFromSettings - Remove setting property: isConfigurableFromUI - Remove the settingss definition on the main plugin and some types. Adapt the usage of types from the core plugin. * fix(configuration): fix password fields on editing API host entry - Fix password fields on edition API host entry that displayed an error when this was not modified * fix(configuration): fix error adding an API host entry * fix(configuration): fix redefinition of styles related to EuiFormRow * feat(configuration): reafactor the administrator user - Create API endpoint: GET /utils/account/is-admin - Refactor the DashboardSecurity method to get if the current user is an admin or not * fix(configuration): fix default value of port setting of an API entry * fix(configuration): fix response when the current user is not an administrator * feat(configuration): add wazuh_core.security.administrator.roles plugin setting - Add add wazuh_core.security.administrator.roles plugin setting to define the administrator users * feat(configuration): fixed response of ConfigurationStore when updating settings on the server side * todo(configuration): add todo * feat(configuration): add CLI to udpate the configuration from file * feat(configuration): replace the label of Add API host button * feat(configuration): add endpoint to clear the configuration - Add endpoint to clear the configuration: POST /utils/configuration/clear - Clear the configuration in the migration or script to set the configuration * feat(confgiuration): change API endpoint /utils/account/is-admin to /utils/account * feat(configuration): refactor response of GET /utils/account API endpoint - Rename properties of response of GET /utils/account - is_admin to administrator - message to administrator_message * feat(configuration): add an option to clear the previous configuration * feat(configuration): support for multiple instances of configuration - Support for multiple instances of configuration that gives the ability to deploy multiple instances of Wazuh dashboard with independant configurations * feat(configuration): apply the migration process if there is no saved object stored - Changes in the migrate configguration from file process: - Apply the migration process if there is no saved object stored yet. - Remove the renaming of file * fix: remove the requirement of administrator user to remove reports in the Reports application * feat(configuration): rename wazuh_core.configuration.instance to wazuh_core.instance * remove: remove unused import * feat(configuration): add user account data to Redux store * feat(authorization): replace the authorization for the administrator actions - Change in Redux: - Create userAccount property in the appStateReducers - Create action creator for the userAccount property - Fetch the userAccount data when the application is initiated - Remove previous management of administrator actions - Remove Redux action creator - Remove state property - Remove hooks - Remove HOCs - Remove constants from main and core plugins: - WAZUH_ROLE_ADMINISTRATOR_ID - WAZUH_ROLE_ADMINISTRATOR_NAME - Replace the optional requirement of API roles by plugin administrator in the WzButtonPermissions - Replace the optional requirement of API roles by plugin administrator in the authorization HOCs - Replace the protection of endpoints to use the plugin administrator instead of based in API roles: - POST /elastic/samplealerts/{category} - DELETE /elastic/samplealerts/{category} * fix(configuration): replace the usage of deprecated getSettingDefaultValue * fix: tests * feat: rename platform setting from wazuh_core.configuration.encryption_password to wazuh_core.configuration.encryption_key * fix: tests * feat: rename script to setup the configuration * feat(configuration): consider administrator used based on rest API access - Replace the logic to consider the administrator user based on the rest API access - Removed plugin setting: wazuh_core.security.administrator.roles - Removed the required configuration of the DashboardSecurity service that is not necessary anymore * feat(configuration): remove unused constant * feat(configuration): fix clear * feat(configuration): add cache to ConfigurationStore backend service - Create CacheTTL class - Add cache to ConfigurationStoreBackend * fix(cache): wrong returned value * fix(menu): minor bugs - Fix infinte loop of requests when there are not configured API hosts entries - Fix update of API hosts entries when changin the index pattern * fix: fix update API host list when swithching the index pattern * fix: apply buton was disabled when editing * fix: adapt the configuration management to the stastistics job * fix: sort the plugin setting categories by title * fix: display callout related to API seems to be down * fix: remove unused file * fix: remove some unwanted comments * fix: tests * fix: resolve some todos * changelog: add pull request entries * fix: renamed some referecnts to API hosts by API connections * fix: refactor update API host entry to use the ManageHosts instance instead * fix: missing variable * feat: move test of plugin setting input value validation to core plugin * fix: replace refernces to API connections * feat: add confirm modal to WzButtonPermissionsOpenFlyout and WzButtonOpenFlyout * fix: variable name * fix: move some AngularJS dependencies to the component in the ApiTable component * fix: remove console log on setup-configuration script * fix: execution of setup-script through the sh script * fix: replace details button about the available updates * feat(manage-hosts): enhance the management of API connections - Create API endpoint to create API connections: - POST /hosts/apis/{id} - Adapt the API request done by the form of API connection - Adapt setup-configuration script to use the new API endpoint - Add method to create API connection to the ManageHosts service * feat: add platform server mock and wazuh-host test * fix: enhance error messages in API endpoints related to API hosts management * feat: enhance setup-configuration script * fix: description of API endopoint controller * fix: clear and reset method of Configuration service * feat(configuration): replace the management of setup the plugins configuration - Create new API endpoint to import a configuration file - POST /utils/configuration/import - Create method to enhance the configuration of the backend side to manage the importation - Remove duplicated code to check if updating some settings requires to do some actions to apply * remove: remove unneeded script to setup the configuration * fix(configuration): fix display warnings on settings that requires to run the health check * feat(configuration): renamed the type of configuration saved objecto to wazuh-dashboard-plugins-config * fix(configuration): tests * remove(configuration): unused types and settings-validator service on main plugin * fix: tests * fix(configuration): change the status code to 403 in the route decorator related to administrator user * fix: tests --------- Co-authored-by: Federico Rodriguez <[email protected]>
- Loading branch information