diff --git a/pandora_agents/pc/pandora_agent_installer b/pandora_agents/pc/pandora_agent_installer index 7d8de1134d..bcfee3eb00 100644 --- a/pandora_agents/pc/pandora_agent_installer +++ b/pandora_agents/pc/pandora_agent_installer @@ -467,7 +467,7 @@ fi # Script banner at start echo " " -echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST" +echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2024 PandoraFMS" echo "This program is licensed under GPL2 Terms. http://pandorafms.com" echo " " diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 53c77569a8..574029ce9f 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.775-240214 +Version: 7.0NG.775-240220 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 7bf7bc4137..2b0d9e0fb4 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.775-240214" +pandora_version="7.0NG.775-240220" 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 b34f9d03dd..5a963ef6e5 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.775'; -use constant AGENT_BUILD => '240214'; +use constant AGENT_BUILD => '240220'; # 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 ec2bd3452a..53d0db8510 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.775 -%define release 240214 +%define release 240220 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index 65e0909714..3e053d1139 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240214 +%define release 240220 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index a275445faa..2d3be11084 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240214 +%define release 240220 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index b8b9328937..78495c142d 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.775 -%define release 240214 +%define release 240220 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 7c6f827532..ae7336afaa 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.775 -%define release 240214 +%define release 240220 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 f7df2b0f00..4231f83ca3 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.775" -PI_BUILD="240214" +PI_BUILD="240220" OS_NAME=`uname -s` FORCE=0 @@ -579,7 +579,7 @@ fi # Script banner at start echo " " -echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST" +echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2024 PandoraFMS" echo "This program is licensed under GPL2 Terms. http://pandorafms.com" echo " " diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 635fa7571a..dfdeecea3d 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{240214} +{240220} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index c61bdb22ec..0f7f128e46 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.775 Build 240214") +#define PANDORA_VERSION ("7.0NG.775 Build 240220") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index fc0510add9..ff6ed8fa7e 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.775(Build 240214))" + VALUE "ProductVersion", "(7.0NG.775(Build 240220))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index bffc7430e0..cab607fc18 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.775-240214 +Version: 7.0NG.775-240220 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 df5cfce604..610e452556 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.775-240214" +pandora_version="7.0NG.775-240220" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/quick_shell.php b/pandora_console/extensions/quick_shell.php index 9ea79ba364..a3f5872f84 100644 --- a/pandora_console/extensions/quick_shell.php +++ b/pandora_console/extensions/quick_shell.php @@ -394,7 +394,7 @@ function quickShellSettings() __('Address'), html_print_input_text( 'gotty_addr', - $config['gotty_addr'], + ($config['gotty_addr'] ?? ''), '', 30, 100, @@ -443,9 +443,8 @@ function quickShellSettings() html_print_checkbox_switch( 'gotty_ssh_use_ssl', 1, - $config['gotty_ssh_use_ssl'], - true, - $disable_agentaccess + ($config['gotty_ssh_use_ssl'] ?? false), + true ) ); @@ -497,7 +496,7 @@ function quickShellSettings() html_print_checkbox_switch( 'gotty_telnet_use_ssl', 1, - $config['gotty_telnet_use_ssl'], + ($config['gotty_telnet_use_ssl'] ?? false), true ) ); diff --git a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini index d05611a6b5..ea136c996c 100644 --- a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini +++ b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini @@ -1,5 +1,5 @@ pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b -pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe +pandorafms.mysql=ca7dd8b80a1a03a25eb0fb077818ad63 pandorafms.mssql=1cc215409741d19080269ffba112810e pandorafms.oracle=abdfd7280f76276f696115cabdac731e pandorafms.db2=122f2abff0ec1d668c35ee0911483021 diff --git a/pandora_console/extras/mr/68.sql b/pandora_console/extras/mr/68.sql index aa815a869a..6315c64ae7 100644 --- a/pandora_console/extras/mr/68.sql +++ b/pandora_console/extras/mr/68.sql @@ -58,9 +58,43 @@ UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FRO -- Update version for plugin oracle UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle'; +-- Update version for plugin mysql +UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.mysql'; + SET @widget_id = NULL; SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = 'GisMap'; INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,'GisMap','GisMap','Gis map','','GisMap.php'); +SET @class_name = 'ITSMIncidences'; +SET @unique_name = 'ITSMIncidences'; +SET @description = 'Pandora ITSM tickets'; +SET @page = 'ITSMIncidences.php'; +SET @widget_id = NULL; +SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name; +INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page); + +-- Create SNMPv3 credentials for recon tasks and update them +SET @creds_name = 'Recon-SNMP-creds-'; +INSERT IGNORE INTO `tcredential_store` (`identifier`, `id_group`, `product`, `extra_1`) + SELECT + CONCAT(@creds_name,`id_rt`) AS `identifier`, + `id_group`, + 'SNMP' AS `product`, + CONCAT( + '{', + '"community":"',`snmp_community`,'",', + '"version":"',`snmp_version`,'",', + '"securityLevelV3":"',`snmp_security_level`,'",', + '"authUserV3":"',`snmp_auth_user`,'",', + '"authMethodV3":"',`snmp_auth_method`,'",', + '"authPassV3":"',`snmp_auth_pass`,'",', + '"privacyMethodV3":"',`snmp_privacy_method`,'",', + '"privacyPassV3":"',`snmp_privacy_pass`,'"', + '}' + ) AS `extra1` + FROM `trecon_task` WHERE `snmp_version` = 3 AND `snmp_enabled` = 1 +; +UPDATE `trecon_task` SET `auth_strings` = IF(`auth_strings` = '',CONCAT(@creds_name,`id_rt`),CONCAT(@creds_name,`id_rt`,',',`auth_strings`)) WHERE `snmp_version` = 3 AND `snmp_enabled` = 1; + COMMIT; \ No newline at end of file diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 35b994fead..e2573bd859 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -54,7 +54,7 @@ echo sprintf('
', $menuTypeClass); // ======= Servers List =============================================== if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { $servers = []; - $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); + $servers['all'] = (int) count((servers_get_info() ?? [])); if ($servers['all'] != 0) { $servers['up'] = (int) servers_check_status(); $servers['down'] = ($servers['all'] - $servers['up']); diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index e6b1d5ca9e..18722508e9 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -357,7 +357,18 @@ if ($new_agent === false) { $tableAgent->data['caption_name'][0] = __('Agent name'); $tableAgent->rowclass['name'] = 'w540px'; $tableAgent->cellstyle['name'][0] = 'width: 100%;'; - $tableAgent->data['name'][0] = html_print_input_text('agente', $nombre_agente, '', 76, 100, true, false, false, '', 'w100p'); + $tableAgent->data['name'][0] = html_print_input_text( + 'agente', + $nombre_agente, + '', + 76, + 100, + true, + true, + false, + '', + 'w100p' + ); $tableAgent->data['name'][0] .= html_print_div( [ 'class' => 'moduleIdBox', @@ -365,6 +376,29 @@ if ($new_agent === false) { ], true ); + + // Other than Linux, Solaris, AIX, BSD, HPUX, MacOs, and Windows. + if ($id_os !== LINUX && $id_os !== SOLARIS && $id_os !== AIX + && $id_os !== BSD && $id_os !== HPUX && $id_os !== MACOS + && $id_os !== WINDOWS + ) { + $tableAgent->data['name'][0] .= html_print_anchor( + [ + 'content' => html_print_image( + 'images/edit.svg', + true, + [ + 'border' => 0, + 'title' => __('Edit agent name'), + 'class' => 'main_menu_icon invert_filter after_input_icon forced_title clickable', + 'onclick' => 'editAgent()', + ] + ), + ], + true + ); + } + // Agent options for QR code. $agent_options_update = 'agent_options_update'; } @@ -1491,7 +1525,6 @@ ui_require_jquery_file('bgiframe'); 128 ); } - $("#text-agente").prop('readonly', true); $("#text-direccion").on('change',function(e){ @@ -1538,6 +1571,39 @@ ui_require_jquery_file('bgiframe'); } } + function editAgent() { + $(`#text-agente`).attr(`readonly`, false); + const title = ''; + const text = ''; + const id = uniqId(); + $("body").append('
'); + $("#" + id).empty(); + $("#" + id).append(text); + $("#" + id).dialog({ + height: 150, + width: 528, + opacity: 1, + modal: true, + position: { + my: "center", + at: "center", + of: window, + collision: "fit" + }, + title: title, + closeOnEscape: true, + buttons: [{ + text: "OK", + click: function() { + $(this).dialog("close"); + } + }], + open: function(event, ui) { + $(".ui-dialog-titlebar-close").hide(); + }, + }).show(); + } + function check_unique_ip() { const direccion = $('#text-direccion').val(); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index a10833081c..c6b5f2b691 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -949,6 +949,13 @@ if ($update_agent) { $mssg_warning = 0; $id_agente = (int) get_parameter_post('id_agente'); $nombre_agente = str_replace('`', '‘', (string) get_parameter_post('agente', '')); + $repeated_name = db_get_row_sql( + sprintf( + 'SELECT nombre FROM tagente WHERE id_agente <> %s AND nombre like "%s"', + $id_agente, + $nombre_agente + ) + ); $alias_safe_output = strip_tags(io_safe_output(get_parameter('alias', ''))); $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output))); $alias_as_name = (int) get_parameter_post('alias_as_name', 0); @@ -1077,14 +1084,17 @@ if ($update_agent) { } } + // Verify if there is another agent with the same name but different ID. + if (empty($repeated_name) === false) { + ui_print_error_message(__('Agent with repeated name')); + } + if ($mssg_warning) { ui_print_warning_message(__('The ip or dns name entered cannot be resolved')); } - // Verify if there is another agent with the same name but different ID. if ($alias == '') { ui_print_error_message(__('No agent alias specified')); - // If there is an agent with the same name, but a different ID. } $old_group = agents_get_agent_group($id_agente); @@ -1139,13 +1149,16 @@ if ($update_agent) { 'ignore_unknown' => $ignore_unknown, ]; + if (empty($repeated_name) === true) { + $values['nombre'] = $nombre_agente; + } + if ($config['metaconsole_agent_cache'] == 1) { $values['update_module_count'] = 1; // Force an update of the agent cache. } - $result = db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]); - + $result = (bool) db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]); if ($result === false && $update_custom_result == false) { ui_print_error_message( __('There was a problem updating the agent') diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index a7ee6bf4c0..b0f071c1b4 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -697,7 +697,7 @@ if ($agents !== false) { $tableAgents->head = []; $tableAgents->data = []; // Header. - $tableAgents->head[0] = ''.__('Agent name').''; + $tableAgents->head[0] = ''.__('Agent alias').''; $tableAgents->head[0] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown); $tableAgents->head[1] = ''.__('R').''; $tableAgents->head[1] .= ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown); diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 74d9f07527..b30f1d6c43 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -5941,6 +5941,7 @@ ui_require_javascript_file('pandora'); ?>