--
You received this message because you are subscribed to a topic in the Google Groups "Wazuh mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wazuh/yhOXhyNJOKk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wazuh+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/2134ad03-6735-42be-be36-a267cc8f7da9n%40googlegroups.com.
Hi,
The full_log field is the result of the logs generated by Wazuh, but it is not processed as such by the analysis engine, it is later. The full_log field generated by wazuh is the result of the raw event it has received and processed, so the original event that it is processing would be the following one:
EXECVE msg=audit(1664283895.468:434292): argc=3 a0="systemctl" a1="disable" a2="syslog.service"
From here, you should see if there is any existing decoder and/or rule that matches this example, for this you can use the tool /var/ossec/bin/wazuh-logtest.
# /var/ossec/bin/wazuh-logtest
Starting wazuh-logtest v4.3.8
Type one log per line
EXECVE msg=audit(1664283895.468:434292): argc=3 a0="systemctl" a1="disable" a2="syslog.service"
**Phase 1: Completed pre-decoding.
full event: 'EXECVE msg=audit(1664283895.468:434292): argc=3 a0="systemctl" a1="disable" a2="syslog.service"'
**Phase 2: Completed decoding.
No decoder matched.
As you can see, this log is not decoded or matched with any rule, so you will have to add some custom decoder and rule for the use case you need.
For example, I will create a decoder and rule for your intended case.
Add the following decoder to the /var/ossec/etc/decoders/local_decoder.xml file:
<decoder name="custom_audit">
<prematch>msg=audit(\S+):</prematch>
<regex>a0="(\S+)" a1="(\S+)" a2="(\S+)"</regex>
<order>command, _action, service</order>
</decoder>
Note: the name _action has been used because action is a reserved name.
And add the following content to the end of your rules file /var/ossec/etc/rules/local_rules.xml:
<group name="custom_audit,">
<rule id="100050" level="4">
<decoded_as>custom_audit</decoded_as>
<field name="command">^systemctl$|^chkconfig$|^service$</field>
<field name="_action">^start$|^stop$|^disable$|^off$|^kill$</field>
<description>Custom audit rule</description>
</rule>
</group>
Restart the wazuh-manager to apply the changes:
systemctl restart wazuh-manager
This will generate alerts when any decoded field such as command or _action meets the indicated regex. Remember that the wazuh-manager processes all the events and logs that are being monitored, and you have to build the rules and decoders based on that raw log, in this case, the raw log is the following:
EXECVE msg=audit(1664283895.468:434292): argc=3 a0="systemctl" a1="disable" a2="syslog.service"
Remember also, that you can test using the /var/ossec/bin/wazuh-logtest tool and see if the log is decoded and matched with some rule, but introducing the monitored log and not the one generated by wazuh.
If you have some doubts about decoders and rules, I share with you some interesting links:
I hope I have solved your doubts. Try the above and let us know the results.
Best regards.