wazuh: check if dir exists before creating it (#4874)

This commit is contained in:
KS
2025-08-05 19:23:19 +02:00
committed by GitHub
parent 2244a20843
commit f8b9581270
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
PLUGIN_NAME= wazuh-agent
PLUGIN_VERSION= 1.2
PLUGIN_REVISION= 1
PLUGIN_REVISION= 2
PLUGIN_COMMENT= Agent for the open source security platform Wazuh
PLUGIN_DEPENDS= wazuh-agent
PLUGIN_MAINTAINER= ad@opnsense.org
@@ -56,7 +56,11 @@ if (!empty((string)$mdl->auth->password)) {
* 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);
if (!is_dir("/var/log/wazuhagent/ossec/")) {
mkdir("/var/log/wazuhagent/ossec/", 0700, true);
}
if (!is_dir("/var/log/wazuhagent/activeresponses/")) {
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");