wazuh-yara: ERROR - Yara active response error. Yara path and rules parameters are mandatory. SOLUTIONTo resolve the issue below, you first need to review the steps following this documentation
https://documentation.wazuh.com/current/user-manual/capabilities/active-response/ar-use-cases/wazuh-with-yara.htmlAfter following it and the message still appears, check the following steps:
1 - Check if the FMI module is active and functional. Open the ossec.conf file inside the manager and the agent and add the path below to use as an example, restart both.
<!-- Directories to check (perform all possible verifications) -->
<directories check_all="yes" realtime="yes">/tmp*</directories>
2 - After this verification and even so the problem persists, check if the path you configured inside the manager in the ossec.conf file is working.
<command>
<name>yara</name>
<executable>yara.sh</executable>
<extra_args>-yara_path /usr/bin -yara_rules /opt/yara_rules/rules/index.yar</extra_args>
<timeout_allowed>no</timeout_allowed>
</command>
<active-response>
<command>yara</command>
<location>location</location>
<rules_id>550,554</rules_id>
</active-response>
To discover the correct path on your agent machine, just use the command
where is yara and it will tell you the correct path where the binary is. If this deployment is for several computers, all computers must be configured in the same directory, the bin and the rules.
3 - When creating the yara.sh file, do not forget to assign the commands below
chmod 750 yara.sh
chown root:wazuh (or root:ossec, just check in ls -l) yara.sh
4 - If you are using the documentation mentioned above and you are still having the problem, check if the main dependency of the script yara.sh is installed.
apt-get install jq
yum install jq
for dealing with calls in JSON, it is necessary to install this dependency. In my case, everything above was working and I didn't pay attention to JQ only. After that, everything is 100% functional.
Don't forget to restart the wazuh agent service whenever you make any changes.
You can test if it is working just by using the command below to monitor in real time what is going to wazuh
tail -f /var/ossec/etc/logs/active-responses.log
using step 1 as a test, download a test file from
https://www.dasmalwerk.eu/ using wget and check the tail above.
then unzip filename and password so everyone is infected.