As a follow up to the previous post (Agentless monitoring), I will now show how to use public key authentication instead of passwords to access the remote boxes.
1- Adding the remote host
When adding the remote host, you need to provide the password as “NOPASS”:
# /var/ossec/agentless/register_host.sh add root@xx.net NOPASS *Host root@xx.netl added.
2-Adding the public key
The public key must be created by the user ossec inside the ossec home directory. To do that, follow these steps:
# sudo -u ossec ssh-keygen
It will create the public keys inside /var/ossec/.ssh . After that, just scp the public key to the remote box and your password less connection should work.