I have a NetGate pfSense firewall/router, but I don't think I can install the Wazuh agent on it. So I turned on it's built-in Syslog option.
Here are some lines from the log. (I think this is the format that it is sending):
Mar 16 09:12:40 dhcpd[7416]: Wrote 0 class decls to leases file.
Mar 16 09:12:40 dhcpd[7416]: Wrote 21 leases to leases file.
Mar 16 09:12:40 dhcpd[7416]: DHCPACK on 10.10.10.65 to 84:98:66:ca:f5:e3 (Galaxy-Tab-A) via mvneta0.4091
Mar 16 09:22:41 dhcpd[7416]: reuse_lease: lease age 8124 (secs) under 25% threshold, reply with unaltered, existing lease for 10.10.10.69
Mar 16 09:22:41 dhcpd[7416]: DHCPREQUEST for 10.10.10.69 from 02:ec:36:d6:3e:bb via mvneta0.4091
Mar 16 09:22:41 dhcpd[7416]: DHCPACK on 10.10.10.69 to 02:ec:36:d6:3e:bb via mvneta0.4091
Mar 16 09:31:13 dhcpd[7416]: DHCPREQUEST for 10.10.10.80 from 28:29:86:16:af:52 via mvneta0.4091
Mar 16 09:31:13 dhcpd[7416]: DHCPACK on 10.10.10.80 to 28:29:86:16:af:52 via mvneta0.4091
(I'm saying that 'I think this is the format' because I set up a simple Syslog server on a test Windows PC to receive the pfSense logs and that is how they're being recorded.)
Now, when I temporarily turned on the logall option in Wazuh, this is a sample line from archives.log:
2023 Mar 13 22:19:43 ubuntusrvwazuhtest1->10.10.10.253 Mar 13 15:19:43 dhcpd[7416]: DHCPACK on 10.10.10.77 to 56:8d:3d:8f:0c:90 via mvneta0.4091As you can see it's not the same - Wazuh seems to be prepending data? I did not know it does this - I do not remember seeing anything about that in the documentation.
So my first question then is when writing decoders, do I need to base them off of what the 'raw' logs are coming in as, or do I base them off of the Wazuh-modified logs that I see in archives.log?
Next, I've been trying to write a decoder based on the assumption that I'm supposed to write the decoder based off of the 'raw' log. But I haven't gotten very far. Here's what I've got so far in my /var/ossec/etc/decoders/local_decoder.xml:
<decoder name="dork">
<prematch>^\w\w\w\s\d\d\s\d\d:\d\d:\d\d\sdhcpd\p\d+\p:</prematch>
</decoder>However, when I run wazuh-logtest:
Starting wazuh-logtest v4.3.10
Type one log per line
Mar 16 05:36:14 dhcpd[7416]: DHCPACK on 10.10.10.80 to 28:29:86:16:af:52 via mvneta0.4091
**Phase 1: Completed pre-decoding.
full event: 'Mar 16 05:36:14 dhcpd[7416]: DHCPACK on 10.10.10.80 to 28:29:86:16:af:52 via mvneta0.4091'
timestamp: 'Mar 16 05:36:14'
hostname: 'dhcpd[7416]:'
**Phase 2: Completed decoding.
No decoder matched.Is Wazuh pre-decoding from some other file other than mine maybe? I don't know where the 'timestamp' and 'hostname' is coming from, because as you can see I don't have those in my local_decoder.xml file. Next, it's my understanding that at this point
Phase 2 should have given me something, right? However, it's saying 'No decoder matched'.
Please excuse my ignorance on Wazuh, pre-decoding, decoding, and regular expressions - I'm super new to all of this. But I was wondering if maybe someone could clarify my first question and then maybe point out what I'm doing wrong in my local_decoder.xml file?
What I ultimately want to do is extract the IP address and MAC address and build an alert from all of the log lines that contain 'DHCPACK', and pass the IP and MAC address to that alert.
Thank you,
Jamie