wazuh / wazuh-agent

Wazuh agent, the Wazuh agent for endpoints.
GNU Affero General Public License v3.0
27 stars 18 forks source link

Migrate Syscollector module to new agent #17

Closed cborla closed 1 month ago

cborla commented 4 months ago

Parent issue:

Description

Migrate Syscollector and DBsync code from the wazuh/wazuh repository to the wazuh/wazuh-agent repository.

Tasks

  1. Identify the code in the wazuh/wazuh repository.
  2. Migrate the code to the wazuh/wazuh-agent repository.
  3. Refactor the code as necessary to fit the new repository structure.
  4. Test the migrated code to ensure it works correctly in the new repository.

Implementation Constraints

  1. Code Migration: The code for Syscollector and DBsync must be migrated to the new repository. This task depends on the migration spike: https://github.com/wazuh/wazuh/issues/24037.
  2. Modular Implementation: The new Inventory will be implemented as a module of the agent, following the predefined scaffolding: #1.
  3. Queue Integration: Messages generated by Syscollector must be inserted into the new Queue component. #16

Dependencies

Migration spike: https://github.com/wazuh/wazuh/issues/24037

Subtasks

Initial tasks

  1. [x] Investigate how to add missing dependencies to vcpkg:

    • Research how to add libdb, pacman, procps, and rpm to vcpkg.
    • This is a high priority task, as we currently need to manually copy the binaries from the Wazuh Agent 4.x build to 5.0.
    • Investigate issue #65.
    • This task is complex because it uses make instead of cmake. We may need help from Octa or the team who originally worked on it.
  2. [x] Integrate with the Queue:

    • Use Task Manager to integrate the new client with the Queue component.
    • Note: This task is on hold until #82 is merged into master.
    1. [x] Testing:
      • [x] Define and create tests for the module manager:
      • [x] Migrate tests for inventory, data-provider, and dbsync.
      • [x] Create tests for the new module manager (pool.cpp) and decide if this will be the final name.
  3. [x] Compile Windows with MSVC

    • [x] Adapt the agent code for windows to compile with MSVC.
  4. [x] Replace to new Logger

    • [x] Adapt the agent code use the new Logger.
  5. [ ] Clean up code for unsupported operating systems.

  6. [x] Analyze if http-request (urlrequest) used by data-provider can be removed.

Nice to have

  1. [ ] Replace unwanted libraries
    • [ ] #152
    • [ ] #155
    • [ ] #156
ncvicchi commented 2 months ago

Update 2024/08/20

Inventory migration

nbertoldo commented 2 months ago

Update 2024/08/20

Testing:

ncvicchi commented 2 months ago

Update 2024/08/21

Inventory migration

nbertoldo commented 2 months ago

Update 2024/08/21

Testing:

nbertoldo commented 2 months ago

Update 2024/08/22

Migrate inventory unit test #102:

ncvicchi commented 2 months ago

Update 2024/08/22

nbertoldo commented 2 months ago

Update 2024/08/23

Migrate inventory unit test #102:

nbertoldo commented 2 months ago

Update 2024/08/26

Migrate inventory unit test #102:

ncvicchi commented 2 months ago

Update 2024/08/26

Commit c213c35

nbertoldo commented 2 months ago

Update 2024/08/27

Migrate inventory unit test #102:

ncvicchi commented 2 months ago

Update 2024/08/27

Migrate inventory unit test #102:

nbertoldo commented 2 months ago

Update 2024/08/28

ncvicchi commented 2 months ago

Update 2024/08/28

nbertoldo commented 2 months ago

Update 2024/08/29

ncvicchi commented 2 months ago

Update 2024/08/29

nbertoldo commented 2 months ago

Update 2024/08/30

ncvicchi commented 2 months ago

Update 2024/08/30

nbertoldo commented 2 months ago

Update 2024/09/02

Server output ```console ==================== REQUEST START ==================== Timestamp: Mon Sep 2 17:47:01 2024 Client IP: 127.0.0.1:55884 HTTP Request: POST /stateless HTTP/1.1 Host: localhost User-Agent: Boost.Beast/353 Accept: application/json Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJleHAiOjE3MjUzMTAwNTEsImlhdCI6MTcyNTMxMDAyMSwiaXNzIjoic29tZS1hdXRoLXNlcnZlciIsInV1aWQiOiJkNTJhYTA1Yy1jMTBkLTRmMzQtYjZhNi05NDk1OWU5NTQxMGMifQ.aIoXm4XBlKnAxC_uMFjifsJO5lBN1WqlZoCuTT_4LoI Content-Type: application/json Content-Length: 344 {"events":[[{"data":{"data":{"board_serial":" ","checksum":"51ee4bfdf4dd6179f792c57b94339053067cd2e7","cpu_cores":16,"cpu_mhz":4846.0,"cpu_name":"AMD Ryzen 7 5800X 8-Core Processor","ram_free":23144424,"ram_total":32799344,"ram_usage":30,"scan_time":"2024/08/30 21:22:31"},"operation":"INSERTED","type":"dbsync_hwinfo"},"module":"inventory"}]]} ==================== REQUEST END ====================== ==================== RESPONSE START =================== Timestamp: Mon Sep 2 17:47:01 2024 Client IP: 127.0.0.1:55884 HTTP Response: HTTP/1.1 400 Bad Request Server: Boost.Beast Content-Type: json Content-Length: 22 Invalid request format ==================== RESPONSE END ===================== ```
nbertoldo commented 2 months ago

Update 2024/09/03

ncvicchi commented 2 months ago

Update 2024/09/03

nbertoldo commented 2 months ago

Update 2024/09/04

nbertoldo commented 2 months ago

Update 2024/09/05

nbertoldo commented 2 months ago

Update 2024/09/06

nbertoldo commented 2 months ago

Update 2024/09/09

nbertoldo commented 2 months ago

Update 2024/09/10

nbertoldo commented 2 months ago

Update 2024/09/11

nbertoldo commented 2 months ago

Update 2024/09/12

nbertoldo commented 2 months ago

Update 2024/09/13

nbertoldo commented 1 month ago

Update 2024/09/16

nbertoldo commented 1 month ago

Update 2024/09/17

nbertoldo commented 1 month ago

Update 2024/09/18

nbertoldo commented 1 month ago

Update 2024/09/19

nbertoldo commented 1 month ago

Update 2024/09/20

nbertoldo commented 1 month ago

Update 2024/09/23

nbertoldo commented 1 month ago

Update 2024/09/24

nbertoldo commented 1 month ago

Update 2024/09/26

nbertoldo commented 1 month ago

Update 2024/09/27

nbertoldo commented 1 month ago

Update 2024/09/30

nbertoldo commented 1 month ago

Update 2024/10/01