Skip to content

Commit

Permalink
feat(#3040): Integration tests for Vulnerability Detector - RHEL 9 su…
Browse files Browse the repository at this point in the history
…pport
  • Loading branch information
tdrauncieal committed Sep 15, 2023
1 parent 39f1354 commit 8bb06c8
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ All notable changes to this project will be documented in this file.
Wazuh commit: TBD \
Release report: TBD

### Added

- Add Integration tests for Vulnerability Detector: Red Hat 9 support (https:/wazuh/wazuh-qa/issues/3040)

### Changed

- Update _wazuh_db_ schema database version ([#4353](https:/wazuh/wazuh-qa/pull/4353)) \- (Tests)
Expand Down
2 changes: 2 additions & 0 deletions deps/wazuh_testing/wazuh_testing/mocking/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
'config_sum': '', 'merged_sum': '', 'manager_host': 'alas2022', 'node_name': 'node01',
'date_add': '1645538646', 'last_keepalive': '253402300799', 'sync_status': 'synced',
'connection_status': 'active'},
'RHEL9': {'os_name': 'CentOS Linux', 'os_major': '9', 'os_minor': '1', 'os_platform': 'centos',
'name': 'centos9', 'connection_status': 'active'},
'RHEL8': {'os_name': 'CentOS Linux', 'os_major': '8', 'os_minor': '1', 'os_platform': 'centos',
'name': 'centos8', 'connection_status': 'active'},
'RHEL7': {'os_name': 'CentOS Linux', 'os_major': '7', 'os_minor': '1', 'os_platform': 'centos', 'os_version': '7.0',
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ def mock_system(request):
"""Update the agent system in the global DB using the `mocked_system` variable defined in the test module and
restore the initial one after finishing.
"""
system = getattr(request.module, 'mocked_system') if hasattr(request.module, 'mocked_system') else 'RHEL8'
system = getattr(request.module, 'mocked_system') if hasattr(request.module, 'mocked_system') else 'RHEL9'

# Backup the old system data
sys_info = get_system()
Expand Down Expand Up @@ -1235,7 +1235,7 @@ def mock_agent_module():
@pytest.fixture(scope='function')
def mock_agent_function(request):
"""Fixture to create a mocked agent in wazuh databases"""
system = getattr(request.module, 'mocked_system') if hasattr(request.module, 'mocked_system') else 'RHEL8'
system = getattr(request.module, 'mocked_system') if hasattr(request.module, 'mocked_system') else 'RHEL9'
agent_data = mocking.SYSTEM_DATA[system] if system in mocking.SYSTEM_DATA else {'name': 'mocked_agent'}

agent_id = mocking.create_mocked_agent(**agent_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- os:
attributes:
- url: CUSTOM_FEED_URL
value: '8'
value: '9'
- url:
value: CUSTOM_FEED_URL
- provider:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@
download_timeout: 150
update_treshold_weeks: 2

- name: RHEL9
description: Red Hat Enterprise Linux provider
configuration_parameters:
PROVIDER: redhat
OS: '9'
metadata:
provider_name: Red Hat Enterprise Linux 9
provider_json_name: JSON Red Hat Enterprise Linux
provider_os: RHEL9
download_timeout: 150
update_treshold_weeks: 2

- name: TRUSTY
description: Canonical provider
configuration_parameters:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
- name: RedHat
description: Insert RHEL 9 OVAL and JSON feed from local path
configuration_parameters:
PROVIDER: redhat
OS: '9'
OS_PATH: CUSTOM_REDHAT_OVAL_FEED_PATH
PATH: CUSTOM_REDHAT_JSON_FEED_PATH
metadata:
provider_name: Red Hat Enterprise Linux 9
provider_json_name: JSON Red Hat Enterprise Linux

- name: RedHat
description: Insert RHEL 8 OVAL and JSON feed from local path
configuration_parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@
decompressed_file: /tmp/rhel8.xml
url: https://www.redhat.com/security/data/oval/v2/RHEL8/rhel-8-including-unpatched.oval.xml.bz2

- name: Red Hat Enterprise Linux
description: Red Hat Enterprise Linux provider
configuration_parameters:
metadata:
provider_name: Red Hat Enterprise Linux 9
expected_format: application/x-bzip2
path: /tmp/rhel-9-including-unpatched.oval.xml.bz2
extension: bz2
decompressed_file: /tmp/rhel9.xml
url: https://www.redhat.com/security/data/oval/v2/RHEL9/rhel-9-including-unpatched.oval.xml.bz2

- name: Canonical Jammy
description: Canonical provider
configuration_parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@
metadata:
provider_name: Ubuntu Jammy

- name: RHEL 9
description: Test disabled Red Hat Enterprise Linux 9
configuration_parameters:
ENABLED: 'no'
PROVIDER: redhat
OS: '9'
metadata:
provider_name: Red Hat Enterprise Linux 9

- name: RHEL 8
description: Test disabled Red Hat Enterprise Linux 8
configuration_parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@
metadata:
provider_name: Ubuntu Jammy

- name: RHEL 9
description: Test enabled Red Hat Enterprise Linux 8
configuration_parameters:
ENABLED: 'yes'
PROVIDER: redhat
OS: '9'
metadata:
provider_name: Red Hat Enterprise Linux 9

- name: RHEL 8
description: Test enabled Red Hat Enterprise Linux 8
configuration_parameters:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
- name: RedHat 8
description: Insert RHEL 8 OVAL and JSON feed from local path
- name: RedHat 9
description: Insert RHEL 9 OVAL and JSON feed from local path
configuration_parameters:
PROVIDER: redhat
OS: '8'
OS: '9'
OS_PATH: CUSTOM_REDHAT_OVAL_FEED_PATH
PATH: CUSTOM_REDHAT_JSON_FEED_PATH
metadata:
provider_name: Red Hat Enterprise Linux 8
provider_name: Red Hat Enterprise Linux 9
provider_json_name: JSON Red Hat Enterprise Linux
oval_feed_path: CUSTOM_REDHAT_OVAL_FEED_PATH
json_feed_path: CUSTOM_REDHAT_JSON_FEED_PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- os:
attributes:
- path: CUSTOM_REDHAT_OVAL_FEED
value: '8'
value: '9'
- path:
value: CUSTOM_REDHAT_JSON_FEED
- provider:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- os:
attributes:
- path: CUSTOM_REDHAT_OVAL_FEED
value: '8'
value: '9'
- path:
value: CUSTOM_REDHAT_JSON_FEED
- provider:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- os:
attributes:
- path: CUSTOM_REDHAT_OVAL_FEED
value: '8'
value: '9'
- path:
value: CUSTOM_REDHAT_JSON_FEED
- provider:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
configuration_parameters:
NVD_JSON_PATH: CUSTOM_NVD_JSON_PATH
metadata:
system: RHEL8
system: RHEL9

- name: UBUNTU
description: Scan UBUNTU vulnerabilities using only the NVD feed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
configuration_parameters: null
metadata:
provider_name: redhat
system: RHEL8
system: RHEL9
json_feed: custom_redhat_json_feed.json
oval_feed: custom_redhat_oval_feed.xml
nvd_feed: custom_nvd_feed.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
configuration_parameters: null
metadata:
provider_name: redhat
system: RHEL8
system: RHEL9
json_feed: custom_redhat_json_feed.json
oval_feed: custom_redhat_oval_feed.xml
nvd_feed: custom_nvd_alternative_feed.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- name: RHEL
description: Check that after partial scan is launched triaged status changes from NULL to 1
configuration_parameters:
OS: '8'
OS: '9'
SCAN_INTERVAL: '5'
metadata:
system: RHEL8
system: RHEL9
triaged: ''
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
configuration_parameters: null
metadata:
provider_name: redhat
system: RHEL8
system: RHEL9
json_feed: custom_redhat_json_feed.json
oval_feed: custom_redhat_oval_feed.xml
nvd_feed: custom_nvd_feed.json
Expand Down

0 comments on commit 8bb06c8

Please sign in to comment.