From 0c2c3e32c3c87dda0f6839008bd998eb9ecb2b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Wed, 21 Aug 2024 12:33:42 +0100 Subject: [PATCH 1/6] docs: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d529d94d7..d89a3f6658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. ### Added +- Adding jobflow templates ([#5680](https://github.com/wazuh/wazuh-qa/pull/5680/)) \- (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) @@ -32,6 +33,7 @@ All notable changes to this project will be documented in this file. ### Fixed +- Fix playbook cleanup.yaml ([#5672](https://github.com/wazuh/wazuh-qa/pull/5672)) \- (Tests) - Fixed unnecesary reference to debian file in dashboard provisioning task ([#5643](https://github.com/wazuh/wazuh-qa/pull/5643)) \- (Framework) - Changed 'Ensure that the manager version is' expected warning to an agnostic version of regex ([#5630](https://github.com/wazuh/wazuh-qa/pull/5630)) \- (Tests) - Adding fixed and dynamic waits to port status checks ([#5627](https://github.com/wazuh/wazuh-qa/pull/5627)) (Framework) From 9af7b7243b9bbbbeb52ffcb9ae0a5b11fa0caa7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Wed, 21 Aug 2024 13:01:36 +0100 Subject: [PATCH 2/6] feat: bump 4.9.0 revision to 40906 --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 68a33aea49..5a3ccead7c 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { "version": "4.9.0", - "revision": "40905" + "revision": "40906" } From df8030ed36a98057fcca4f4aff10d3f8f11eb212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Fri, 30 Aug 2024 14:56:22 +0100 Subject: [PATCH 3/6] feat: comment macOS for testing --- .../environments/e2e_vulnerability_detector.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/provisioning/environments/e2e_vulnerability_detector.yaml b/provisioning/environments/e2e_vulnerability_detector.yaml index f0fe3aff01..a2cf1b9089 100644 --- a/provisioning/environments/e2e_vulnerability_detector.yaml +++ b/provisioning/environments/e2e_vulnerability_detector.yaml @@ -35,8 +35,8 @@ agent5: manager: manager2 architecture: arm64v8 -agent6: - roles: [agent] - os: macos_1400 - manager: manager1 - architecture: arm64v8 +# agent6: +# roles: [agent] +# os: macos_1400 +# manager: manager1 +# architecture: arm64v8 From 0848dfd28d3355f591fe32d0b4b692facb3ac1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Mon, 2 Sep 2024 09:03:10 +0100 Subject: [PATCH 4/6] feat: reduce env to debugging --- .../e2e_vulnerability_detector.yaml | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/provisioning/environments/e2e_vulnerability_detector.yaml b/provisioning/environments/e2e_vulnerability_detector.yaml index a2cf1b9089..0f59dcdbb2 100644 --- a/provisioning/environments/e2e_vulnerability_detector.yaml +++ b/provisioning/environments/e2e_vulnerability_detector.yaml @@ -13,27 +13,27 @@ agent1: os: centos_7 manager: manager1 -agent2: - roles: [agent] - os: windows_11 - manager: manager2 +# agent2: +# roles: [agent] +# os: windows_11 +# manager: manager2 -agent3: - roles: [agent] - os: ubuntu_22 - manager: manager1 +# agent3: +# roles: [agent] +# os: ubuntu_22 +# manager: manager1 -agent4: - roles: [agent] - os: centos_7 - manager: manager1 - architecture: arm64v8 +# agent4: +# roles: [agent] +# os: centos_7 +# manager: manager1 +# architecture: arm64v8 -agent5: - roles: [agent] - os: ubuntu_22 - manager: manager2 - architecture: arm64v8 +# agent5: +# roles: [agent] +# os: ubuntu_22 +# manager: manager2 +# architecture: arm64v8 # agent6: # roles: [agent] From 4942b05f80a6c1446362b4c2dbdb75fd4eab8694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Mon, 2 Sep 2024 17:29:16 +0100 Subject: [PATCH 5/6] feat: restore regular environment --- .../e2e_vulnerability_detector.yaml | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/provisioning/environments/e2e_vulnerability_detector.yaml b/provisioning/environments/e2e_vulnerability_detector.yaml index 0f59dcdbb2..f0fe3aff01 100644 --- a/provisioning/environments/e2e_vulnerability_detector.yaml +++ b/provisioning/environments/e2e_vulnerability_detector.yaml @@ -13,30 +13,30 @@ agent1: os: centos_7 manager: manager1 -# agent2: -# roles: [agent] -# os: windows_11 -# manager: manager2 +agent2: + roles: [agent] + os: windows_11 + manager: manager2 -# agent3: -# roles: [agent] -# os: ubuntu_22 -# manager: manager1 +agent3: + roles: [agent] + os: ubuntu_22 + manager: manager1 -# agent4: -# roles: [agent] -# os: centos_7 -# manager: manager1 -# architecture: arm64v8 +agent4: + roles: [agent] + os: centos_7 + manager: manager1 + architecture: arm64v8 -# agent5: -# roles: [agent] -# os: ubuntu_22 -# manager: manager2 -# architecture: arm64v8 +agent5: + roles: [agent] + os: ubuntu_22 + manager: manager2 + architecture: arm64v8 -# agent6: -# roles: [agent] -# os: macos_1400 -# manager: manager1 -# architecture: arm64v8 +agent6: + roles: [agent] + os: macos_1400 + manager: manager1 + architecture: arm64v8 From 1f310ac136a4b51352950e79f326dfba03c4a986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Mon, 2 Sep 2024 17:46:01 +0100 Subject: [PATCH 6/6] feat: add fixture to increase max result windows --- .../wazuh_testing/end_to_end/indexer_api.py | 33 +++++++++++++++++++ .../test_vulnerability_detector/conftest.py | 7 +++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/deps/wazuh_testing/wazuh_testing/end_to_end/indexer_api.py b/deps/wazuh_testing/wazuh_testing/end_to_end/indexer_api.py index 1ca658f186..13c696b1c3 100644 --- a/deps/wazuh_testing/wazuh_testing/end_to_end/indexer_api.py +++ b/deps/wazuh_testing/wazuh_testing/end_to_end/indexer_api.py @@ -176,3 +176,36 @@ def delete_index(host_manager: HostManager, credentials: dict = {'user': 'admin' requests.delete(url=url, verify=False, auth=requests.auth.HTTPBasicAuth(credentials['user'], credentials['password']), headers=headers) + + +def extend_result_window(host_manager: HostManager, credentials: dict = {'user': 'admin', 'password': 'changeme'}, + index: str = 'wazuh-alerts*', new_max_result_window: int = 100000): + """Extend the max_result_window setting for a Wazuh Indexer index. + + Args: + host_manager: An instance of the HostManager class containing information about hosts. + credentials (Optional): A dictionary containing the Indexer credentials. Defaults to + {'user': 'admin', 'password': 'changeme'}. + index (Optional): The Indexer index name. Defaults to 'wazuh-alerts*'. + new_max_result_window (Optional): The new maximum result window size. Defaults to 100,000. + """ + logging.info(f"Extending max_result_window for {index} index to {new_max_result_window}") + + url = f"https://{host_manager.get_master_ip()}:9200/{index}/_settings" + headers = { + 'Content-Type': 'application/json', + } + data = { + "index": { + "max_result_window": new_max_result_window + } + } + + response = requests.put(url=url, json=data, verify=False, + auth=requests.auth.HTTPBasicAuth(credentials['user'], credentials['password']), + headers=headers) + + if response.status_code == 200: + logging.info(f"Successfully updated max_result_window for {index} index.") + else: + logging.error(f"Failed to update max_result_window for {index} index. Response: {response.text}") \ No newline at end of file diff --git a/tests/end_to_end/test_vulnerability_detector/conftest.py b/tests/end_to_end/test_vulnerability_detector/conftest.py index 181e641ec6..e4a76010e3 100644 --- a/tests/end_to_end/test_vulnerability_detector/conftest.py +++ b/tests/end_to_end/test_vulnerability_detector/conftest.py @@ -52,7 +52,7 @@ def test_example(host_manager): restore_configuration, save_indexer_credentials_into_keystore) from wazuh_testing.end_to_end.indexer_api import ( - get_wazuh_states_vulnerabilities_indexname, delete_index) + get_wazuh_states_vulnerabilities_indexname, delete_index, extend_result_window) from wazuh_testing.end_to_end.logs import (get_hosts_alerts, get_hosts_logs, truncate_remote_host_group_files) from wazuh_testing.end_to_end.remote_operations_handler import ( @@ -400,6 +400,11 @@ def enable_modulesd_debug(request, host_manager): host_manager.modify_file_content(manager, '/var/ossec/etc/local_internal_options.conf', 'wazuh_modules.debug=0\n') host_manager.control_environment('restart', ['manager'], parallel=True) +@pytest.fixture(scope='session', autouse=True) +def max_result_window(request, host_manager): + vuln_index = get_wazuh_states_vulnerabilities_indexname() + extend_result_window(host_manager, index=vuln_index) + @pytest.fixture(scope='session', autouse=True) def handle_gather_evidence_when_passed(request):