Closed damarisg closed 1 year ago
After a meeting with the dev team about API usage. We need to send the requests to the /var/ossec/queue/sockets/engine-api socket
(unixgram) using some JSON format https://github.com/wazuh/wazuh/issues/5934#issuecomment-688380312.
As a first attempt to send these to the socket using Python:
INFO: Sending encoded event: b'\x88\x00\x00\x001:location:{"version": 1, "origin": {"name": "worker1","module": "api"},"command": "env","parameters": {"action": "get","name": "test"}}'
It seems like it is received:
root@engine:/home/vagrant/engine/wazuh/src/engine# nc -uUlk /var/ossec/queue/sockets/engine-api
�1:location:{"version": 1, "origin": {"name": "worker1","module": "api"},"command": "env","parameters": {"action": "get","name": "test"}}
But there is no API logging within the /tmp/engine.log
. So something is missing or the unixgram socket is not receiving the message as expected.
I worked trying to make this out, but I was not able to. This issue will be blocked until we have some way to test this
graph
command/tmp/env_graph.dot
fileenv
commandget
subcommand 🟡set
subcommand :yellow_circle:delete
subcommand :yellow_circle:delete
without an env name :yellow_circle:Completed test
command testing. Gathered all logs and cases, and tomorrow I will post the markdown message.
test
command--kvdb-path
option :red_circle:test
subcommand does not accept kvdb paths without an ending /
:red_circle:test
subcommand accepts kvdb paths with an ending /
:red_circle:-f,--file_storage
option :yellow_circle:--environment
option :yellow_circle:source-malicious-ip
rulerule/source-malicious-ip/0
:green_circle:decoder/apache-access/0
:green_circle:decoder/apache-access/0,rule/source-malicious-ip/0
:green_circle:During the testing process we could test the following cases:
graph
command :red_circle:env
command :green_circle:get
subcommand :green_circle:
set
subcommand :yellow_circle:
delete
subcommand :yellow_circle:
test
command :red_circle:--kvdb-path
option :red_circle:
test
subcommand does not accept kvdb paths without an ending \
:red_circle:test
subcommand accepts kvdb paths with an ending \
:red_circle:-f,--file_storage
option :yellow_circle:
--environment
option :yellow_circle:
rule/source-malicious-ip/0
:green_circle:decoder/apache-access/0
:green_circle:decoder/apache-access/0,rule/source-malicious-ip/0
:green_circle:Error logs that are not that descriptive for a user:
Referencing the store and files, like
14:44:31.406714 cmdGraph.cpp:77 ERR[4089 ] Exception while building environment: [exception: [Environment] Error retreiving environment [my-env] from store: [FileDriver] File [/var/ossec/engine/store/my-env] does not exist
These logs appear for these cases:
Logs that are very short and could be more descriptive, like adding the proper way to call them:
root@engine:/home/vagrant/engine/wazuh/src/engine# /var/ossec/engine/wazuh-engine env set
environment is required
Run with --help for more information.
This affects to the following cases:
or
root@engine:/home/vagrant/engine/wazuh/src/engine# /var/ossec/engine/wazuh-engine env get
No active environments found
root@engine:/home/vagrant/engine/wazuh/src/engine#
This affects to the following cases:
Logs that has not the right format:
root@engine:/home/vagrant/engine/wazuh/src/engine# /var/ossec/engine/wazuh-engine env set environment/wazuh/1
Environment created and startedroot@engine:/home/vagrant/engine/wazuh/src/engine#
This affects to the following cases:
When using the testing feature:
--kvdb-path
option it could warn the users about this, so they can know that any action that needs the kvdb won't work
Affected cases:
--kvdb-path
is \
sensitive in the end of the string. It should accept both.
Affected cases:
test
subcommand does not accept kvdb paths without an ending \
test
subcommand accepts kvdb paths with an ending \
Run test with different environments: one with a loaded rule and other without it
case. Maybe it could not appear or say that no rule has been triggered.Repeated cases:
Graph file is not generated:
Repeated cases:
Description
Since the team is reworking the engine, we need to cover this new engine rework. This issue will test the new engine to ensure all is correct. The first two commands with their subcommand were tested in https://github.com/wazuh/wazuh-qa/issues/3475, now some of them like
env
are remainingProposed test cases
API:
We want to test a correct input returns a valid result, an incorrect input returns an error and an unexpected input doesn't crash the program. The module to test are:test
commandgraph
commandenv
commandConsiderations