diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index a8a7940165..7a6aeff356 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.769-230302 +Version: 7.0NG.769-230303 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 21522e4937..fa61aa49c9 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230302" +pandora_version="7.0NG.769-230303" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index a1e5ea6e0e..0a12df1c9f 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.769'; -use constant AGENT_BUILD => '230302'; +use constant AGENT_BUILD => '230303'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 107be42b57..89ea2a0b9f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230302 +%define release 230303 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 0f5ae307c0..aed2381793 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230302 +%define release 230303 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 6c14bec893..c63a4a6cfc 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230302" +PI_BUILD="230303" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 0c79064ec1..2c51bc2a4b 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230302} +{230303} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 13c0a7445d..acf6b701e5 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.769 Build 230302") +#define PANDORA_VERSION ("7.0NG.769 Build 230303") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index eff0e22339..c6e79f7d24 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.769(Build 230302))" + VALUE "ProductVersion", "(7.0NG.769(Build 230303))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 59ea1588fa..57d645e9b5 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230302 +Version: 7.0NG.769-230303 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index aaae992e96..f701f80ec0 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230302" +pandora_version="7.0NG.769-230303" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql index 9d9c14656f..f92441a5f0 100644 --- a/pandora_console/extras/mr/62.sql +++ b/pandora_console/extras/mr/62.sql @@ -60,7 +60,31 @@ UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-incremental-data@svg.svg' W UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 38; UPDATE `ttipo_modulo` SET `icon` = 'keepalive@svg.svg' WHERE `id_tipo` = 100; +CREATE TABLE IF NOT EXISTS `tagent_filter` ( + `id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `id_name` VARCHAR(600) NOT NULL, + `id_group_filter` INT NOT NULL DEFAULT 0, + `group_id` INT NOT NULL DEFAULT 0, + `recursion` TEXT, + `status` INT NOT NULL DEFAULT -1, + `search` TEXT, + `id_os` INT NOT NULL DEFAULT 0, + `policies` TEXT, + `search_custom` TEXT, + `ag_custom_fields` TEXT, + PRIMARY KEY (`id_filter`) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; + +CREATE TABLE `tevent_sound` ( + `id` INT NOT NULL AUTO_INCREMENT, + `name` TEXT NULL, + `sound` TEXT NULL, + `active` TINYINT NOT NULL DEFAULT '1', +PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; + CREATE INDEX agente_modulo_estado ON tevento (estado, id_agentmodule); CREATE INDEX idx_disabled ON talert_template_modules (disabled); +INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent safe mode not enable', 'select alias from tagente where safe_mode_module = 0'); + COMMIT; diff --git a/pandora_console/extras/mr/63.sql b/pandora_console/extras/mr/63.sql deleted file mode 100644 index 401d4a748c..0000000000 --- a/pandora_console/extras/mr/63.sql +++ /dev/null @@ -1,5 +0,0 @@ -START TRANSACTION; - -INSERT INTO `treport_custom_sql` (`name`, `sql`) VALUES ('Agent safe mode not enable', 'select alias from tagente where safe_mode_module = 0'); - -COMMIT; diff --git a/pandora_console/godmode/events/configuration_sounds.php b/pandora_console/godmode/events/configuration_sounds.php new file mode 100644 index 0000000000..d4e9d77688 --- /dev/null +++ b/pandora_console/godmode/events/configuration_sounds.php @@ -0,0 +1,71 @@ + '[EventSound]'.$e->getMessage() ]); + exit; + } else { + echo '[EventSound]'.$e->getMessage(); + } + + // Stop this execution, but continue 'globally'. + return; +} + +// AJAX controller. +if ((bool) is_ajax() === true) { + $method = get_parameter('method'); + + if (method_exists($controller, $method) === true) { + if ($controller->ajaxMethod($method) === true) { + $controller->{$method}(); + } else { + $controller->error('Unavailable method.'); + } + } else { + $controller->error('Method not found. ['.$method.']'); + } + + // Stop any execution. + exit; +} else { + // Run. + $controller->run(); +} diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index e9c262b7cf..af15b28f7a 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -438,6 +438,10 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($ } } + $sub['godmode/events/configuration_sounds']['text'] = __('Accoustic console setup'); + $sub['godmode/events/configuration_sounds']['id'] = 'Accoustic console setup'; + $sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds']; + $menu_godmode['gextensions']['sub'] = $sub; } diff --git a/pandora_console/images/omnishell.png b/pandora_console/images/omnishell.png new file mode 100644 index 0000000000..02c8f0e071 Binary files /dev/null and b/pandora_console/images/omnishell.png differ diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php index 48abefdc7e..f0884dea7f 100644 --- a/pandora_console/include/ajax/agent.php +++ b/pandora_console/include/ajax/agent.php @@ -31,6 +31,15 @@ $get_agents_interfaces = (bool) get_parameter('get_agents_interfaces'); $id_agents = get_parameter('id_agents', []); $get_agents_group = (bool) get_parameter('get_agents_group', false); $force_local = (bool) get_parameter('force_local', false); + +// Agent detail filter. +$load_filter_modal = get_parameter('load_filter_modal', 0); +$save_filter_modal = get_parameter('save_filter_modal', 0); +$get_agent_filters = get_parameter('get_agent_filters', 0); +$save_agent_filter = get_parameter('save_agent_filter', 0); +$update_agent_filter = get_parameter('update_agent_filter', 0); +$delete_agent_filter = get_parameter('delete_agent_filter', 0); + if (https_is_running()) { header('Content-type: application/json'); } @@ -345,4 +354,656 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { return; } +// Saves an event filter. +if ($save_agent_filter) { + $values = []; + $values['id_name'] = get_parameter('id_name'); + $values['group_id'] = get_parameter('group_id'); + $values['recursion'] = get_parameter('recursion'); + $values['status'] = get_parameter('status'); + $values['search'] = get_parameter('search'); + $values['id_os'] = get_parameter('id_os'); + $values['policies'] = json_encode(get_parameter('policies')); + $values['search_custom'] = get_parameter('search_custom'); + $values['ag_custom_fields'] = get_parameter('ag_custom_fields'); + $values['id_group_filter'] = get_parameter('id_group_filter'); + + $exists = (bool) db_get_value_filter( + 'id_filter', + 'tagent_filter', + $values + ); + + if ($exists === true) { + echo 'duplicate'; + } else { + $result = db_process_sql_insert('tagent_filter', $values); + + if ($result === false) { + echo 'error'; + } else { + echo $result; + } + } +} + +if ($update_agent_filter) { + $values = []; + $id = get_parameter('id'); + + $values['group_id'] = get_parameter('group_id'); + $values['recursion'] = get_parameter('recursion'); + $values['status'] = get_parameter('status'); + $values['search'] = get_parameter('search'); + $values['id_os'] = get_parameter('id_os'); + $values['policies'] = json_encode(get_parameter('policies')); + $values['search_custom'] = get_parameter('search_custom'); + $values['ag_custom_fields'] = get_parameter('ag_custom_fields'); + + $result = db_process_sql_update( + 'tagent_filter', + $values, + ['id_filter' => $id] + ); + + if ($result === false) { + echo 'error'; + } else { + echo 'ok'; + } +} + +if ($delete_agent_filter) { + $id = get_parameter('id'); + + $user_groups = users_get_groups( + $config['id_user'], + 'AW', + users_can_manage_group_all('AW'), + true + ); + + $sql = 'DELETE + FROM tagent_filter + WHERE id_filter = '.$id.' AND id_group_filter IN ('.implode(',', array_keys($user_groups)).')'; + + $agent_filters = db_process_sql($sql); + + if ($agent_filters === false) { + echo 'error'; + } else { + echo 'ok'; + } +} + +if ($get_agent_filters) { + $user_groups = users_get_groups( + $config['id_user'], + 'AR', + users_can_manage_group_all('AR'), + true + ); + + $sql = 'SELECT id_filter, id_name + FROM tagent_filter + WHERE id_group_filter IN ('.implode(',', array_keys($user_groups)).')'; + + $agent_filters = db_get_all_rows_sql($sql); + + $result = []; + + if ($agent_filters !== false) { + foreach ($agent_filters as $agent_filter) { + $result[$agent_filter['id_filter']] = $agent_filter['id_name']; + } + } + + echo io_json_mb_encode($result); +} + +if ((int) $load_filter_modal === 1) { + $user_groups = users_get_groups( + $config['id_user'], + 'AR', + users_can_manage_group_all('AR'), + true + ); + + $sql = 'SELECT id_filter, id_name + FROM tagent_filter + WHERE id_group_filter IN ('.implode(',', array_keys($user_groups)).')'; + + $agent_filters = db_get_all_rows_sql($sql); + + $filters = []; + foreach ($agent_filters as $agent_filter) { + $filters[$agent_filter['id_filter']] = $agent_filter['id_name']; + } + + echo '