mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
security/wazuh-agent - prevent model usage in wazuhagent_services()
The wazuh model uses configd for additional info, which makes model initialization a bit slower than usual. When only checking if the module is used, accessing the config object saves a lot of time.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
PLUGIN_NAME= wazuh-agent
|
||||
PLUGIN_VERSION= 1.0
|
||||
PLUGIN_REVISION= 1
|
||||
PLUGIN_COMMENT= Agent for the open source security platform Wazuh
|
||||
PLUGIN_DEPENDS= wazuh-agent
|
||||
PLUGIN_MAINTAINER= ad@opnsense.org
|
||||
|
||||
@@ -30,7 +30,13 @@
|
||||
function wazuhagent_services()
|
||||
{
|
||||
$services = [];
|
||||
if ((new \OPNsense\WazuhAgent\WazuhAgent())->general->enabled == '1') {
|
||||
$cnf = \OPNsense\Core\Config::getInstance()->object();
|
||||
$is_enabled = false;
|
||||
if ($cnf->OPNsense && $cnf->OPNsense->WazuhAgent && $cnf->OPNsense->WazuhAgent->general){
|
||||
$is_enabled = $cnf->OPNsense->WazuhAgent->general->enabled == '1';
|
||||
}
|
||||
|
||||
if ($is_enabled) {
|
||||
$service = [
|
||||
'description' => gettext('Wazuh Agent'),
|
||||
'configd' => [
|
||||
|
||||
Reference in New Issue
Block a user