Hello Matthew,
I have been doing a running test and even if you are receiving alerts from SonicWall the SonicWall decoders do not work correctly. We have opened an issue in order to fix this decoder. You can follow the status of it in the following link:
https://github.com/wazuh/wazuh-ruleset/issues/162
Thank you very much because we have become aware of this issue through your contribution.
To understand how regex works and rules syntax it is a good idea to make your own decoders and rules. For testing purposes, you can create your own decoders and custom rules from existing ones and also add new ones. In this case, I will show you how to create your own decoders and rules:
I am going to describe this procedure using an easy example. Here is a log from a program called Example:
Dec 25 20:45:02 MyHost example[12345]: User 'admin' logged from '192.168.1.100' with id=023
First, we need to decode this information, so we add the new decoder to /var/ossec/etc/decoders/local_decoder.xml:
<decoder name="example">
<program_name>^example</program_name>
</decoder>
<decoder name="example">
<parent>example</parent>
<regex>User '(\w+)' logged from '(\d+.\d+.\d+.\d+)' with \w+=(\d+)</regex>
<order>user, srcip, id</order>
</decoder>
Now, we have to match the program name with the rule. For this, we will add the following rule to /var/ossec/etc/rules/local_rules.xml:
<rule id= "1000010" level="3">
<program_name>example</program_name>
<description>User logged</description>
</rule>
We can check if it works by using /var/ossec/bin/ossec-logtest:
**Phase 1: Completed pre-decoding.
full event: 'Dec 25 20:45:02 MyHost example[12345]: User 'admin' logged from '192.168.1.100' with id=023'
timestamp: 'Dec 25 20:45:02'
hostname: 'MyHost'
program_name: 'example'
log: 'User 'admin' logged from '192.168.1.100' with id=023'
**Phase 2: Completed decoding.
decoder: 'example'
dstuser: 'admin'
srcip: '192.168.1.100'
id: '023'
**Phase 3: Completed filtering (rules).
Rule id: '100010'
Level: '3'
Description: 'User logged'
**Alert to be generated.
I hope this helps you.
Best regards,
Miguel Casares