Skip to content

Commit

Permalink
Merge branch '4.10.0' into bug/5741-error-at-agent-start
Browse files Browse the repository at this point in the history
  • Loading branch information
hossam1522 authored Sep 27, 2024
2 parents 4edd88e + 450388e commit bdce3ba
Show file tree
Hide file tree
Showing 27 changed files with 357 additions and 158 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,35 @@ All notable changes to this project will be documented in this file.
### Fixed

- Changed wazuh-agent service start from install test to registration test ([#5762](https://github.com/wazuh/wazuh-qa/pull/5762)) \- (Tests)
- Fix failed to disable wazuh-manager.service ([#5775])(https://github.com/wazuh/wazuh-qa/pull/5775) \- (Tests)


## [4.9.1] - TBD

### Added

- Added support for macOS 15 (Vagrant) to the Allocation module ([#5743](https://github.com/wazuh/wazuh-qa/pull/5743)) \- (Framework)
- Add Ubuntu 24.04 support to Deployability testing tier 1 ([#5689])(https://github.com/wazuh/wazuh-qa/pull/5689) \- (Tests)
- Added support for macOS 14.6 to the Allocation module (Vagrant) ([#5671](https://github.com/wazuh/wazuh-qa/pull/5671)) \- (Framework)

### Changed

- Update team labels and add 'agent' option ([#5725](https://github.com/wazuh/wazuh-qa/pull/5725)) \- (Framework)
- Change in VD E2E tests to use package feed instead of CTI feed ([#5739](https://github.com/wazuh/wazuh-qa/pull/5739)) \- (Tests)
- Improve VD plots title ([#5740](https://github.com/wazuh/wazuh-qa/pull/5740)) \- (Framework)
- Remove meaningless clean.yaml in DTT1 tests ([#5732])(https://github.com/wazuh/wazuh-qa/pull/5732/) \- (Framework)
- Updated Debian 12 AMIs and Box to 12.7 version ([#5735](https://github.com/wazuh/wazuh-qa/pull/5735)) \- (Framework)

### Fixed

- Fix unexpected warnings in E2E vulnerability detection tests ([#5711](https://github.com/wazuh/wazuh-qa/pull/5711)) \- (Framework + Tests)
- Grafana package used for `upgrade_package_nonvulnerable_to_vulnerable` case is vulnerable ([#5719](https://github.com/wazuh/wazuh-qa/pull/5719)) \- (Tests)
- Increase results windows in E2E Vulnerability detection ([#5712](https://github.com/wazuh/wazuh-qa/pull/5712/)) \- (Framework + Tests)

### Deleted

- Reverted an xfail behaviour change in the API performance test ([#5734](https://github.com/wazuh/wazuh-qa/pull/5734)) \- (Tests)

## [4.9.0] - TBD

### Added
Expand Down
45 changes: 45 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Wazuh Open Source Project Security Policy

Version: 2023-06-12

## Introduction
This document outlines the Security Policy for Wazuh's open source projects. It emphasizes our commitment to maintain a secure environment for our users and contributors, and reflects our belief in the power of collaboration to identify and resolve security vulnerabilities.

## Scope
This policy applies to all open source projects developed, maintained, or hosted by Wazuh.

## Reporting Security Vulnerabilities
If you believe you've discovered a potential security vulnerability in one of our open source projects, we strongly encourage you to report it to us responsibly.

Please submit your findings as security advisories under the "Security" tab in the relevant GitHub repository. Alternatively, you may send the details of your findings to [security@wazuh.com](mailto:security@wazuh.com).

## Vulnerability Disclosure Policy
Upon receiving a report of a potential vulnerability, our team will initiate an investigation. If the reported issue is confirmed as a vulnerability, we will take the following steps:

1. Acknowledgment: We will acknowledge the receipt of your vulnerability report and begin our investigation.
2. Validation: We will validate the issue and work on reproducing it in our environment.
3. Remediation: We will work on a fix and thoroughly test it
4. Release & Disclosure: After 90 days from the discovery of the vulnerability, or as soon as a fix is ready and thoroughly tested (whichever comes first), we will release a security update for the affected project. We will also publicly disclose the vulnerability by publishing a CVE (Common Vulnerabilities and Exposures) and acknowledging the discovering party.
5. Exceptions: In order to preserve the security of the Wazuh community at large, we might extend the disclosure period to allow users to patch their deployments.

This 90-day period allows for end-users to update their systems and minimizes the risk of widespread exploitation of the vulnerability.

## Automatic Scanning
We leverage GitHub Actions to perform automated scans of our supply chain. These scans assist us in identifying vulnerabilities and outdated dependencies in a proactive and timely manner.

## Credit
We believe in giving credit where credit is due. If you report a security vulnerability to us, and we determine that it is a valid vulnerability, we will publicly credit you for the discovery when we disclose the vulnerability. If you wish to remain anonymous, please indicate so in your initial report.

We do appreciate and encourage feedback from our community, but currently we do not have a bounty program. We might start bounty programs in the future.

## Compliance with this Policy
We consider the discovery and reporting of security vulnerabilities an important public service. We encourage responsible reporting of any vulnerabilities that may be found in our site or applications.

Furthermore, we will not take legal action against or suspend or terminate access to the site or services of those who discover and report security vulnerabilities in accordance with this policy because of the fact.

We ask that all users and contributors respect this policy and the security of our community's users by disclosing vulnerabilities to us in accordance with this policy.

## Changes to this Security Policy
This policy may be revised from time to time. Each version of the policy will be identified at the top of the page by its effective date.

If you have any questions about this Security Policy, please contact us at [security@wazuh.com](mailto:security@wazuh.com)
2 changes: 1 addition & 1 deletion deployability/modules/allocation/aws/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _create_instance(cls, base_dir: Path, params: CreationPayload, config: AWSCo
temp_id = cls._generate_instance_id(cls.provider_name)
temp_dir = base_dir / temp_id
credentials = AWSCredentials()
teams = ['qa', 'core', 'framework', 'devops', 'frontend', 'operations', 'cloud', 'threat-intel', 'marketing', 'documentation']
teams = ['qa', 'cppserver', 'pyserver', 'devops', 'dashboard', 'operations', 'cloud', 'threat-intel', 'marketing', 'documentation', 'agent', 'indexer']
platform = str(params.composite_name.split("-")[0])
arch = str(params.composite_name.split("-")[3])
if not config:
Expand Down
16 changes: 12 additions & 4 deletions deployability/modules/allocation/static/specs/os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ vagrant:
virtualizer: virtualbox
linux-debian-12-amd64:
box: debian/bookworm64
box_version: 12.20231211.1
box_version: 12.20240905.1
virtualizer: virtualbox
# Oracle Linux
linux-oracle-7-amd64:
Expand Down Expand Up @@ -182,6 +182,14 @@ vagrant:
box: development/macos-sonoma-1460
box_version: 0.0.0
virtualizer: parallels
macos-sequoia-15-arm64:
box: macos-15
box_version: 0.0.0
virtualizer: parallels
macos-sequoia-15-amd64:
box: development/macos-sequoia
box_version: 0.0.0
virtualizer: parallels
macos-ventura-sign-arm64:
box: macos-ventura-sign
box_version: 0.0.0
Expand Down Expand Up @@ -268,11 +276,11 @@ aws:
zone: us-east-1
user: admin
linux-debian-12-amd64:
ami: ami-055c8118725fe3a84
ami: ami-014124f30c18be425
zone: us-east-1
user: admin
linux-debian-12-arm64:
ami: ami-06703877c23c4ddf1
ami: ami-027a194fc587a2e82
zone: us-east-1
user: admin
# Oracle Linux
Expand Down Expand Up @@ -422,7 +430,7 @@ aws:
zone: us-east-1
user: ec2-user
macos-ventura-13-arm64:
ami: ami-01aa3973cdaf40134
ami: ami-01aa3973cdaf40134
zone: us-east-1
user: ec2-user
macos-sonoma-14-amd64:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ variables:
- linux-debian-11-arm64
- linux-debian-12-amd64
- linux-debian-12-arm64
- linux-ubuntu-24.04-amd64
- linux-ubuntu-24.04-arm64
- linux-ubuntu-22.04-amd64
- linux-ubuntu-22.04-arm64
- linux-ubuntu-18.04-amd64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ variables:
central_components-os:
- linux-ubuntu-20.04-amd64
- linux-ubuntu-22.04-amd64
- linux-ubuntu-24.04-amd64
- linux-amazon-2-amd64
- linux-redhat-7-amd64
- linux-redhat-8-amd64
Expand Down Expand Up @@ -71,6 +72,7 @@ tasks:
depends-on:
- "allocate-central_components-linux-ubuntu-20.04-amd64"
- "allocate-central_components-linux-ubuntu-22.04-amd64"
- "allocate-central_components-linux-ubuntu-24.04-amd64"
- "allocate-central_components-linux-amazon-2-amd64"
- "allocate-central_components-linux-redhat-7-amd64"
- "allocate-central_components-linux-redhat-8-amd64"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ variables:
manager-os:
- linux-ubuntu-20.04-amd64
- linux-ubuntu-22.04-amd64
- linux-ubuntu-24.04-amd64
- linux-amazon-2-amd64
- linux-redhat-7-amd64
- linux-redhat-8-amd64
Expand Down Expand Up @@ -62,14 +63,15 @@ tasks:
- wazuh-1: "{working-dir}/manager-linux-centos-7-amd64/inventory.yaml"
- wazuh-2: "{working-dir}/manager-linux-ubuntu-20.04-amd64/inventory.yaml"
- wazuh-3: "{working-dir}/manager-linux-ubuntu-22.04-amd64/inventory.yaml"
- wazuh-4: "{working-dir}/manager-linux-redhat-7-amd64/inventory.yaml"
- wazuh-5: "{working-dir}/manager-linux-redhat-8-amd64/inventory.yaml"
- wazuh-6: "{working-dir}/manager-linux-redhat-9-amd64/inventory.yaml"
- wazuh-7: "{working-dir}/manager-linux-centos-8-amd64/inventory.yaml"
- wazuh-8: "{working-dir}/manager-linux-debian-10-amd64/inventory.yaml"
- wazuh-9: "{working-dir}/manager-linux-debian-11-amd64/inventory.yaml"
- wazuh-10: "{working-dir}/manager-linux-debian-12-amd64/inventory.yaml"
- wazuh-11: "{working-dir}/manager-linux-amazon-2-amd64/inventory.yaml"
- wazuh-4: "{working-dir}/manager-linux-ubuntu-24.04-amd64/inventory.yaml"
- wazuh-5: "{working-dir}/manager-linux-redhat-7-amd64/inventory.yaml"
- wazuh-6: "{working-dir}/manager-linux-redhat-8-amd64/inventory.yaml"
- wazuh-7: "{working-dir}/manager-linux-redhat-9-amd64/inventory.yaml"
- wazuh-8: "{working-dir}/manager-linux-centos-8-amd64/inventory.yaml"
- wazuh-9: "{working-dir}/manager-linux-debian-10-amd64/inventory.yaml"
- wazuh-10: "{working-dir}/manager-linux-debian-11-amd64/inventory.yaml"
- wazuh-11: "{working-dir}/manager-linux-debian-12-amd64/inventory.yaml"
- wazuh-12: "{working-dir}/manager-linux-amazon-2-amd64/inventory.yaml"
- tests: "install,restart,stop,uninstall"
- component: "manager"
- wazuh-version: "<major.minor.patch>"
Expand All @@ -78,6 +80,7 @@ tasks:
depends-on:
- "allocate-manager-linux-ubuntu-20.04-amd64"
- "allocate-manager-linux-ubuntu-22.04-amd64"
- "allocate-manager-linux-ubuntu-24.04-amd64"
- "allocate-manager-linux-amazon-2-amd64"
- "allocate-manager-linux-redhat-7-amd64"
- "allocate-manager-linux-redhat-8-amd64"
Expand Down
1 change: 0 additions & 1 deletion deployability/modules/testing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def parse_arguments():
parser.add_argument("--tests", required=True)
parser.add_argument("--component", choices=['manager', 'agent', 'central_components'], required=True)
parser.add_argument("--dependencies", action='append', default=[], required=False)
parser.add_argument("--cleanup", required=False, default=True)
parser.add_argument("--wazuh-version", required=True)
parser.add_argument("--wazuh-revision", required=True)
parser.add_argument("--wazuh-branch", required=False)
Expand Down
1 change: 0 additions & 1 deletion deployability/modules/testing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class InputPayload(ExtraVars):
tests: list[str]
targets: list[str]
dependencies: list[str] | None = None
cleanup: bool = True
live: bool = False


Expand Down
11 changes: 0 additions & 11 deletions deployability/modules/testing/playbooks/cleanup.yml

This file was deleted.

32 changes: 5 additions & 27 deletions deployability/modules/testing/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
class Tester:
_playbooks_dir = Path(__file__).parent / 'playbooks'
_setup_playbook = _playbooks_dir / 'setup.yml'
_cleanup_playbook = _playbooks_dir / 'cleanup.yml'
_test_template = _playbooks_dir / 'test.yml'

@classmethod
Expand Down Expand Up @@ -60,14 +59,6 @@ def run(cls, payload: InputPayload) -> None:
cls._setup(ansible, extra_vars)
cls._run_tests(payload.tests, ansible, extra_vars)

# Clean up if required
if payload.cleanup:
for target_path in payload.targets:
target_value = eval(target_path).values()
target_inventory = Inventory(**Utils.load_from_yaml(str(list(target_value)[0])))
logger.info("Cleaning up")
cls._cleanup(ansible, extra_vars['working_dir'])

@classmethod
def _get_extra_vars(cls, payload: InputPayload) -> ExtraVars:
"""
Expand Down Expand Up @@ -96,13 +87,13 @@ def _run_tests(cls, test_list: list[str], ansible: Ansible, extra_vars: ExtraVar
rendering_var = {**extra_vars, 'test': test}
template = str(cls._test_template)
result = ansible.run_playbook(template, rendering_var)

for event in result.events:
logger.info(f"{event['stdout']}")
if result.stats["failures"]:
for event in result.events:
if result.stats["failures"]:
if "fatal" in event['stdout']:
raise Exception(f"Test {test} failed with error")

raise Exception(f"Test {test} failed with error: {event['stdout']}")
else:
logger.info(f"Test {test} Finished with: {event['stdout']}")

@classmethod
def _setup(cls, ansible: Ansible, extra_vars: ExtraVars) -> None:
Expand All @@ -120,16 +111,3 @@ def _setup(cls, ansible: Ansible, extra_vars: ExtraVars) -> None:
if "fatal" in event['stdout']:
raise Exception(f"Setup {template} failed with error: {event['stdout']}")


@classmethod
def _cleanup(cls, ansible: Ansible, remote_working_dir: str = '/tmp') -> None:
"""
Cleanup the environment after the tests.
Args:
ansible (Ansible): The Ansible object to run the cleanup.
remote_working_dir (str): The remote working directory.
"""
extra_vars = {'working_dir': remote_working_dir}
playbook = str(cls._cleanup_playbook)
ansible.run_playbook(playbook, extra_vars)
1 change: 0 additions & 1 deletion deployability/modules/testing/tests/helpers/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def uninstall_manager(inventory_path) -> None:
])

system_commands = [
"systemctl disable wazuh-manager",
"systemctl daemon-reload"
]

Expand Down
10 changes: 5 additions & 5 deletions deps/wazuh_testing/wazuh_testing/end_to_end/check_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabili
for vulnerability in expected_vulns:
if vulnerability not in vulnerabilities.get(agent, []):
logging.critical(f"Vulnerability not found for {agent}: {vulnerability}")
if agent not in vulnerabilities_not_found:
if agent not in vulnerabilities_not_found.keys():
vulnerabilities_not_found[agent] = []
failed_agents.append(agent)

Expand All @@ -39,9 +39,10 @@ def compare_expected_found_vulnerabilities(vulnerabilities, expected_vulnerabili
for vulnerability in agent_vulnerabilities:
if vulnerability not in expected_vulnerabilities.get(agent, []):
logging.critical(f"Vulnerability unexpected found for {agent}: {vulnerability}")
if agent not in vulnerabilities_unexpected:
if agent not in vulnerabilities_unexpected.keys():
vulnerabilities_unexpected[agent] = []
failed_agents.append(agent)
if agent not in failed_agents:
failed_agents.append(agent)

result = False
vulnerabilities_unexpected[agent].append(vulnerability)
Expand Down Expand Up @@ -158,7 +159,6 @@ def equals_but_not_empty(x, y):
empty = lambda x: len(x) == 0

no_errors = lambda x: all(
not any(x[host][level] for level in ["ERROR", "CRITICAL", "WARNING"])
not any(x[host][level] for level in ['ERROR', 'CRITICAL'])
for host in x
)

34 changes: 34 additions & 0 deletions deps/wazuh_testing/wazuh_testing/end_to_end/indexer_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@


WAZUH_STATES_VULNERABILITIES_INDEXNAME_TEMPLATE = 'wazuh-states-vulnerabilities-{cluster_name}'
INDEXER_RESULT_WINDOWS_VULN_E2E = 50000


def get_wazuh_states_vulnerabilities_indexname(cluster_name: str = 'wazuh') -> str:
Expand Down Expand Up @@ -176,3 +177,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}")
Loading

0 comments on commit bdce3ba

Please sign in to comment.