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 Wazuh-logtest: Ruleset reloading at runtime #2077

Merged
merged 104 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
f89e716
base structure for logtest docs added
nmkoremblum Jun 25, 2021
95995f1
logtest index docs updated
nmkoremblum Jun 29, 2021
8633c2a
logtest added to doc indexes
nmkoremblum Jul 1, 2021
20bc39a
logtest ITs index improved
nmkoremblum Jul 1, 2021
2357be6
logtest docs updated
nmkoremblum Jul 1, 2021
ee95206
base structure for logtest docs added
nmkoremblum Jun 25, 2021
d5225c7
logtest index docs updated
nmkoremblum Jun 29, 2021
8e64b54
logtest added to doc indexes
nmkoremblum Jul 1, 2021
aac3531
logtest ITs index improved
nmkoremblum Jul 1, 2021
59ac43c
logtest docs updated
nmkoremblum Jul 1, 2021
2397694
base structure for logtest docs added
nmkoremblum Jun 25, 2021
1de8188
logtest index docs updated
nmkoremblum Jun 29, 2021
4913850
logtest added to doc indexes
nmkoremblum Jul 1, 2021
ec2afd6
logtest ITs index improved
nmkoremblum Jul 1, 2021
29a34ac
logtest docs updated
nmkoremblum Jul 1, 2021
9ab725e
Adds debug mode to analsysid in the remove session IT
juliancnn Jun 24, 2021
d2d059e
Adaptation of logtest IT with runtime ruleset load support
juliancnn Jun 24, 2021
19ec05d
Fixed PEP8 format and added documentation
JcabreraC Jun 30, 2021
34adb3f
logtest docs updated
nmkoremblum Jul 1, 2021
caab645
Daemon start and stop and minor improvements added
nmkoremblum Sep 20, 2021
b60930d
Integration tests fixes according to QA requirements
miguemedina11 Oct 4, 2021
59aa7e8
base structure for logtest docs added
nmkoremblum Jun 25, 2021
b7a2302
logtest index docs updated
nmkoremblum Jun 29, 2021
ec0f733
logtest added to doc indexes
nmkoremblum Jul 1, 2021
d32240c
logtest ITs index improved
nmkoremblum Jul 1, 2021
de1f4df
logtest docs updated
nmkoremblum Jul 1, 2021
7e5c8ad
base structure for logtest docs added
nmkoremblum Jun 25, 2021
9bffc1a
logtest index docs updated
nmkoremblum Jun 29, 2021
0495ace
logtest added to doc indexes
nmkoremblum Jul 1, 2021
568bd88
logtest ITs index improved
nmkoremblum Jul 1, 2021
feb98d4
logtest docs updated
nmkoremblum Jul 1, 2021
f81b23d
Adds integration test for decoders load at logtest runtime
juliancnn Jun 28, 2021
38e3bec
documentation for new test added and indexed
nmkoremblum Jun 28, 2021
7c3427c
Fixed name in decoder_list.yaml
JcabreraC Jun 30, 2021
794c670
Added link documentation to index.md
juliancnn Jul 1, 2021
66b389e
Daemon start and stop and minor improvements added
nmkoremblum Sep 20, 2021
537730f
New ITs changes requested implemented
nmkoremblum Sep 29, 2021
9f26960
base structure for logtest docs added
nmkoremblum Jun 25, 2021
ecf6365
logtest index docs updated
nmkoremblum Jun 29, 2021
9a38db4
logtest added to doc indexes
nmkoremblum Jul 1, 2021
3681560
logtest ITs index improved
nmkoremblum Jul 1, 2021
fbfde3a
logtest docs updated
nmkoremblum Jul 1, 2021
5a50891
base structure for logtest docs added
nmkoremblum Jun 25, 2021
1c37bdc
logtest index docs updated
nmkoremblum Jun 29, 2021
bb75218
logtest added to doc indexes
nmkoremblum Jul 1, 2021
f4672e4
logtest ITs index improved
nmkoremblum Jul 1, 2021
50d49d4
logtest docs updated
nmkoremblum Jul 1, 2021
bb039f4
Adds integration test for ruless load at logtest runtime
juliancnn Jun 29, 2021
629c29c
docs for ITs added
nmkoremblum Jun 30, 2021
f9d580f
Removed duplicate test and corrected documentation
JcabreraC Jun 30, 2021
0fc3df6
Fixes documentation of test_rule_labels
juliancnn Jun 30, 2021
822dc38
Added link documentation to index.md
juliancnn Jul 1, 2021
af1edc9
Daemon start and stop and minor improvements added
nmkoremblum Sep 20, 2021
793d214
New ITs changes requested implemented
nmkoremblum Sep 29, 2021
e36cce8
base structure for logtest docs added
nmkoremblum Jun 25, 2021
033da42
logtest index docs updated
nmkoremblum Jun 29, 2021
b7dec3a
logtest added to doc indexes
nmkoremblum Jul 1, 2021
b01ac98
logtest ITs index improved
nmkoremblum Jul 1, 2021
494685d
logtest docs updated
nmkoremblum Jul 1, 2021
725e508
base structure for logtest docs added
nmkoremblum Jun 25, 2021
dc0bae2
logtest index docs updated
nmkoremblum Jun 29, 2021
97c17b2
logtest added to doc indexes
nmkoremblum Jul 1, 2021
d833597
logtest ITs index improved
nmkoremblum Jul 1, 2021
d935af3
logtest docs updated
nmkoremblum Jul 1, 2021
9894324
Adds integration test for log alert level load at logtest runtime
juliancnn Jun 30, 2021
d4a13f2
ITs docs added
nmkoremblum Jun 30, 2021
26102e9
Added link documentation to index.md
juliancnn Jul 1, 2021
0fb1405
Fixes default alert level
juliancnn Jul 1, 2021
9913ac4
Daemon start and stop and minor improvements added
nmkoremblum Sep 20, 2021
b01cb3b
New ITs changes requested implemented
nmkoremblum Sep 29, 2021
60eb0e7
base structure for logtest docs added
nmkoremblum Jun 25, 2021
b5f9aa3
logtest index docs updated
nmkoremblum Jun 29, 2021
008ce9e
logtest added to doc indexes
nmkoremblum Jul 1, 2021
409eabe
logtest ITs index improved
nmkoremblum Jul 1, 2021
413b141
logtest docs updated
nmkoremblum Jul 1, 2021
6ff359f
base structure for logtest docs added
nmkoremblum Jun 25, 2021
97eb75c
logtest index docs updated
nmkoremblum Jun 29, 2021
3f1dabf
logtest added to doc indexes
nmkoremblum Jul 1, 2021
81d7ece
logtest ITs index improved
nmkoremblum Jul 1, 2021
f14db92
logtest docs updated
nmkoremblum Jul 1, 2021
44da843
Adds integration test for cdb list load at logtest runtime
juliancnn Jun 29, 2021
f59a83a
Fixed typo and added documentation
JcabreraC Jun 30, 2021
9c8efd3
Added documentation to cdb lists
JcabreraC Jul 1, 2021
7a71ed5
Added documentation to index.md
JcabreraC Jul 1, 2021
57573c4
Daemon start and stop and minor improvements added
nmkoremblum Sep 20, 2021
b14f655
New ITs changes requested implemented
nmkoremblum Sep 29, 2021
22142dd
New fixes to ITs added
nmkoremblum Oct 13, 2021
0a91f17
Added local internal options
CamiRomero Oct 15, 2021
486e9ef
Merge branch 'master' into 1433-logtest-ruleset-reload-runtime
juliamagan Oct 19, 2021
6996e62
Merge branch '1433-logtest-ruleset-reload-runtime' into 1506-remove-w…
Rebits Oct 19, 2021
2e3a408
Merge pull request #1507 from wazuh/1506-remove-workarround-restart-m…
Rebits Oct 19, 2021
cc76387
Merge branch '1433-logtest-ruleset-reload-runtime' into 1508-decoder-…
Rebits Oct 19, 2021
6c32f50
Merge pull request #1518 from wazuh/1508-decoder-list-refresh-logtest
Rebits Oct 19, 2021
864e24e
Merge branch '1433-logtest-ruleset-reload-runtime' into 1509-rule-lis…
Rebits Oct 19, 2021
d255224
Merge branch '1433-logtest-ruleset-reload-runtime' into 1509-rule-lis…
Rebits Oct 19, 2021
ca9ea15
Merge pull request #1523 from wazuh/1509-rule-list-refresh-logtest
Rebits Oct 19, 2021
1e702f4
Merge branch '1433-logtest-ruleset-reload-runtime' into 1524-cdb-list…
Rebits Oct 19, 2021
16e9753
Merge pull request #1525 from wazuh/1524-cdb-list-refresh-logtest
Rebits Oct 19, 2021
4afd3cc
Merge branch '1433-logtest-ruleset-reload-runtime' into 1510-log-aler…
Rebits Oct 19, 2021
4fe83bd
Merge pull request #1529 from wazuh/1510-log-alert-level-reload-runti…
Rebits Oct 19, 2021
bcf7435
Merge branch '1433-logtest-ruleset-reload-runtime' into 2034_added_lo…
juliamagan Oct 19, 2021
7ce615a
Merge branch '1433-logtest-ruleset-reload-runtime' of github.com:wazu…
juliamagan Oct 19, 2021
dfeab54
Merge pull request #2054 from wazuh/2034_added_local_internal_options…
juliamagan Oct 19, 2021
4158b73
fix: Add `restart_required_logtest_daemons` and `wait_for_logtest_sta…
juliamagan Oct 19, 2021
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
3 changes: 2 additions & 1 deletion deps/wazuh_testing/wazuh_testing/logcollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
GENERIC_CALLBACK_ERROR_ANALYZING_MACOS = "The expected analyzing macos log has not been produced"
GENERIC_CALLBACK_ERROR_TARGET_SOCKET = "The expected target socket log has not been produced"
GENERIC_CALLBACK_ERROR_TARGET_SOCKET_NOT_FOUND = "The expected target socket not found error has not been produced"
LOG_COLLECTOR_GLOBAL_TIMEOUT = 20
GENERIC_CALLBACK_ERROR_READING_FILE = "The expected invalid content error log has not been produced"
GENERIC_CALLBACK_ERROR = 'The expected error output has not been produced'

LOG_COLLECTOR_GLOBAL_TIMEOUT = 20

DEFAULT_AUTHD_REMOTED_SIMULATOR_CONFIGURATION = {
'ip_address': 'localhost',
'client_keys': os.path.join(WAZUH_PATH, 'etc', 'client.keys'),
Expand Down
1 change: 1 addition & 0 deletions docs/tests/integration/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Our newest integration tests are located in `wazuh-qa/tests/integration/`. They
- _test_sca_
- _test_vulnerability_detector_
- _test_wazuh_db_
- _test_logtest_

Every group will have the following structure:

Expand Down
3 changes: 2 additions & 1 deletion docs/tests/integration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ Our newest integration tests are located in `wazuh-qa/tests/integration/`. They
- **[_test_vulnerability_detector_](test_vulnerability_detector#tests-vulnerability-detector)**
- **[_test_wazuh_db_](test_wazuh_db#test_wazuh_db)**
- **[_test_logcollector_](test_logcollector#test_logcollector)**
- **[_test_logtest_](test_logtest/index.md#test_logtest)**

## How to setup the test environment

To run the tests you need to have `python3 >= 3.6` installed along with a set of additional dependencies.

You can see all the information about it **[here](set_up_environment.md#setting-up-a-test-environment)**

## About test structure
## About test structure

See **[here](help.md#integration-tests-structure)** more information about the testing files structure or about `pytest`
testing framework.
85 changes: 84 additions & 1 deletion docs/tests/integration/test_logtest/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,84 @@
# Overview
# Test Logtest

## Overview

Wazuh-Logtest allows testing and verifying rules and decoders and it is based on
the use of unique sessions where each session loads its own rules and decoders.
These tests ensure that logtest works correctly under different scenarios and
that every option available work as expected.

## Tiers

### Tier 0

#### Test configuration

- **[Test configuration file](test_configuration/test_configuration_file.md)**:
Check if `wazuh-logtest` works as expected under different pre-defined
configurations that either produce the logtest to correctly start; to be
disabled or to log an error.

- **[Test get configuration sock](test_configuration/test_get_configuration_sock.md)**:
Check if `wazuh-analisysd` correctly retrieves the `rule_test` configuration.

#### Test invalid socket input

- **[Test invalid socket input](test_invalid_socket_input/test_invalid_socket_input.md)**:
Check if `wazuh-logtest` correctly detects and handles errors when sending a
message through the socket to `analysisd`.

#### Test invalid token

- **[Test invalid token](test_invalid_token/test_invalid_session_token.md)**:
Check if `wazuh-logtest` correctly detects and handles errors when using a token.

#### Test remove session

- **[Test remove session](test_remove_session/test_remove_session.md)**:
Check if `wazuh-logtest` correctly detects and removes the sessions under
pre-defined scenarios.

#### Test remove old sessions

- **[Test remove old sessions](test_remove_old_sessions/test_remove_old_sessions.md)**:
Check that `wazuh-logtest` correctly detects and handles the situation where trying
to use more sessions than allowed and then the oldest session is released.

- **[Test remove old session for inactivity](test_remove_old_sessions/test_remove_old_session_for_inactivity.md)**:
Check that `wazuh-logtest` correctly detects and handles the situation where trying
to use more sessions than allowed and then old sessions are released due to
inactivity.

#### Test rules decoders load

- **[Test load rules decoders](test_rules_decoders_load/test_load_rules_decoders.md)**:
Check if `wazuh-logtest` produce the correct rule/decoder matching.

#### Test ruleset refresh

- **[Test alert labels](test_ruleset_refresh/test_alert_labels.md)**:
Check that after modifying the alert level it takes effect when opening a new
logtest sessions, without having to reset the manager.
#### Test ruleset refresh

- **[Test cdb labels](test_ruleset_refresh/test_cdb_labels.md)**:
Check that `wazuh-logtest` works as expected with the operation of
loading new cdb list files without the need to restart the manager.

#### Test ruleset refresh

- **[Test rule labels](test_ruleset_refresh/test_rule_labels.md)**:
Checks if modifying the configuration of the rules, by using its labels, takes
effect when opening new logtest sessions, without having to reset the manager.
- **[Test decoder labels](test_ruleset_refresh/test_decoder_labels.md)**:
Checks if modifying the configuration of the decoder, by using its labels, takes
effect when opening new logtest sessions without having to reset the manager.
#### Test invalid rule decoders syntax

- **[Test invalid rules syntax](test_invalid_rule_decoders_syntax/test_invalid_rules_syntax.md)**:
Check that `wazuh-logtest` correctly detects and handles errors when processing a
rules file.

- **[Test invalid decoder syntax](test_invalid_rule_decoders_syntax/test_invalid_decoder_syntax.md)**:
Check that `wazuh-logtest` correctly detects and handles errors when processing a
decoders file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Test logtest - configuration file

## Overview

Check if `wazuh-logtest` works as expected under different pre-defined
configurations that either produce `wazuh-logtest` to correctly start; to be
disabled or to log an error.

## Objective

- Confirm that, under different sets of configurations, `wazuh-logtest`
correctly handles the configuration and creates a log entry on the Wazuh log,
reporting the result of loading it.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 5 | 1m30s |

## Expected behavior

- Fail if the expected log entry is not found among the Wazuh logs.

## Code documentation

::: tests.integration.test_logtest.test_configuration.test_configuration_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Test logtest - get configuration socket

## Overview

Check if `wazuh-analisysd` correctly retrieves the `rule_test` configuration.

## Objective

- Confirm that, under different sets of configurations, `wazuh-analisysd`
returns the right information from the `rule_test` configuration block.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 5 | 1m23s |

## Expected behavior

- Fail if `wazuh-analisysd` does not retrieve the information in the expected format.
- Fail if `wazuh-analisysd` does not retrieve the expected value of the `enabled` field.
- Fail if `wazuh-analisysd` does not retrieve the expected value of the `threads` field.
- Fail if `wazuh-analisysd` does not retrieve the expected value of the `max_sessions` field.
- Fail if `wazuh-analisysd` does not retrieve the expected value of the `session_timeout` field.

## Code documentation

::: tests.integration.test_logtest.test_configuration.test_get_configuration_sock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Test logtest - invalid decoder syntax

## Overview

Check if `wazuh-logtest` correctly detects and handles errors when processing a decoders file.

## Objective

- Confirm that `wazuh-logtest` retrieves errors when the loaded decoders are invalid.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 11 | 1s |

## Expected behavior

- Fail if `wazuh-logtest` does not retrieve an error when it should.

## Code documentation

::: tests.integration.test_logtest.test_invalid_rule_decoders_syntax.test_invalid_decoder_syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Test logtest - invalid rules syntax

## Overview

Check if `wazuh-logtest` correctly detects and handles errors when processing a rules file.

## Objective

- Confirm that `wazuh-logtest` retrieves errors when the loaded rules are invalid.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 15 | 9s |

## Expected behavior

- Fail if `wazuh-logtest` does not retrieve an error when it should.

## Code documentation

::: tests.integration.test_logtest.test_invalid_rule_decoders_syntax.test_invalid_rules_syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Test logtest - invalid socket input

## Overview

Check if `wazuh-logtest` correctly detects and handles errors when sending a
message through the socket to `analysisd`.

## Objective

- Confirm that the comunication through the sockets works well by verifying that
all the test cases produce the right output.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 26 | 1s |

## Expected behavior

- Fail if the message received through the socket does not match the expected output.

## Code documentation

::: tests.integration.test_logtest.test_invalid_socket_input.test_invalid_socket_input
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Test logtest - invalid session token

## Overview

Check if `wazuh-logtest` correctly detects and handles errors when using a session token.

## Objective

- Confirm that `wazuh-logtest` detects invalid session tokens.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 6 | 3s |

## Expected behavior

- Fail if `wazuh-logtest` does not produce an error when trying to use an invalid session token.

## Code documentation

::: tests.integration.test_logtest.test_invalid_token.test_invalid_session_token
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Test logtest - remove old session for inactivity

## Overview

Check if `wazuh-logtest` correctly detects and handles the situation where trying
to use more sessions than allowed and then old sessions are released due to
inactivity.

## Objective

- Confirm that `wazuh-logtest` removes the inactive sessions after a certain time.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 1 | 1m 5s |

## Expected behavior

- Fail if `wazuh-logtest` does not start.
- Fail if `wazuh-logtest` can not create a new session.
- Fail if `wazuh-logtest` old session is not removed.

## Code documentation

::: tests.integration.test_logtest.test_remove_old_sessions.test_remove_old_session_for_inactivity
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Test logtest - remove old sessions

## Overview

Check if `wazuh-logtest` correctly detects and handles the situation when trying
to use more sessions than allowed and so, to make room, the oldest session is
released.

## Objective

- Confirm that `wazuh-logtest` releases the oldest session when a new session is
opened and the number of active sessions reached its limit.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 1 | 1m |

## Expected behavior

- Fail if `wazuh-logtest` does not start.
- Fail if `wazuh-logtest` can not create a new session.
- Fail if `wazuh-logtest` oldest session is not removed.

## Code documentation

::: tests.integration.test_logtest.test_remove_old_sessions.test_remove_old_sessions
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Test logtest - remove session

## Overview

Check if `wazuh-logtest` correctly detects and removes the sessions under
pre-defined scenarios.

## Objective

- Confirm that `wazuh-logtest` correctly handles the sessions removals.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 9 | 1s |

## Expected behavior

- Fail if the session removal attempt does not produce the expected result message.

## Code documentation

::: tests.integration.test_logtest.test_remove_session.test_remove_session
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Test logtest - load rules decoders

## Overview

Check if `wazuh-logtest` produce the correct rule/decoder matching.

## Objective

- Confirm that `wazuh-logtest` does produce the right decoder/rule matching when
processing a log under different sets of configurations.

## General info

|Tier | Total | Time spent |
| :--:| :--: | :--: |
| 0 | 6 | 7s |

## Expected behavior

- Fail if `wazuh-logtest` does not produce the expected output when processing a log.

## Code documentation

::: tests.integration.test_logtest.test_rules_decoders_load.test_load_rules_decoders
Loading