+
diff --git a/security/wazuh-agent/src/opnsense/scripts/syslog/logformats/wazuhagent.py b/security/wazuh-agent/src/opnsense/scripts/syslog/logformats/wazuhagent.py
new file mode 100644
index 000000000..198256291
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/scripts/syslog/logformats/wazuhagent.py
@@ -0,0 +1,51 @@
+"""
+ Copyright (c) 2023 Ad Schellevis
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+"""
+import re
+import datetime
+from . import NewBaseLogFormat
+ossec_timeformat = r'^(\d{4}/\d{1,2}/\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}).*'
+
+class OssecLogFormat(NewBaseLogFormat):
+ def __init__(self, filename):
+ super().__init__(filename)
+ self._priority = 100
+
+ def match(self, line):
+ return self._filename.find('wazuhagent') > -1 and re.match(ossec_timeformat, line) is not None
+
+ @property
+ def timestamp(self):
+ tmp = re.match(ossec_timeformat, self._line)
+ grp = tmp.group(1)
+ return datetime.datetime.strptime(grp, "%Y/%m/%d %H:%M:%S").isoformat()
+
+ @property
+ def process_name(self):
+ return self._line[19:].strip().split(':', 1)[0]
+
+ @property
+ def line(self):
+ return self._line[19:].strip().split(':', 1)[-1]
\ No newline at end of file
diff --git a/security/wazuh-agent/src/opnsense/scripts/wazuh/opnsense-fw b/security/wazuh-agent/src/opnsense/scripts/wazuh/opnsense-fw
new file mode 100755
index 000000000..f2b349a25
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/scripts/wazuh/opnsense-fw
@@ -0,0 +1,160 @@
+#!/usr/local/bin/python3
+
+"""
+ Copyright (c) 2023 Ad Schellevis
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+"""
+
+import argparse
+import datetime
+import json
+import os
+import sys
+import subprocess
+import ipaddress
+from select import select
+from configparser import ConfigParser
+
+
+def send_log(line):
+ with open('/var/ossec/logs/active-responses.log', 'a') as handle:
+ handle.write(
+ str(datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')) +
+ " " +
+ os.path.basename(__file__) +
+ ": " +
+ line +
+ "\n"
+ )
+
+
+def read_data(filename):
+ payload = []
+ with open(filename, 'rb') as fin:
+ while True:
+ rlist, _, _ = select([fin], [], [], 0.5)
+ if not rlist:
+ break
+ line = fin.readline()
+ if line == b'':
+ break
+ payload.append(line)
+
+ return b''.join(payload)
+
+
+def main(params):
+ send_log('Started')
+ skip_alias=''
+ if os.path.isfile('/var/ossec/etc/opnsense-fw.conf'):
+ cnf = ConfigParser()
+ cnf.read('/var/ossec/etc/opnsense-fw.conf')
+ skip_alias = cnf.get('general', 'skip_alias') if cnf.has_option('general', 'skip_alias') else ''
+ else:
+ send_log('Skip configuration')
+
+ event=None
+ try:
+ event=json.loads(read_data(params.input))
+ except ValueError:
+ pass
+ if event is None:
+ send_log('Decoding JSON has failed, invalid input format')
+ return -1
+ else:
+ send_log('Received : %s' % json.dumps(event))
+
+ command=event.get('command', None)
+ srcip=event
+ for token in ['parameters', 'alert', 'data', 'srcip']:
+ if type(srcip) is dict and token in srcip:
+ srcip = srcip[token]
+ else:
+ srcip = None
+ break
+
+ if srcip is None:
+ send_log('srcip not found')
+ return -1
+
+ try:
+ ipaddress.ip_address(srcip)
+ except ValueError:
+ send_log('Unable to process even, invalid srcip (%s)' % srcip)
+ return -1
+
+ if skip_alias != '' and command == 'add':
+ sp = subprocess.run(['/sbin/pfctl', '-t', skip_alias, '-Ttest', srcip], capture_output=True, text=True)
+ if sp.stderr.strip().find("1/1") == 0:
+ send_log('Skip event %s in alias %s' % (srcip, skip_alias))
+ return 0
+
+ if command == 'add':
+ # return rule id for timeout list
+ try:
+ print(json.dumps({
+ "version": 1,
+ "origin": {
+ "name": sys.argv[0],
+ "module":"active-response"
+ },
+ "command": "check_keys",
+ "parameters":{
+ "keys": [event['parameters']['alert']['rule']['id']]
+ }
+ }))
+ sys.stdout.flush()
+ except KeyError:
+ pass
+ # When attached to stdin we're likely running inside the agent, in which case we will read a second event which
+ # may abort the first one.
+ if params.input == '/dev/stdin':
+ timeout_event = None
+ try:
+ timeout_event=json.loads(read_data(params.input))
+ except ValueError:
+ pass
+ if timeout_event:
+ send_log('Received : %s' % json.dumps(timeout_event))
+ if timeout_event.get('command') == 'abort':
+ send_log('Aborted')
+ return 0
+ elif timeout_event.get('command') != 'continue':
+ send_log('Invalid command')
+ return -1
+ # add to table and kill active sessions for this ip as well
+ subprocess.run(['/sbin/pfctl', '-t', '__wazuh_agent_drop', '-T', 'add', srcip], capture_output=True)
+ subprocess.run(['/sbin/pfctl', '-k', srcip], capture_output=True)
+ elif command == 'delete':
+ subprocess.run(['/sbin/pfctl', '-t', '__wazuh_agent_drop', '-T', 'delete', srcip], capture_output=True)
+
+ send_log('Active response executed (%s %s)' % (command, srcip))
+
+ return 0
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-input', help='read message from', default='/dev/stdin')
+ sys.exit(main(parser.parse_args()))
diff --git a/security/wazuh-agent/src/opnsense/scripts/wazuh/setup.php b/security/wazuh-agent/src/opnsense/scripts/wazuh/setup.php
new file mode 100755
index 000000000..e294fd723
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/scripts/wazuh/setup.php
@@ -0,0 +1,61 @@
+#!/usr/local/bin/php
+auth->password)) {
+ $fhandle = fopen($authd_pass, 'a+');
+ if (flock($fhandle, LOCK_EX)) {
+ chown($authd_pass, 'root');
+ chgrp($authd_pass, 'wazuh');
+ chmod($authd_pass, 0640);
+ fseek($fhandle, 0);
+ ftruncate($fhandle, 0);
+ fwrite($fhandle, (string)$mdl->auth->password);
+ flock($fhandle, LOCK_UN);
+ }
+} elseif (file_exists($authd_pass)) {
+ unlink($authd_pass);
+}
+
+/***
+ * Temporary solution to link log files so we can view at least the last items in the file easily for debug purposes
+ * It looks like ossec is not able to log to syslog directly, which means our log files live outside our normal bounds
+ **/
+mkdir("/var/log/wazuhagent/ossec/", 0700, true);
+mkdir("/var/log/wazuhagent/activeresponses/", 0700, true);
+@symlink("/var/ossec/logs/ossec.log", "/var/log/wazuhagent/ossec/ossec_99991231.log");
+@symlink( "/var/ossec/logs/active-responses.log", "/var/log/wazuhagent/activeresponses/activeresponses_99991231.log");
diff --git a/security/wazuh-agent/src/opnsense/service/conf/actions.d/actions_wazuh_agent.conf b/security/wazuh-agent/src/opnsense/service/conf/actions.d/actions_wazuh_agent.conf
new file mode 100644
index 000000000..33c1e1c4a
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/conf/actions.d/actions_wazuh_agent.conf
@@ -0,0 +1,25 @@
+[start]
+command:
+ /usr/local/sbin/pluginctl -s syslog-ng restart;
+ /usr/local/etc/rc.d/wazuh-agent onestart
+type:script
+message:starting wazuh-agent
+
+[stop]
+command:/usr/local/etc/rc.d/wazuh-agent onestop
+type:script
+message:stopping wazuh-agent
+
+[status]
+command:
+ /usr/local/etc/rc.d/wazuh-agent status > /dev/null 2>&1 && echo "wazuh is running..." || echo "wazuh is not running...";
+ exit 0
+type:script_output
+message:get wazuh-agent status
+
+[restart]
+command:
+ /usr/local/sbin/pluginctl -s syslog-ng restart;
+ /usr/local/etc/rc.d/wazuh-agent onerestart
+type:script
+message:restarting wazuh-agent
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/+TARGETS b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/+TARGETS
new file mode 100644
index 000000000..268450b04
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/+TARGETS
@@ -0,0 +1,6 @@
+ossec.conf:/var/ossec/etc/ossec.conf
+local_internal_options.conf:/var/ossec/etc/local_internal_options.conf
+rc.conf.d:/etc/rc.conf.d/wazuh_agent
+syslog-ng-wazuh-agent.conf:/usr/local/etc/syslog-ng.conf.d/syslog-ng-wazuh-agent.conf
+newsyslog.conf:/etc/newsyslog.conf.d/wazuh-agent.conf
+opnsense-fw.conf:/var/ossec/etc/opnsense-fw.conf
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/local_internal_options.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/local_internal_options.conf
new file mode 100644
index 000000000..2ed6e9dde
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/local_internal_options.conf
@@ -0,0 +1,28 @@
+# local_internal_options.conf
+#
+# This file should be handled with care. It contains
+# run time modifications that can affect the use
+# of OSSEC. Only change it if you know what you
+# are doing. Look first at ossec.conf
+# for most of the things you want to change.
+#
+# This file will not be overwritten during upgrades.
+logcollector.remote_commands={% if not helpers.empty('OPNsense.WazuhAgent.logcollector.remote_commands') %}1{% else %}0{% endif +%}
+wazuh_command.remote_commandss={% if not helpers.empty('OPNsense.WazuhAgent.wazuh_command.remote_commands') %}1{% else %}0{% endif +%}
+
+
+{% if not helpers.empty('OPNsense.WazuhAgent.general.debug_level') %}
+windows.debug={{OPNsense.WazuhAgent.general.debug_level}}
+syscheck.debug={{OPNsense.WazuhAgent.general.debug_level}}
+remoted.debug={{OPNsense.WazuhAgent.general.debug_level}}
+analysisd.debug={{OPNsense.WazuhAgent.general.debug_level}}
+authd.debug={{OPNsense.WazuhAgent.general.debug_level}}
+execd.debug={{OPNsense.WazuhAgent.general.debug_level}}
+monitord.debug={{OPNsense.WazuhAgent.general.debug_level}}
+logcollector.debug={{OPNsense.WazuhAgent.general.debug_level}}
+integrator.debug={{OPNsense.WazuhAgent.general.debug_level}}
+agent.debug={{OPNsense.WazuhAgent.general.debug_level}}
+wazuh_db.debug={{OPNsense.WazuhAgent.general.debug_level}}
+wazuh_modules.debug={{OPNsense.WazuhAgent.general.debug_level}}
+wazuh_clusterd.debug={{OPNsense.WazuhAgent.general.debug_level}}
+{% endif %}
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/newsyslog.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/newsyslog.conf
new file mode 100644
index 000000000..558d19da0
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/newsyslog.conf
@@ -0,0 +1,4 @@
+# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
+{% if not helpers.empty('OPNsense.WazuhAgent.general.enabled') %}
+/var/ossec/logs/opnsense_syslog.log root:wazuh 660 2 * $D0 Z /var/run/syslog-ng.pid
+{% endif %}
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/opnsense-fw.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/opnsense-fw.conf
new file mode 100644
index 000000000..073220f8f
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/opnsense-fw.conf
@@ -0,0 +1,4 @@
+[general]
+{% if not helpers.empty('OPNsense.WazuhAgent.wazuh_command.fw_alias_ignore') and helpers.getUUID(OPNsense.WazuhAgent.wazuh_command.fw_alias_ignore) %}
+skip_alias={{helpers.getUUID(OPNsense.WazuhAgent.wazuh_command.fw_alias_ignore).name}}
+{% endif %}
\ No newline at end of file
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec.conf
new file mode 100644
index 000000000..1303029ae
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec.conf
@@ -0,0 +1,22 @@
+
+
+
+ {{OPNsense.WazuhAgent.general.server_address}}
+
+ aes
+
+
+
+
+ no
+ 5000
+ 500
+
+
+{% for sfilename in helpers.glob("OPNsense/WazuhAgent/ossec_config.d/*.conf") %}{%
+ include sfilename without context
++%}
+
+{% endfor %}
+
+
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/000-rootcheck.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/000-rootcheck.conf
new file mode 100644
index 000000000..e0f98ff46
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/000-rootcheck.conf
@@ -0,0 +1,16 @@
+
+
+ {% if not helpers.empty('OPNsense.WazuhAgent.rootcheck.enabled') %}no{% else %}yes{% endif %}
+
+
+ 43200
+
+ /var/ossec/etc/shared/rootkit_files.txt
+ /var/ossec/etc/shared/rootkit_trojans.txt
+
+ /var/ossec/etc/shared/system_audit_rcl.txt
+ /var/ossec/etc/shared/system_audit_ssh.txt
+ /var/ossec/etc/shared/cis_debian_linux_rcl.txt
+
+ yes
+
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/001-wodle_syscollector.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/001-wodle_syscollector.conf
new file mode 100644
index 000000000..b3d32ce38
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/001-wodle_syscollector.conf
@@ -0,0 +1,13 @@
+
+ {% if not helpers.empty('OPNsense.WazuhAgent.syscollector.enabled') %}no{% else %}yes{% endif %}
+ 1h
+ yes
+ yes
+ yes
+ yes
+
+
+
+ 10
+
+
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/002-syscheck.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/002-syscheck.conf
new file mode 100644
index 000000000..4285d50e0
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/002-syscheck.conf
@@ -0,0 +1,55 @@
+
+
+ {% if not helpers.empty('OPNsense.WazuhAgent.syscheck.enabled') %}no{% else %}yes{% endif %}
+
+
+ 43200
+
+ yes
+
+
+ /etc,/usr/bin,/usr/sbin
+ /bin,/sbin,/boot
+
+
+ /etc/mtab
+ /etc/hosts.deny
+ /etc/mail/statistics
+ /etc/random-seed
+ /etc/random.seed
+ /etc/adjtime
+ /etc/httpd/logs
+ /etc/utmpx
+ /etc/wtmpx
+ /etc/cups/certs
+ /etc/dumpdates
+ /etc/svc/volatile
+ /sys/kernel/security
+ /sys/kernel/debug
+
+
+ .log$|.swp$
+
+
+ /etc/ssl/private.key
+
+ yes
+ yes
+ yes
+ yes
+
+
+ 10
+
+
+ 100
+
+
+
+ yes
+ 5m
+ 30
+ 16384
+ 10
+
+
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/003-localfile-generic.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/003-localfile-generic.conf
new file mode 100644
index 000000000..6b337fca1
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/003-localfile-generic.conf
@@ -0,0 +1,10 @@
+
+
+ syslog
+ /var/ossec/logs/active-responses.log
+
+
+
+ syslog
+ /var/ossec/logs/opnsense_syslog.log
+
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/004-localfile-suricata.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/004-localfile-suricata.conf
new file mode 100644
index 000000000..ec0b9ffce
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/004-localfile-suricata.conf
@@ -0,0 +1,9 @@
+
+{% if not helpers.empty('OPNsense.WazuhAgent.logcollector.suricata_eve_log') %}
+
+ json
+ /var/log/suricata/eve.json
+
+{% else %}
+
+{% endif %}
\ No newline at end of file
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/005-active-response.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/005-active-response.conf
new file mode 100644
index 000000000..6627c9eac
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/ossec_config.d/005-active-response.conf
@@ -0,0 +1,4 @@
+
+
+ {% if not helpers.empty('OPNsense.WazuhAgent.active_response.enabled') %}no{% else %}yes{% endif %}
+
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/rc.conf.d b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/rc.conf.d
new file mode 100644
index 000000000..c1e4bbe5c
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/rc.conf.d
@@ -0,0 +1,2 @@
+wazuh_agent_setup="/usr/local/opnsense/scripts/wazuh/setup.php"
+wazuh_agent_enable={% if not helpers.empty('OPNsense.WazuhAgent.general.enabled') %}"YES"{% else %}"NO"{% endif %}
diff --git a/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/syslog-ng-wazuh-agent.conf b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/syslog-ng-wazuh-agent.conf
new file mode 100644
index 000000000..649aa0221
--- /dev/null
+++ b/security/wazuh-agent/src/opnsense/service/templates/OPNsense/WazuhAgent/syslog-ng-wazuh-agent.conf
@@ -0,0 +1,27 @@
+#######################################################################################################################
+# This syslog-ng output is a bit of a work-around. As Wazuh does only support RFC3164 format syslog data
+# (https://github.com/wazuh/wazuh/issues/2038), we do need to flush our syslog output twice.
+#
+# Ideally we should then send it to a pipe, but that seems to be a feature
+# currenty on the wishlist (https://github.com/wazuh/wazuh/issues/15178)
+#
+# So, we will flush relevant messages to /var/ossec/logs/opnsense_syslog.log, which newsyslog may rotate
+#
+#######################################################################################################################
+{% if not helpers.empty('OPNsense.WazuhAgent.general.enabled') and not helpers.empty('OPNsense.WazuhAgent.logcollector.syslog_programs') %}
+filter f_local_wazuhagent {
+{% for prg in OPNsense.WazuhAgent.logcollector.syslog_programs.split(',') %}
+ program("{{prg}}") {% if loop.last %} ; {% else %} or {% endif +%}
+{% endfor %}
+};
+
+destination d_local_wazuhagent {
+ file("/var/ossec/logs/opnsense_syslog.log");
+};
+
+log {
+ source(s_all);
+ filter(f_local_wazuhagent);
+ destination(d_local_wazuhagent);
+};
+{% endif %}
\ No newline at end of file