First, I made a typo in the commands, it is client.keys instead of ossec.conf:
1. Go to the server 10.0.106.88. Check the key: cat /var/ossec/etc/client.keys
2. Go to the manager, check the key for the agent ID 083: cat /var/ossec/etc/client.keys | grep 083
Let me clarify what is the root cause of that error:
There are 2 options: Wrong key or corrupt payload. I'm going to focus on the first one: Wrong key.
The error message says that agent '083' at '10.0.106.88' sent a wrong key. This is what happened:
- An agent was installed in server '10.0.106.88' and the Wazuh manager provided a key with the ID: 083.
- I assume that the agent was working properly for a while.
- Then, for some reason, the key 083 is not valid.
- So, the server '10.0.106.88' is sending the key (083) and the manager is refusing the key due to is not valid.
What is the reason?
Probably the key doesn't exist in the client.keys of the manager (check it with cat /var/ossec/etc/client.keys | grep 083). This is due to it was removed manually or automatically.
When a new agent is registered, if there is another agent with the same name, it is removed. Example:
1. Server "A" is registered:
Server "A" - IP: 10.0.106.88 -> Registered with key 086.
2. The client.keys are:
manager
...
086 ...
server 10.0.106.88
086 ...
3. A new server with the same name ("A") is registered
Server "A" - IP: 10.0.200.100 -> Registered with key 090.
4. The client.keys are:
manager
...
090 ...
server 10.0.106.88
086 ...
server 10.0.200.100
090 ...
5. When the server 10.0.106.88 sends the key 086, the manager will refuse it because it doesn't exist.
This behavior is configured in the authd section of the ossec.conf. Could you share it (remove the sensitive information)?
Thanks.