From 0df437992620576bb80c57f29d13c08ef0904f43 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 30 Jan 2024 17:47:43 +0100 Subject: [PATCH 01/15] fixed database ncm info --- pandora_console/extras/mr/68.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/extras/mr/68.sql b/pandora_console/extras/mr/68.sql index 254cb2e7c1..b7aff681a9 100644 --- a/pandora_console/extras/mr/68.sql +++ b/pandora_console/extras/mr/68.sql @@ -10,5 +10,7 @@ ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_dat ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT NULL AFTER `url`; +UPDATE `tncm_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]'); +UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]'); COMMIT; \ No newline at end of file From 60d2733066b04a2fc0ca5e65ef2b7f38bfb4bd9f Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 30 Jan 2024 18:22:20 +0100 Subject: [PATCH 02/15] #12794 fixed login when user use external login --- pandora_console/godmode/users/configure_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 2344116cb1..668216d330 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -770,7 +770,7 @@ if ($update_user) { $id_user = (string) get_parameter('id_user', ''); if ($password_new != '') { - if ($config['auth'] !== 'mysql') { + if ($config['auth'] !== 'mysql' && $values['local_user'] === false) { ui_print_error_message(__('It is not possible to change the password because external authentication is being used')); } else { $correct_password = false; From 656eed0536d9758a862ef5e3ac0658dfac3ad587 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 31 Jan 2024 11:17:36 +0100 Subject: [PATCH 03/15] remove chkconfig from redhat9 agent --- pandora_agents/unix/pandora_agent.redhat_bin.el9.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index b21d106a96..49f7def432 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -13,17 +13,17 @@ Name: %{name} Version: %{version} Release: %{release} License: GPL -Vendor: ArticaST +Vendor: PandoraFMS Source0: %{source_name}-%{version}.tar.gz -URL: http://pandorafms.org +URL: https://pandorafms.com Group: System/Monitoring -Packager: Sancho Lerena +Packager: PandoraFMS Prefix: /usr/share BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot BuildArch: x86_64 Requires(pre): shadow-utils -Requires(post): chkconfig /bin/ln -Requires(preun): chkconfig /bin/rm /usr/sbin/userdel +Requires(post): /bin/ln +Requires(preun): /bin/rm /usr/sbin/userdel Requires: coreutils unzip Requires: util-linux procps grep Requires: /sbin/ip /bin/awk From 53fbd10ef89a03b08a975aa59948e8dcedb31449 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 31 Jan 2024 13:33:53 +0100 Subject: [PATCH 04/15] test for systemd configuration --- .../unix/pandora_agent.redhat_bin.el9.spec | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index 49f7def432..d72e66739f 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -29,7 +29,6 @@ Requires: util-linux procps grep Requires: /sbin/ip /bin/awk Requires: perl-interpreter Requires: perl-IO-Compress -Requires: libnsl Requires: libxcrypt-compat AutoReq: 0 Provides: %{name}-%{version} @@ -50,7 +49,7 @@ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/ mkdir -p $RPM_BUILD_ROOT/usr/bin/ mkdir -p $RPM_BUILD_ROOT/usr/sbin/ mkdir -p $RPM_BUILD_ROOT/etc/pandora/ -mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/ +#mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/ mkdir -p $RPM_BUILD_ROOT/var/log/pandora/ mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ @@ -58,7 +57,7 @@ cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/ cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/ cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/ cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/ -cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon +#cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/ cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/ @@ -119,21 +118,11 @@ then cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/ chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service # Enable the services on SystemD + systemctl daemon reload systemctl enable pandora_agent_daemon.service -else - /sbin/chkconfig --add pandora_agent_daemon - /sbin/chkconfig pandora_agent_daemon on -fi - -if [ "$1" -gt 1 ] -then - - echo "If Pandora Agent daemon was running with init.d script," - echo "please stop it manually and start the service with systemctl" fi - %preun # Upgrading @@ -141,8 +130,7 @@ if [ "$1" = "1" ]; then exit 0 fi -/sbin/chkconfig --del pandora_agent_daemon -/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || : +systemctl stop pandora_agent_daemon.service > /dev/null 2>&1 || : # Remove symbolic links pushd /etc/pandora @@ -162,7 +150,6 @@ exit 0 %defattr(755,root,root) /usr/bin/pandora_agent_exec /usr/bin/tentacle_client -/etc/rc.d/init.d/pandora_agent_daemon %defattr(644,root,root) /usr/share/man/man1/pandora_agent.1.gz From 8bf37940724ed9418f27292ae6d3b1dc2050a260 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 31 Jan 2024 15:02:20 +0100 Subject: [PATCH 05/15] #12824 fixed create agent view --- .../godmode/agentes/agent_manager.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 80a480dd12..283610e06a 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -507,14 +507,16 @@ if (enterprise_installed()) { // Read configuration file. $files = config_agents_get_agent_config_filenames($id_agente); $file_name = $files['conf']; - $agent_config = file_get_contents($file_name); - $encoding = 'UTF-8'; - $agent_config_utf8 = mb_convert_encoding($agent_config, 'UTF-8', $encoding); - if ($agent_config_utf8 !== false) { - $agent_config = $agent_config_utf8; - } + if (empty($file_name) === false) { + $agent_config = file_get_contents($file_name); + $encoding = 'UTF-8'; + $agent_config_utf8 = mb_convert_encoding($agent_config, 'UTF-8', $encoding); + if ($agent_config_utf8 !== false) { + $agent_config = $agent_config_utf8; + } - $broker = str_contains($agent_config, '#broker active'); + $broker = str_contains($agent_config, '#broker active'); + } } if ($broker === false) { From 5feb11c547e2eb54a939c9c6a028a2542dd2fefd Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 31 Jan 2024 16:34:25 +0100 Subject: [PATCH 06/15] 9992 added email test dialog in metaconsole --- .../godmode/setup/setup_general.php | 112 ------------------ pandora_console/include/functions_html.php | 49 ++++++++ pandora_console/include/javascript/pandora.js | 57 +++++++++ 3 files changed, 106 insertions(+), 112 deletions(-) diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 46a91e27c6..3366fcc6f8 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -960,60 +960,6 @@ echo ''.__('Mail configuration').''; ); echo ''; - - - /** - * Print the modal window for the summary of each alerts group - * - * @param string $id Id. - * - * @return void - */ - function print_email_test_modal_window($id) - { - // Email config table. - $table_mail_test = new stdClass(); - $table_mail_test->width = '100%'; - $table_mail_test->class = 'filter-table-adv'; - $table_mail_test->data = []; - - $table_mail_test->data[0][] = html_print_label_input_block( - __('Address'), - html_print_input_text( - 'email_test_address', - '', - '', - 35, - 100, - true - ) - ); - - $table_mail_test->data[1][] = '  Email could not be sent'; - - // $table_mail_test->colspan[2][0] = 2; - $submitButton = html_print_div( - [ - 'class' => 'action-buttons-right-forced', - 'content' => html_print_button( - __('Send'), - 'email_test', - false, - '', - [ - 'icon' => 'cog', - 'mode' => 'mini', - ], - true - ), - ], - true - ); - - echo ''; - } - - ?>