#12341 module plugin enable disable windows

This commit is contained in:
Jonathan 2023-11-29 10:27:40 +01:00
parent c68bf25886
commit 824e6b78a0
2 changed files with 63 additions and 12 deletions

View File

@ -618,7 +618,7 @@ if (enterprise_installed()) {
$plugins = $agent_plugin->getPlugins();
// Check if some plugin was enabled/disabled in conf.
foreach ($plugins as $key => $row) {
if (preg_match('/(pandora_hardening).*/', $row['raw']) === 1) {
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$security_hardening = 0;
} else {
@ -626,6 +626,7 @@ if (enterprise_installed()) {
}
}
if ($id_os === '1' || $id_os === '8') {
if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$enable_log_collector = 0;
@ -641,6 +642,28 @@ if (enterprise_installed()) {
$enable_inventory = 1;
}
}
} else {
if (preg_match('/PROGRAMFILES%.Pandora_Agent.util.software_installed.vbs/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$enable_inventory = 0;
} else {
$enable_inventory = 1;
}
}
}
}
if ($id_os === '9') {
$modules = $agent_plugin->getModules();
foreach ($modules as $key => $row) {
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$enable_log_collector = 0;
} else {
$enable_log_collector = 1;
}
}
}
}
unset($agent_plugin, $plugins);

View File

@ -1259,7 +1259,7 @@ if ($update_agent) {
foreach ($plugins as $key => $row) {
// Only check plugins when agent package is bigger than 774.
if ($options_package === '1') {
if (preg_match('/(pandora_hardening).*/', $row['raw']) === 1) {
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
if ($security_hardening === 1) {
if ($row['disabled'] === 1) {
$agent->enablePlugins($row['raw']);
@ -1296,6 +1296,34 @@ if ($update_agent) {
}
}
}
// Inventory switch enable when basic options are enabled.
if (preg_match('/PROGRAMFILES%.Pandora_Agent.util.software_installed.vbs/', $row['raw']) === 1) {
if ($enable_inventory === 1) {
if ($row['disabled'] === 1) {
$agent->enablePlugins($row['raw']);
}
} else {
if ($row['disabled'] !== 1) {
$agent->disablePlugins($row['raw']);
}
}
}
}
$modules = $agent->getModules();
foreach ($modules as $key => $row) {
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
if ($enable_log_collector === 1) {
if ($row['disabled'] === 1) {
$agent->enableModule($row['module_name'], $row);
}
} else {
if ($row['disabled'] !== 1) {
$agent->disableModule($row['module_name'], $row);
}
}
}
}
}
}