-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Migration agent-info data to Wazuh DB implementation #5541
Merged
Merged
Conversation
This file contains 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
…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
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 DB
has the capability of accessglobal.db
for 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.db
in a regular direct way to instead make use of theWazuh DB
socket interface.Note: When upgrading, the old
global.db
database 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-info
folder 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 byremoted
and no plain text files are created in theagent-info
folder.new
sync_status
column inglobal.db
: There is a new column inglobal.db
calledsync_status
that 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 DB
the agents to be synchronized, it is set toWDB_SYNCED
following the next state machine.wazuh db
commands for cluster synchronization: There are two new commands inWazuh DB
that are used for the agents' data synchronization in the cluster. The first one issync-agent-info-get
and is used in theworker
nodes. It will return all the agents inglobal.db
with thesync_status
inWDB_SYNC_REQ
. At the same time, and before returning the data, it will set that value toWDB_SYNCED
. The second one issync-agent-info-set
and is used in themaster
nodes. It will insert all the agents' data returned by the previous one. This allows the cluster to implement the next sequence of tasks.Vulnerability Detector
working withWazuh DB
: There was a query made byVulnerability Detector
toglobal.db
to get the list of agents connected in order to perform the scans. Now, this query is made troughWazuh DB
.agent_control
working withWazuh DB
: Theagent_control
tool no longer uses theagent-info
plain text files. Now, it gets the information fromglobal.db
by executing one of the newWazuh DB
commands.manage_agents
working withWazuh DB
: Themanage_agents
tool no longer uses theagent-info
plain text files. Now, it gets the information fromglobal.db
by executing one of the newWazuh DB
commands.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