Migration agent-info data to Wazuh DB implementation#5541
Merged
Conversation
…gent-belong wazuh db commands
…e result of the wazuh db query
… the result of the wazuh db query
… result of the wazuh db query
…in the result of the wazuh db query
…ult of the wazuh db query
…i-tests Update agent-info insert in API integration tests
Fixing all the comments from the agent-info epic pull request
…aldb Adapt framework to use wazuh-db
Fix unit tests in cluster
7 tasks
Fixing errors discovered in exploratory testing
7 tasks
Fix and update entrypoint and agent branch
Fixing issues found during exploratory testing
General framework fixes for dev-agent-info
Fix sending [] to master
vikman90
approved these changes
Sep 29, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR includes all the changes developed as part of the epic: Migration agent-info data to wazuhdb. These changes are:
Wazuh DBhas the capability of accessglobal.dbfor either query, update or modify it. This is simplified by a set of methods that were already in the code but were modified in order to avoid accessingglobal.dbin a regular direct way to instead make use of theWazuh DBsocket interface.Note: When upgrading, the old
global.dbdatabase is relocated from thevar/db/folder toqueue/db/. In addition, the database permissions and ownership are set in order to make Wazuh DB be able to manage it. Finally, in the first manager initialization after the upgrade, the database is updated to the new schema by adding columns and tables.remoted no longer creates agent-info files: The agent control messages that were stored in the
agent-infofolder in plain text files are now saved in theglobal.db. This mechanism already existed but was made in the past bywazuh-modulesd:database. Now the action is performed byremotedand no plain text files are created in theagent-infofolder.new
sync_statuscolumn inglobal.db: There is a new column inglobal.dbcalledsync_statusthat is used to reflect the synchronization status of the data in the cluster. This column is mainly used in the workers where each keepalive sets it toWDB_SYNC_REQ, and then, when the cluster requires toWazuh DBthe agents to be synchronized, it is set toWDB_SYNCEDfollowing the next state machine.wazuh dbcommands for cluster synchronization: There are two new commands inWazuh DBthat are used for the agents' data synchronization in the cluster. The first one issync-agent-info-getand is used in theworkernodes. It will return all the agents inglobal.dbwith thesync_statusinWDB_SYNC_REQ. At the same time, and before returning the data, it will set that value toWDB_SYNCED. The second one issync-agent-info-setand is used in themasternodes. It will insert all the agents' data returned by the previous one. This allows the cluster to implement the next sequence of tasks.Vulnerability Detectorworking withWazuh DB: There was a query made byVulnerability Detectortoglobal.dbto get the list of agents connected in order to perform the scans. Now, this query is made troughWazuh DB.agent_controlworking withWazuh DB: Theagent_controltool no longer uses theagent-infoplain text files. Now, it gets the information fromglobal.dbby executing one of the newWazuh DBcommands.manage_agentsworking withWazuh DB: Themanage_agentstool no longer uses theagent-infoplain text files. Now, it gets the information fromglobal.dbby executing one of the newWazuh DBcommands.With the changes introduced in this pull request, a simplified architecture diagram looks like:
Tests
Compilation without warnings in every supported platform
Source installation
Package installation
Source upgrade
Package upgrade
Review logs syntax and correct language
QA templates contemplate the added capabilities
Memory tests for Linux
Memory tests for Windows
Memory tests for macOS
Retrocompatibility with older Wazuh versions
Working on cluster environments
Configuration on demand reports new parameters
The data flow works as expected (agent-manager-api-app)
Added unit tests (for new features)
Stress test for affected components