Skip to content

Commit

Permalink
Merge pull request #5594 from wazuh/merge-4.10.0-to-master
Browse files Browse the repository at this point in the history
Merge 4.10.0 to master
  • Loading branch information
Rebits authored Jul 19, 2024
2 parents f3a875f + 33fcaab commit 243fb08
Show file tree
Hide file tree
Showing 209 changed files with 18,967 additions and 776 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ __pycache__
venv
wazuh_testing.egg-info
dist
deployability/modules/build
deployability/modules/jobflow.egg-info

# Python bytecode files
*.pyc
Expand Down
49 changes: 40 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,59 @@ All notable changes to this project will be documented in this file.

## [5.0.0] - TBD

## [4.10.0] - TBD

## [4.9.0] - TBD

### Added

- Add integration tests for Update field to CPE_Helper. ([#4574](https://github.com/wazuh/wazuh-qa/pull/4574)) \- (Core)
- Updated integration tests README ([#4742](https://github.com/wazuh/wazuh-qa/pull/4742)) \- (Framework)
- Removed configobj library from requirements.txt ([#4803](https://github.com/wazuh/wazuh-qa/pull/4803)) \- (Framework)
- Add RockyLinux 8.10 to Allocator module ([#5524](https://github.com/wazuh/wazuh-qa/pull/5524)) \- (Framework)
- Add Deployability testing tier 1 ([#5190](https://github.com/wazuh/wazuh-qa/pull/5190)) \- (Framework + Documentation + Tests)
- Add Workflow module to Wazuh-qa repository ([#4990](https://github.com/wazuh/wazuh-qa/pull/4990)) \- (Tests)
- Add an IT to check that the agent erases its wazuh-agent.state file ([#4716](https://github.com/wazuh/wazuh-qa/pull/4716)) \- (Tests)
- Add integration tests for Update field to CPE_Helper ([#4574](https://github.com/wazuh/wazuh-qa/pull/4574)) \- (Framework + Tests)

### Changed

- Enhance the PR template. ([#4881](https://github.com/wazuh/wazuh-qa/pull/4881)) \- (Framework)
- Updated the API script file name. ([#5351](https://github.com/wazuh/wazuh-qa/pull/5351)) \- (Framework)
- Update CentOS 7 Vagrant box ([#5546](https://github.com/wazuh/wazuh-qa/pull/5546)) \- (Framework)
- Update CentOS 7 AMIs ([#5545](https://github.com/wazuh/wazuh-qa/pull/5545)) \- (Framework)
- Update OpenSUSE 15 AMI ([#5536](https://github.com/wazuh/wazuh-qa/pull/5536)) \- (Framework)
- Update Debian 12 AMIs ([#5529](https://github.com/wazuh/wazuh-qa/pull/5529)) \- (Framework)
- Update AL2023 AMIs ([#5530](https://github.com/wazuh/wazuh-qa/pull/5530)) \- (Framework)
- Update Oracle Linux 9 AMI ([#5525](https://github.com/wazuh/wazuh-qa/pull/5525)) \- (Framework)
- Update the API script file name ([#5351](https://github.com/wazuh/wazuh-qa/pull/5351)) \- (Framework + Tests)
- Enhance the PR template ([#4881](https://github.com/wazuh/wazuh-qa/pull/4881)) \- (Framework)
- Update integration tests README ([#4742](https://github.com/wazuh/wazuh-qa/pull/4742)) \- (Documentation)

### Fixed

- Add an IT to check that the agent erases its wazuh-agent.state file ([#4716](https://github.com/wazuh/wazuh-qa/pull/4716)) \- (Core)
- Fix CentOS 9 AMI in Allocator module ([#5523](https://github.com/wazuh/wazuh-qa/pull/5523)) \- (Framework)
- Fix stability in cluster reliability tests ([#5477](https://github.com/wazuh/wazuh-qa/pull/5477)) \- (Tests)
- Fix agent_simulator response for active-response configuration commands ([#4895](https://github.com/wazuh/wazuh-qa/pull/4895)) \- (Framework + Tests)
- Fix manager_agent system tests environment ([#4808](https://github.com/wazuh/wazuh-qa/pull/4808)) \- (Framework)
- Fixed agent_simulator response for active-response configuration commands. ([#4895](https://github.com/wazuh/wazuh-qa/pull/4895)) \- (Framework)
- Fixed stability in cluster reliability tests. ([#5448](https://github.com/wazuh/wazuh-qa/pull/5448)) \- (Framework)

## [4.8.1] - TBD
### Deleted

- Remove configobj library from requirements.txt ([#4803](https://github.com/wazuh/wazuh-qa/pull/4803)) \- (Framework)

## [4.8.1] - 18/07/2024

### Added

- Added the capability to plot indexed alerts and vulnerabilities. ([#5518](https://github.com/wazuh/wazuh-qa/pull/5518)) \- (Framework)
- Add functionality to unify data of the binary processes with their subprocesses to plot ([#5500](https://github.com/wazuh/wazuh-qa/pull/5500)) \- (Framework)
s
### Changed

- Remove hardcoded references in provision playbook for E2E tests ([#5517](https://github.com/wazuh/wazuh-qa/pull/5517)) \- (Framework)
- Fix test_consistency_initial_scans by adding a 30-minute wait before collecting vulnerabilities. ([#5507](https://github.com/wazuh/wazuh-qa/pull/5507)) \- (Tests)
- Update `wazuh_template_branch` in filebeat provision template ([#5499]https://github.com/wazuh/wazuh-qa/pull/5499) \- (Test)


### Fixed

- Fix indexer data visualizaiton class generation ([#5520](https://github.com/wazuh/wazuh-qa/pull/5520)) and ([#5526]https://github.com/wazuh/wazuh-qa/pull/5526) \- (Framework)


## [4.8.0] - 12/06/2024

Expand Down
319 changes: 319 additions & 0 deletions deployability/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,319 @@
## Deployability general documentation

### User documentation

To perform Deployability type tests, it is necessary to:

- Install Python libraries

For this purpose, it is recommended to use virtual environments. Follow the technical [documentation](https://docs.python.org/es/3/library/venv.html):

1. Activate the environment:

```
source {venv directory}/bin/activate
```

2. Clone the wazuh-qa repository:

Navigate to the project directory and switch to the project branch:

```
git clone https://github.com/wazuh/wazuh-qa.git
```

Navigate to the project directory and switch to the project branch:

```
cd wazuh-qa
git checkout {project-branch}
```

3. Install requirements:

```
pip3 install -r deployability/deps/requirements.txt
```

4. Install the JobFlow engine library and its launcher:

While in wazuh-qa:

```
cd modules
pip3 uninstall -y jobflow && pip3 install .
```

5. Test Fixture to Execute

It will be necessary to create a fixture (yaml file) where the infrastructure, provisioning, and tests to be executed will be declared.

> Note: It is possible to find some fixture examples in deployability/modules/jobflow/examples/

Example:

```
version: 0.1
description: This YAML is used to test agents' deployment for DDT1 PoC
variables:
agents-os:
- linux-ubuntu-22.04-amd64
manager-os: linux-ubuntu-22.04-amd64
infra-provider: vagrant
working-dir: /tmp/dtt1-poc
tasks:
# Generic agent test task
- task: "run-agent-tests-{agent}"
description: "Run tests uninstall for the {agent} agent."
do:
this: process
with:
path: python3
args:
- modules/testing/main.py
- inventory: "{working-dir}/agent-{agent}/inventory.yaml"
- dependencies:
- manager: "{working-dir}/manager-{manager-os}/inventory.yaml"
- agent: "{working-dir}/agent-{agent}/inventory.yaml"
- tests: "install,register,stop"
- component: "agent"
- wazuh-version: "4.7.1"
- wazuh-revision: "40709"
depends-on:
- "provision-install-{agent}"
- "provision-manager"
foreach:
- variable: agents-os
as: agent
# Generic agent test task
- task: "run-agent-tests-uninstall-{agent}"
description: "Run tests uninstall for the {agent} agent."
do:
this: process
with:
path: python3
args:
- modules/testing/main.py
- inventory: "{working-dir}/agent-{agent}/inventory.yaml"
- dependencies:
- manager: "{working-dir}/manager-{manager-os}/inventory.yaml"
- tests: "uninstall"
- component: "agent"
- wazuh-version: "4.7.1"
- wazuh-revision: "40709"
depends-on:
- "run-agent-tests-{agent}"
- "provision-uninstall-{agent}"
foreach:
- variable: agents-os
as: agent
# Unique manager provision task
- task: "provision-manager"
description: "Provision the manager."
do:
this: process
with:
path: python3
args:
- modules/provision/main.py
- inventory-manager: "{working-dir}/manager-{manager-os}/inventory.yaml"
- install:
- component: wazuh-manager
type: package
depends-on:
- "allocate-manager"
# Unique manager allocate task
- task: "allocate-manager"
description: "Allocate resources for the manager."
do:
this: process
with:
path: python3
args:
- modules/allocation/main.py
- action: create
- provider: "{infra-provider}"
- size: large
- composite-name: "{manager-os}"
- inventory-output: "{working-dir}/manager-{manager-os}/inventory.yaml"
- track-output: "{working-dir}/manager-{manager-os}/track.yaml"
cleanup:
this: process
with:
path: python3
args:
- modules/allocation/main.py
- action: delete
- track-output: "{working-dir}/manager-{manager-os}/track.yaml"
# Generic agent provision task
- task: "provision-install-{agent}"
description: "Provision resources for the {agent} agent."
do:
this: process
with:
path: python3
args:
- modules/provision/main.py
- inventory-agent: "{working-dir}/agent-{agent}/inventory.yaml"
- inventory-manager: "{working-dir}/manager-{manager-os}/inventory.yaml"
- install:
- component: wazuh-agent
type: package
- component: curl
depends-on:
- "allocate-{agent}"
- "provision-manager"
foreach:
- variable: agents-os
as: agent
# Generic agent provision task
- task: "provision-uninstall-{agent}"
description: "Provision resources for the {agent} agent."
do:
this: process
with:
path: python3
args:
- modules/provision/main.py
- inventory-agent: "{working-dir}/agent-{agent}/inventory.yaml"
- inventory-manager: "{working-dir}/manager-{manager-os}/inventory.yaml"
- uninstall:
- component: wazuh-agent
type: package
depends-on:
- "provision-install-{agent}"
foreach:
- variable: agents-os
as: agent
# Generic agent allocate task
- task: "allocate-{agent}"
description: "Allocate resources for the {agent} agent."
do:
this: process
with:
path: python3
args:
- modules/allocation/main.py
- action: create
- provider: "{infra-provider}"
- size: small
- composite-name: "{agent}"
- inventory-output: "{working-dir}/agent-{agent}/inventory.yaml"
- track-output: "{working-dir}/agent-{agent}/track.yaml"
cleanup:
this: process
with:
path: python3
args:
- modules/allocation/main.py
- action: delete
- track-output: "{working-dir}/agent-{agent}/track.yaml"
foreach:
- variable: agents-os
as: agent
```

Following the schema of the example:

Configure the following parameters depending on your test case:

```
variables/agent-os
variables/manager-os
infra-provider
working-dir
tasks
```

Pay attention to the tasks:

```
args
depends-on
```

> Note: In args, configure the launcher's path correctly (main.py files in each module), and to fill depends-on, consider the steps of your test (allocation, provision, and test)
6. Execution of Command (local):

Execute the command by referencing the parameters required by the library (launcher).

```
python3 -m jobflow {.yaml fixture path}
```

Example

```
python3 -m jobflow modules/jobflow/examples/dtt1-agents-poc.yaml
```


---

### Technical documentation

- Modules

The framework has 4 modules (`allocation`, `provision`, `testing`, `observability`) that must act consecutively, and a 5th module that orchestrates the previous modules (`Jobflow`).

|Module|Description
|--|--|
|JobFlow (Orchestrator)|Receives a YAML containing all the instructions to execute for the test development. It contains instructions for allocation, provision, and testing.
|Allocation| Receives instructions for the desired architecture and creates the structures, generating IPs, and ports either in AWS or locally with Vagrant.
|Provision| Installs applications on the structures created in allocation.
|Testing| Executes tests on the previously defined structures and triggers actions depending on the test.
|Observability| Allows the ordered and indexed visualization of data obtained in the 3 previous modules.

- Directory Structure

```
wazuh-qa/
└── deployability
├── deps
├── Jenkinsfiles
├── modules
│ ├── allocation
│ ├── generic
│ ├── provision
│ ├── testing
│ └── jobflow
└── plugins
```
Deployability contains the following directories:

|Directory|Description|
|---|---|
|deps|Contains information about the dependencies used for installing the necessary libraries for running the framework.|
|Jenkinsfiles|Contains instructions for the pipelines for test execution.|
|modules|Contains files, the launcher (main.py), and playbooks.|
|plugins|Contains modules for the observability plugin.|

#### Overview

![image](https://github.com/wazuh/wazuh-qa/assets/2949519/29b600cf-44bd-412c-b02f-9b08353babde)

#### Allocator, provision & test process

![image](https://github.com/wazuh/wazuh-qa/assets/2949519/9338ccc4-2ffa-47d4-b4cc-86c2a8aa5851)



----


[draw-plot.zip](https://github.com/user-attachments/files/15792115/draw-plot.zip)



### License

WAZUH Copyright (C) 2015 Wazuh Inc. (License GPLv2)
File renamed without changes.
Loading

0 comments on commit 243fb08

Please sign in to comment.