diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index 292f0f801e..5e580ef1a3 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -270,10 +270,10 @@ vmware_dependencies=" \ execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies" # Instant client Oracle -oracle_dependencier=" \ +oracle_dependencies=" \ https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \ https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm" -execute_cmd "yum install -y $vmware_dependencies" "Installing Oracle Instant client" +execute_cmd "yum install -y $oracle_dependencies" "Installing Oracle Instant client" # Disabling SELINUX and firewalld setenforce 0 diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 42200192b9..2630849da9 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.754-210506 +Version: 7.0NG.754-210507 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 472c9a3333..781e81f4e3 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.754-210506" +pandora_version="7.0NG.754-210507" 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 1e66f30de8..518185c093 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.754'; -use constant AGENT_BUILD => '210506'; +use constant AGENT_BUILD => '210507'; # 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 b227006b34..40586c0508 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.754 -%define release 210506 +%define release 210507 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 8c824b369e..9b1013caeb 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.754 -%define release 210506 +%define release 210507 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 f0976bb83e..344dc88a15 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.754" -PI_BUILD="210506" +PI_BUILD="210507" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index cbd3ff9976..c69a9adf9a 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210506} +{210507} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index d8abbf4558..33c03caa6e 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.754(Build 210506)") +#define PANDORA_VERSION ("7.0NG.754(Build 210507)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index b74dd8a3f7..26de75bdde 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.754(Build 210506))" + VALUE "ProductVersion", "(7.0NG.754(Build 210507))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 31ef8ccfc5..4fa3fc5456 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.754-210506 +Version: 7.0NG.754-210507 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 47e688372b..740bad70d5 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.754-210506" +pandora_version="7.0NG.754-210507" package_pear=0 package_pandora=1 diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index bc8d247994..923a6c20aa 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -1006,7 +1006,7 @@ echo '
'; @@ -1147,7 +1147,7 @@ if ($step == 2) { '', true, '', - $is_central_policies_on_node | $disabled + ($is_central_policies_on_node | $disabled) ); $table->data[2][0] = __('Priority'); @@ -1162,7 +1162,7 @@ if ($step == 2) { false, false, '', - $is_central_policies_on_node | $disabled + ($is_central_policies_on_node | $disabled) ); if (defined('METACONSOLE')) { diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 046c8a9366..f806096ea9 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -585,133 +585,21 @@ if ($update_alert || $duplicate_alert) { // Duplicate alert snmp if ($duplicate_alert) { - $sql = sprintf( - 'insert into talert_snmp ( - id_alert, al_field1, al_field2, al_field3, - al_field4, al_field5, al_field6, al_field7, - al_field8, al_field9, al_field10, al_field11, - al_field12, al_field13, al_field14, al_field15, - al_field16, al_field17, al_field18, al_field19, - al_field20, description, alert_type, agent, custom_oid, - oid, time_threshold, times_fired, last_fired, - max_alerts, min_alerts, internal_counter, priority, - '.db_escape_key_identifier('_snmp_f1_').', - '.db_escape_key_identifier('_snmp_f2_').', - '.db_escape_key_identifier('_snmp_f3_').', - '.db_escape_key_identifier('_snmp_f4_').', - '.db_escape_key_identifier('_snmp_f5_').', - '.db_escape_key_identifier('_snmp_f6_').', - '.db_escape_key_identifier('_snmp_f7_').', - '.db_escape_key_identifier('_snmp_f8_').', - '.db_escape_key_identifier('_snmp_f9_').', - '.db_escape_key_identifier('_snmp_f10_').', - '.db_escape_key_identifier('_snmp_f11_').', - '.db_escape_key_identifier('_snmp_f12_').', - '.db_escape_key_identifier('_snmp_f13_').', - '.db_escape_key_identifier('_snmp_f14_').', - '.db_escape_key_identifier('_snmp_f15_').', - '.db_escape_key_identifier('_snmp_f16_').', - '.db_escape_key_identifier('_snmp_f17_').', - '.db_escape_key_identifier('_snmp_f18_').', - '.db_escape_key_identifier('_snmp_f19_').', - '.db_escape_key_identifier('_snmp_f20_').", - trap_type, single_value, position, disable_event, id_group, - order_1, order_2, order_3, order_4, order_5, order_6, order_7, order_8, - order_9, order_10, order_11, order_12, order_13, order_14, order_15, - order_16, order_17, order_18, order_19, order_20) - VALUES - (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', - '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s', - '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', - '%s', '%s', '%s', '%s', %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, - %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", - $id_alert, - $al_field1, - $al_field2, - $al_field3, - $al_field4, - $al_field5, - $al_field6, - $al_field7, - $al_field8, - $al_field9, - $al_field10, - $al_field11, - $al_field12, - $al_field13, - $al_field14, - $al_field15, - $al_field16, - $al_field17, - $al_field18, - $al_field19, - $al_field20, - $description, - $alert_type, - $source_ip, - $custom_value, - $oid, - $time_threshold, - $times_fired, - $last_fired, - $max_alerts, - $min_alerts, - $internal_counter, - $priority, - $custom_oid_data_1, - $custom_oid_data_2, - $custom_oid_data_3, - $custom_oid_data_4, - $custom_oid_data_5, - $custom_oid_data_6, - $custom_oid_data_7, - $custom_oid_data_8, - $custom_oid_data_9, - $custom_oid_data_10, - $custom_oid_data_11, - $custom_oid_data_12, - $custom_oid_data_13, - $custom_oid_data_14, - $custom_oid_data_15, - $custom_oid_data_16, - $custom_oid_data_17, - $custom_oid_data_18, - $custom_oid_data_19, - $custom_oid_data_20, - $trap_type, - $single_value, - $position, - $disable_event, - $group, - $order_1, - $order_2, - $order_3, - $order_4, - $order_5, - $order_6, - $order_7, - $order_8, - $order_9, - $order_10, - $order_11, - $order_12, - $order_13, - $order_14, - $order_15, - $order_16, - $order_17, - $order_18, - $order_19, - $order_20 - ); - $result = db_process_sql($sql); + $values_duplicate = $alert; + if (!empty($values_duplicate)) { + unset($values_duplicate['id_as']); + $result = db_process_sql_insert('talert_snmp', $values_duplicate); - if (!$result) { + if (!$result) { + db_pandora_audit('SNMP management', "Fail try to duplicate snmp alert #$id_as"); + ui_print_error_message(__('There was a problem duplicating the alert')); + } else { + db_pandora_audit('SNMP management', "Duplicate snmp alert #$id_as"); + ui_print_success_message(__('Successfully Duplicate')); + } + } else { db_pandora_audit('SNMP management', "Fail try to duplicate snmp alert #$id_as"); ui_print_error_message(__('There was a problem duplicating the alert')); - } else { - db_pandora_audit('SNMP management', "Duplicate snmp alert #$id_as"); - ui_print_success_message(__('Successfully Duplicate')); } } diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index 09c2e1af48..f2819b4e74 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -898,7 +898,7 @@ class HostDevices extends Wizard ], [ 'label' => ''.__('Networks (current)').':'.ui_print_help_tip( - __('Plese upload a new file to overwrite this content.'), + __('Please upload a new file to overwrite this content.'), true ), 'arguments' => [ diff --git a/pandora_console/include/class/AgentsAlerts.class.php b/pandora_console/include/class/AgentsAlerts.class.php index f566e3a4d9..c577842485 100644 --- a/pandora_console/include/class/AgentsAlerts.class.php +++ b/pandora_console/include/class/AgentsAlerts.class.php @@ -765,7 +765,7 @@ class AgentsAlerts extends HTML // Start Header form. $headerForm = [ - 'action' => ui_get_full_url(), + 'action' => ui_get_full_url('index.php?sec=view&sec2=extensions/agents_alerts'), 'id' => 'form-header-filters', 'method' => 'POST', 'class' => 'modal flex flex-row', diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index 403cd72fa6..30cd41067c 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -462,6 +462,12 @@ class ExternalTools extends HTML $ids[] = join(',', $address); } + // Must be an a IP at least for work. + if (empty($ids) === true) { + ui_print_message(__('The agent doesn`t have an IP yet'), 'error', true); + return; + } + $ips = db_get_all_rows_sql( sprintf( 'SELECT ip FROM taddress WHERE id_a IN (%s)', @@ -469,18 +475,6 @@ class ExternalTools extends HTML ) ); - // Must be an a IP at least for work. - if (empty($ips) === true) { - html_print_div( - [ - 'class' => 'error', - 'style' => 'margin-top:5px', - 'content' => __('The agent hasn\'t got IP'), - ] - ); - return; - } - // Make the data for show in table. $ipsSelect = array_reduce( $ips, diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 9f5a807037..dc0dca6df4 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -1020,7 +1020,7 @@ class Tree $agent_search_filter = $this->getAgentSearchFilter(); $agent_status_filter = $this->getAgentStatusFilter(); $module_search_filter = $this->getModuleSearchFilter(); - $module_status_filter = $this->getModuleStatusFilter(); + $module_status_filter = $this->getModuleStatusFilterFromTestado($this->filter['statusModule']); $condition = $this->L2condition; $condition_inside = $this->L2conditionInside; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 972e0b9657..53ba322f9f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210506'; +$build_version = 'PC210507'; $pandora_version = 'v7.0NG.754'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index d6cd569c91..bfa2733840 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -2755,7 +2755,7 @@ function alerts_ui_update_or_create_actions($update=true) $al_action = alerts_get_alert_action($id); if ($al_action !== false) { if ($al_action['id_group'] == 0) { - if (! check_acl($config['id_user'], 0, 'PM')) { + if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'LM')) { db_pandora_audit( 'ACL Violation', 'Trying to access Alert Management' diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index de094fabad..026af0da76 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -2121,9 +2121,9 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) } $ag_groups = implode(',', (array) $ag_groups); - } - $where .= ' AND (id_grupo IN ('.$ag_groups.') OR id_group IN ('.$ag_groups.'))'; + $where .= ' AND (id_grupo IN ('.$ag_groups.') OR id_group IN ('.$ag_groups.'))'; + } } if (isset($other['data'][3])) { @@ -11248,10 +11248,10 @@ function api_set_add_user_profile($id, $thrash1, $other, $thrash2) return; } - $group = $other['data'][0]; + $group = (int) $other['data'][0]; $profile = $other['data'][1]; - if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $group) === false) { + if ($group !== 0 && db_get_value('id_grupo', 'tgrupo', 'id_grupo', $group) === false) { returnError('There is not any group with the ID provided.'); return; } diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index cad1dbf91a..d22641d4c7 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -590,3 +590,32 @@ function io_output_password($password) return io_safe_output($plaintext); } + + +/** + * Clean html tags symbols for prevent use JS + * + * @param string $string String for safe. + * + * @return string + */ +function io_safe_html_tags(string $string) +{ + // Must have safe output for work properly. + $string = io_safe_output($string); + if (strpos($string, '<') !== false && strpos($string, '>') !== false) { + $output = strstr($string, '<', true); + $tmpOutput = strstr($string, '<'); + $output .= strstr(substr($tmpOutput, 1), '>', true); + $tmpOutput = strstr($string, '>'); + $output .= substr($tmpOutput, 1); + // If the string still contains tags symbols. + if (strpos($string, '<') !== false && strpos($string, '>') !== false) { + $output = io_safe_html_tags($output); + } + } else { + $output = $string; + } + + return $output; +} diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 89aacde9c6..1896078e5d 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -1187,7 +1187,7 @@ function snmp_browser_create_modules_snmp( } } - $fail_modules = []; + $fail_modules = []; foreach ($targets_oids as $key => $target_oid) { $oid = snmp_browser_get_oid( @@ -1243,7 +1243,7 @@ function snmp_browser_create_modules_snmp( 'min' => 0, 'tcp_send' => $snmp_version, 'tcp_rcv' => '', - 'tcp_port' => 0, + 'tcp_port' => $target_port, 'snmp_oid' => $oid['numeric_oid'], 'snmp_community' => $community, 'id_module_group' => 3, diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 90a5a45ea1..2ff84de751 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -1609,6 +1609,7 @@ function paint_graph_status( svg .append("g") .attr("transform", "translate(100, 150)") + .attr("class", "invert_filter") .call(yAxis); //legend Normal text @@ -1623,6 +1624,7 @@ function paint_graph_status( .style("font-family", "arial") .style("font-weight", "bold") .style("font-size", "8pt") + .attr("class", "invert_filter") .html(legend_normal) .style("text-anchor", "first") .attr("width", 300) @@ -1649,6 +1651,7 @@ function paint_graph_status( .style("font-family", "arial") .style("font-weight", "bold") .style("font-size", "8pt") + .attr("class", "invert_filter") .html(legend_warning) .style("text-anchor", "first"); @@ -1673,6 +1676,7 @@ function paint_graph_status( .style("font-family", "arial") .style("font-weight", "bold") .style("font-size", "8pt") + .attr("class", "invert_filter") .html(legend_critical) .style("text-anchor", "first"); diff --git a/pandora_console/install.php b/pandora_console/install.php index 8323680a9d..d57b9b4c21 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@