Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IT VDT - Add SUSE Linux Enterpise Support for 4.4 #2945

Merged
merged 102 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
48dee81
add: Add custom feeds for suse
CamiRomero Apr 22, 2022
b98bab1
add: new mocking agent systems
Deblintrake09 Apr 22, 2022
c1e5155
add: SUSE test cases for test_no_agent_data
Deblintrake09 Apr 22, 2022
23fd0f3
docu: add tested SUSE systems - test_no_agent_data
Deblintrake09 Apr 22, 2022
a2a76d6
add: test cases and config for SUSE cases
Deblintrake09 Apr 22, 2022
8c9766b
add: generate suse vulnerabilites json
Deblintrake09 Apr 27, 2022
e9226c1
fix: modify execute_sqlite_query to return values
Deblintrake09 Apr 27, 2022
a56ccde
add: SUSE systems to mock SYSTEM_DATA array
Deblintrake09 Apr 27, 2022
541ab10
add: vendor tag to update_feed_path_configurations
Deblintrake09 Apr 27, 2022
cd155d1
add: create suse_vulnerabilities yaml
Deblintrake09 Apr 27, 2022
67a84b6
create suse_vulnerabilities cases yaml
Deblintrake09 Apr 27, 2022
36aaf23
refac: remove unused imported functions
Deblintrake09 Apr 27, 2022
d8eaf37
test: add new test_scan_suse_vulnerabilites.py
Deblintrake09 Apr 27, 2022
af4ad0b
fix: add deps_id param to insert_vulnerabilites
Deblintrake09 Apr 27, 2022
233cb73
add: new func insert_dependency & insert_pkg_dep
Deblintrake09 Apr 27, 2022
cbe1310
add: new fixture check_cve_db
Deblintrake09 Apr 27, 2022
85f61d4
fix: add more information SUSE mock systems
Deblintrake09 Apr 29, 2022
863b904
add: insert_suse_vulnerabilities function
Deblintrake09 Apr 29, 2022
cc33b83
add: check_suse_system_vulnerabilities function
Deblintrake09 Apr 29, 2022
83b4dce
add: fixture to prepare enviroment for suse scan
Deblintrake09 Apr 29, 2022
190a40a
refac: fix JSON format for suse vulnerabilities
Deblintrake09 Apr 29, 2022
4cf829d
fix: test_cases_suse_vulnerabilities yaml
Deblintrake09 Apr 29, 2022
4cbd3ec
rm: remove suse from test_scan_nvd test cases
Deblintrake09 Apr 29, 2022
d43d9e4
fix: suse system configuration
Deblintrake09 Apr 29, 2022
6cd0ea4
fix: refactor test_scan_suse_vulnerabilities v3
Deblintrake09 Apr 29, 2022
03d8bf6
fix: create alternative vulnerabilities and feeds
Deblintrake09 May 2, 2022
893abf0
test: ne test_scam_suse_vulnerability_removal
Deblintrake09 May 3, 2022
030df68
fix: change min_full_scan_interval suse_removal
Deblintrake09 May 3, 2022
8f50e7d
fix: update custom_suse_oval_feed - apply to test
Deblintrake09 May 5, 2022
e62d1a2
rm: delete unused variable
Deblintrake09 May 12, 2022
03b1945
refac: change name id var in insert_dependency
Deblintrake09 May 12, 2022
09c13e2
rm: remove unused variable and rollback changes
Deblintrake09 May 12, 2022
f62538b
refac: remove unneeded lines and fix some formatting
Deblintrake09 May 12, 2022
cedc565
doc: add docu to functions in vdt.__init__
Deblintrake09 May 12, 2022
f24064f
rm: remove changes check_vulnerability_affects_log
Deblintrake09 May 12, 2022
d4818b4
refac: add complete SLES15 mock data
Deblintrake09 May 12, 2022
6aa2a83
refac: modify suse mocked system data
Deblintrake09 May 16, 2022
b2b21e1
add: suse_system_package and function to insert
Deblintrake09 May 16, 2022
a9f212f
add: Add test case enable for SUSE Linux
CamiRomero Apr 22, 2022
d23e818
add: Add test case disabled for SUSE Linux
CamiRomero Apr 22, 2022
4ecfd64
add: Add test case 'missing OS' for SUSE Linux
CamiRomero Apr 22, 2022
c7c86c7
add: Add test cases to 'test_os'
CamiRomero Apr 22, 2022
27343c1
add: Add suse case to 'cases_update_from_year'
CamiRomero Apr 22, 2022
94058c5
fix: Fix typo in SUSE
CamiRomero Apr 22, 2022
7de6db4
add: Add case for suse to 'update_interval'
CamiRomero Apr 22, 2022
226189c
add: Add test documentation for SUSE
CamiRomero Apr 22, 2022
62b6f39
rm: Remove imports
CamiRomero Apr 22, 2022
ae18767
add: Add cases of download feeds in the yaml file.
damarisg Apr 25, 2022
409a60d
fix: Fix provider_os in 'cases_download_feeds'
CamiRomero Apr 27, 2022
6099a17
add: Add suse to cases_duplicated.yaml
CamiRomero Apr 27, 2022
67dae31
Modify test in order to run suse cases
CamiRomero Apr 27, 2022
117f623
add: Add invalid case for SUSE
CamiRomero Apr 27, 2022
ce725c5
add: Add configuration for suse
CamiRomero Apr 27, 2022
aa83fc7
add: add cases for suse in 'validate test'
CamiRomero Apr 27, 2022
d6e5186
add: Add test documentation for suse
CamiRomero Apr 27, 2022
64f55c8
rm: Remove unnecesary imports
CamiRomero Apr 27, 2022
b5b091b
add: Add custom_suse_oval_fedd variable
CamiRomero Apr 27, 2022
4842a88
Add: Add cases fot all OS - suse
CamiRomero Apr 27, 2022
82f972c
add: Add test cases enableb for all OS - suse
CamiRomero Apr 27, 2022
a8c62d9
add: Add restart Wazuh
CamiRomero Apr 28, 2022
e7b07c1
add: Add OS to missing_os test
CamiRomero Apr 28, 2022
84e899d
fix: Fix documentation about suse test
CamiRomero Apr 28, 2022
b2e4aef
Add: add OS comments
CamiRomero Apr 28, 2022
ebe5644
fix: Fix copyright
CamiRomero Apr 28, 2022
9716ec2
docu: add suse to supported systems
Deblintrake09 May 16, 2022
5851d58
add: suse case to scan_provider_vulns
Deblintrake09 May 16, 2022
bd05cf8
add: suse case to test_scan_provider_and_nvd vulns
Deblintrake09 May 16, 2022
e69af86
refac: modify custom_suse_oval_feed
Deblintrake09 May 16, 2022
4b4fa30
rm: test_scan_suse_vulnerabilities
Deblintrake09 May 16, 2022
91fa488
refac: fix suse_feed import
Deblintrake09 May 16, 2022
ae475e3
refac: clean custom_suse_oval_feed
Deblintrake09 May 16, 2022
a64b553
rm: delete test_scan_suse_vuln_removal
Deblintrake09 May 17, 2022
8da9f89
refac: make test_scan_vuln_removal accept agent OS
Deblintrake09 May 17, 2022
0ed67f7
add: SUSE test case scan_vuln_removal
Deblintrake09 May 17, 2022
ed6a9ea
rm: delete unused file
Deblintrake09 May 17, 2022
a112182
rm: delete unused functions
Deblintrake09 May 17, 2022
e7ab614
docu: add supported SUSE systems
Deblintrake09 May 17, 2022
2b5fca9
style: remove whitespaces
Deblintrake09 May 17, 2022
759a050
rm: remove unused imports
Deblintrake09 May 17, 2022
6b0f96f
docu: update docu
Deblintrake09 May 17, 2022
efd74ed
style: adjust files to pep8
Deblintrake09 May 17, 2022
facad52
docu: update wazuh_min_version to 4.4.0
Deblintrake09 May 17, 2022
32fce15
style: remove whitespace
Deblintrake09 May 17, 2022
c87ac11
style: fix to comply to pep8
Deblintrake09 May 17, 2022
b91e372
style: fix typo
Deblintrake09 May 17, 2022
dc8d955
Update CHANGELOG.md
Deblintrake09 May 19, 2022
9346701
rm: delete unused imports in conftest.py
Deblintrake09 May 19, 2022
6c0e8ab
Merge pull request #2833 from wazuh/2807-add-test-feeds-cases
damarisg Apr 29, 2022
e050dfa
rm: Update last SUSE version to test.
damarisg May 20, 2022
def177d
rm: Update doc with wazuh_min_version and OS version supported.
damarisg May 20, 2022
802211b
fix: modify threxhold_weeks for SLED11
Deblintrake09 May 23, 2022
4b3a68c
fix: modify threxhold_weeks for SLED11
Deblintrake09 May 23, 2022
4ef835a
gitfix: modify threxhold_weeks for SLED11
Deblintrake09 May 23, 2022
58e458e
fix: test_download_feeds always pass if Timeout
Deblintrake09 May 27, 2022
d7095c0
docu: Fix test_scan_vulnerability_removal
Deblintrake09 May 27, 2022
77ea3a1
fix: Remove unused data in test
Deblintrake09 May 27, 2022
17d8e61
style: Fix SUSE_SYSTEM_PACKAGE indentation
Deblintrake09 May 30, 2022
d56719a
fix: Modify BIONIC xfail structure
Deblintrake09 May 31, 2022
9e26335
rm: Delete restart in test_multiple_providers
Deblintrake09 Jun 1, 2022
021375f
fix: Add restart_wazuh_daemon_after_finishing
Deblintrake09 Jun 1, 2022
c2c0cb4
fix: indentation error in test_download_feeds
Deblintrake09 Jun 1, 2022
a3f723a
fix: raise download_timeout for RHEL feed
Deblintrake09 Jun 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Release report: TBD
- Add system test to check that agent registered in master node with a specific group is synced to worker node [#2686]((https:/wazuh/wazuh-qa/pull/2686))
- Add system test cluster sync group with 40 agents ([#2761](https:/wazuh/wazuh-qa/pull/2761))
- Add system test - 40 agents cluster syncs group ([#2764](https:/wazuh/wazuh-qa/pull/2764))
- Add support for SUSE systems in VDT tests ([#2902](https:/wazuh/wazuh-qa/pull/2902))
- Add `qa-docs` `v0.1`([#2649](https:/wazuh/wazuh-qa/pull/2649))
- Add `qa-ctl` `v0.3.1`([#2649](https:/wazuh/wazuh-qa/pull/2649))
- Add test fim with file currently open ([#2300](https:/wazuh/wazuh-qa/pull/2300))
Expand Down
5 changes: 3 additions & 2 deletions deps/wazuh_testing/wazuh_testing/db_interface/agent_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def insert_hotfix(agent_id='000', scan_id=int(time()), scan_time=datetime.dateti


def insert_os_info(agent_id='000', scan_id=int(time()), scan_time=datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S"),
hostname='centos8', architecture='x64', os_name='CentOS Linux', os_version='8.4', os_codename= '',
hostname='centos8', architecture='x64', os_name='CentOS Linux', os_version='8.4', os_codename='',
os_major='8', os_minor='4', os_patch='', os_build='', os_platform='centos', sysname='Linux',
release='', version='', os_release='', checksum='dummychecksum', os_display_version='', triaged=0,
reference=''):
Expand Down Expand Up @@ -138,6 +138,7 @@ def insert_package(agent_id='000', scan_id=int(time()), format='rpm', name='cust
f"{arguments['description']}, {arguments['location']}, {arguments['triaged']}, {arguments['checksum']},"
f"{arguments['item_id']})")


def update_sync_info(agent_id='000', component='syscollector-packages', last_attempt=1, last_completion=1,
n_attempts=0, n_completions=0, last_agent_checksum=''):
"""Update the sync_info table of the specified agent for the selected component.
Expand Down Expand Up @@ -215,7 +216,7 @@ def delete_os_info(agent_id='000'):


def update_os_info(agent_id='000', scan_id=int(time()), scan_time=datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S"),
hostname='centos8', architecture='x64', os_name='CentOS Linux', os_version='8.4', os_codename= '',
hostname='centos8', architecture='x64', os_name='CentOS Linux', os_version='8.4', os_codename='',
os_major='8', os_minor='4', os_patch='', os_build='', os_platform='centos', sysname='Linux',
release='', version='', os_release='', checksum='dummychecksum', os_display_version='', triaged=0,
reference=''):
Expand Down
7 changes: 4 additions & 3 deletions deps/wazuh_testing/wazuh_testing/db_interface/cve_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def insert_vulnerability(cveid='CVE-000', target='RHEL7', target_minor='',
reference='https:/wazuh/wazuh-qa', target_v='REDHAT', cvss='10.000000',
cvss_vector='AV:N/AC:L/Au:N/C:C/I:C/A:C', rationale='Wazuh integration test vulnerability',
cvss3='', bugzilla_reference='https:/wazuh/wazuh-qa', cwe='WVE-000 -> WVE-001',
advisory='RHSA-2010:0029', ref_target='RHEL'):
advisory='RHSA-2010:0029', ref_target='RHEL', deps_id='0'):
"""Insert a vulnerability in CVE database.

Args:
Expand All @@ -87,10 +87,11 @@ def insert_vulnerability(cveid='CVE-000', target='RHEL7', target_minor='',
cwe (str): CWE ID.
advisory (str): Advisory ID.
ref_target (str): OS target ID.
deps_id (str): id of the dependencies related to the vulnerability.
"""
queries = [
'INSERT INTO VULNERABILITIES (cveid, target, target_minor, package, operation, operation_value) VALUES '
f"('{cveid}', '{target}', '{target_minor}', '{package}', '{operation}', '{operation_value}')",
'INSERT INTO VULNERABILITIES (cveid, target, target_minor, package, operation, operation_value, deps_id) VALUES'
f" ('{cveid}', '{target}', '{target_minor}', '{package}', '{operation}', '{operation_value}', '{deps_id}')",

'INSERT INTO VULNERABILITIES_INFO (ID, title, severity, published, updated, target, rationale, cvss, '
f"cvss_vector, CVSS3, cwe) VALUES ('{cveid}', '{title}', '{severity}', '{published}', '{updated}', "
Expand Down
43 changes: 31 additions & 12 deletions deps/wazuh_testing/wazuh_testing/mocking/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@
'WINDOWS_SERVER_2019': {'os_name': 'Microsoft Windows Server 2019', 'os_major': '10', 'os_minor': '0',
'os_platform': 'windows', 'name': 'windows_server_2019', 'os_version': '1000'},
'WINDOWS_SERVER_2022_1': {'os_name': 'Microsoft Windows Server 2022', 'os_major': '10', 'os_minor': '0',
'os_platform': 'windows', 'name': 'windows_server_2022', 'os_version': '1000'},
'os_platform': 'windows', 'name': 'windows_server_2022', 'os_version': '1000'},
'WINDOWS_SERVER_2022_2': {'os_name': 'Microsoft Windows Server 2022', 'os_major': '10', 'os_minor': '0',
'os_platform': 'windows', 'name': 'windows_server', 'os_version': '1000'},
'os_platform': 'windows', 'name': 'windows_server', 'os_version': '1000'},
'MAC': {'os_name': 'Mac OS X', 'os_major': '10', 'os_minor': '15', 'os_platform': 'darwin',
'name': 'macos-catalina'},
'MACS': {'os_name': 'Mac OS X Server', 'os_major': '5', 'os_minor': '10', 'os_platform': 'darwin',
'name': 'macos-server'},
'ARCH': {'os_name': 'Arch Linux', 'os_major': '', 'os_minor': '', 'os_platform': '', 'name': 'archlinux'},
'ALAS': {'hostname': 'amz', 'architecture': 'x86_64', 'os_name': 'Amazon Linux AMI', 'os_version': '2018.03',
'os_codename': '', 'os_major': '2018', 'os_minor': '03', 'os_patch': '', 'os_build': '',
'os_platform': 'amzn', 'sysname': 'Linux', 'release': '4.14.97-74.72.amzn1.x86_64',
'version': 'Wazuh v4.3.0', 'os_release': '', 'checksum': '1645433796303855540', 'os_display_version': '',
'triaged': '0', 'reference': '0886f3023b131f5bf1ecbc33f651807114cb5a53', 'name': 'amz', 'ip': '127.0.0.1',
'register_ip': '127.0.0.1', 'internal_key': '',
'os_uname': 'Linux |amz |4.14.97-74.72.amzn1.x86_64 |#1 SMP Tue Feb 5 20:59:30 UTC 2019 |x86_64',
'os_arch': 'x86_64', 'config_sum': '', 'merged_sum': '', 'manager_host': 'amz', 'node_name': 'node01',
'date_add': '1645433793', 'last_keepalive': '253402300799', 'sync_status': 'synced',
'connection_status': 'active', 'disconnection_time': '0'},
'os_codename': '', 'os_major': '2018', 'os_minor': '03', 'os_patch': '', 'os_build': '',
'os_platform': 'amzn', 'sysname': 'Linux', 'release': '4.14.97-74.72.amzn1.x86_64',
'version': 'Wazuh v4.3.0', 'os_release': '', 'checksum': '1645433796303855540', 'os_display_version': '',
'triaged': '0', 'reference': '0886f3023b131f5bf1ecbc33f651807114cb5a53', 'name': 'amz', 'ip': '127.0.0.1',
'register_ip': '127.0.0.1', 'internal_key': '',
'os_uname': 'Linux |amz |4.14.97-74.72.amzn1.x86_64 |#1 SMP Tue Feb 5 20:59:30 UTC 2019 |x86_64',
'os_arch': 'x86_64', 'config_sum': '', 'merged_sum': '', 'manager_host': 'amz', 'node_name': 'node01',
'date_add': '1645433793', 'last_keepalive': '253402300799', 'sync_status': 'synced',
'connection_status': 'active', 'disconnection_time': '0'},
'ALAS2': {'hostname': 'alas2', 'architecture': 'x86_64', 'os_name': 'Amazon Linux', 'os_version': '2',
'os_codename': '', 'os_major': '2', 'os_minor': '', 'os_patch': '', 'os_build': '', 'os_platform': 'amzn',
'sysname': 'Linux', 'release': '4.14.198-152.320.amzn2.x86_64', 'version': 'Wazuh v4.3.0',
Expand Down Expand Up @@ -103,7 +103,26 @@
'BUSTER': {'os_name': 'Debian GNU/Linux', 'os_major': '10', 'os_minor': '0', 'os_platform': 'debian',
'name': 'debian10'},
'STRETCH': {'os_name': 'Debian GNU/Linux', 'os_major': '9', 'os_minor': '0', 'os_platform': 'debian',
'name': 'debian9'}
'name': 'debian9'},
'SLED11': {'hostname': 'sled', 'architecture': 'x86_64', 'os_name': 'SLED', 'os_major': '11', 'os_minor': '',
'os_platform': 'sled', 'name': 'Desktop11', 'os_codename': 'sled'},
'SLED12': {'hostname': 'sled', 'architecture': 'x86_64', 'os_name': 'SLED', 'os_major': '12', 'os_minor': '',
'os_platform': 'sled', 'name': 'Desktop12', 'os_codename': 'sled'},
'SLED15': {'hostname': 'sled', 'architecture': 'x86_64', 'os_name': 'SLED', 'os_major': '15', 'os_minor': '',
'os_platform': 'sled', 'name': 'Desktop15', 'os_codename': 'sled'},
'SLES11': {'hostname': 'sles', 'architecture': 'x86_64', 'os_name': 'SLES', 'os_major': '11', 'os_minor': '',
'os_platform': 'sles', 'name': 'Server11', 'os_codename': 'sles'},
'SLES12': {'hostname': 'sles', 'architecture': 'x86_64', 'os_name': 'SLES', 'os_major': '12', 'os_minor': '',
'os_platform': 'sles', 'name': 'Server12', 'os_codename': 'sles'},
'SLES15': {'hostname': 'localhost', 'architecture': 'x64', 'os_name': 'SLES', 'os_version': '15.2',
'os_codename': '', 'os_major': '15', 'os_minor': '', 'os_patch': '', 'os_build': '',
'os_platform': 'sles', 'sysname': 'Linux', 'release': '5.3.18-22-default', 'version': 'Wazuh v4.4.0',
'os_release': '', 'checksum': '1652388661375945607', 'name': 'SUSE15', 'ip': '127.0.0.1',
'register_ip': 'any', 'internal_key': '',
'os_uname': 'Linux |localhost|5.3.18-22-default |#1 SMP Wed Jun 3 12:16:43 UTC 2020 (720aeba)|x86_64',
'os_arch': 'x64', 'config_sum': '', 'merged_sum': '', 'manager_host': 'localhost.localdomain',
'node_name': 'node01', 'date_add': '1652381429', 'last_keepalive': '253402300799',
'sync_status': 'synced', 'connection_status': 'active'}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
CUSTOM_ARCHLINUX_JSON_FEED = 'custom_archlinux_feed.json'
CUSTOM_ALAS_JSON_FEED = 'custom_alas_feed.json'
CUSTOM_ALAS2_JSON_FEED = 'custom_alas2_feed.json'
CUSTOM_SUSE_OVAL_FEED = 'custom_suse_oval_feed.xml'

VULNERABILITY_DETECTOR_PREFIX = r'.*wazuh-modulesd:vulnerability-detector.*'

Expand Down Expand Up @@ -67,6 +68,17 @@
}
]

SUSE_SYSTEM_PACKAGE = {
'SLES15': [
{
"name": "sle-module-basesystem-release",
"version": "15.2",
"format": "rpm",
"vendor": "SUSE LLC <https://www.suse.com/>"
}
]
}


def update_feed_path_configurations(configurations, metadata, feeds_path):
"""Replace feed path tags in the configuration template, using the metadata information.
Expand All @@ -83,17 +95,17 @@ def update_feed_path_configurations(configurations, metadata, feeds_path):

for index, _ in enumerate(configurations):
if 'json_feed' in metadata[index] and metadata[index]['json_feed'] is not None:
new_configurations[index] = json.loads(json.dumps(new_configurations[index]).\
new_configurations[index] = json.loads(json.dumps(new_configurations[index]).
replace(metadata[index]['json_feed_tag'], os.path.join(feeds_path, metadata[index]['provider_name'],
metadata[index]['json_feed'])))

if 'oval_feed' in metadata[index] and metadata[index]['oval_feed'] is not None:
new_configurations[index] = json.loads(json.dumps(new_configurations[index]).\
new_configurations[index] = json.loads(json.dumps(new_configurations[index]).
replace(metadata[index]['oval_feed_tag'], os.path.join(feeds_path, metadata[index]['provider_name'],
metadata[index]['oval_feed'])))

if 'nvd_feed_tag' in metadata[index] and 'nvd_feed' in metadata[index]:
new_configurations[index] = json.loads(json.dumps(new_configurations[index]).\
new_configurations[index] = json.loads(json.dumps(new_configurations[index]).
replace(metadata[index]['nvd_feed_tag'], os.path.join(feeds_path, 'nvd', metadata[index]['nvd_feed'])))

return new_configurations
Expand Down Expand Up @@ -130,6 +142,24 @@ def insert_vulnerabilities_agent_inventory(agent_id='000', status='VALID'):
cve=package['cveid'], status=status)


def insert_suse_system_package(agent_id='000', version='SLES15'):
"""Insert suse OS package to an agent.

Args:
agent_id (str): Agent ID.
version (str): Package version.

Raises:
ValueError: If version parameter has an invalid value.
"""
if version not in SUSE_SYSTEM_PACKAGE:
raise ValueError(f"Suse system parameter invalid.")

for package in SUSE_SYSTEM_PACKAGE[version]:
agent_db.insert_package(name=package['name'], version=package['version'], source=package['name'],
agent_id=agent_id, vendor=package['vendor'])


def feed_is_recently_updated(provider_name, provider_os, threshold_weeks):
"""Check if the provider OS feed is recently updated according to a specified threshold.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def check_vuln_detector_event(file_monitor=None, callback='', error_message=None
error_message

file_monitor.start(timeout=timeout, update_position=update_position, accum_results=accum_results,
callback=make_vuln_callback(callback, prefix), error_message=error_message)
callback=make_vuln_callback(callback, prefix), error_message=error_message)


def check_vulnerability_detector_disabled():
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ def restart_wazuh_daemon_function(daemon=None):
truncate_file(LOG_FILE_PATH)
control_service("restart", daemon=daemon)

@pytest.fixture(scope='module')
def restart_wazuh_daemon_after_finishing(daemon=None):
"""
Restart a Wazuh daemon
"""
yield
truncate_file(LOG_FILE_PATH)
control_service("restart", daemon=daemon)

@pytest.fixture(scope='module')
def reset_ossec_log(get_configuration, request):
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/test_vulnerability_detector/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Created by Wazuh, Inc. <[email protected]>.
# This program is free software; you can redistribute it and/or modify it under the terms of GPLv2
import pytest

from subprocess import CalledProcessError

from wazuh_testing.tools.services import control_service
Expand Down Expand Up @@ -111,6 +112,10 @@ def prepare_full_scan_with_vuln_packages_and_custom_system(agent_system, mock_ag
# Insert vulnerable packages
package_vendor = 'Red Hat, Inc.' if 'RHEL' in agent_system else 'wazuh-mocking'

if 'SLES' in agent_system:
package_vendor = 'SUSE LLC <https://www.suse.com/>'
vd.insert_suse_system_package(agent_id=mock_agent_with_custom_system, version=agent_system)

vd.insert_vulnerable_packages(agent_id=mock_agent_with_custom_system, vendor=package_vendor)

# Update sync info for packages
Expand Down
Loading