-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
FIM System tests: 0207 Use of report changes #523
Comments
Hi all! Here we comment on some details about the essential changes we applied to reach this issue goals. - Adapted wazuh-qa/tests/system/fim/common_tasks/generate_files.py Lines 165 to 167 in cf3678a
- Adapted wazuh-qa/tests/system/fim/common_tasks/modify_files.py Lines 110 to 112 in cf3678a
In this case, added a new function to add a new sentence at the beginning of the target file, so the difference between the file before and after the change would be printable in the generated alert. as Syscheck will print the whole document in case of inserting the new text at the end of the file and in case of passing over x bytes of length, Syscheck will print Line x changed, More Changes ... and then our tests will not be applicable. def modify_file_text_content(filepath, sentence):
"""
Modify file content by adding sentence at the end of filepath
in a new line.
:param str filepath: The path of the file to modify
:param str sentence: A setnence of 1 or more words.
"""
with open(filepath, 'r+') as file:
content = file.read()
file.seek(0, 0)
file.write(sentence.rstrip('\r\n') + '\n' + content) - Adapted Added a new argument parser.add_argument("-d", "--diff", type=str, required=False, dest='diff_string',
help="When syscheck:report_changes enabled, represents the diff text")
args = parser.parse_args() As you can see, in the function def alerts_prune(path, target_event, diff_statement=None):
.
.
if (diff_statement is not None) and \
('diff' in data['syscheck']) and \
(diff_statement not in data['syscheck']['diff']):
add_path = False
if add_path:
alerts_list.append(data)
add_path = True
.
. - Adapted
Kr, Rshad |
Hi all! Regarding the issue on Windows host, where the alerts of CPU and RAM memory are not relatedWe decided to repeat the experiment with higher RAM memory and CPU. Default Machine Characteristics
Custom Machine Characteristics
Windows Images
But nothing has been changed, the alert still taking a long time to be sent with the same amount (~8 alerts per minute). After checking the Windows machine RAM and CPU behavior we found that there is no leak of RAM memory or CPU, as you can check on the following capture. We can clearly see that the process of Syscheck
|
Hi all! It's clear that Windows is taking a long time to run the diff process of each file, but to know what time it exactly takes depending on each group of files of a determined size, we estimated the time between the first received alert and the last one, testing with the different files groups depending on the file size, separately.
Notes
Kr, Rshad |
Hi!
In this issue, we will comment on all the related activities to complete the design and the implementation of the scenario
Use of report_changes
for FIM system tests.Configuration
ossec.conf
ossec.conf
file: Enablereport_changes
in Syscheck.ossec.conf
file: Enablereport_changes
in Syscheck.All of them can be found in
wazuh-qa/tests/system/fim/scenarios/207_use_of_report_changes/config/
Tasks
Create the corresponding
ossec.conf
with the scenario specifications.Apply the required changes on the corresponding scripts.
create_files.py
modify_files.py
alerts.json
verification script.ES
verification scripts.Adapt actions tasks in Ansible format which will import required actions from common_tasks folder, so it takes into account the newly added parameters for each action script.
create_files.yml
modify_files.yml
delete_files.yml
../vars/main.yml
Done in Add extra parameters variable #530
Create master playbook
launch_test_scenario.yml
which will import the scenario's tasks and launch them.Actions
Tests
added
event, using the corresponding scripts and manually. ✔️mdofied
event and the diff text in the diff field, using the corresponding scripts and manually.Timeout with files of 11MB
❌Note: Between almost 15 execution, in 1 of them, the alerts from Windows took more time to reach the usual in reaching
alerts.json
orElasticsearch
index. From my perspective was lead due to the low performance of the host where Windows is running, because no errors were detected.Pending
of testing with higher dedicated RAM memory for such host. ❌Conclusions
The tests applied on this scenario have been passed successfully. All changes made on the target files were reported by
syscheck:report_changes
. But we detected the issue of taking a long time to run the diff in Windows.Note
: The description may be updated in the future if needed.Kr,
Rshad
The text was updated successfully, but these errors were encountered: