mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch 'ent-13078-habilitar-enable-security-hardening-monitoring-no-funciona-como-se-espera' into 'develop'
Ent 13078 Habilitar Enable security hardening monitoring no funciona como se espera See merge request artica/pandorafms!7104
This commit is contained in:
commit
aeaaaf54d4
@ -1292,10 +1292,18 @@ if ($update_agent) {
|
|||||||
// Get all plugins (BASIC OPTIONS).
|
// Get all plugins (BASIC OPTIONS).
|
||||||
$agent = new PandoraFMS\Agent($id_agente);
|
$agent = new PandoraFMS\Agent($id_agente);
|
||||||
$plugins = $agent->getPlugins();
|
$plugins = $agent->getPlugins();
|
||||||
|
$pluginsToWrite = [
|
||||||
|
'security_hardening' => [
|
||||||
|
'write' => $security_hardening,
|
||||||
|
'raw' => "module_begin \nmodule_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150 \nmodule_absoluteinterval 7d \nmodule_end",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($plugins as $key => $row) {
|
foreach ($plugins as $key => $row) {
|
||||||
// Only check plugins when agent package is bigger than 774.
|
// Only check plugins when agent package is bigger than 774.
|
||||||
if ($options_package === '1') {
|
if ($options_package === '1') {
|
||||||
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
|
if (preg_match('/pandora_hardening/', $row['raw']) === 1) {
|
||||||
|
$pluginsToWrite['security_hardening']['write'] = 0;
|
||||||
if ($security_hardening === 1) {
|
if ($security_hardening === 1) {
|
||||||
if ($row['disabled'] === 1) {
|
if ($row['disabled'] === 1) {
|
||||||
$agent->enablePlugins($row['raw']);
|
$agent->enablePlugins($row['raw']);
|
||||||
@ -1347,6 +1355,12 @@ if ($update_agent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($pluginsToWrite as $name => $val) {
|
||||||
|
if ($val['write'] === 1) {
|
||||||
|
$result = $agent->addPlugins(io_safe_output($val['raw']), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$modules = $agent->getModules();
|
$modules = $agent->getModules();
|
||||||
|
|
||||||
foreach ($modules as $key => $row) {
|
foreach ($modules as $key => $row) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user