diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index 00c31d911b..7f70addfec 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -151,7 +151,7 @@ execute_cmd "yum install -y $extra_repos" "Installing extra repositories" execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP" # Install percona Database -[ -f /etc/resolv.conf ] && rm -rf /etc/my.cnf +[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server" # Console dependencies @@ -429,6 +429,7 @@ sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini +sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini cat > /var/www/html/index.html << EOF_INDEX diff --git a/extras/docker/centos8/pandora-stack/sources/init_pandora.sh b/extras/docker/centos8/pandora-stack/sources/init_pandora.sh index 7c000ebebd..76a0954bb8 100755 --- a/extras/docker/centos8/pandora-stack/sources/init_pandora.sh +++ b/extras/docker/centos8/pandora-stack/sources/init_pandora.sh @@ -149,6 +149,7 @@ EOF_INDEX sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini + sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini echo "- Setting Public URL: $PUBLICURL" q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 1ac8bf612d..aca7789abe 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.756-210730 +Version: 7.0NG.756-210811 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 808f2cb660..c39e8dbc58 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.756-210730" +pandora_version="7.0NG.756-210811" 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 464c6505e2..0ba3c6da31 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.756'; -use constant AGENT_BUILD => '210730'; +use constant AGENT_BUILD => '210811'; # 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 5cf021fa92..2b84c2c34e 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.756 -%define release 210730 +%define release 210811 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 7220bf2ad0..6368caccdc 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.756 -%define release 210730 +%define release 210811 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 035bdce8ac..bc494a258c 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.756" -PI_BUILD="210730" +PI_BUILD="210811" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 175c29685a..44ca677b1a 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210730} +{210811} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 643e0db880..de85debc1f 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.756 Build 210730") +#define PANDORA_VERSION ("7.0NG.756 Build 210811") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 31e4bf7f79..37ea4cfd9f 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.756(Build 210730))" + VALUE "ProductVersion", "(7.0NG.756(Build 210811))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index c55a3cee41..09ce384a2a 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.756-210730 +Version: 7.0NG.756-210811 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 9699a7edca..a51c27ae14 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.756-210730" +pandora_version="7.0NG.756-210811" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 884285dd28..32be153e69 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -33,10 +33,19 @@ function users_extension_main_god($god=true) $image = 'images/user.png'; } - // Header + // Header. ui_print_page_header(__('Users connected'), $image, false, '', $god); - // Get groups user has permission + $check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up'); + if ($check_profile === false && !users_is_admin()) { + return ui_print_error_message( + __('This user does not have any associated profile'), + '', + false + ); + } + + // Get groups user has permission. $group_um = users_get_groups_UM($config['id_user']); // Is admin or has group permissions all. $groups = implode(',', array_keys($group_um, 1)); @@ -44,51 +53,85 @@ function users_extension_main_god($god=true) // Get user conected last 5 minutes.Show only those on which the user has permission. switch ($config['dbtype']) { case 'mysql': - $sql = sprintf( - 'SELECT tusuario.id_user, tusuario.last_connect - FROM tusuario - INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user - AND tusuario_perfil.id_grupo IN (%s) - WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.') - GROUP BY tusuario.id_user - ORDER BY last_connect DESC', - $groups - ); + if (users_is_admin()) { + $sql = sprintf( + 'SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC' + ); + } else { + $sql = sprintf( + 'SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user + AND tusuario_perfil.id_grupo IN (%s) + WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC', + $groups + ); + } break; case 'postgresql': - $sql = sprintf( - "SELECT tusuario.id_user, tusuario.last_connect - FROM tusuario - INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user - AND tusuario_perfil.id_grupo IN (%s) - WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.') - GROUP BY tusuario.id_user - ORDER BY last_connect DESC', - $groups - ); + if (users_is_admin()) { + $sql = sprintf( + "SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC' + ); + } else { + $sql = sprintf( + "SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user + AND tusuario_perfil.id_grupo IN (%s) + WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC', + $groups + ); + } break; case 'oracle': - $sql = sprintf( - "SELECT tusuario.id_user, tusuario.last_connect - FROM tusuario - INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user - AND tusuario_perfil.id_grupo IN (%s) - WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.') - GROUP BY tusuario.id_user - ORDER BY last_connect DESC', - $groups - ); + if (users_is_admin()) { + $sql = sprintf( + "SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC' + ); + } else { + $sql = sprintf( + "SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user + AND tusuario_perfil.id_grupo IN (%s) + WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC', + $groups + ); + } + break; + + default: + // Nothing to do. break; } $rows = db_get_all_rows_sql($sql); - if (empty($rows)) { $rows = []; echo "
".__('No other users connected').'
'; } else { + $table = new StdClass(); $table->cellpadding = 0; $table->cellspacing = 0; $table->width = '100%'; @@ -105,7 +148,7 @@ function users_extension_main_god($god=true) $rowPair = true; $iterator = 0; - // Get data + // Get data. foreach ($rows as $row) { // Get data of user's last login. switch ($config['dbtype']) { @@ -135,6 +178,10 @@ function users_extension_main_god($god=true) ) ); break; + + default: + // Nothing to do. + break; } if ($rowPair) { diff --git a/pandora_console/extras/mr/49.sql b/pandora_console/extras/mr/49.sql new file mode 100644 index 0000000000..68de9070ed --- /dev/null +++ b/pandora_console/extras/mr/49.sql @@ -0,0 +1,6 @@ +START TRANSACTION; + +UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'custom_report_front_font'; +UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'fontpath'; + +COMMIT; diff --git a/pandora_console/extras/mr/procedures/updateSnmpAlerts.sql b/pandora_console/extras/mr/procedures/updateSnmpAlerts.sql deleted file mode 100644 index 5fed73fdf9..0000000000 --- a/pandora_console/extras/mr/procedures/updateSnmpAlerts.sql +++ /dev/null @@ -1,35 +0,0 @@ -CREATE PROCEDURE updateSnmpAlerts() -BEGIN - DECLARE tokenId INT DEFAULT 0; - DECLARE procedureRun INT DEFAULT 0; - DECLARE done BOOLEAN DEFAULT FALSE; - DECLARE a, b INT DEFAULT 0; - DECLARE alertsCur CURSOR FOR SELECT id, id_alert_command FROM talert_actions; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SELECT id_config, value INTO tokenId, procedureRun FROM tconfig WHERE token = 'update_snmp_alerts_procedure_already_run' LIMIT 1; - - IF procedureRun < 1 THEN - SET done = FALSE; - - OPEN alertsCur; - - read_loop: LOOP - FETCH alertsCur INTO a, b; - IF done THEN - LEAVE read_loop; - END IF; - - UPDATE talert_snmp SET id_alert = b WHERE id_alert = a; - UPDATE talert_snmp_action SET alert_type = b WHERE alert_type = a; - END LOOP; - - CLOSE alertsCur; - - IF tokenId < 1 THEN - INSERT INTO tconfig (id_config, token, value) VALUES ('', 'update_snmp_alerts_procedure_already_run', '1'); - ELSE - UPDATE tconfig SET value = 1 WHERE token = 'update_snmp_alerts_procedure_already_run'; - END IF; - END IF; -END \ No newline at end of file diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index c615e74f61..88bd581f2c 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -63,6 +63,7 @@ switch ($login_screen) { case 'error_perms': case 'homedir_bad_defined': case 'homeurl_bad_defined': + case 'disabled_access_node': $logo_link = 'index.php'; $logo_title = __('Go to Login'); break; @@ -208,6 +209,7 @@ if (is_metaconsole() === true) { switch ($login_screen) { case 'logout': case 'login': + case 'disabled_access_node': if (!empty($page) && !empty($sec)) { foreach ($_POST as $key => $value) { html_print_input_hidden(io_safe_input($key), io_safe_input($value)); @@ -508,9 +510,29 @@ if ($login_screen == 'logout') { echo ''; } +if ($login_screen === 'disabled_access_node') { + echo '
'; + echo '
'; + echo '
'; + echo html_print_image('images/icono_logo_pandora.png', true, ['alt' => __('Centralized user in metaconsole'), 'border' => 0]); + echo '
'; + echo '
'; + echo '
'; + echo '

