wazuh / wazuh-agent

Wazuh agent, the Wazuh agent for endpoints.
GNU Affero General Public License v3.0
32 stars 18 forks source link

Fix Agent Registration Behavior #319

Closed vikman90 closed 2 days ago

vikman90 commented 3 days ago

Summary

This pull request addresses two issues:

Changes

Tests

[!IMPORTANT] In this change, we simplify the RegistrationTestSuccessWithEmptyKey test, since this test makes the agent produce a random key. Since persistence is removed, the mock does not have access to the new key. However, the persistence behavior of AgentRegistration is checked in RegistrationSuccess.

Manual testing

Registration failure

./wazuh-agent --config-file wazuh-agent.yml --register-agent --user wazuh --password topsecret --name other

Failed to authenticate with the manager wazuh-agent registration failed

sqlite3 agent_info.db 'select * from agent_info'

||

Registration success

./wazuh-agent --config-file wazuh-agent.yml --register-agent --user wazuh --password topsecret --name dummy

wazuh-agent registered

sqlite3 agent_info.db 'select * from agent_info'

dummy|vEcz2euGDR2mTAxn4Fu6KrCIOhmsfq7U|114563d6-a9ae-4aec-aa58-7f0ee0500bab