Dear Satiswaran,
Thank you for the logs. After carefully examining the logs and the default sophos decoders ( located in /var/ossec/ruleset/decoders/0510-sophos_fw_decoders.xml), the default parent sophos decoder is not matching any of your log because it starts with the statement ^device ( see below), which is not the case for your logs from the klfirewall log file you shared.
Default sophos fw decoder
======================
<decoder name="sophos-fw">
<prematch>^device="\w*"\s+date=\d+-\d+-\d+\s+time=</prematch>
</decoder>
I have modified the default sophos decoder and rules to match your logs. Kindly follow the below steps to add the modified sophos decoders and rules to your Wazuh deployment.
1- Create a file klfirewall_decoders.xml in /var/ossec/etc/decoders/ and add the decoders ( see attached file) inside the newly created file:
2. Create a file klfirewall_rules.xml in /var/ossec/etc/rules and add the rules ( see attached file ) inside the newly created file:
3. Finally restart the Wazuh manager by running the below command:
systemctl restart wazuh-manager
I tested some of the logs using Wazuh-logtest, and this works for me. One example of the tests is shown below.
Starting wazuh-logtest v4.7.2
Type one log per line
2024-05-15T02:55:16.510104700Z {ip=192.168.61.1} <29>device="SFW" date=2024-05-15 time=10:35:37 timezone="+08" device_name="XG106" device_id=C1C0B9V2PKPCGD1 log_id=018201500005 log_type="Firewall" log_component="ICMP ERROR MESSAGE" log_subtype="Allowed" status="Allow" priority=Notice duration=0 fw_rule_id=5 fw_rule_name="Internet Access" fw_rule_section="Local rule" nat_rule_id=3 nat_rule_name="fw#5_migrated_NAT_Rule" policy_type=1 sdwan_profile_id_request=0 sdwan_profile_name_request="" sdwan_profile_id_reply=0 sdwan_profile_name_reply="" gw_id_request=0 gw_name_request="" gw_id_reply=0 gw_name_reply="" sdwan_route_id_request=0 sdwan_route_name_request="" sdwan_route_id_reply=0 sdwan_route_name_reply="" user_name="" user_gp="" iap=4 ips_policy_id=3 appfilter_policy_id=0 application="" application_risk=0 application_technology="" application_category="" vlan_id="" ether_type=IPv4 (0x0800) bridge_name="" bridge_display_name="" in_interface="Port2_ppp" in_display_interface="Port2_ppp" out_interface="" out_display_interface="" src_mac= dst_mac= src_ip=72.14.214.196 src_country_code=USA dst_ip=175.136.252.61 dst_country_code=MYS protocol="ICMP" icmp_type=11 icmp_code=0 sent_pkts=0 recv_pkts=0 sent_bytes=0 recv_bytes=0 tran_src_ip= tran_src_port=0 tran_dst_ip= tran_dst_port=0 srczonetype="LAN" srczone="LAN" dstzonetype="" dstzone="" dir_disp="" connevent="Interim" connid="2228086869" vconnid="" hb_health="No Heartbeat" message="" appresolvedby="Signature" app_is_cloud=0 log_occurrence=1 flags=0
**Phase 1: Completed pre-decoding.
full event: '2024-05-15T02:55:16.510104700Z {ip=192.168.61.1} <29>device="SFW" date=2024-05-15 time=10:35:37 timezone="+08" device_name="XG106" device_id=C1C0B9V2PKPCGD1 log_id=018201500005 log_type="Firewall" log_component="ICMP ERROR MESSAGE" log_subtype="Allowed" status="Allow" priority=Notice duration=0 fw_rule_id=5 fw_rule_name="Internet Access" fw_rule_section="Local rule" nat_rule_id=3 nat_rule_name="fw#5_migrated_NAT_Rule" policy_type=1 sdwan_profile_id_request=0 sdwan_profile_name_request="" sdwan_profile_id_reply=0 sdwan_profile_name_reply="" gw_id_request=0 gw_name_request="" gw_id_reply=0 gw_name_reply="" sdwan_route_id_request=0 sdwan_route_name_request="" sdwan_route_id_reply=0 sdwan_route_name_reply="" user_name="" user_gp="" iap=4 ips_policy_id=3 appfilter_policy_id=0 application="" application_risk=0 application_technology="" application_category="" vlan_id="" ether_type=IPv4 (0x0800) bridge_name="" bridge_display_name="" in_interface="Port2_ppp" in_display_interface="Port2_ppp" out_interface="" out_display_interface="" src_mac= dst_mac= src_ip=72.14.214.196 src_country_code=USA dst_ip=175.136.252.61 dst_country_code=MYS protocol="ICMP" icmp_type=11 icmp_code=0 sent_pkts=0 recv_pkts=0 sent_bytes=0 recv_bytes=0 tran_src_ip= tran_src_port=0 tran_dst_ip= tran_dst_port=0 srczonetype="LAN" srczone="LAN" dstzonetype="" dstzone="" dir_disp="" connevent="Interim" connid="2228086869" vconnid="" hb_health="No Heartbeat" message="" appresolvedby="Signature" app_is_cloud=0 log_occurrence=1 flags=0'
timestamp: '2024-05-15T02:55:16.510104700Z '
**Phase 2: Completed decoding.
name: 'klfirewall'
appfilter_policy_id: '0'
application_risk: '0'
appresolvedby: 'Signature'
connevent: 'Interim'
connid: '2228086869'
date: '2024-05-15'
device: 'SFW'
device_id: 'C1C0B9V2PKPCGD1'
device_name: 'XG106'
dst_country_code: 'MYS'
dst_ip: '175.136.252.61'
dst_port: '0'
duration: '0'
fw_rule_id: '5'
hb_health: 'No Heartbeat'
iap: '4'
in_interface: 'Port2_ppp'
ips_policy_id: '3'
log_component: 'ICMP ERROR MESSAGE'
log_id: '018201500005'
log_subtype: 'Allowed'
log_type: 'Firewall'
name: 'XG106'
policy_type: '1'
priority: 'Notice'
protocol: 'ICMP'
recv_bytes: '0'
recv_pkts: '0'
sent_bytes: '0'
sent_pkts: '0'
sophos_fw_status_msg: 'Allow'
src_country_code: 'USA'
src_ip: '72.14.214.196'
src_port: '0'
srczone: 'LAN'
srczonetype: 'LAN'
th: 'No Heartbeat'
time: '10:35:37'
timezone: '+08'
tran_dst_port: '0'
tran_src_port: '0'
**Phase 3: Completed filtering (rules).
id: '700220'
level: '3'
description: 'Traffic Allowed: from 72.14.214.196 to 175.136.252.61'
groups: '['klfirewall']'
firedtimes: '1'
mail: 'False'
**Alert to be generated.
Please let me know if this works for you.
Regards,