'.__('Centralized user in metaconsole').'

'; + echo '

'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'

'; + echo '
'; + echo '
'; + html_print_submit_button('Ok', 'hide-login-logout', false); + echo '
'; + echo '
'; + echo '
'; + echo '
'; +} + switch ($login_screen) { case 'error_dbconfig': case 'error_authconfig': + case 'disabled_node_access': if (!isset($config['rb_product_name_alt'])) { $title = __('Problem with %s database', get_product_name()); } else { @@ -694,6 +716,29 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' }); break; + case 'disabled_access_node': + $(document).ready (function () { + $(function() { + $("#disabled_access_node").dialog({ + resizable: true, + draggable: true, + modal: true, + height: 220, + width: 528, + clickOutside: true, + overlay: { + opacity: 0.5, + background: "black" + } + }); + }); + + $("#submit-hide-login-logout").click (function () { + document.location = ""; + }); + }); + break; + default: $(document).ready (function () { // IE9- modal warning window diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 6cbaf79304..fe39fca203 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -349,7 +349,14 @@ if (isset($groups[$grupo]) || $new_agent) { } $table_primary_group .= '
'; -$table_primary_group .= ui_print_group_icon($grupo, true); +if ($id_agente === 0) { + $hidden = 'display: none;'; +} else { + $hidden = ''; +} + +$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden); + $table_primary_group .= '
'; $table_interval = '

'.__('Interval').'

'; @@ -500,7 +507,10 @@ if (enterprise_installed()) { false, // Delete_groups. // Do not show the primary group in this selection. - array_merge(($secondary_groups_selected['plain'] ?? []), [$agent['id_grupo']]) + array_merge( + (empty($secondary_groups_selected['plain']) === false) ? $secondary_groups_selected['plain'] : [], + [$agent['id_grupo']] + ) // Include_groups. // Size. // Simple_multiple_options. @@ -1243,6 +1253,9 @@ ui_require_jquery_file('bgiframe'); }); $("select#id_os").pandoraSelectOS (); + $('select#grupo').pandoraSelectGroupIcon (); + + var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) { diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index abdb5a8dca..2cb686fc3c 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -2368,7 +2368,7 @@ switch ($tab) { var aget_id_os = ''; - if('' != $('#text-name').val() && + if('' != $('#text-name').val() && '' == 19){ event.preventDefault(); @@ -2402,7 +2402,7 @@ switch ($tab) { var module_type_snmp = ''; - if('' != $('#text-name').val() && ( + if('' != $('#text-name').val() && ( module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){ event.preventDefault(); diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 84f9c77ed7..36efc20290 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -215,7 +215,7 @@ $table_simple->colspan[3][1] = 3; $table_simple->data[0][0] = __('Name'); $table_simple->data[0][1] = html_print_input_text_extended( 'name', - io_safe_input(html_entity_decode($name, ENT_QUOTES, 'UTF-8')), + $name, 'text-name', '', 45, diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 399bb55cfd..7025433316 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -708,7 +708,7 @@ foreach ($simple_alerts as $alert) { $data[3] .= '