Hi Sachin!
Based on your logs, I would understand that the manager and the agent are checking if they can establish a connection and they fail because there is a mismatch between the agent's id/name and the key. The error SSL read (unable to receive message) in the Wazuh agent logs typically points to issues with SSL/TLS communication between the agent and the Wazuh manager. This can occur if there is a mismatch in the SSL certificates or issues with the certificate verification setup
To fix this please check the following
Make sure The manager IP address is correct in ossec.conf of side like:
<server>
<address>192.168.55.56</address>
</server>After this, please ensure that the client key on the agent matches the key in the manager's client.keys file. You can typically find the key file at: `/var/ossec/etc/client.keys` on both the manager and the agent. In case it doesnt than
Run this command at the wazuh-manager server, to extra the key
/var/ossec/bin/manage_agents -e <agent id>On the agent side, import the key by running:
/var/ossec/bin/manage_agents -i <key>You can see this documentation as a guide:
https://documentation.wazuh.com/current/development/client-keys.html.
In case this didnt reolsve the issue the use the Wazuh agent identity verification method which uses SSL certificates to verify that a Wazuh agent is authorized to enroll in the Wazuh manager.
Manger side:1. Run the following command on the Wazuh server to use Wazuh as the certificate authority and generate
rootCA.key and
rootCA.pem file with higher validity (365 days):
openssl req -x509 -days 365 -new -nodes -newkey rsa:4096 -keyout rootCA.key -out rootCA.pem -batch -subj "/C=US/ST=CA/O=Wazuh"
2. Generate a certificate signing request (CSR) for the Wazuh agent on the Wazuh server:
openssl req -new -nodes -newkey rsa:4096 -keyout sslagent.key -out sslagent.csr -batch
3. Sign the generated agent CSR using the CA keys and generate the sslagent.cert certificate:
openssl x509 -req -days 365 -in sslagent.csr -CA rootCA.pem -CAkey rootCA.key -out sslagent.cert -CAcreateserial
4. Then copy the rootCA.pem file to the manager's /var/ossec/etc/ directory and configured that as the ssl_agent_ca in the manager's ossec.conf file. Uncomment the <auth><ssl_agent_ca> section and specify the path to the rootCA.pem file on the Wazuh manager.
<auth>
...
<ssl_agent_ca>/var/ossec/etc/rootCA.pem</ssl_agent_ca>
</auth>5. Restarted the wazuh-manager to make the change effective.
Agent side:
1.Copy the sslagent.cert and sslagent.key to the agent and used that as enrollment certificate and key.
2. Using an administrator account, modify the Wazuh agent configuration file located at C:\Program Files (x86)\ossec-agent\ossec.conf and include the following:
Wazuh manager IP address or FQDN in the <client><server><address> section.
The local path to the agent certificate and key are in the <client><enrollment> section.
<client>
<server>
<address>WAZUH_MANAGER_IP</address>
</server>
<enrollment>
<agent_certificate_path>/<PATH_TO>/sslagent.cert</agent_certificate_path>
<agent_key_path>/<PATH_TO>/sslagent.key</agent_key_path>
</enrollment>
</client>
Restart the Wazuh agent to make the changes effective. # Restart-Service -Name wazuh
Refer to
https://documentation.wazuh.com/current/user-manual/agent/agent-enrollment/security-options/agent-identity-verification.html#windowsIf you have any questions, do not hesitate to ask me.