From 210ef60b69572a99c4db738bb5a32923157fa426 Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Tue, 27 Feb 2024 14:18:00 +0100 Subject: [PATCH 01/65] Added MR changes --- pandora_console/extras/mr/69.sql | 19 +++++++++++++++++++ pandora_console/pandoradb.sql | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 pandora_console/extras/mr/69.sql diff --git a/pandora_console/extras/mr/69.sql b/pandora_console/extras/mr/69.sql new file mode 100644 index 0000000000..17fa864e13 --- /dev/null +++ b/pandora_console/extras/mr/69.sql @@ -0,0 +1,19 @@ +START TRANSACTION; + +ALTER TABLE `tdeployment_hosts` ADD COLUMN `deploy_method` ENUM('SSH', 'HTTP', 'HTTPS') DEFAULT 'SSH'; +ALTER TABLE `tdeployment_hosts` ADD COLUMN `deploy_port` INT UNSIGNED NOT NULL DEFAULT 22; +ALTER TABLE `tdeployment_hosts` ADD COLUMN `server_port` INT UNSIGNED NOT NULL DEFAULT 41121; +ALTER TABLE `tdeployment_hosts` ADD COLUMN `temp_folder` VARCHAR(500) DEFAULT '/tmp'; + +UPDATE + `tdeployment_hosts`, `tconfig_os` +SET + `tdeployment_hosts`.`deploy_method` = 'HTTP', + `tdeployment_hosts`.`deploy_port` = 5985, + `tdeployment_hosts`.`temp_folder` = '$env:TEMP' +WHERE + `tdeployment_hosts`.`id_os` = `tconfig_os`.`id_os` AND `tconfig_os`.`name` = 'Windows' AND `tdeployment_hosts`.`deployed` = 0; + +UPDATE `trecon_task` SET `field4` = 41121 WHERE `type` = 9; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index e340dfbf27..a7a17f48eb 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -3948,6 +3948,10 @@ CREATE TABLE IF NOT EXISTS `tdeployment_hosts` ( `deployed` BIGINT NOT NULL DEFAULT 0 COMMENT 'When it was deployed', `server_ip` VARCHAR(100) DEFAULT NULL COMMENT 'Where to point target agent', `last_err` TEXT, + `deploy_method` ENUM('SSH', 'HTTP', 'HTTPS') DEFAULT 'SSH', + `deploy_port` INT UNSIGNED NOT NULL DEFAULT 22, + `server_port` INT UNSIGNED NOT NULL DEFAULT 41121, + `temp_folder` VARCHAR(500) DEFAULT '/tmp', PRIMARY KEY (`id`), FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`) ON UPDATE CASCADE ON DELETE SET NULL, From 3776f10bc785f61a23127c921e62b34a583c5ec3 Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Tue, 27 Feb 2024 20:20:46 +0100 Subject: [PATCH 02/65] Use external utility for agents deployment --- pandora_console/extras/mr/69.sql | 18 ++++++++++++++++++ pandora_console/pandoradb.sql | 5 ----- pandora_server/lib/PandoraFMS/Config.pm | 5 +++++ .../lib/PandoraFMS/DiscoveryServer.pm | 10 ++++++---- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/pandora_console/extras/mr/69.sql b/pandora_console/extras/mr/69.sql index 17fa864e13..6e18995c64 100644 --- a/pandora_console/extras/mr/69.sql +++ b/pandora_console/extras/mr/69.sql @@ -1,5 +1,6 @@ START TRANSACTION; +-- Add new columns in tdeployment_hosts ALTER TABLE `tdeployment_hosts` ADD COLUMN `deploy_method` ENUM('SSH', 'HTTP', 'HTTPS') DEFAULT 'SSH'; ALTER TABLE `tdeployment_hosts` ADD COLUMN `deploy_port` INT UNSIGNED NOT NULL DEFAULT 22; ALTER TABLE `tdeployment_hosts` ADD COLUMN `server_port` INT UNSIGNED NOT NULL DEFAULT 41121; @@ -14,6 +15,23 @@ SET WHERE `tdeployment_hosts`.`id_os` = `tconfig_os`.`id_os` AND `tconfig_os`.`name` = 'Windows' AND `tdeployment_hosts`.`deployed` = 0; +-- Find the name of the foreign key constraint +SELECT @constraint_name := `constraint_name` +FROM `information_schema`.`key_column_usage` +WHERE `table_name` = 'tdeployment_hosts' AND `column_name` = 'id_os'; + +-- Drop the foreign key constraint using dynamic SQL +SET @drop_fk_query = CONCAT('ALTER TABLE `tdeployment_hosts` DROP FOREIGN KEY ', @constraint_name); +PREPARE stmt FROM @drop_fk_query; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +-- Drop unused columns in tdeployment_hosts +ALTER TABLE `tdeployment_hosts` DROP COLUMN `id_os`; +ALTER TABLE `tdeployment_hosts` DROP COLUMN `os_version`; +ALTER TABLE `tdeployment_hosts` DROP COLUMN `arch`; + +-- Update all deployment recon tasks port UPDATE `trecon_task` SET `field4` = 41121 WHERE `type` = 9; COMMIT; \ No newline at end of file diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index a7a17f48eb..2b0e21043a 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -3940,9 +3940,6 @@ CREATE TABLE IF NOT EXISTS `tdeployment_hosts` ( `id` SERIAL, `id_cs` VARCHAR(100), `ip` VARCHAR(100) NOT NULL UNIQUE, - `id_os` INT UNSIGNED DEFAULT 0, - `os_version` VARCHAR(100) DEFAULT '' COMMENT 'OS version in STR format', - `arch` ENUM('x64', 'x86') DEFAULT 'x64', `current_agent_version` VARCHAR(100) DEFAULT '' COMMENT 'String latest installed agent', `target_agent_version_id` BIGINT UNSIGNED, `deployed` BIGINT NOT NULL DEFAULT 0 COMMENT 'When it was deployed', @@ -3955,8 +3952,6 @@ CREATE TABLE IF NOT EXISTS `tdeployment_hosts` ( PRIMARY KEY (`id`), FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`) ON UPDATE CASCADE ON DELETE SET NULL, - FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`) - ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`) ON UPDATE CASCADE ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 89ef89c453..72310b6fa9 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -556,6 +556,8 @@ sub pandora_load_config { $pa_config->{'ncmserver_threads'} = 1; # 7.0.758 $pa_config->{'ncm_ssh_utility'} = '/usr/share/pandora_server/util/ncm_ssh_extension'; # 7.0.758 + $pa_config->{'agent_deployer_utility'} = '/usr/share/pandora_server/util/pandora_agent_deployer'; # 7.0.777 + $pa_config->{"pandora_service_cmd"} = 'service pandora_server'; # 7.0.761 $pa_config->{"tentacle_service_cmd"} = 'service tentacle_serverd'; # 7.0.761 $pa_config->{"tentacle_service_watchdog"} = 1; # 7.0.761 @@ -1336,6 +1338,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^ncm_ssh_utility\s+(.*)/i) { $pa_config->{'ncm_ssh_utility'}= clean_blank($1); } + elsif ($parametro =~ m/^agent_deployer_utility\s+(.*)/i) { + $pa_config->{'agent_deployer_utility'}= clean_blank($1); + } # Pandora HA extra elsif ($parametro =~ m/^ha_mode\s(.*)/i) { diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 972f259bb5..fe26cc2ff3 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -148,21 +148,23 @@ sub data_producer ($) { WHERE id_recon_server = ? AND disabled = 0 AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1) - OR (status < 0 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id); + OR (status < 0 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP())) + OR (status < 0 AND utimestamp = 0 AND interval_sweep = 0)', $server_id); } else { @rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task WHERE (id_recon_server = ? OR id_recon_server NOT IN (SELECT id_server FROM tserver WHERE status = 1 AND server_type = ?)) AND disabled = 0 AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1) - OR (status < 0 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id, DISCOVERYSERVER); + OR (status < 0 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP())) + OR (status < 0 AND utimestamp = 0 AND interval_sweep = 0)', $server_id, DISCOVERYSERVER); } foreach my $row (@rows) { - # Discovery apps must be fully set up. + # Discovery apps must be fully set up. if ($row->{'type'} == DISCOVERY_APP && $row->{'setup_complete'} != 1) { logger($pa_config, 'Setup for recon app task ' . $row->{'id_app'} . ' not complete.', 10); - next; + next; } # Update task status From 244433983d334f603013c98a07ce31e9dac19ee2 Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Wed, 28 Feb 2024 10:56:25 +0100 Subject: [PATCH 03/65] Run deploy agents task from script --- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index fe26cc2ff3..4e3dd03576 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -148,15 +148,15 @@ sub data_producer ($) { WHERE id_recon_server = ? AND disabled = 0 AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1) - OR (status < 0 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP())) - OR (status < 0 AND utimestamp = 0 AND interval_sweep = 0)', $server_id); + OR (status < 0 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()) + OR (status < 0 AND utimestamp = 0 AND interval_sweep = 0))', $server_id); } else { @rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task WHERE (id_recon_server = ? OR id_recon_server NOT IN (SELECT id_server FROM tserver WHERE status = 1 AND server_type = ?)) AND disabled = 0 AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1) - OR (status < 0 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP())) - OR (status < 0 AND utimestamp = 0 AND interval_sweep = 0)', $server_id, DISCOVERYSERVER); + OR (status < 0 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()) + OR (status < 0 AND utimestamp = 0 AND interval_sweep = 0))', $server_id, DISCOVERYSERVER); } foreach my $row (@rows) { @@ -315,13 +315,7 @@ sub data_consumer ($$) { # Clean tmp file. if (defined($cnf_extra{'creds_file'}) && -f $cnf_extra{'creds_file'}) { - unlink($cnf_extra{'creds_file'}); - } - - - # Clean one shot tasks - if ($task->{'type'} eq DISCOVERY_DEPLOY_AGENTS) { - db_delete_limit($dbh, ' trecon_task ', ' id_rt = ? ', 1, $task->{'id_rt'}); + unlink($cnf_extra{'creds_file'}); } }; if ($@) { From 80add40a5b7a367b415de09539cc06cb0a6ed1fa Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Wed, 28 Feb 2024 12:42:02 +0100 Subject: [PATCH 04/65] Set agent deployer default value to pandora_server.conf --- pandora_server/conf/pandora_server.conf.new | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index f7d4df74aa..4fceaca30c 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -711,6 +711,9 @@ ncmserver_threads 1 # NCM utility to avoid Net::SSH::Expect issues in multi-threaded environments. ncm_ssh_utility /usr/share/pandora_server/util/ncm_ssh_extension +# Utility to deploy software agents via SSH or WinRM. +agent_deployer_utility /usr/share/pandora_server/util/pandora_agent_deployer + # Pandora FMS Daemon Watchdog execution interval in seconds (PANDORA FMS ENTERPRISE ONLY). ha_interval 30 From 618c04997a8deac1a4a08d6e4f1dabbab2c59e44 Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Wed, 28 Feb 2024 14:25:23 +0100 Subject: [PATCH 05/65] Set new tentacle_server filter for agents deployment --- pandora_server/pandora_server_installer | 22 ++++++++++++++++++++++ tentacle/tentacle_server | 8 ++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 6fdd7041cd..c747ab016b 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -437,6 +437,28 @@ install () { then echo cp $TENTACLE_CFG_FILE_DIST $DESTDIR$TENTACLE_CFG_DIR cp $TENTACLE_CFG_FILE_DIST $DESTDIR$TENTACLE_CFG_DIR + + # Add agents deployment filters if not added yet + filter_changed=0 + tentacle_filters=$(grep -E '^\s*filters\s*.*$' "$DESTDIR$TENTACLE_CFG_FILE" | sed 's/\\/\\\\/g') + if ! [[ $tentacle_filters =~ \.\*\\\\\.agent_setup\\\\\.exe:agent ]] + then + sed -i -e "s/$tentacle_filters/$tentacle_filters;.*\\\\.agent_setup\\\\.exe:agent/" "$DESTDIR$TENTACLE_CFG_FILE" + filter_changed=1 + fi + tentacle_filters=$(grep -E '^\s*filters\s*.*$' "$DESTDIR$TENTACLE_CFG_FILE" | sed 's/\\/\\\\/g') + if ! [[ $tentacle_filters =~ \.\*\\\\\.agent_setup\\\\\.tar\\\\\.gz:agent ]] + then + sed -i -e "s/$tentacle_filters/$tentacle_filters;.*\\\\.agent_setup\\\\.tar\\\\.gz:agent/" "$DESTDIR$TENTACLE_CFG_FILE" + filter_changed=1 + fi + + if [ $filter_changed -eq 1 ] + then + echo "Tentacle filter updated for agent deployment feature." + echo "Please restart 'tentacle_serverd' service." + fi + else echo cp $TENTACLE_CFG_FILE_DIST $DESTDIR$TENTACLE_CFG_FILE cp $TENTACLE_CFG_FILE_DIST $DESTDIR$TENTACLE_CFG_FILE diff --git a/tentacle/tentacle_server b/tentacle/tentacle_server index b6d6ae7b08..78e8bf3f7a 100755 --- a/tentacle/tentacle_server +++ b/tentacle/tentacle_server @@ -1785,10 +1785,10 @@ sub check_ssleay_version { ################################################################################ # Never run as root -if ($> == 0 && $^O ne 'MSWin32') { - print ("Error: for safety reasons $0 cannot be run with root privileges.\n"); - exit 1; -} +#if ($> == 0 && $^O ne 'MSWin32') { +# print ("Error: for safety reasons $0 cannot be run with root privileges.\n"); +# exit 1; +#} # Parse command line options parse_options (); From b4d5cd61dc18ce50f322dd968577cbabe4c151b3 Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Wed, 28 Feb 2024 14:26:03 +0100 Subject: [PATCH 06/65] Set new tentacle_server filter for agents deployment --- pandora_server/conf/tentacle_server.conf.new | 2 +- tentacle/tentacle_server | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_server/conf/tentacle_server.conf.new b/pandora_server/conf/tentacle_server.conf.new index a7cec8fd2c..9f0452d82b 100644 --- a/pandora_server/conf/tentacle_server.conf.new +++ b/pandora_server/conf/tentacle_server.conf.new @@ -21,7 +21,7 @@ daemon 1 #insecure 0 # [-i] Filters (regexp:dir;regexp:dir...). -filters .*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.lock:trans;.*\.rcmd:commands +filters .*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.lock:trans;.*\.rcmd:commands;.*\.agent_setup\.exe:agent;.*\.agent_setup\.tar\.gz:agent # [-m] Maximum file size allowed by the server in bytes # max_size 2000000 diff --git a/tentacle/tentacle_server b/tentacle/tentacle_server index 78e8bf3f7a..b6d6ae7b08 100755 --- a/tentacle/tentacle_server +++ b/tentacle/tentacle_server @@ -1785,10 +1785,10 @@ sub check_ssleay_version { ################################################################################ # Never run as root -#if ($> == 0 && $^O ne 'MSWin32') { -# print ("Error: for safety reasons $0 cannot be run with root privileges.\n"); -# exit 1; -#} +if ($> == 0 && $^O ne 'MSWin32') { + print ("Error: for safety reasons $0 cannot be run with root privileges.\n"); + exit 1; +} # Parse command line options parse_options (); From a7a0813cf5a305f1e6eaa05d6e48a961f00568fd Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Wed, 28 Feb 2024 14:30:22 +0100 Subject: [PATCH 07/65] Added agent folder to data_in during server installation --- pandora_server/pandora_server_installer | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index c747ab016b..f1e0eb22da 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -346,6 +346,8 @@ install () { chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/commands mkdir $DESTDIR$PANDORA_SPOOL/data_in/discovery 2> /dev/null chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/discovery + mkdir $DESTDIR$PANDORA_SPOOL/data_in/agent 2> /dev/null + chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/agent mkdir -p $DESTDIR$PANDORA_LOG 2> /dev/null chown -R pandora:apache $DESTDIR$PANDORA_LOG 2> /dev/null chmod 2774 $DESTDIR$PANDORA_LOG 2> /dev/null From 146ffef66bf3f8ef3320e2270780c7775cb33d16 Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Wed, 28 Feb 2024 17:27:16 +0100 Subject: [PATCH 08/65] Changed windows default temp folder --- pandora_console/extras/mr/69.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/extras/mr/69.sql b/pandora_console/extras/mr/69.sql index 6e18995c64..5495cb7ada 100644 --- a/pandora_console/extras/mr/69.sql +++ b/pandora_console/extras/mr/69.sql @@ -11,7 +11,7 @@ UPDATE SET `tdeployment_hosts`.`deploy_method` = 'HTTP', `tdeployment_hosts`.`deploy_port` = 5985, - `tdeployment_hosts`.`temp_folder` = '$env:TEMP' + `tdeployment_hosts`.`temp_folder` = 'C:\\Widnows\\Temp' WHERE `tdeployment_hosts`.`id_os` = `tconfig_os`.`id_os` AND `tconfig_os`.`name` = 'Windows' AND `tdeployment_hosts`.`deployed` = 0; From 240a6551b7f7ff8b0a09d1182eb02b60a082c841 Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Wed, 28 Feb 2024 17:39:31 +0100 Subject: [PATCH 09/65] Changed windows default temp folder --- pandora_console/extras/mr/69.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/extras/mr/69.sql b/pandora_console/extras/mr/69.sql index 5495cb7ada..aa2f0e841e 100644 --- a/pandora_console/extras/mr/69.sql +++ b/pandora_console/extras/mr/69.sql @@ -11,7 +11,7 @@ UPDATE SET `tdeployment_hosts`.`deploy_method` = 'HTTP', `tdeployment_hosts`.`deploy_port` = 5985, - `tdeployment_hosts`.`temp_folder` = 'C:\\Widnows\\Temp' + `tdeployment_hosts`.`temp_folder` = 'C:\Widnows\Temp' WHERE `tdeployment_hosts`.`id_os` = `tconfig_os`.`id_os` AND `tconfig_os`.`name` = 'Windows' AND `tdeployment_hosts`.`deployed` = 0; From a5592eccc54aa93957a285c54dc712a97043bb41 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Wed, 28 Feb 2024 17:50:53 +0100 Subject: [PATCH 10/65] added check to group deletion --- pandora_console/include/functions_groups.php | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index a09baf5d9f..84ea9e34ee 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -267,6 +267,32 @@ function groups_check_used($idGroup) $return['tables'][] = __('SNMP alerts'); } + switch ($config['dbtype']) { + case 'mysql': + case 'postgresql': + $numRows = db_get_num_rows( + 'SELECT * + FROM tusuario_perfil WHERE id_grupo = '.$idGroup.';' + ); + break; + + case 'oracle': + $numRows = db_get_num_rows( + 'SELECT * + FROM tusuario_perfil WHERE id_grupo = '.$idGroup + ); + break; + + default: + // Ignore. + break; + } + + if ($numRows > 0) { + $return['return'] = true; + $return['tables'][] = __('User profile'); + } + $hookEnterprise = enterprise_include_once('include/functions_groups.php'); if ($hookEnterprise !== ENTERPRISE_NOT_HOOK) { $returnEnterprise = enterprise_hook('groups_check_used_group_enterprise', [$idGroup]); From ead051073b3e30fb90a074adaf77a9441f23d01e Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Thu, 29 Feb 2024 09:33:05 +0100 Subject: [PATCH 11/65] added check to group deletion --- pandora_console/godmode/groups/group_list.php | 38 ++++++++++++++++- pandora_console/include/functions.php | 42 +++++++++++++++++++ pandora_console/include/functions_groups.php | 26 ------------ pandora_console/include/lib/Group.php | 31 ++++++++++++++ 4 files changed, 109 insertions(+), 28 deletions(-) diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 6aad60e71d..b8d969a90c 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -727,6 +727,11 @@ if ($is_management_allowed === true ['id_grupo' => $id_group] ); + $result_user_profile = db_process_sql_delete( + 'tusuario_perfil', + ['id_grupo' => $id_group] + ); + if ($result && (!$usedGroup['return'])) { db_process_sql_delete( 'tfavmenu_user', @@ -1132,7 +1137,7 @@ if ($tab == 'tree') { $confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message; } - $table->data[$key][6] .= ''.html_print_image( + $table->data[$key][6] .= ''.html_print_image( 'images/delete.svg', true, [ @@ -1218,7 +1223,6 @@ $tab = 'group_edition'; }); $('#button-filter').on('click', function(event) { - console.log('here'); event.preventDefault(); load_tree(show_full_hirearchy, show_not_init_agents, show_not_init_modules); @@ -1318,5 +1322,35 @@ $tab = 'group_edition'; }); } + function preprocessDeletion(group_id, delete_URL, confirm_text) { + var parameters = {}; + parameters['page'] = 'include/ajax/group'; + parameters['method'] = 'checkGroupIsLinkedToElement'; + parameters['group_id'] = group_id; + parameters['table_name'] = 'tusuario_perfil'; + parameters['field_name'] = 'id_grupo'; + + $.ajax({ + type: "POST", + url: "", + data: parameters, + success: function(data) { + if (data.result == '1') { + confirmDialog({ + title: '', + message: '', + onAccept: function() { + window.location.assign(delete_URL); + } + }); + } else { + if (!confirm(confirm_text)) return false; + } + }, + dataType: "json" + }); + + return true; + } diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 1762326077..77f3d62380 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6938,3 +6938,45 @@ function get_defined_translation($string) } } } + + +/** + * General utility to check if at least one element in an array meets a certain criteria defined by passed function. + * + * @param array $array Array to be checked. + * @param callable $fn Checking function (must accept one argument => array item to be evaluated and returns + * true/false depending on whether or not the condition was fulfilled). + * + * @return boolean + */ +function array_some(array $array, callable $fn) +{ + foreach ($array as $value) { + if ($fn($value) === true) { + return true; + } + } + + return false; +} + + +/** + * General utility to check if every element in an array meets a certain criteria defined by passed function. + * + * @param array $array Array to be checked. + * @param callable $fn Checking function (must accept one argument => array item to be evaluated and returns + * true/false depending on whether or not the condition was fulfilled). + * + * @return boolean + */ +function array_every(array $array, callable $fn) +{ + foreach ($array as $value) { + if ($fn($value) === false) { + return false; + } + } + + return true; +} diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 84ea9e34ee..a09baf5d9f 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -267,32 +267,6 @@ function groups_check_used($idGroup) $return['tables'][] = __('SNMP alerts'); } - switch ($config['dbtype']) { - case 'mysql': - case 'postgresql': - $numRows = db_get_num_rows( - 'SELECT * - FROM tusuario_perfil WHERE id_grupo = '.$idGroup.';' - ); - break; - - case 'oracle': - $numRows = db_get_num_rows( - 'SELECT * - FROM tusuario_perfil WHERE id_grupo = '.$idGroup - ); - break; - - default: - // Ignore. - break; - } - - if ($numRows > 0) { - $return['return'] = true; - $return['tables'][] = __('User profile'); - } - $hookEnterprise = enterprise_include_once('include/functions_groups.php'); if ($hookEnterprise !== ENTERPRISE_NOT_HOOK) { $returnEnterprise = enterprise_hook('groups_check_used_group_enterprise', [$idGroup]); diff --git a/pandora_console/include/lib/Group.php b/pandora_console/include/lib/Group.php index 66317471f6..66afa624ad 100644 --- a/pandora_console/include/lib/Group.php +++ b/pandora_console/include/lib/Group.php @@ -50,6 +50,7 @@ class Group extends Entity 'loadInfoAgent', 'getAgentsByGroup', 'getGroupsName', + 'checkGroupIsLinkedToElement', ]; @@ -777,5 +778,35 @@ class Group extends Entity exit; } + /** + * Check whether group is linked to a database element (needed for ajax check). + * + * @return void + */ + public static function checkGroupIsLinkedToElement() + { + $group_id = get_parameter('group_id', null); + $table_name = get_parameter('table_name', null); + $field_name = get_parameter('field_name', null); + + if (count(array_filter([$group_id, $table_name, $field_name])) < 3) { + $result['result'] = 0; + } else { + $sql = sprintf( + 'SELECT * FROM %s WHERE %s = %s', + $table_name, + $field_name, + $group_id + ); + + $count = db_get_num_rows($sql); + + $result['result'] = (int) ($count > 0); + } + + echo json_encode($result); + exit; + } + } From ef4d7b90aca7c4fc4b81d61ef0c71142064ccf8f Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 29 Feb 2024 12:22:32 +0100 Subject: [PATCH 12/65] #12934 changed filters --- pandora_console/include/styles/deployment_list.css | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/include/styles/deployment_list.css b/pandora_console/include/styles/deployment_list.css index e487207b05..746fe82716 100644 --- a/pandora_console/include/styles/deployment_list.css +++ b/pandora_console/include/styles/deployment_list.css @@ -29,6 +29,5 @@ ul.wizard li.flex-indep { } .datatable_filter.content li input[type="text"] { - width: 150px; margin: 0 1em 0 0; } From bf1874ca09f14a224c5eabc7c7810eb629d3efaf Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Fri, 1 Mar 2024 10:26:10 +0100 Subject: [PATCH 13/65] #12934 added modals for edit task of DISCOVERY_DEPLOY_AGENTS --- .../wizards/DiscoveryTaskList.class.php | 72 ++++++++++++++----- 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 1023a00704..ea4f615646 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -100,6 +100,26 @@ class DiscoveryTaskList extends HTML // Load styles. parent::run(); + $deploymentCenter = new DeploymentCenter(); + echo $deploymentCenter->loadJS(); + ui_require_css_file('deployment_list'); + + html_print_div( + [ + 'content' => '', + 'id' => 'modal_add_target', + 'class' => 'invisible', + ] + ); + + html_print_div( + [ + 'content' => '', + 'id' => 'modal_deploy_targets', + 'class' => 'invisible', + ] + ); + $this->prepareBreadcrum( [ [ @@ -176,7 +196,7 @@ class DiscoveryTaskList extends HTML } if (is_reporting_console_node() === false) { - $ret2 = $this->showList(__('Host & devices tasks'), [0, 1]); + $ret2 = $this->showList(__('Host & devices tasks'), [0, 1, 9]); $ret2 .= $this->showList(__('Applications tasks'), [3, 4, 5, 10, 11, 12], 'app'); $ret2 .= $this->showList(__('Cloud tasks'), [6, 7, 8, 13, 14], 'cloud'); $ret2 .= $this->showList(__('Custom tasks'), [-1], 'custom'); @@ -870,14 +890,12 @@ class DiscoveryTaskList extends HTML break; case DISCOVERY_DEPLOY_AGENTS: - // Internal deployment task. - $no_operations = true; $data[6] = html_print_image( 'images/osx-terminal@groups.svg', true, ['title' => __('Agent deployment')] ).'  '; - $data[6] .= __('Discovery.Agent.Deployment (legacy)'); + $data[6] .= __('Discovery.Agent.Deployment'); break; case DISCOVERY_APP_MICROSOFT_SQL_SERVER: @@ -1003,6 +1021,7 @@ class DiscoveryTaskList extends HTML && $task['type'] != DISCOVERY_APP_SAP && $task['type'] != DISCOVERY_CLOUD_AWS_RDS && $task['type'] != DISCOVERY_CLOUD_AWS_S3 + && $task['type'] != DISCOVERY_DEPLOY_AGENTS ) { if (check_acl($config['id_user'], 0, 'MR') && (int) $task['type'] !== DISCOVERY_EXTENSION) { $data[9] .= ''; @@ -1062,25 +1081,40 @@ class DiscoveryTaskList extends HTML ).''; } } else { - $url_edit = sprintf( - 'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d', - $this->getTargetWiz($task, $recon_script_data), - $task['id_rt'] - ); + // Create the url edit. + switch ((int) $task['type']) { + case DISCOVERY_EXTENSION: + $url_edit = ui_get_full_url( + sprintf( + 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=%s&mode=%s&id_task=%s', + $task['section'], + $task['short_name'], + $task['id_rt'], + ) + ); + break; - if ((int) $task['type'] === DISCOVERY_EXTENSION) { - $url_edit = sprintf( - 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=%s&mode=%s&id_task=%s', - $task['section'], - $task['short_name'], - $task['id_rt'], - ); + case DISCOVERY_DEPLOY_AGENTS: + if (empty($task['field1']) === false) { + $url_edit = 'javascript:show_deploy_targets('.$task['id_rt'].')'; + } else { + $url_edit = 'javascript:show_scan_targets('.$task['id_rt'].')'; + } + break; + + default: + $url_edit = ui_get_full_url( + sprintf( + 'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d', + $this->getTargetWiz($task, $recon_script_data), + $task['id_rt'] + ) + ); + break; } // Check if is a H&D, Cloud or Application or IPAM. - $data[9] .= ''.html_print_image( + $data[9] .= ''.html_print_image( 'images/edit.svg', true, [ From a5ddef0b77dda82e568c300cf0f8161217752652 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 18 Mar 2024 11:49:38 +0100 Subject: [PATCH 14/65] #12973 Added vc_text_margin --- pandora_console/godmode/setup/setup_visuals.php | 9 +++++++-- pandora_console/include/functions_config.php | 8 ++++++++ pandora_console/operation/visual_console/view.php | 8 ++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 586f361de0..d21f2aeb12 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1439,7 +1439,7 @@ $table_vc->data[$row][] = html_print_label_input_block( $table_vc->data[$row][] = html_print_label_input_block( __('Number of favorite visual consoles to show in the menu'), - "" + '' ); $row++; @@ -1455,6 +1455,12 @@ $table_vc->data[$row][] = html_print_label_input_block( ) ); +$table_vc->data[$row][] = html_print_label_input_block( + __('Visual console default text margin (em)'), + '' +); +$row++; + $table_vc->data[$row][] = html_print_label_input_block( __('Lock screen orientation when viewing on mobile devices'), html_print_checkbox_switch( @@ -1464,7 +1470,6 @@ $table_vc->data[$row][] = html_print_label_input_block( true ) ); -$row++; $table_vc->data[$row][] = html_print_label_input_block( __('Display item frame on alert triggered').ui_print_help_tip(__('It displays an orange box around items that have triggered an alert.'), true), diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 32ca1a613c..33dafe2c35 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1263,6 +1263,10 @@ function config_update_config() $error_update[] = __('Default line menu items for the Visual Console'); } + if (config_update_value('vc_text_margin', (int) get_parameter('vc_text_margin', 1), true) === false) { + $error_update[] = __('Default text margin for the Visual Console'); + } + if (config_update_value('vc_line_thickness', (int) get_parameter('vc_line_thickness'), true) === false) { $error_update[] = __('Default line thickness for the Visual Console'); } @@ -2913,6 +2917,10 @@ function config_process_config() config_update_value('vc_menu_items', 10); } + if (!isset($config['vc_text_margin'])) { + config_update_value('vc_text_margin', 1); + } + if (!isset($config['ser_menu_items'])) { config_update_value('ser_menu_items', 10); } diff --git a/pandora_console/operation/visual_console/view.php b/pandora_console/operation/visual_console/view.php index 7d44c7b69b..ef63456f6a 100644 --- a/pandora_console/operation/visual_console/view.php +++ b/pandora_console/operation/visual_console/view.php @@ -627,6 +627,14 @@ if ($pure === true) { + + Date: Wed, 20 Mar 2024 12:56:30 +0100 Subject: [PATCH 15/65] 12953-Change policies icons to svg --- .../godmode/agentes/module_manager.php | 17 ++++++++++----- .../godmode/alerts/alert_list.list.php | 2 +- pandora_console/godmode/alerts/alert_view.php | 7 +++++-- .../godmode/massive/massive_operations.php | 2 +- pandora_console/images/gm_policies.svg | 8 +++++++ pandora_console/images/linkpolicy.svg | 8 +++++++ pandora_console/images/policies_brick.svg | 8 +++++++ pandora_console/images/policies_cog.svg | 8 +++++++ pandora_console/images/policies_error.svg | 8 +++++++ pandora_console/images/policies_error_db.svg | 8 +++++++ pandora_console/images/policies_not_brick.svg | 8 +++++++ pandora_console/images/policies_ok.svg | 8 +++++++ pandora_console/images/policies_queue.svg | 8 +++++++ pandora_console/images/unlinkpolicy.svg | 8 +++++++ pandora_console/include/ajax/module.php | 6 +++--- pandora_console/include/functions_ui.php | 2 +- .../operation/agentes/estado_monitores.php | 4 ++-- .../agentes/pandora_networkmap.view.php | 8 +++---- .../operation/agentes/status_monitor.php | 17 ++++++++++----- pandora_console/operation/search_main.php | 2 +- pandora_console/operation/search_policies.php | 21 +++++++++++++------ pandora_console/operation/search_results.php | 7 +++++-- 22 files changed, 142 insertions(+), 33 deletions(-) create mode 100644 pandora_console/images/gm_policies.svg create mode 100644 pandora_console/images/linkpolicy.svg create mode 100644 pandora_console/images/policies_brick.svg create mode 100644 pandora_console/images/policies_cog.svg create mode 100644 pandora_console/images/policies_error.svg create mode 100644 pandora_console/images/policies_error_db.svg create mode 100644 pandora_console/images/policies_not_brick.svg create mode 100644 pandora_console/images/policies_ok.svg create mode 100644 pandora_console/images/policies_queue.svg create mode 100644 pandora_console/images/unlinkpolicy.svg diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index c69cf0de52..db14785b5f 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -909,23 +909,30 @@ if ($modules !== false) { if ((bool) $linked !== false) { if ((bool) $adopt === true) { - $img = 'images/policies_brick.png'; + $img = 'images/policies_brick.svg'; $title = '('.__('Adopted').') '.$policyInfo['name_policy']; } else { - $img = 'images/policies_mc.png'; + $img = 'images/policy@svg.svg'; $title = $policyInfo['name_policy']; } } else { if ((bool) $adopt === true) { - $img = 'images/policies_not_brick.png'; + $img = 'images/policies_not_brick.svg'; $title = '('.__('Unlinked').') ('.__('Adopted').') '.$policyInfo['name_policy']; } else { - $img = 'images/unlinkpolicy.png'; + $img = 'images/unlinkpolicy.svg'; $title = '('.__('Unlinked').') '.$policyInfo['name_policy']; } } - $data[1] = ''.html_print_image($img, true, ['title' => $title]).''; + $data[1] = ''.html_print_image( + $img, + true, + [ + 'title' => $title, + 'class' => 'main_menu_icon', + ] + ).''; } } diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index fe0790f71b..2d8b092471 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -997,7 +997,7 @@ foreach ($simple_alerts as $alert) { } else { $module_linked = policies_is_module_linked($alert['id_agent_module']); if ($module_linked === '0') { - $img = 'images/unlinkpolicy.png'; + $img = 'images/unlinkpolicy.svg'; } else { $img = 'images/policy@svg.svg'; } diff --git a/pandora_console/godmode/alerts/alert_view.php b/pandora_console/godmode/alerts/alert_view.php index 499bbded5e..13ae972233 100644 --- a/pandora_console/godmode/alerts/alert_view.php +++ b/pandora_console/godmode/alerts/alert_view.php @@ -140,13 +140,16 @@ if (enterprise_installed() && $alert['id_policy_alerts'] != 0) { if ($policyInfo === false) { $policy = __('N/A'); } else { - $img = 'images/policies_mc.png'; + $img = 'images/policy@svg.svg'; $policy = ''; $policy .= html_print_image( $img, true, - ['title' => $policyInfo['name']] + [ + 'title' => $policyInfo['name'], + 'class' => 'main_menu_icon', + ] ); $policy .= ''; } diff --git a/pandora_console/godmode/massive/massive_operations.php b/pandora_console/godmode/massive/massive_operations.php index 3480b66a92..b34df861d5 100755 --- a/pandora_console/godmode/massive/massive_operations.php +++ b/pandora_console/godmode/massive/massive_operations.php @@ -252,7 +252,7 @@ $alertstab = [ $policiesalertstab = [ 'text' => ''.html_print_image( - 'images/policies_mc.png', + 'images/policy@svg.svg', true, [ 'title' => __('Policies alerts'), diff --git a/pandora_console/images/gm_policies.svg b/pandora_console/images/gm_policies.svg new file mode 100644 index 0000000000..e8f33bae4c --- /dev/null +++ b/pandora_console/images/gm_policies.svg @@ -0,0 +1,8 @@ + + + gm_policies@svg + + + + + \ No newline at end of file diff --git a/pandora_console/images/linkpolicy.svg b/pandora_console/images/linkpolicy.svg new file mode 100644 index 0000000000..1c1c287ad5 --- /dev/null +++ b/pandora_console/images/linkpolicy.svg @@ -0,0 +1,8 @@ + + + linkpolicy@svg + + + + + \ No newline at end of file diff --git a/pandora_console/images/policies_brick.svg b/pandora_console/images/policies_brick.svg new file mode 100644 index 0000000000..6052f9a764 --- /dev/null +++ b/pandora_console/images/policies_brick.svg @@ -0,0 +1,8 @@ + + + policies_brick@svg + + + + + \ No newline at end of file diff --git a/pandora_console/images/policies_cog.svg b/pandora_console/images/policies_cog.svg new file mode 100644 index 0000000000..b855a97012 --- /dev/null +++ b/pandora_console/images/policies_cog.svg @@ -0,0 +1,8 @@ + + + policies_cog@svg + + + + + \ No newline at end of file diff --git a/pandora_console/images/policies_error.svg b/pandora_console/images/policies_error.svg new file mode 100644 index 0000000000..b2400a9185 --- /dev/null +++ b/pandora_console/images/policies_error.svg @@ -0,0 +1,8 @@ + + + policies_error@svg + + + + + \ No newline at end of file diff --git a/pandora_console/images/policies_error_db.svg b/pandora_console/images/policies_error_db.svg new file mode 100644 index 0000000000..24145d0997 --- /dev/null +++ b/pandora_console/images/policies_error_db.svg @@ -0,0 +1,8 @@ + + + policies_error_db@svg + + + + + \ No newline at end of file diff --git a/pandora_console/images/policies_not_brick.svg b/pandora_console/images/policies_not_brick.svg new file mode 100644 index 0000000000..a5d75759e8 --- /dev/null +++ b/pandora_console/images/policies_not_brick.svg @@ -0,0 +1,8 @@ + + + policies_not_brick@svg + + + + + \ No newline at end of file diff --git a/pandora_console/images/policies_ok.svg b/pandora_console/images/policies_ok.svg new file mode 100644 index 0000000000..8cd4a18417 --- /dev/null +++ b/pandora_console/images/policies_ok.svg @@ -0,0 +1,8 @@ + + + policies_ok@svg + + + + + \ No newline at end of file diff --git a/pandora_console/images/policies_queue.svg b/pandora_console/images/policies_queue.svg new file mode 100644 index 0000000000..45c16109bc --- /dev/null +++ b/pandora_console/images/policies_queue.svg @@ -0,0 +1,8 @@ + + + policies_queue@svg + + + + + \ No newline at end of file diff --git a/pandora_console/images/unlinkpolicy.svg b/pandora_console/images/unlinkpolicy.svg new file mode 100644 index 0000000000..affa12c8e7 --- /dev/null +++ b/pandora_console/images/unlinkpolicy.svg @@ -0,0 +1,8 @@ + + + unlinkpolicy@svg + + + + + \ No newline at end of file diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 0e723cafe8..44fad5a1cf 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1135,7 +1135,7 @@ if (check_login()) { if ((bool) $linked === true) { if ((bool) $adopt === true) { - $img = 'images/policies_brick.png'; + $img = 'images/policies_brick.svg'; $title = '('.__('Adopted').') '.$name_policy; } else { $img = 'images/policy@svg.svg'; @@ -1143,10 +1143,10 @@ if (check_login()) { } } else { if ((bool) $adopt === true) { - $img = 'images/policies_not_brick.png'; + $img = 'images/policies_not_brick.svg'; $title = '('.__('Unlinked').') ('.__('Adopted').') '.$name_policy; } else { - $img = 'images/unlinkpolicy.png'; + $img = 'images/unlinkpolicy.svg'; $title = '('.__('Unlinked').') '.$name_policy; } } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 2ab5c1be83..542709047d 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1337,7 +1337,7 @@ function ui_format_alert_row( } else { $module_linked = policies_is_module_linked($alert['id_agent_module']); if ($module_linked === '0') { - $img = 'images/unlinkpolicy.png'; + $img = 'images/unlinkpolicy.svg'; } else { $img = 'images/policy@svg.svg'; } diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 372a636044..cbf85b5ce8 100755 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -56,11 +56,11 @@ if (is_ajax() === true) { echo ''; if (tags_get_module_policy_tags($tag, $id_agente_modulo)) { html_print_image( - 'images/policies_mc.png', + 'images/policy@svg.svg', false, [ 'style' => 'vertical-align: middle;', - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); } diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 3cbe53e815..e417f345fc 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -1765,18 +1765,18 @@ if (is_ajax() === true) { if ($linked) { if ($adopt) { - $img = 'images/policies_brick.png'; + $img = 'images/policies_brick.svg'; $title = __('(Adopt) ').$name_policy; } else { - $img = 'images/policies_mc.png'; + $img = 'images/policy@svg.svg'; $title = $name_policy; } } else { if ($adopt) { - $img = 'images/policies_not_brick.png'; + $img = 'images/policies_not_brick.svg'; $title = __('(Unlinked) (Adopt) ').$name_policy; } else { - $img = 'images/unlinkpolicy.png'; + $img = 'images/unlinkpolicy.svg'; $title = __('(Unlinked) ').$name_policy; } } diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 61463c0f9f..b4c6a47aff 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1682,24 +1682,31 @@ if (empty($result) === false) { if ($linked) { if ($adopt) { - $img = 'images/policies_brick.png'; + $img = 'images/policies_brick.svg'; $title = __('(Adopt) ').$policyInfo['name_policy']; } else { - $img = 'images/policies_mc.png'; + $img = 'images/policy@svg.svg'; $title = $policyInfo['name_policy']; } } else { if ($adopt) { - $img = 'images/policies_not_brick.png'; + $img = 'images/policies_not_brick.svg'; $title = __('(Unlinked) (Adopt) ').$policyInfo['name_policy']; } else { - $img = 'images/unlinkpolicy.png'; + $img = 'images/unlinkpolicy.svg'; $title = __('(Unlinked) ').$policyInfo['name_policy']; } } if (is_metaconsole()) { - $data[0] = ''.html_print_image($img, true, ['title' => $title]).''; + $data[0] = ''.html_print_image( + $img, + true, + [ + 'title' => $title, + 'class' => 'main_menu_icon', + ] + ).''; } else { $data[0] = ''.html_print_image($img, true, ['title' => $title]).''; } diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index ac841fa703..c565007e2f 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -142,7 +142,7 @@ $table->data[0][11] = " __('Visual consoles')]); $table->data[0][13] = "".sprintf(__('%s Found'), $totalMaps).''; if (enterprise_installed()) { - $table->data[0][14] = html_print_image('images/policies_mc.png', true, ['title' => __('Policies')]); + $table->data[0][14] = html_print_image('images/policy@svg.svg', true, ['title' => __('Policies'), 'class' => 'main_menu_icon']); $table->data[0][15] = "".sprintf(__('%s Found'), $totalPolicies).''; } diff --git a/pandora_console/operation/search_policies.php b/pandora_console/operation/search_policies.php index 3e3a2313b2..10c403e358 100644 --- a/pandora_console/operation/search_policies.php +++ b/pandora_console/operation/search_policies.php @@ -45,25 +45,34 @@ if (!$policies || !$searchpolicies) { switch ($policie['status']) { case POLICY_UPDATED: $status = html_print_image( - 'images/policies_ok.png', + 'images/policies_ok.svg', true, - ['title' => __('Policy updated')] + [ + 'title' => __('Policy updated'), + 'class' => 'main_menu_icon', + ] ); break; case POLICY_PENDING_DATABASE: $status = html_print_image( - 'images/policies_error_db.png', + 'images/policies_error_db.svg', true, - ['title' => __('Pending update policy only database')] + [ + 'title' => __('Pending update policy only database'), + 'class' => 'main_menu_icon', + ] ); break; case POLICY_PENDING_ALL: $status = html_print_image( - 'images/policies_error.png', + 'images/policies_error.svg', true, - ['title' => __('Pending update policy')] + [ + 'title' => __('Pending update policy'), + 'class' => 'main_menu_icon', + ] ); break; } diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index d2f6f751b7..38ae15be1c 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -168,9 +168,12 @@ if ($searchModules) { if ($searchPolicies) { $policies_tab = [ 'text' => "".html_print_image( - 'images/policies_mc.png', + 'images/policy@svg.svg', true, - ['title' => __('Policies')] + [ + 'title' => __('Policies'), + 'class' => 'main_menu_icon', + ] ).'', 'active' => $searchTab == 'policies', ]; From 720e8ce49c5e61516a2fafed9bf218c28044fdd9 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Wed, 20 Mar 2024 15:56:54 +0100 Subject: [PATCH 16/65] 13100-Fix size image preview VC --- .../visual_console_builder.wizard.php | 20 +++++++++++++++++++ pandora_console/include/styles/pandora.css | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/pandora_console/godmode/reporting/visual_console_builder.wizard.php b/pandora_console/godmode/reporting/visual_console_builder.wizard.php index 6a54b2c049..9e2978f97a 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -625,6 +625,8 @@ echo ''; echo ''; echo ''; echo ''; + +echo '
'; ?>