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

Improve wazuh-db detection of deleted database files #18476

Merged
merged 7 commits into from Aug 25, 2023

Conversation

thejbte
Copy link
Member

@thejbte thejbte commented Aug 17, 2023

Wazuh version Component Install type Install method Platform Related issue
4.5.0 WazuhDB Manager Packages/Sources OS version #15279

Description

This PR includes a fix for issue #15279, which presented an error when deleting the agent database in the manager. In the wdb_parser.c file, a condition has been added that verifies the status of result and the existence of the database. Then the function wdb_close() is called.

Configuration options

  <!-- System inventory -->

  <wodle name="syscollector">
    <disabled>no</disabled>
    <interval>10s</interval>
    <scan_on_start>yes</scan_on_start>
    <hardware>yes</hardware>
    <os>yes</os>
    <network>yes</network>
    <packages>yes</packages>
    <ports all="no">yes</ports>
    <processes>yes</processes>

    <!-- Database synchronization settings -->
    <synchronization>
      <max_eps>10</max_eps>
    </synchronization>
  </wodle>

Logs/Alerts example

2023/06/09 19:22:58 wazuh-modulesd:syscollector[56431] wm_syscollector.c:98 at wm_sys_log(): DEBUG: Sync sent: {"component":"syscollector_processes","data":{"begin":"56288","checksum":"d93afc6b277f223c3b635f685e138c9919daf4a2","end":"56288","id":1667328464},"type":"integrity_check_right"}
2023/06/09 19:22:58 wazuh-db: ERROR: at wdb_process_insert(): sqlite3_step(): attempt to write a readonly database
2023/06/09 19:22:58 wazuh-analysisd: ERROR: dbsync: Bad response from database: Cannot save Syscollector

Tests

image
  • Compilation without warnings in every supported platform
    • Linux
    • Windows
    • MAC OS X

@thejbte thejbte self-assigned this Aug 17, 2023
@thejbte thejbte added the module/db Wazuh DB engine label Aug 17, 2023
@thejbte thejbte linked an issue Aug 17, 2023 that may be closed by this pull request
@thejbte thejbte force-pushed the Wazuh_DB_does_not_detect_Agents_DB_has_been_deleted branch from 571bc5e to de7ca7a Compare August 18, 2023 16:39
TomasTurina
TomasTurina previously approved these changes Aug 18, 2023
@TomasTurina TomasTurina force-pushed the Wazuh_DB_does_not_detect_Agents_DB_has_been_deleted branch from de7ca7a to 66243a4 Compare August 24, 2023 16:02
@vikman90 vikman90 merged commit 36417a4 into master Aug 25, 2023
59 checks passed
@vikman90 vikman90 deleted the Wazuh_DB_does_not_detect_Agents_DB_has_been_deleted branch August 25, 2023 06:42
@vikman90 vikman90 changed the title Wazuh db does not detect agents db has been deleted Improve wazuh-db detection of deleted database files Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/db Wazuh DB engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wazuh DB does not detect Agent's DB has been deleted
4 participants