From f1e9ce3dd7bf688f3d12dcc5b4aab24c4b113b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Tue, 5 Dec 2023 12:34:31 +0000 Subject: [PATCH 1/7] docs: update IT README --- tests/integration/README.md | 125 +++++++++++++++--------------------- 1 file changed, 53 insertions(+), 72 deletions(-) diff --git a/tests/integration/README.md b/tests/integration/README.md index 85e5332b90..142b9abac1 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -13,17 +13,19 @@ tests modify the system date and there could be some synchronization issues. This guide will cover the following platforms: [Linux](#linux), [Windows](#windows) and [MacOS](#macos). -You can run these tests on a manager or an agent. In case you are using an agent, please remember to register it and use -the correct version (Wazuh branch). +You can run these tests on a manager or an agent. In case you are using an agent, please remember to register it and use the correct version (Wazuh branch). _We are skipping Wazuh installation steps. For further information, -check [Wazuh documentation](https://documentation.wazuh.com/3.11/installation-guide/index.html)._ +check [Wazuh documentation](https://documentation.wazuh.com/current/installation-guide/index.html)._ ### Linux _We are using **CentOS** for this example:_ -- Install **Wazuh** +- Install and start **Wazuh** + +> [!NOTE] +> In case you are using an agent, please remember to register to the manager - Disable firewall (only for **CentOS**) @@ -32,41 +34,40 @@ systemctl stop firewalld systemctl disable firewalld ``` -- Install Python and its dependencies - -```shell script -# Install dependencies -yum install make gcc policycoreutils-python automake autoconf libtool epel-release git which sudo wget -y - -# Install development dependencies for jq library -yum groupinstall "Development Tools" -y +- Install Python3 -# Install Python3 +```sheel script yum install python36 python36-pip python36-devel -y - -# Install Python libraries -pip3 install pytest freezegun jq jsonschema pyyaml==5.3 psutil distro pandas==0.25.3 pytest-html==2.0.1 numpydoc==0.9.2 ``` -- Add some internal options and restart +- Install integration tests dependencies ```shell script -# Enable debug 2 -echo 'syscheck.debug=2' >> $wazuh_path/etc/local_internal_options.conf +cd wazuh-qa +python -m pip install -r requirements.txt +``` -# Avoid agent disconnections when travelling in time (only for agents) -sed -i "s:60:99999999999:g" /var/ossec/etc/ossec.conf +- Install wazuh-testing framework -# Disable log rotation -echo 'monitord.rotate_log=0' >> $wazuh_path/etc/local_internal_options.conf +```shell script +cd deps/wazuh_testing/ +python setup.py install +``` -# Restart Wazuh -/var/ossec/bin/wazuh-control restart +> [!NOTE] +> When developing tests, utilize the following command to seamlessly update the framework with each modification. + +``` +python -m pip install . -e ``` + ### Windows -- Install **Wazuh** +- Install and start **Wazuh** + +> [!NOTE] +> In case you are using an agent, please remember to register to the manager - Download and install [Python](https://www.python.org/downloads/windows/) @@ -79,68 +80,52 @@ echo 'monitord.rotate_log=0' >> $wazuh_path/etc/local_internal_options.conf choco install jq ``` -- Install Python dependencies +- Install integration tests dependencies ```shell script -pip install pytest freezegun jsonschema pyyaml==5.4 psutil paramiko distro pywin32 pypiwin32 wmi pandas==0.25.3 pytest-html==2.0.1 numpydoc==0.9.2 +cd wazuh-qa +python -m pip install -r requirements.txt ``` -- Change `time-reconnect` from `C:\Program Files (x86)\ossec-agent\ossec.conf` - -```xml -99999999999 -``` - -- Add some internal options +- Install wazuh-testing framework ```shell script -# Enable debug 2 -echo 'syscheck.debug=2' >> "C:\Program Files (x86)\ossec-agent\local_internal_options.conf" - -# Disable log rotation -echo 'monitord.rotate_log=0' >> "C:\Program Files (x86)\ossec-agent\local_internal_options.conf" +cd deps/wazuh_testing/ +python setup.py install ``` -- Restart **Wazuh** using the GUI +> [!NOTE] +> When developing tests, utilize the following command to seamlessly update the framework with each modification. +``` +python -m pip install . -e +``` ### MacOS -- Install **Wazuh** +- Install and start **Wazuh** -- Install Python and its dependencies +> [!NOTE] +> Remember to register the agent to the manager -```shell script # Install Python -brew install python3 -# Install dependencies -brew install autoconf automake libtool - -# Install Python libraries -pip3 install filetype freezegun jq jsonschema lockfile numpydoc psutil pytest-html pytest-testinfra pyyaml +```shell script +brew install python3 ``` -- Add some internal options and restart +- Install Python and its dependencies ```shell script - -# Enable debug 2 -echo 'syscheck.debug=2' >> /Library/Ossec/etc/local_internal_options.conf - -# Avoid agent disconnections when travelling in time -brew install gnu-sed -gsed -i "s:60:99999999999:g" /Library/Ossec/etc/ossec.conf - -# Disable log rotation -echo 'monitord.rotate_log=0' >> /Library/Ossec/etc/local_internal_options.conf - -# Restart Wazuh -/Library/Ossec/bin/wazuh-control restart +cd wazuh-qa +python -m pip install -r requirements.txt ``` ------------ +- Install wazuh-testing framework -Finally, copy your `wazuh-qa` repository within your testing environment and you are set. +```shell script +cd deps/wazuh_testing/ +python setup.py install +``` ## Integration tests @@ -278,14 +263,11 @@ This will be our python module with all the needed code to test everything. ### Dependencies -To run them, we need to install all these Python dependencies: - +It is necessary to install the wazuh testing framework dependencies: ```shell script -pip3 install distro freezegun jq jsonschema psutil pytest pyyaml==5.3 pandas==0.25.3 pytest-html==2.0.1 numpydoc==0.9.2 +python -m pip install -r requirements.txt ``` -_**NOTE:** `jq` library can only be installed with `pip` on **Linux**_ - ### Wazuh-Testing package We have a Python package at `wazuh-qa/deps/` with all the tools needed to run these tests. From file monitoring classes @@ -354,7 +336,6 @@ To install it: ```shell script cd wazuh-qa/deps/wazuh_testing -pip3 install . ``` _**NOTE:** It is important to reinstall this package every time we modify anything From 15215b391ba5d18eae8923b418137fd9f649b541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Thu, 14 Dec 2023 11:16:46 +0000 Subject: [PATCH 2/7] fix: include local internal options requirements for IT --- tests/integration/README.md | 41 +++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/tests/integration/README.md b/tests/integration/README.md index 142b9abac1..93d9547e2b 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -40,6 +40,18 @@ systemctl disable firewalld yum install python36 python36-pip python36-devel -y ``` +- Add some internal options and restart +```shell script +# Avoid agent disconnections when travelling in time (only for agents) +sed -i "s:60:99999999999:g" /var/ossec/etc/ossec.conf + +# Disable log rotation +echo 'monitord.rotate_log=0' >> $wazuh_path/etc/local_internal_options.conf + +# Restart Wazuh +/var/ossec/bin/wazuh-control restart +``` + - Install integration tests dependencies ```shell script @@ -56,8 +68,7 @@ python setup.py install > [!NOTE] > When developing tests, utilize the following command to seamlessly update the framework with each modification. - -``` +```shell script python -m pip install . -e ``` @@ -74,6 +85,19 @@ python -m pip install . -e - Download and install [chocolatey](https://chocolatey.org/docs/installation) to be able to install `jq` using the terminal. +- Change `time-reconnect` from `C:\Program Files (x86)\ossec-agent\ossec.conf` +```xml +99999999999 +``` + +- Add some internal options +# Disable log rotation +```shell script +echo 'monitord.rotate_log=0' >> "C:\Program Files (x86)\ossec-agent\local_internal_options.conf" +``` + +- Restart **Wazuh** using the GUI + - Install `jq`: ```shell script @@ -113,6 +137,19 @@ python -m pip install . -e brew install python3 ``` +- Add some internal options and restart +```shell script +# Avoid agent disconnections when travelling in time +brew install gnu-sed +gsed -i "s:60:99999999999:g" /Library/Ossec/etc/ossec.conf + +# Disable log rotation +echo 'monitord.rotate_log=0' >> /Library/Ossec/etc/local_internal_options.conf + +# Restart Wazuh +/Library/Ossec/bin/wazuh-control restart +``` + - Install Python and its dependencies ```shell script From 7270875ae9502a94954599f46739d8b0ce3bae48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Thu, 14 Dec 2023 11:39:12 +0000 Subject: [PATCH 3/7] docs: fix shell script comment in disable log rotation step --- tests/integration/README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/integration/README.md b/tests/integration/README.md index 93d9547e2b..7b5df3e997 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -40,16 +40,22 @@ systemctl disable firewalld yum install python36 python36-pip python36-devel -y ``` -- Add some internal options and restart +- Avoid agent disconnections when travelling in time (only for agents) ```shell script -# Avoid agent disconnections when travelling in time (only for agents) + sed -i "s:60:99999999999:g" /var/ossec/etc/ossec.conf -# Disable log rotation +``` + +- Disable log rotation +```shell script echo 'monitord.rotate_log=0' >> $wazuh_path/etc/local_internal_options.conf +``` -# Restart Wazuh +- Restart Wazuh +```shell script /var/ossec/bin/wazuh-control restart + ``` - Install integration tests dependencies @@ -91,8 +97,8 @@ python -m pip install . -e ``` - Add some internal options -# Disable log rotation ```shell script +# Disable log rotation echo 'monitord.rotate_log=0' >> "C:\Program Files (x86)\ossec-agent\local_internal_options.conf" ``` From 2d4117489e6961eaeee122715b264bb9ce61067c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Thu, 14 Dec 2023 11:39:54 +0000 Subject: [PATCH 4/7] docs: remove extra whitespace --- tests/integration/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/README.md b/tests/integration/README.md index 7b5df3e997..bb957f47ac 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -55,7 +55,6 @@ echo 'monitord.rotate_log=0' >> $wazuh_path/etc/local_internal_options.conf - Restart Wazuh ```shell script /var/ossec/bin/wazuh-control restart - ``` - Install integration tests dependencies From da676e6172f4734a74fa24b7b526706c8830259f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Wed, 3 Jan 2024 14:25:34 +0000 Subject: [PATCH 5/7] docs: include 4742 changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eca021024..0313602441 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [4.8.1] - TBD +### Changed + +- Updated Integration Tests README ([#4742](https://github.com/wazuh/wazuh-qa/pull/4742)) \- (Framework) + ## [4.8.0] - TBD ### Added From dbcb6342890659f7ac051dc15279f5fc8d23981f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Wed, 3 Jan 2024 14:26:32 +0000 Subject: [PATCH 6/7] docs: correct capitalization --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0313602441..cf29c06f21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file. ### Changed -- Updated Integration Tests README ([#4742](https://github.com/wazuh/wazuh-qa/pull/4742)) \- (Framework) +- Updated integration tests README ([#4742](https://github.com/wazuh/wazuh-qa/pull/4742)) \- (Framework) ## [4.8.0] - TBD From bdc9bb6d170b49a867da41d2fd855ffa78881117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Wed, 3 Jan 2024 15:23:42 +0000 Subject: [PATCH 7/7] docs: fix typo --- tests/integration/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/README.md b/tests/integration/README.md index bb957f47ac..7f6a00746f 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -36,7 +36,7 @@ systemctl disable firewalld - Install Python3 -```sheel script +```shell script yum install python36 python36-pip python36-devel -y ```