wazuh / wazuh-qa

Wazuh - Quality Assurance
GNU General Public License v2.0
66 stars 32 forks source link

Prevent agents using the same key from connecting at the same time #2456

Closed Nicogp closed 4 months ago

Nicogp commented 2 years ago

Description:

This issue is associated with https://github.com/wazuh/wazuh/issues/10172. Main goal of this test is reject same key configuration agent. When manager receive same key configuration from a new connection, and that agent has a different socket number, the new connection is rejected.

Category:

System test

Environment requirements:

Warning:

General configuration:

Expected behavior:

DoD

danisan90 commented 2 years ago

update 2/11/2022

In order to develop this test two principal test cases are necessary: 0- Provisioning environment: One manager and 2 agents with only agent1 connected.

Case 1 0- Deactivate autoenrrolment. 1- Copy Agent 1 key 2- Paste Agent 1 key in the Agent2 client.keys file (/var/ossec/etc/client.keys)
3- Connect Agent 2

Expected Result: agent will be rejected with message log "Agent key already in use: agent ID {id}". Log example: 2022/01/19 19:52:11 wazuh-remoted: WARNING: Agent key already in use: agent ID '007'

Case 2 0- Autoenrrolment active by default. 1- Copy Agent 1 key 2- Paste Agent 1 key in the Agent2 client.keys file (/var/ossec/etc/client.keys)
3- Connect Agent 2

Expected Result: the manager will assign a new client.keys configuration to the second agent.

mauromalara commented 2 years ago

Working branch: 2456-test-prevent-same-key-config