Merge remote-tracking branch 'origin/develop' into ent-7861-fallo-umc-cuando-hay-db-historico

Conflicts:
	pandora_console/godmode/um_client/index.php
This commit is contained in:
fbsanchez 2021-08-11 09:56:02 +02:00
commit cf976f9622
97 changed files with 906 additions and 422 deletions

View File

@ -151,7 +151,7 @@ execute_cmd "yum install -y $extra_repos" "Installing extra repositories"
execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP" execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP"
# Install percona Database # 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" execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
# Console dependencies # 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/^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/^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/^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 cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/"> <meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">

View File

@ -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/^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/^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/^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" echo "- Setting Public URL: $PUBLICURL"
q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url) q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url)

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.756-210728 Version: 7.0NG.756-210811
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.756-210728" pandora_version="7.0NG.756-210811"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.756'; use constant AGENT_VERSION => '7.0NG.756';
use constant AGENT_BUILD => '210728'; use constant AGENT_BUILD => '210811';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.756 %define version 7.0NG.756
%define release 210728 %define release 210811
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.756 %define version 7.0NG.756
%define release 210728 %define release 210811
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.756" PI_VERSION="7.0NG.756"
PI_BUILD="210728" PI_BUILD="210811"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{210728} {210811}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.756 Build 210728") #define PANDORA_VERSION ("7.0NG.756 Build 210811")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.756(Build 210728))" VALUE "ProductVersion", "(7.0NG.756(Build 210811))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.756-210728 Version: 7.0NG.756-210811
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.756-210728" pandora_version="7.0NG.756-210811"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -33,10 +33,19 @@ function users_extension_main_god($god=true)
$image = 'images/user.png'; $image = 'images/user.png';
} }
// Header // Header.
ui_print_page_header(__('Users connected'), $image, false, '', $god); 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']); $group_um = users_get_groups_UM($config['id_user']);
// Is admin or has group permissions all. // Is admin or has group permissions all.
$groups = implode(',', array_keys($group_um, 1)); $groups = implode(',', array_keys($group_um, 1));
@ -44,6 +53,15 @@ function users_extension_main_god($god=true)
// Get user conected last 5 minutes.Show only those on which the user has permission. // Get user conected last 5 minutes.Show only those on which the user has permission.
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
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( $sql = sprintf(
'SELECT tusuario.id_user, tusuario.last_connect 'SELECT tusuario.id_user, tusuario.last_connect
FROM tusuario FROM tusuario
@ -54,9 +72,19 @@ function users_extension_main_god($god=true)
ORDER BY last_connect DESC', ORDER BY last_connect DESC',
$groups $groups
); );
}
break; break;
case 'postgresql': case 'postgresql':
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( $sql = sprintf(
"SELECT tusuario.id_user, tusuario.last_connect "SELECT tusuario.id_user, tusuario.last_connect
FROM tusuario FROM tusuario
@ -67,9 +95,19 @@ function users_extension_main_god($god=true)
ORDER BY last_connect DESC', ORDER BY last_connect DESC',
$groups $groups
); );
}
break; break;
case 'oracle': case 'oracle':
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( $sql = sprintf(
"SELECT tusuario.id_user, tusuario.last_connect "SELECT tusuario.id_user, tusuario.last_connect
FROM tusuario FROM tusuario
@ -80,15 +118,20 @@ function users_extension_main_god($god=true)
ORDER BY last_connect DESC', ORDER BY last_connect DESC',
$groups $groups
); );
}
break;
default:
// Nothing to do.
break; break;
} }
$rows = db_get_all_rows_sql($sql); $rows = db_get_all_rows_sql($sql);
if (empty($rows)) { if (empty($rows)) {
$rows = []; $rows = [];
echo "<div class='nf'>".__('No other users connected').'</div>'; echo "<div class='nf'>".__('No other users connected').'</div>';
} else { } else {
$table = new StdClass();
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
$table->width = '100%'; $table->width = '100%';
@ -105,7 +148,7 @@ function users_extension_main_god($god=true)
$rowPair = true; $rowPair = true;
$iterator = 0; $iterator = 0;
// Get data // Get data.
foreach ($rows as $row) { foreach ($rows as $row) {
// Get data of user's last login. // Get data of user's last login.
switch ($config['dbtype']) { switch ($config['dbtype']) {
@ -135,6 +178,10 @@ function users_extension_main_god($god=true)
) )
); );
break; break;
default:
// Nothing to do.
break;
} }
if ($rowPair) { if ($rowPair) {

View File

@ -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;

View File

@ -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

View File

@ -63,6 +63,7 @@ switch ($login_screen) {
case 'error_perms': case 'error_perms':
case 'homedir_bad_defined': case 'homedir_bad_defined':
case 'homeurl_bad_defined': case 'homeurl_bad_defined':
case 'disabled_access_node':
$logo_link = 'index.php'; $logo_link = 'index.php';
$logo_title = __('Go to Login'); $logo_title = __('Go to Login');
break; break;
@ -208,6 +209,7 @@ if (is_metaconsole() === true) {
switch ($login_screen) { switch ($login_screen) {
case 'logout': case 'logout':
case 'login': case 'login':
case 'disabled_access_node':
if (!empty($page) && !empty($sec)) { if (!empty($page) && !empty($sec)) {
foreach ($_POST as $key => $value) { foreach ($_POST as $key => $value) {
html_print_input_hidden(io_safe_input($key), io_safe_input($value)); html_print_input_hidden(io_safe_input($key), io_safe_input($value));
@ -508,9 +510,29 @@ if ($login_screen == 'logout') {
echo '</div>'; echo '</div>';
} }
if ($login_screen === 'disabled_access_node') {
echo '<div id="disabled_access_node" title="'.__('User node access not enabled').'">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
echo html_print_image('images/icono_logo_pandora.png', true, ['alt' => __('Centralized user in metaconsole'), 'border' => 0]);
echo '</div>';
echo '<div class="content_message_alert">';
echo '<div class="text_message_alert">';
echo '<h1>'.__('Centralized user in metaconsole').'</h1>';
echo '<p>'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'</p>';
echo '</div>';
echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-logout', false);
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
switch ($login_screen) { switch ($login_screen) {
case 'error_dbconfig': case 'error_dbconfig':
case 'error_authconfig': case 'error_authconfig':
case 'disabled_node_access':
if (!isset($config['rb_product_name_alt'])) { if (!isset($config['rb_product_name_alt'])) {
$title = __('Problem with %s database', get_product_name()); $title = __('Problem with %s database', get_product_name());
} else { } else {
@ -694,6 +716,29 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
}); });
break; 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 = "<?php echo ui_get_full_url('index.php'); ?>";
});
});
break;
default: default:
$(document).ready (function () { $(document).ready (function () {
// IE9- modal warning window // IE9- modal warning window

View File

@ -349,7 +349,14 @@ if (isset($groups[$grupo]) || $new_agent) {
} }
$table_primary_group .= '<div class="label_select_child_icons"><span id="group_preview">'; $table_primary_group .= '<div class="label_select_child_icons"><span id="group_preview">';
$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 .= '</span></div></div></div>'; $table_primary_group .= '</span></div></div></div>';
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').'</p>'; $table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').'</p>';
@ -500,7 +507,10 @@ if (enterprise_installed()) {
false, false,
// Delete_groups. // Delete_groups.
// Do not show the primary group in this selection. // 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. // Include_groups.
// Size. // Size.
// Simple_multiple_options. // Simple_multiple_options.
@ -1243,6 +1253,9 @@ ui_require_jquery_file('bgiframe');
}); });
$("select#id_os").pandoraSelectOS (); $("select#id_os").pandoraSelectOS ();
$('select#grupo').pandoraSelectGroupIcon ();
var checked = $("#checkbox-cascade_protection").is(":checked"); var checked = $("#checkbox-cascade_protection").is(":checked");
if (checked) { if (checked) {

View File

@ -2368,7 +2368,7 @@ switch ($tab) {
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>'; var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>';
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() && if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() &&
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){ '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){
event.preventDefault(); event.preventDefault();
@ -2402,7 +2402,7 @@ switch ($tab) {
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>'; var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>';
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() && ( if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() && (
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){ module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
event.preventDefault(); event.preventDefault();

View File

@ -215,7 +215,7 @@ $table_simple->colspan[3][1] = 3;
$table_simple->data[0][0] = __('Name'); $table_simple->data[0][0] = __('Name');
$table_simple->data[0][1] = html_print_input_text_extended( $table_simple->data[0][1] = html_print_input_text_extended(
'name', 'name',
io_safe_input(html_entity_decode($name, ENT_QUOTES, 'UTF-8')), $name,
'text-name', 'text-name',
'', '',
45, 45,

View File

@ -708,7 +708,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible left">'; $data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible left">';
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">'; $data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
$data[3] .= '<table class="databox_color w100p">'; $data[3] .= '<table class="databox_color w100p bg_color222">';
$data[3] .= html_print_input_hidden('add_action', 1, true); $data[3] .= html_print_input_hidden('add_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true); $data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);

View File

@ -135,6 +135,10 @@ if ($id) {
$create_wu_integria = $action['create_wu_integria']; $create_wu_integria = $action['create_wu_integria'];
} }
if (users_can_manage_group_all('LW') === false && !$id) {
$group = users_get_first_group(false, 'LW', false);
}
// Hidden div with help hint to fill with javascript. // Hidden div with help hint to fill with javascript.
html_print_div( html_print_div(
[ [
@ -623,9 +627,6 @@ $(document).ready (function () {
$("#group option").each(function(index, value) { $("#group option").each(function(index, value) {
var current_group = $(value).val(); var current_group = $(value).val();
}); });
if (data.id_group != 0 && $("#group").val() != data.id_group) {
$("#group").val(0);
}
var integria_custom_fields_values = []; var integria_custom_fields_values = [];
var integria_custom_fields_rvalues = []; var integria_custom_fields_rvalues = [];

View File

@ -105,6 +105,7 @@ if ($update_command) {
$alert['command'] = $command; $alert['command'] = $command;
$alert['description'] = $description; $alert['description'] = $description;
$alert['id_group'] = $id_group; $alert['id_group'] = $id_group;
$alert['fields_hidden'] = io_json_mb_encode($fields_hidden);
} }
} }

View File

@ -182,6 +182,7 @@ if (isset($id)) {
$snmp3_privacy_pass = io_output_password( $snmp3_privacy_pass = io_output_password(
$component['custom_string_2'] $component['custom_string_2']
); );
unset($tcp_send);
$snmp3_security_level = $component['custom_string_3']; $snmp3_security_level = $component['custom_string_3'];
} else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) { } else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) {
$command_text = $component['tcp_send']; $command_text = $component['tcp_send'];

View File

@ -331,9 +331,9 @@ echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters'>"; echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters'>";
echo '<tr>'; echo '<tr>';
echo "<td colspan='3'>".__('Filter group').'</td>'; echo "<td colspan='1'>".__('Filter group').'</td>';
echo '</tr><tr>'; echo '</tr><tr>';
echo "<td colspan='3'>".html_print_select_groups( echo "<td colspan='1'>".html_print_select_groups(
$config['id_user'], $config['id_user'],
($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RW'), ($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RW'),
true, true,

View File

@ -986,12 +986,11 @@ if ($create_alert || $update_alert) {
echo html_print_select(get_priorities(), 'priority', $priority, '', '', '0', false, false, false); echo html_print_select(get_priorities(), 'priority', $priority, '', '', '0', false, false, false);
echo '</td></tr>'; echo '</td></tr>';
// Alert type (e-mail, event etc.) // Alert type (e-mail, event etc.).
echo '<tr><td class="datos">'.__('Alert commands').'</td><td class="datos">'; echo '<tr><td class="datos">'.__('Alert action').'</td><td class="datos">';
html_print_select_from_sql( html_print_select_from_sql(
'SELECT id, name 'SELECT id, name
FROM talert_commands FROM talert_actions
ORDER BY name', ORDER BY name',
'alert_type', 'alert_type',
$alert_type, $alert_type,
@ -1481,7 +1480,7 @@ $(document).ready (function () {
value: "1" value: "1"
}); });
values.push ({ values.push ({
name: "id", name: "id_action",
value: this.value value: this.value
}); });
values.push ({ values.push ({

View File

@ -231,6 +231,21 @@ if (is_ajax() !== true) {
} }
} }
} }
$PHPmemory_limit_min = config_return_in_bytes('800M');
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== -1) {
$msg = __(
'\'%s\' recommended value is %s or greater. Please, change it on your PHP configuration file (php.ini) or contact with administrator',
'memory_limit',
'800M'
);
if (function_exists('ui_print_warning_message') === true) {
ui_print_warning_message($msg);
} else {
echo $msg;
}
}
} }
// Load styles. // Load styles.
@ -366,21 +381,6 @@ if (is_array($config) === true) {
} }
} }
$PHPmemory_limit_min = config_return_in_bytes('800M');
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') {
$msg = __(
'\'%s\' recommended value is %s or greater. Please, change it on your PHP configuration file (php.ini) or contact with administrator',
'memory_limit',
'800M'
);
if (function_exists('ui_print_warning_message') === true) {
ui_print_warning_message($msg);
} else {
echo $msg;
}
}
$proxy = null; $proxy = null;
if (empty($config['update_manager_proxy_server']) === false if (empty($config['update_manager_proxy_server']) === false
|| empty($config['update_manager_proxy_port']) === false || empty($config['update_manager_proxy_port']) === false

View File

@ -941,7 +941,7 @@ class Client
$queries = preg_split("/(;\n)|(;\n\r)/", $sql); $queries = preg_split("/(;\n)|(;\n\r)/", $sql);
foreach ($queries as $query) { foreach ($queries as $query) {
if (empty($query) !== true) { if (empty($query) !== true) {
if (preg_match('/^\s*LOAD\s+(.*)$/i', $query, $matches) > 0) { if (preg_match('/^\s*SOURCE\s+(.*)$/i', $query, $matches) > 0) {
$filepath = dirname($mr_file).'/'.$matches[1]; $filepath = dirname($mr_file).'/'.$matches[1];
if (file_exists($filepath) === true) { if (file_exists($filepath) === true) {
$query = file_get_contents($filepath); $query = file_get_contents($filepath);
@ -1342,14 +1342,14 @@ class Client
function ($errno, $errstr) { function ($errno, $errstr) {
throw new \Exception($errstr, $errno); throw new \Exception($errstr, $errno);
}, },
E_ERROR (E_ALL ^ E_NOTICE)
); );
register_shutdown_function( register_shutdown_function(
function () { function () {
$error = error_get_last(); $error = error_get_last();
if (null !== $error if (null !== $error
&& $error['type'] === E_ERROR && $error['type'] === (E_ALL ^ E_NOTICE)
) { ) {
echo __('Failed to analyze package: %s', $error['message']); echo __('Failed to analyze package: %s', $error['message']);
} }
@ -1434,7 +1434,7 @@ class Client
function ($errno, $errstr) { function ($errno, $errstr) {
throw new \Exception($errstr, $errno); throw new \Exception($errstr, $errno);
}, },
E_ERROR (E_ALL ^ E_NOTICE)
); );
if ($package === null) { if ($package === null) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -423,7 +423,7 @@ if ($show_update_action_menu) {
); );
$data .= '<form id="update_action-'.$alert['id'].'" method="post">'; $data .= '<form id="update_action-'.$alert['id'].'" method="post">';
$data .= '<table class="databox_color w100p">'; $data .= '<table class="databox_color w100p bg_color222">';
$data .= html_print_input_hidden( $data .= html_print_input_hidden(
'update_action', 'update_action',
1, 1,

View File

@ -1599,7 +1599,6 @@ if ($get_extended_event) {
page: "include/ajax/events", page: "include/ajax/events",
get_comments: 1, get_comments: 1,
event: '.json_encode($event).', event: '.json_encode($event).',
filter: '.json_encode($filter).'
}, },
dataType : "html", dataType : "html",
success: function (data) { success: function (data) {

View File

@ -319,7 +319,7 @@ function process_user_login_remote($login, $pass, $api=false)
defined('METACONSOLE') defined('METACONSOLE')
); );
if ($return === 'error_permissions') { if ($result === 'error_permissions') {
$config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator'); $config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator');
return false; return false;
} }
@ -735,7 +735,14 @@ function ldap_process_user_login($login, $password)
} }
// Connect to the LDAP server // Connect to the LDAP server
if (stripos($config['ldap_server'], 'ldap://') !== false
|| stripos($config['ldap_server'], 'ldaps://') !== false
|| stripos($config['ldap_server'], 'ldapi://') !== false
) {
$ds = @ldap_connect($config['ldap_server'].':'.$config['ldap_port']);
} else {
$ds = @ldap_connect($config['ldap_server'], $config['ldap_port']); $ds = @ldap_connect($config['ldap_server'], $config['ldap_port']);
}
if (!$ds) { if (!$ds) {
$config['auth_error'] = 'Error connecting to LDAP server'; $config['auth_error'] = 'Error connecting to LDAP server';
@ -1393,7 +1400,7 @@ function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $ac
} }
if (!empty($ldap_admin_pass)) { if (!empty($ldap_admin_pass)) {
$ldap_admin_pass = ' -w '.$ldap_admin_pass; $ldap_admin_pass = ' -w '.escapeshellarg($ldap_admin_pass);
} }
$dn = " -b '".$dn."'"; $dn = " -b '".$dn."'";

View File

@ -810,7 +810,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.LICENSE.LIMITED', 'type' => 'NOTIF.LICENSE.LIMITED',
'title' => __('Limited mode.'), 'title' => __('Limited mode.'),
'message' => io_safe_output($config['limited_mode']), 'message' => io_safe_output($config['limited_mode']),
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'), 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
] ]
); );
} else { } else {
@ -836,7 +836,7 @@ class ConsoleSupervisor
$msg, $msg,
$days_to_expiry $days_to_expiry
), ),
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'), 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
] ]
); );
} else if ($days_to_expiry < 0) { } else if ($days_to_expiry < 0) {
@ -854,7 +854,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.LICENSE.EXPIRATION', 'type' => 'NOTIF.LICENSE.EXPIRATION',
'title' => $title, 'title' => $title,
'message' => $msg, 'message' => $msg,
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'), 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
] ]
); );
return false; return false;
@ -931,7 +931,7 @@ class ConsoleSupervisor
'Directory %s is not writable. Please, configure corresponding permissions.', 'Directory %s is not writable. Please, configure corresponding permissions.',
$config['attachment_store'] $config['attachment_store']
), ),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=general',
] ]
); );
return; return;
@ -953,7 +953,7 @@ class ConsoleSupervisor
'There are more than %d files in attachment, consider cleaning up attachment directory manually.', 'There are more than %d files in attachment, consider cleaning up attachment directory manually.',
$config['num_files_attachment'] $config['num_files_attachment']
), ),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=perf',
] ]
); );
} else { } else {
@ -987,7 +987,7 @@ class ConsoleSupervisor
'Remote configuration directory %s is not readable. Please, adjust configuration.', 'Remote configuration directory %s is not readable. Please, adjust configuration.',
$remote_config_dir $remote_config_dir
), ),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=general',
] ]
); );
return; return;
@ -1006,7 +1006,7 @@ class ConsoleSupervisor
'Remote configuration directory %s is not writable. Please, adjust configuration.', 'Remote configuration directory %s is not writable. Please, adjust configuration.',
$remote_config_dir.'/conf' $remote_config_dir.'/conf'
), ),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=general',
] ]
); );
} else { } else {
@ -1024,7 +1024,7 @@ class ConsoleSupervisor
'Collections directory %s is not writable. Please, adjust configuration.', 'Collections directory %s is not writable. Please, adjust configuration.',
$remote_config_dir.'/collections' $remote_config_dir.'/collections'
), ),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=general',
] ]
); );
} else { } else {
@ -1042,7 +1042,7 @@ class ConsoleSupervisor
'MD5 directory %s is not writable. Please, adjust configuration.', 'MD5 directory %s is not writable. Please, adjust configuration.',
$remote_config_dir.'/md5' $remote_config_dir.'/md5'
), ),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=general',
] ]
); );
} else { } else {
@ -1073,7 +1073,7 @@ class ConsoleSupervisor
$MAX_FILES_DATA_IN, $MAX_FILES_DATA_IN,
$remote_config_dir $remote_config_dir
), ),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=perf',
] ]
); );
} else { } else {
@ -1096,7 +1096,7 @@ class ConsoleSupervisor
$MAX_BADXML_FILES_DATA_IN, $MAX_BADXML_FILES_DATA_IN,
$remote_config_dir $remote_config_dir
), ),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=perf',
] ]
); );
} else { } else {
@ -1188,7 +1188,7 @@ class ConsoleSupervisor
$modules_queued, $modules_queued,
$queue['queued_modules'] $queue['queued_modules']
), ),
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'), 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
] ]
); );
} else { } else {
@ -1324,7 +1324,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'], 'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'],
'title' => $msg, 'title' => $msg,
'message' => $description, 'message' => $description,
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'), 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
] ]
); );
} }
@ -1636,7 +1636,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.HISTORYDB', 'type' => 'NOTIF.HISTORYDB',
'title' => __('Historical database not available'), 'title' => __('Historical database not available'),
'message' => __('Historical database is enabled, though not accessible with the current configuration.'), 'message' => __('Historical database is enabled, though not accessible with the current configuration.'),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=hist_db'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=hist_db',
] ]
); );
} else { } else {
@ -1683,7 +1683,7 @@ class ConsoleSupervisor
'Your database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', 'Your database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.',
io_safe_output(get_product_name()) io_safe_output(get_product_name())
), ),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=perf',
] ]
); );
} else { } else {
@ -1743,7 +1743,7 @@ class ConsoleSupervisor
'Historical database maintenance problem.' 'Historical database maintenance problem.'
), ),
'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()), 'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=perf',
] ]
); );
} else { } else {
@ -1782,7 +1782,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.HISTORYDB.MR', 'type' => 'NOTIF.HISTORYDB.MR',
'title' => __('Historical database MR mismatch'), 'title' => __('Historical database MR mismatch'),
'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'), 'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=hist_db'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=hist_db',
] ]
); );
} else { } else {
@ -1823,7 +1823,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.EXT.ELASTICSEARCH', 'type' => 'NOTIF.EXT.ELASTICSEARCH',
'title' => __('Log collector cannot connect to ElasticSearch'), 'title' => __('Log collector cannot connect to ElasticSearch'),
'message' => __('ElasticSearch is not available using current configuration.'), 'message' => __('ElasticSearch is not available using current configuration.'),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=log'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=log',
] ]
); );
} else { } else {
@ -1893,7 +1893,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.METACONSOLE.DB_CONNECTION', 'type' => 'NOTIF.METACONSOLE.DB_CONNECTION',
'title' => __('Metaconsole DB is not available.'), 'title' => __('Metaconsole DB is not available.'),
'message' => __('Cannot connect with Metaconsole DB using current configuration.'), 'message' => __('Cannot connect with Metaconsole DB using current configuration.'),
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=enterprise'), 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=enterprise',
] ]
); );
} }
@ -1922,7 +1922,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.DOWNTIME', 'type' => 'NOTIF.DOWNTIME',
'title' => __('Scheduled downtime running.'), 'title' => __('Scheduled downtime running.'),
'message' => __('A scheduled downtime is running. Some monitoring data won\'t be available while downtime is taking place.'), 'message' => __('A scheduled downtime is running. Some monitoring data won\'t be available while downtime is taking place.'),
'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'), 'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
] ]
); );
return; return;
@ -2083,7 +2083,7 @@ class ConsoleSupervisor
date('M j, G:i:s ', $next_downtime_begin), date('M j, G:i:s ', $next_downtime_begin),
date('M j, G:i:s ', $next_downtime_end) date('M j, G:i:s ', $next_downtime_end)
), ),
'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'), 'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
] ]
); );
return; return;
@ -2144,7 +2144,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD', 'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD',
'title' => __('Default password for "Admin" user has not been changed'), 'title' => __('Default password for "Admin" user has not been changed'),
'message' => __('Please, change the default password since it is a commonly reported vulnerability.'), 'message' => __('Please, change the default password since it is a commonly reported vulnerability.'),
'url' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list'), 'url' => '__url__/index.php?sec=gusuarios&sec2=godmode/users/user_list',
] ]
); );
} else { } else {
@ -2180,7 +2180,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.MISC.FONTPATH', 'type' => 'NOTIF.MISC.FONTPATH',
'title' => __('Default font doesn\'t exist'), 'title' => __('Default font doesn\'t exist'),
'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'), 'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'),
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=vis'), 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup&section=vis',
] ]
); );
} else { } else {
@ -2207,7 +2207,7 @@ class ConsoleSupervisor
'Your %s has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production environment. This value is located in the main index.php file', 'Your %s has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production environment. This value is located in the main index.php file',
get_product_name() get_product_name()
), ),
'url' => ui_get_full_url('index.php'), 'url' => '__url__/index.php',
] ]
); );
} else { } else {
@ -2230,7 +2230,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION', 'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION',
'title' => __('Event storm protection is enabled.'), 'title' => __('Event storm protection is enabled.'),
'message' => __('Some events may get lost while this mode is enabled. The server must be restarted after altering this setting.'), 'message' => __('Some events may get lost while this mode is enabled. The server must be restarted after altering this setting.'),
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=general'), 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup&section=general',
] ]
); );
} else { } else {
@ -2257,7 +2257,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP', 'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP',
'title' => __('Failed to retrieve updates, please configure utility'), 'title' => __('Failed to retrieve updates, please configure utility'),
'message' => $message, 'message' => $message,
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=general'), 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup&section=general',
] ]
); );
} }
@ -2277,7 +2277,7 @@ class ConsoleSupervisor
get_product_name() get_product_name()
), ),
'message' => __('There is a new update available. Please<a class="bolder" href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online').'"> go to Administration:Setup:Update Manager</a> for more details.'), 'message' => __('There is a new update available. Please<a class="bolder" href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online').'"> go to Administration:Setup:Update Manager</a> for more details.'),
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online'), 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online',
] ]
); );
} else { } else {
@ -2315,7 +2315,7 @@ class ConsoleSupervisor
'There is one or more minor releases available. <a id="aviable_updates" target="blank" href="%s">.About minor release update</a>.', 'There is one or more minor releases available. <a id="aviable_updates" target="blank" href="%s">.About minor release update</a>.',
$url $url
), ),
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'), 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
] ]
); );
} else { } else {
@ -2364,7 +2364,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.CRON.CONFIGURED', 'type' => 'NOTIF.CRON.CONFIGURED',
'title' => __('DiscoveryConsoleTasks is not configured.'), 'title' => __('DiscoveryConsoleTasks is not configured.'),
'message' => __($message_conf_cron), 'message' => __($message_conf_cron),
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'), 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist',
] ]
); );
} else { } else {
@ -2468,7 +2468,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.SERVER.MISALIGNED', 'type' => 'NOTIF.SERVER.MISALIGNED',
'title' => __($title_ver_misaligned), 'title' => __($title_ver_misaligned),
'message' => __($message_ver_misaligned), 'message' => __($message_ver_misaligned),
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'), 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
] ]
); );
} }
@ -2513,7 +2513,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE', 'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE',
'title' => __('AllowOverride is disabled'), 'title' => __('AllowOverride is disabled'),
'message' => __($message), 'message' => __($message),
'url' => ui_get_full_url('index.php'), 'url' => '__url__/index.php',
] ]
); );
} }
@ -2559,7 +2559,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.HAMASTER.MESSAGE', 'type' => 'NOTIF.HAMASTER.MESSAGE',
'title' => __('Desynchronized operation on the node '.$node['host']), 'title' => __('Desynchronized operation on the node '.$node['host']),
'message' => __($message), 'message' => __($message),
'url' => ui_get_full_url('index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster'), 'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster',
] ]
); );
} else { } else {

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC210728'; $build_version = 'PC210811';
$pandora_version = 'v7.0NG.756'; $pandora_version = 'v7.0NG.756';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -14821,6 +14821,9 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
// Graph width (optional). // Graph width (optional).
$width = (!empty($other) && isset($other['data'][4]) && $other['data'][4]) ? $other['data'][4] : ''; $width = (!empty($other) && isset($other['data'][4]) && $other['data'][4]) ? $other['data'][4] : '';
// If recive value its from mail call.
$graph_font_size = $other['data'][5];
} else { } else {
// Fixed parameters for _modulegraph_nh_. // Fixed parameters for _modulegraph_nh_.
$graph_seconds = $other['data']; $graph_seconds = $other['data'];
@ -14857,6 +14860,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
'fullscale' => false, 'fullscale' => false,
'return_img_base_64' => true, 'return_img_base_64' => true,
'image_treshold' => $graph_threshold, 'image_treshold' => $graph_threshold,
'graph_font_size' => $graph_font_size,
]; ];
// Format MIME RFC 2045 (line break 76 chars). // Format MIME RFC 2045 (line break 76 chars).

View File

@ -2243,7 +2243,7 @@ function config_process_config()
if (!isset($config['fontpath'])) { if (!isset($config['fontpath'])) {
config_update_value( config_update_value(
'fontpath', 'fontpath',
'lato.ttf' 'Lato-Regular.ttf'
); );
} }
@ -3126,7 +3126,7 @@ function config_process_config()
} }
if (!isset($config['custom_report_front_font'])) { if (!isset($config['custom_report_front_font'])) {
config_update_value('custom_report_front_font', 'lato.ttf'); config_update_value('custom_report_front_font', 'Lato-Regular.ttf');
} }
if (!isset($config['custom_report_front_logo'])) { if (!isset($config['custom_report_front_logo'])) {
@ -3386,7 +3386,7 @@ function config_user_set_custom_config()
} }
} }
if ((isset($userinfo['id_skin']) && $userinfo['id_skin'] !== 0)) { if ((isset($userinfo['id_skin']) && (int) $userinfo['id_skin'] !== 0)) {
if ((int) $userinfo['id_skin'] === 1) { if ((int) $userinfo['id_skin'] === 1) {
$config['style'] = 'pandora'; $config['style'] = 'pandora';
} }
@ -3402,12 +3402,10 @@ function config_user_set_custom_config()
if ($sec2_aux != 'godmode/groups/group_list' && $skin !== false) { if ($sec2_aux != 'godmode/groups/group_list' && $skin !== false) {
$id_user_aux = get_parameter('id'); $id_user_aux = get_parameter('id');
if ($id_user_aux == $config['id_user']) { if ($id_user_aux == $config['id_user']) {
if ((int) $skin === 1 || (int) $skin === 0) { if ($config['style'] === 'pandora_black' && (int) $skin === 0 || (int) $skin === 2) {
$config['style'] = 'pandora';
}
if ((int) $skin === 2) {
$config['style'] = 'pandora_black'; $config['style'] = 'pandora_black';
} else if ((int) $skin === 1 || (int) $skin === 0) {
$config['style'] = 'pandora';
} }
} }
} }

View File

@ -1151,7 +1151,12 @@ function events_get_all(
$tags_names[$id_tag] = tags_get_name($id_tag); $tags_names[$id_tag] = tags_get_name($id_tag);
} }
if ($tags[0] === $id_tag) {
$_tmp .= ' AND ( '; $_tmp .= ' AND ( ';
} else {
$_tmp .= ' OR ( ';
}
$_tmp .= sprintf( $_tmp .= sprintf(
' tags LIKE "%s" OR', ' tags LIKE "%s" OR',
$tags_names[$id_tag] $tags_names[$id_tag]
@ -3576,7 +3581,12 @@ function events_page_responses($event, $childrens_ids=[])
'', '',
__('None'), __('None'),
-1, -1,
true true,
false,
true,
'',
false,
'width: 70%'
); );
$data[2] .= html_print_button( $data[2] .= html_print_button(
__('Update'), __('Update'),
@ -4843,7 +4853,7 @@ function events_page_general($event)
if (isset($event['id_agente']) && $event['id_agente'] > 0) { if (isset($event['id_agente']) && $event['id_agente'] > 0) {
enterprise_include_once('include/functions_agents.php'); enterprise_include_once('include/functions_agents.php');
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$event['id_agente'], is_metaconsole()]); $secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$event['id_agente'], is_metaconsole()]);
if (!empty($secondary_groups_selected)) { if (empty($secondary_groups_selected['for_select']) === false) {
$secondary_groups = implode(', ', $secondary_groups_selected['for_select']); $secondary_groups = implode(', ', $secondary_groups_selected['for_select']);
} }
} }

View File

@ -218,7 +218,7 @@ function upload_file($upload_file_or_zip, $default_real_directory)
ui_print_error_message(__('Security error')); ui_print_error_message(__('Security error'));
} else { } else {
if (PandoraFMS\Tools\Files::unzip($filepath, $real_directory) === false) { if (PandoraFMS\Tools\Files::unzip($filepath, $real_directory) === false) {
ui_print_error_message(__('No he podido descomprimir tu archivo de mierda')); ui_print_error_message(__('It was impossible to uncompress your file'));
} else { } else {
unlink($_FILES['file']['tmp_name']); unlink($_FILES['file']['tmp_name']);
ui_print_success_message(__('Upload correct')); ui_print_success_message(__('Upload correct'));

View File

@ -735,7 +735,7 @@ function grafico_modulo_sparse($params)
$params['backgroundColor'] = 'white'; $params['backgroundColor'] = 'white';
} }
if (isset($params['only_image']) === true) { if (isset($params['only_image']) === true && $params['vconsole'] !== true) {
$params['backgroundColor'] = 'transparent'; $params['backgroundColor'] = 'transparent';
} }
@ -829,7 +829,11 @@ function grafico_modulo_sparse($params)
$params['stacked'] = 0; $params['stacked'] = 0;
} }
if (isset($params['graph_font_size']) === true) {
$font_size = $params['graph_font_size'];
} else {
$font_size = $config['font_size']; $font_size = $config['font_size'];
}
// If is metaconsole set 10pt size value. // If is metaconsole set 10pt size value.
if (is_metaconsole()) { if (is_metaconsole()) {

View File

@ -2365,12 +2365,13 @@ function html_print_div(
/** /**
* Render an anchor <a> html element. * Render an anchor <a> html element.
* *
* @param array $options Parameters * @param array $options Parameters.
* - id: string. * - id: string.
* - style: string. * - style: string.
* - title: string. * - title: string.
* - href: string. * - href: string.
* - content: string. * - content: string.
* - onClick: string.
* @param boolean $return Return or echo flag. * @param boolean $return Return or echo flag.
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
@ -2387,6 +2388,7 @@ function html_print_anchor(
'style', 'style',
'class', 'class',
'title', 'title',
'onClick',
]; ];
$output .= (isset($options['href']) === true) ? 'href="'.io_safe_input_html($options['href']).'"' : ui_get_full_url(); $output .= (isset($options['href']) === true) ? 'href="'.io_safe_input_html($options['href']).'"' : ui_get_full_url();

View File

@ -199,7 +199,7 @@ function integria_api_call($api_hostname=null, $user=null, $user_pass=null, $api
'user_pass' => $user_pass, 'user_pass' => $user_pass,
'pass' => $api_pass, 'pass' => $api_pass,
'op' => $operation, 'op' => $operation,
'params' => html_entity_decode($params), 'params' => io_safe_output($params),
]; ];
if ($return_type !== '') { if ($return_type !== '') {

View File

@ -662,7 +662,7 @@ function messages_get_url($message_id)
// Return URL stored if is set in database. // Return URL stored if is set in database.
if (isset($messages['url'])) { if (isset($messages['url'])) {
return $messages['url']; return str_replace('__url__', ui_get_full_url('/'), $messages['url']);
} }
// Return the message direction. // Return the message direction.

View File

@ -600,7 +600,7 @@ function netflow_get_stats(
global $config, $nfdump_date_format; global $config, $nfdump_date_format;
// Requesting remote data. // Requesting remote data.
if (defined('METACONSOLE') && $connection_name != '') { if (is_metaconsole() === true && empty($connection_name) === false) {
$data = metaconsole_call_remote_api($connection_name, 'netflow_get_stats', "$start_date|$end_date|".base64_encode(json_encode($filter))."|$aggregate|$max|$absolute|".(int) $address_resolution); $data = metaconsole_call_remote_api($connection_name, 'netflow_get_stats', "$start_date|$end_date|".base64_encode(json_encode($filter))."|$aggregate|$max|$absolute|".(int) $address_resolution);
return json_decode($data, true); return json_decode($data, true);
} }
@ -612,7 +612,7 @@ function netflow_get_stats(
// Execute nfdump. // Execute nfdump.
exec($command, $string); exec($command, $string);
if (! is_array($string)) { if (is_array($string) === false) {
return []; return [];
} }
@ -1062,7 +1062,7 @@ function netflow_draw_item(
) { ) {
$aggregate = $filter['aggregate']; $aggregate = $filter['aggregate'];
$interval = ($end_date - $start_date); $interval = ($end_date - $start_date);
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$width = 950; $width = 950;
} else { } else {
$width = 850; $width = 850;
@ -1084,12 +1084,13 @@ function netflow_draw_item(
$connection_name, $connection_name,
$address_resolution $address_resolution
); );
if (empty($data)) {
if (empty($data) === true) {
break; break;
} }
if ($output == 'HTML' || $output == 'PDF') { if ($output === 'HTML' || $output === 'PDF') {
$html .= graph_netflow_aggregate_area( return graph_netflow_aggregate_area(
$data, $data,
$interval, $interval,
$width, $width,
@ -1098,9 +1099,8 @@ function netflow_draw_item(
($output === 'HTML'), ($output === 'HTML'),
$end_date $end_date
); );
return $html; } else if ($output === 'XML') {
} else if ($output == 'XML') { $xml = '<aggregate>'.$aggregate."</aggregate>\n";
$xml .= '<aggregate>'.$aggregate."</aggregate>\n";
$xml .= '<resolution>'.$interval_length."</resolution>\n"; $xml .= '<resolution>'.$interval_length."</resolution>\n";
$xml .= netflow_aggregate_area_xml($data); $xml .= netflow_aggregate_area_xml($data);
return $xml; return $xml;
@ -1119,18 +1119,19 @@ function netflow_draw_item(
$connection_name, $connection_name,
$address_resolution $address_resolution
); );
if (empty($data)) {
if (empty($data) === true) {
break; break;
} }
if ($output == 'HTML' || $output == 'PDF') { if ($output === 'HTML' || $output === 'PDF') {
$html .= "<div class='w100p overflow'>"; $html = "<div class='w100p overflow'>";
$html .= netflow_data_table($data, $start_date, $end_date, $aggregate); $html .= netflow_data_table($data, $start_date, $end_date, $aggregate);
$html .= '</div>'; $html .= '</div>';
return $html; return $html;
} else if ($output == 'XML') { } else if ($output === 'XML') {
$xml .= '<aggregate>'.$aggregate."</aggregate>\n"; $xml = '<aggregate>'.$aggregate."</aggregate>\n";
$xml .= '<resolution>'.$interval_length."</resolution>\n"; $xml .= '<resolution>'.$interval_length."</resolution>\n";
// Same as netflow_aggregate_area_xml. // Same as netflow_aggregate_area_xml.
$xml .= netflow_aggregate_area_xml($data); $xml .= netflow_aggregate_area_xml($data);
@ -1159,7 +1160,8 @@ function netflow_draw_item(
$connection_name, $connection_name,
$address_resolution $address_resolution
); );
if (empty($data_pie)) {
if (empty($data_pie) === true) {
break; break;
} }
@ -1222,6 +1224,8 @@ function netflow_draw_item(
$connection_name, $connection_name,
$address_resolution $address_resolution
); );
if (empty($data_stats) === false) {
switch ($aggregate) { switch ($aggregate) {
case 'srcip': case 'srcip':
case 'srcport': case 'srcport':
@ -1247,11 +1251,11 @@ function netflow_draw_item(
foreach ($data_stats as $sdata) { foreach ($data_stats as $sdata) {
$data_graph['children'][] = [ $data_graph['children'][] = [
'id' => $i++, 'id' => $id++,
'name' => $sdata['agg'], 'name' => $sdata['agg'],
'children' => [ 'children' => [
[ [
'id' => $i++, 'id' => $id++,
'name' => $sdata['agg'], 'name' => $sdata['agg'],
'value' => $sdata['data'], 'value' => $sdata['data'],
'tooltip_content' => network_format_bytes($sdata['data']), 'tooltip_content' => network_format_bytes($sdata['data']),
@ -1259,14 +1263,17 @@ function netflow_draw_item(
], ],
]; ];
} }
return graph_netflow_host_traffic($data_graph, 'auto', 400); return graph_netflow_host_traffic($data_graph, 'auto', 400);
}
break;
default: default:
// Nothing to do. // Nothing to do.
break; break;
} }
if ($output == 'HTML' || $output == 'PDF') { if ($output === 'HTML' || $output === 'PDF') {
return graph_nodata_image(300, 110, 'data'); return graph_nodata_image(300, 110, 'data');
} }
} }

View File

@ -1845,14 +1845,25 @@ function reporting_event_report_group(
} }
$id_meta = 0; $id_meta = 0;
$node_historical_event_enbled = '';
if (is_metaconsole() === true && empty($content['server_name']) === false) { if (is_metaconsole() === true && empty($content['server_name']) === false) {
$id_meta = metaconsole_get_id_server($content['server_name']); $id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta); $server = metaconsole_get_connection_by_id($id_meta);
metaconsole_connect($server); metaconsole_connect($server);
// Check if node historical event is enable.
$sql = sprintf(
'SELECT value
FROM tconfig
WHERE token LIKE "history_event_enabled"'
);
$result = db_get_row_sql($sql);
$node_historical_event_enbled = $result['value'];
} }
$history = false; $history = false;
if ($config['history_event_enabled']) { if ($config['history_event_enabled'] || $node_historical_event_enbled) {
$history = true; $history = true;
} }

View File

@ -665,7 +665,7 @@ function reports_get_report_types($template=false, $not_editor=false)
]; ];
$types['sql_graph_hbar'] = [ $types['sql_graph_hbar'] = [
'optgroup' => __('Graphs'), 'optgroup' => __('Graphs'),
'name' => __('SQL horizonal bar graph'), 'name' => __('SQL horizontal bar graph'),
]; ];
} }
@ -723,15 +723,15 @@ function reports_get_report_types($template=false, $not_editor=false)
$types['avg_value'] = [ $types['avg_value'] = [
'optgroup' => __('Modules'), 'optgroup' => __('Modules'),
'name' => __('Avg. Value'), 'name' => __('Avg. value'),
]; ];
$types['max_value'] = [ $types['max_value'] = [
'optgroup' => __('Modules'), 'optgroup' => __('Modules'),
'name' => __('Max. Value'), 'name' => __('Max. value'),
]; ];
$types['min_value'] = [ $types['min_value'] = [
'optgroup' => __('Modules'), 'optgroup' => __('Modules'),
'name' => __('Min. Value'), 'name' => __('Min. value'),
]; ];
$types['monitor_report'] = [ $types['monitor_report'] = [
'optgroup' => __('Modules'), 'optgroup' => __('Modules'),

View File

@ -511,6 +511,11 @@ function tags_update_policy_module_tag($id_policy_module, $tags, $autocommit=fal
} }
} }
if ($errn > 0) {
return false;
} else {
return true;
}
} }

View File

@ -5047,11 +5047,7 @@ function ui_print_agent_autocomplete_input($parameters)
$metaconsole_enabled = $parameters['metaconsole_enabled']; $metaconsole_enabled = $parameters['metaconsole_enabled'];
} else { } else {
// If metaconsole_enabled param is not setted then pick source configuration. // If metaconsole_enabled param is not setted then pick source configuration.
if (defined('METACONSOLE')) { $metaconsole_enabled = is_metaconsole();
$metaconsole_enabled = true;
} else {
$metaconsole_enabled = false;
}
} }
$get_only_string_modules = false; $get_only_string_modules = false;
@ -5161,6 +5157,12 @@ function ui_print_agent_autocomplete_input($parameters)
} }
'; ';
} else if ($from_wux_transaction != '') { } else if ($from_wux_transaction != '') {
if (is_metaconsole() === true) {
$inputNode = 'inputs.push ("server_id=" + $("#'.$input_id_server_id.'").val());';
} else {
$inputNode = '';
}
$javascript_code_function_select = ' $javascript_code_function_select = '
function function_select_'.$input_name.'(agent_name) { function function_select_'.$input_name.'(agent_name) {
$("#'.$selectbox_id.'").empty(); $("#'.$selectbox_id.'").empty();
@ -5169,6 +5171,7 @@ function ui_print_agent_autocomplete_input($parameters)
inputs.push ("id_agent=" + $("#'.$hidden_input_idagent_id.'").val()); inputs.push ("id_agent=" + $("#'.$hidden_input_idagent_id.'").val());
inputs.push ("get_agent_transactions=1"); inputs.push ("get_agent_transactions=1");
inputs.push ("page=enterprise/include/ajax/wux_transaction.ajax"); inputs.push ("page=enterprise/include/ajax/wux_transaction.ajax");
'.$inputNode.'
jQuery.ajax ({ jQuery.ajax ({
data: inputs.join ("&"), data: inputs.join ("&"),
@ -5457,14 +5460,11 @@ function ui_print_agent_autocomplete_input($parameters)
server_name = ui.item.ip; server_name = ui.item.ip;
} }
if (('.((int) $use_input_id_server).') if (('.((int) $use_input_id_server).')
|| ('.((int) $print_input_id_server).')) { || ('.((int) $print_input_id_server).')) {
server_id = ui.item.id_server; server_id = ui.item.id_server;
} }
//Put the name //Put the name
$(this).val(agent_name); $(this).val(agent_name);

View File

@ -169,6 +169,11 @@ function pandoraFlotPieCustom(
var label_conf; var label_conf;
var show_legend = true; var show_legend = true;
// Set default value if not come like a number.
if (isNaN(width) === true) {
width = 451;
}
if (width <= 450) { if (width <= 450) {
show_legend = false; show_legend = false;
label_conf = { label_conf = {
@ -222,6 +227,9 @@ function pandoraFlotPieCustom(
conf_pie.series.pie.label = { show: false }; conf_pie.series.pie.label = { show: false };
} }
// Avoid issues with 0 width values.
$("#" + graph_id).width(width);
var plot = $.plot($("#" + graph_id), data, conf_pie); var plot = $.plot($("#" + graph_id), data, conf_pie);
if (no_data == data.length) { if (no_data == data.length) {
$("#" + graph_id + " .overlay").remove(); $("#" + graph_id + " .overlay").remove();

View File

@ -170,7 +170,7 @@ function flot_area_graph(
// Set some containers to legend, graph, timestamp tooltip, etc. // Set some containers to legend, graph, timestamp tooltip, etc.
if ($params['show_legend']) { if ($params['show_legend']) {
$return .= '<p id="legend_'.$graph_id.'" style="text-align:left; width: '.$params['width'].'px;"></p>'; $return .= '<p id="legend_'.$graph_id.'" class="legend_background" style="text-align:left; width: '.$params['width'].'px;"></p>';
} }
if (isset($params['graph_combined']) === true && $params['graph_combined'] if (isset($params['graph_combined']) === true && $params['graph_combined']
@ -763,7 +763,8 @@ function flot_slicesbar_graph(
$height = ((int) $height + 15); $height = ((int) $height + 15);
$style = 'width:'.$width.'%;'; $style = 'width:'.$width.'%;';
$style .= 'height:'.$height.'px;'; // Fixed height size.
$style .= 'height: 100%;';
$return = "<div id='".$graph_id."' class='noresizevc graph ".$adapt_key."' style='".$style."'></div>"; $return = "<div id='".$graph_id."' class='noresizevc graph ".$adapt_key."' style='".$style."'></div>";
$return .= "<div id='value_".$graph_id."' class='flot_container'></div>"; $return .= "<div id='value_".$graph_id."' class='flot_container'></div>";

View File

@ -2784,7 +2784,7 @@ function donutNarrowGraph(
arc = d3.svg arc = d3.svg
.arc() .arc()
.outerRadius(radius) .outerRadius(radius)
.innerRadius(radius - radius / 2.5); .innerRadius(radius - radius / 6);
svg = donutbody svg = donutbody
.append("svg") .append("svg")

View File

@ -281,11 +281,11 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
$.each(data, function(i, val) { $.each(data, function(i, val) {
var s = js_html_entity_decode(val); var s = js_html_entity_decode(val);
s = s.replace(/"/g, "&quot;").replace(/'/g, "&apos;");
i = i.replace(/"/g, "&quot;").replace(/'/g, "&apos;");
$("#module").append( $("#module").append(
$("<option></option>") $('<option value="' + i + '" title="' + s + '"></option>').text(val)
.html(s)
.attr("value", i)
.attr("title", s)
); );
all_common_modules.push(i); all_common_modules.push(i);
@ -385,12 +385,11 @@ function agent_changed_by_multiple_agents_with_alerts(
} }
} }
jQuery.each(data, function(i, val) { jQuery.each(data, function(i, val) {
s = js_html_entity_decode(val); var s = js_html_entity_decode(val);
$("#module").append(
$("<option></option>") s = s.replace(/"/g, "&quot;").replace(/'/g, "&apos;");
.html(s)
.attr("value", val) $("#module").append($('<option value="' + s + '"></option>').text(val));
);
$("#module").fadeIn("normal"); $("#module").fadeIn("normal");
}); });
if (selected != undefined) $("#module").attr("value", selected); if (selected != undefined) $("#module").attr("value", selected);
@ -481,12 +480,22 @@ function alert_templates_changed_by_multiple_agents_with_alerts(
} }
} }
jQuery.each(data, function(i, val) { jQuery.each(data, function(i, val) {
s = js_html_entity_decode(val); var decoded_val = js_html_entity_decode(val);
decoded_val = decoded_val
.replace(/"/g, "&quot;")
.replace(/'/g, "&apos;");
$("#module").append( $("#module").append(
$("<option></option>") $(
.html(s) '<option value="' +
.attr("value", val) decoded_val +
'" title="' +
decoded_val +
'"></option>'
).text(val)
); );
$("#module").fadeIn("normal"); $("#module").fadeIn("normal");
}); });
if (selected != undefined) $("#module").attr("value", selected); if (selected != undefined) $("#module").attr("value", selected);

View File

@ -809,6 +809,7 @@ function dashboardLoadWuxStats(settings) {
page: settings.page, page: settings.page,
wux_transaction_stats: 1, wux_transaction_stats: 1,
id_agent: settings.id_agent, id_agent: settings.id_agent,
server_id: settings.server_id,
transaction: settings.transaction, transaction: settings.transaction,
view_all_stats: settings.view_all_stats, view_all_stats: settings.view_all_stats,
auth_class: settings.auth_class, auth_class: settings.auth_class,
@ -844,6 +845,8 @@ function processTreeSearch(settings) {
filters.statusModule = settings.statusModule; filters.statusModule = settings.statusModule;
filters.groupID = settings.searchGroup; filters.groupID = settings.searchGroup;
filters.searchHirearchy = 1; filters.searchHirearchy = 1;
filters.show_not_init_agents = 1;
filters.show_not_init_modules = 1;
$.ajax({ $.ajax({
type: "POST", type: "POST",
@ -1144,6 +1147,11 @@ function dashboardLoadVC(settings) {
return item; return item;
}); });
settings.items.map(function(item) {
item["cellId"] = settings.cellId;
return item;
});
createVisualConsole( createVisualConsole(
container, container,
settings.props, settings.props,

View File

@ -315,9 +315,9 @@ class AgentModuleWidget extends Widget
function ($carry, $item) { function ($carry, $item) {
$d = explode('|', $item); $d = explode('|', $item);
if (isset($d[1]) === true) { if (isset($d[1]) === true) {
$carry[] = $d[1]; $carry[] = \io_safe_output($d[1]);
} else { } else {
$carry[] = $item; $carry[] = \io_safe_output($item);
} }
return $carry; return $carry;
@ -424,7 +424,7 @@ class AgentModuleWidget extends Widget
foreach ($allModules as $module_name) { foreach ($allModules as $module_name) {
$file_name = ui_print_truncate_text( $file_name = ui_print_truncate_text(
$module_name, \io_safe_output($module_name),
'module_small', 'module_small',
false, false,
true, true,
@ -466,7 +466,7 @@ class AgentModuleWidget extends Widget
} }
$file_name = \ui_print_truncate_text( $file_name = \ui_print_truncate_text(
$row['agent_alias'], \io_safe_output($row['agent_alias']),
'agent_small', 'agent_small',
false, false,
true, true,
@ -636,13 +636,13 @@ class AgentModuleWidget extends Widget
} }
// Extract info all modules selected. // Extract info all modules selected.
$target_modules = $this->values['mModules'];
if (is_metaconsole() === true) {
$target_modules = explode( $target_modules = explode(
self::MODULE_SEPARATOR, self::MODULE_SEPARATOR,
$this->values['mModules'] $this->values['mModules']
); );
if (is_metaconsole() === true
&& $this->values['mShowCommonModules'] === '0'
) {
$all_modules = $target_modules; $all_modules = $target_modules;
} else { } else {
$all_modules = Module::search( $all_modules = Module::search(
@ -661,8 +661,13 @@ class AgentModuleWidget extends Widget
if (is_object($item) === true) { if (is_object($item) === true) {
$carry[$item->name()] = null; $carry[$item->name()] = null;
} else { } else {
if ((is_metaconsole() === true
&& $this->values['mShowCommonModules'] !== '1')
|| is_metaconsole() === false
) {
$carry[$item] = null; $carry[$item] = null;
} }
}
return $carry; return $carry;
} }
@ -699,9 +704,19 @@ class AgentModuleWidget extends Widget
if (is_metaconsole() === true if (is_metaconsole() === true
&& $this->values['mShowCommonModules'] === '1' && $this->values['mShowCommonModules'] === '1'
) { ) {
// MC should connect to nodes and retrieve information
// from targets.
$modules = $agent->searchModules( $modules = $agent->searchModules(
['id_agente_modulo' => $target_modules] ['id_agente_modulo' => $target_modules]
); );
foreach ($modules as $module) {
if ($module === null) {
$reduceAllModules[] = null;
} else {
$reduceAllModules[$module->name()] = null;
}
}
} else { } else {
$modules = $agent->searchModules( $modules = $agent->searchModules(
['nombre' => array_keys($reduceAllModules)] ['nombre' => array_keys($reduceAllModules)]
@ -714,10 +729,6 @@ class AgentModuleWidget extends Widget
continue; continue;
} }
if ((bool) is_metaconsole() === true) {
$reduceAllModules[$module->name()] = null;
}
$visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado(); $visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado();
} }
@ -729,7 +740,6 @@ class AgentModuleWidget extends Widget
} }
} }
ksort($reduceAllModules);
$allModules = array_keys($reduceAllModules); $allModules = array_keys($reduceAllModules);
if ($allModules === null) { if ($allModules === null) {
$allModules = []; $allModules = [];

View File

@ -529,11 +529,11 @@ class EventsListWidget extends Widget
if ($customFilter !== false) { if ($customFilter !== false) {
$filter = $customFilter; $filter = $customFilter;
$filter['tag_with'] = base64_encode( $filter['tag_with'] = base64_encode(
json_encode($filter['tag_with']) io_safe_output($filter['tag_with'])
); );
$filter['tag_without'] = base64_encode( $filter['tag_without'] = base64_encode(
json_encode($filter['tag_without']) io_safe_output($filter['tag_without'])
); );
if (!empty($filter['id_agent_module'])) { if (!empty($filter['id_agent_module'])) {

View File

@ -414,10 +414,32 @@ class TopNWidget extends Widget
$quantity $quantity
); );
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
$modules = [];
foreach ($servers as $server) {
if (metaconsole_connect(null, $server['id']) !== NOERR) {
continue;
}
$modules = array_merge(
$modules,
@db_get_all_rows_sql(
$sql,
$search_in_history_db
)
);
metaconsole_restore_db();
}
} else {
$modules = @db_get_all_rows_sql( $modules = @db_get_all_rows_sql(
$sql, $sql,
$search_in_history_db $search_in_history_db
); );
}
if (empty($modules) === true) { if (empty($modules) === true) {
$output .= '<div class="container-center">'; $output .= '<div class="container-center">';

View File

@ -367,6 +367,8 @@ class TopNEventByGroupWidget extends Widget
$this->values['groupId'] = explode(',', $this->values['groupId'][0]); $this->values['groupId'] = explode(',', $this->values['groupId'][0]);
$event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
if (empty($this->values['groupId']) === true) { if (empty($this->values['groupId']) === true) {
$output .= '<div class="container-center">'; $output .= '<div class="container-center">';
$output .= \ui_print_info_message( $output .= \ui_print_info_message(
@ -388,12 +390,13 @@ class TopNEventByGroupWidget extends Widget
if ($all_group === false) { if ($all_group === false) {
$sql = sprintf( $sql = sprintf(
'SELECT id_agente, COUNT(*) AS count 'SELECT id_agente, COUNT(*) AS count
FROM tevento FROM %s
WHERE utimestamp >= %d WHERE utimestamp >= %d
AND id_grupo IN (%s) AND id_grupo IN (%s)
GROUP BY id_agente GROUP BY id_agente
ORDER BY count DESC ORDER BY count DESC
LIMIT %d', LIMIT %d',
$event_table,
$timestamp, $timestamp,
implode(',', $this->values['groupId']), implode(',', $this->values['groupId']),
$this->values['amountShow'] $this->values['amountShow']
@ -401,11 +404,12 @@ class TopNEventByGroupWidget extends Widget
} else { } else {
$sql = sprintf( $sql = sprintf(
'SELECT id_agente, COUNT(*) AS count 'SELECT id_agente, COUNT(*) AS count
FROM tevento FROM %s
WHERE utimestamp >= %d WHERE utimestamp >= %d
GROUP BY id_agente GROUP BY id_agente
ORDER BY count DESC ORDER BY count DESC
LIMIT %d', LIMIT %d',
$event_table,
$timestamp, $timestamp,
$this->values['amountShow'] $this->values['amountShow']
); );
@ -427,11 +431,20 @@ class TopNEventByGroupWidget extends Widget
foreach ($result as $row) { foreach ($result as $row) {
if ($row['id_agente'] == 0) { if ($row['id_agente'] == 0) {
$name = __('System'); $name = __('System');
} else {
if (is_metaconsole() === true) {
$name = (string) db_get_value(
'alias',
'tmetaconsole_agent',
'id_tagente',
(int) $row['id_agente']
);
} else { } else {
$name = io_safe_output( $name = io_safe_output(
agents_get_alias($row['id_agente']) agents_get_alias($row['id_agente'])
); );
} }
}
$name .= ' ('.$row['count'].')'; $name .= ' ('.$row['count'].')';

View File

@ -365,6 +365,8 @@ class TopNEventByModuleWidget extends Widget
$this->values['groupId'] = explode(',', $this->values['groupId'][0]); $this->values['groupId'] = explode(',', $this->values['groupId'][0]);
$event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
if (empty($this->values['groupId']) === true) { if (empty($this->values['groupId']) === true) {
$output = '<div class="container-center">'; $output = '<div class="container-center">';
$output .= \ui_print_info_message( $output .= \ui_print_info_message(
@ -389,12 +391,13 @@ class TopNEventByModuleWidget extends Widget
id_agentmodule, id_agentmodule,
event_type, event_type,
COUNT(*) AS count COUNT(*) AS count
FROM tevento FROM %s
WHERE utimestamp >= %d WHERE utimestamp >= %d
AND id_grupo IN (%s) AND id_grupo IN (%s)
GROUP BY id_agentmodule, event_type GROUP BY id_agentmodule, event_type
ORDER BY count DESC ORDER BY count DESC
LIMIT %d', LIMIT %d',
$event_table,
$timestamp, $timestamp,
implode(',', $this->values['groupId']), implode(',', $this->values['groupId']),
$this->values['amountShow'] $this->values['amountShow']
@ -405,11 +408,12 @@ class TopNEventByModuleWidget extends Widget
id_agentmodule, id_agentmodule,
event_type, event_type,
COUNT(*) AS count COUNT(*) AS count
FROM tevento FROM %s
WHERE utimestamp >= %d WHERE utimestamp >= %d
GROUP BY id_agentmodule, event_type GROUP BY id_agentmodule, event_type
ORDER BY count DESC ORDER BY count DESC
LIMIT %d', LIMIT %d',
$event_table,
$timestamp, $timestamp,
$this->values['amountShow'] $this->values['amountShow']
); );

View File

@ -259,7 +259,7 @@ class WuxWidget extends Widget
'label' => __('Wux transaction'), 'label' => __('Wux transaction'),
'arguments' => [ 'arguments' => [
'type' => 'autocomplete_module', 'type' => 'autocomplete_module',
'fields' => $fields, 'fields' => [],
'name' => 'transactionId', 'name' => 'transactionId',
'selected' => $values['transactionId'], 'selected' => $values['transactionId'],
'return' => true, 'return' => true,

View File

@ -270,7 +270,7 @@ class WuxStatsWidget extends Widget
'label' => __('Wux transaction'), 'label' => __('Wux transaction'),
'arguments' => [ 'arguments' => [
'type' => 'autocomplete_module', 'type' => 'autocomplete_module',
'fields' => $fields, 'fields' => [],
'name' => 'transactionId', 'name' => 'transactionId',
'selected' => $values['transactionId'], 'selected' => $values['transactionId'],
'return' => true, 'return' => true,
@ -326,6 +326,7 @@ class WuxStatsWidget extends Widget
{ {
global $config; global $config;
$server_id = ($this->values['node'] ?? '0');
$id_agent = $this->values['agentId']; $id_agent = $this->values['agentId'];
$transaction = $this->values['transactionId']; $transaction = $this->values['transactionId'];
$view_all_stats = $this->values['allStats']; $view_all_stats = $this->values['allStats'];
@ -340,6 +341,7 @@ class WuxStatsWidget extends Widget
false false
), ),
'page' => 'enterprise/include/ajax/wux_transaction.ajax', 'page' => 'enterprise/include/ajax/wux_transaction.ajax',
'server_id' => $server_id,
'id_agent' => $id_agent, 'id_agent' => $id_agent,
'transaction' => $transaction, 'transaction' => $transaction,
'view_all_stats' => $view_all_stats, 'view_all_stats' => $view_all_stats,

View File

@ -1517,6 +1517,20 @@ class Item extends CachedModel
$result['border_color'] = $border_color; $result['border_color'] = $border_color;
} }
$id_custom_graph = static::parseIntOr(
static::issetInArray(
$data,
[
'customGraphId',
'id_custom_graph',
]
),
null
);
if ($id_custom_graph !== null) {
$result['id_custom_graph'] = $id_custom_graph;
}
$linked_layout_node_id = static::parseIntOr( $linked_layout_node_id = static::parseIntOr(
static::issetInArray( static::issetInArray(
$data, $data,

View File

@ -356,10 +356,15 @@ class View extends \HTML
case MODULE_GRAPH: case MODULE_GRAPH:
$data['backgroundType'] = \get_parameter('backgroundType'); $data['backgroundType'] = \get_parameter('backgroundType');
$type = \get_parameter('choosetype');
$data['agentId'] = \get_parameter('agentId'); $data['agentId'] = \get_parameter('agentId');
$data['metaconsoleId'] = \get_parameter('metaconsoleId'); $data['metaconsoleId'] = \get_parameter('metaconsoleId');
$data['moduleId'] = \get_parameter('moduleId'); $data['moduleId'] = \get_parameter('moduleId');
$data['customGraphId'] = \get_parameter('customGraphId'); $data['customGraphId'] = \get_parameter('customGraphId');
if ($type === 'module') {
$data['customGraphId'] = 0;
}
$data['graphType'] = \get_parameter('graphType'); $data['graphType'] = \get_parameter('graphType');
$data['showLegend'] = \get_parameter_switch('showLegend'); $data['showLegend'] = \get_parameter_switch('showLegend');
$data['period'] = \get_parameter('period'); $data['period'] = \get_parameter('period');

View File

@ -5564,7 +5564,7 @@ div#bullets_modules div {
/* Agent details in agent view */ /* Agent details in agent view */
div#status_pie path { div#status_pie path {
stroke-width: 8px; stroke-width: 0px;
} }
div#status_pie { div#status_pie {
margin-bottom: 2em; margin-bottom: 2em;
@ -7208,7 +7208,7 @@ div.graph div.legend table {
} }
.bg_82B92E { .bg_82B92E {
background-color: #82b92e; background-color: #82b92e !important;
} }
.bg_B2B2B2 { .bg_B2B2B2 {
@ -7233,13 +7233,13 @@ div.graph div.legend table {
background-color: #eee; background-color: #eee;
} }
.bg_ffd { .bg_ffd {
background-color: #ffd036; background-color: #ffd036 !important;
} }
.bg_ff5 { .bg_ff5 {
background-color: #ff5653; background-color: #ff5653 !important;
} }
.bg_ff9 { .bg_ff9 {
background-color: #ff9e39; background-color: #ff9e39 !important;
} }
.bg_lightgray { .bg_lightgray {
background-color: lightgray; background-color: lightgray;
@ -8303,3 +8303,9 @@ div.stat-win-spinner img {
.line_height_12pt { .line_height_12pt {
line-height: 12pt; line-height: 12pt;
} }
.line_height_0pt {
line-height: 10pt !important;
}
#license_error_msg_dialog {
min-height: 350px !important;
}

View File

@ -308,6 +308,7 @@ table.black_table_modal_alternate tr:nth-child(even) td {
.action_buttons input[type="image"], .action_buttons input[type="image"],
.action_button_img { .action_button_img {
filter: brightness(4.5) contrast(50%); filter: brightness(4.5) contrast(50%);
background-color: transparent !important;
} }
a.pandora_pagination { a.pandora_pagination {
@ -398,7 +399,7 @@ table#diagnostic_info tbody td div {
} }
.ui-widget-content, .ui-widget-content,
.ui-widget-content a { .ui-widget-content a {
color: #fff; color: #fff !important;
} }
.ui-widget-content.ui-autocomplete a { .ui-widget-content.ui-autocomplete a {
@ -657,7 +658,8 @@ form ul.form_flex {
.graph_conteiner_inside, .graph_conteiner_inside,
.container_table, .container_table,
.second_background { .second_background,
.bg_color222 {
background-color: #222; background-color: #222;
} }
@ -1159,3 +1161,8 @@ a.pandora_pagination,
padding-right: 35px; padding-right: 35px;
background-color: #222; background-color: #222;
} }
.legend_background {
background-color: #222;
color: #fff !important;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -996,6 +996,7 @@ if (! isset($config['id_user'])) {
$iduser = $_SESSION['id_usuario']; $iduser = $_SESSION['id_usuario'];
unset($_SESSION['id_usuario']); unset($_SESSION['id_usuario']);
unset($iduser); unset($iduser);
$login_screen = 'disabled_access_node';
include_once 'general/login_page.php'; include_once 'general/login_page.php';
while (ob_get_length() > 0) { while (ob_get_length() > 0) {
ob_end_flush(); ob_end_flush();

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.756'; $version = '7.0NG.756';
$build = '210728'; $build = '210811';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -388,7 +388,7 @@ $table_contact->data[] = $data;
$data = []; $data = [];
$data[0] = '<b>'.__('Secondary groups').'</b>'; $data[0] = '<b>'.__('Secondary groups').'</b>';
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]); $secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
if (!$secondary_groups) { if (empty($secondary_groups['for_select']) === true) {
$data[1] = '<em>'.__('N/A').'</em>'; $data[1] = '<em>'.__('N/A').'</em>';
} else { } else {
$secondary_links = []; $secondary_links = [];

View File

@ -79,13 +79,16 @@ if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')) {
if ($refresh > 0) { if ($refresh > 0) {
$query = ui_get_url_refresh(false); $query = ui_get_url_refresh(false);
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />'; echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
if ($config['style'] === 'pandora_black') {
echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css"/>';
}
} }
?> ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo __('%s Snapshot data view for module (%s)', get_product_name(), $label); ?></title> <title><?php echo __('%s Snapshot data view for module (%s)', get_product_name(), $label); ?></title>
<script type='text/javascript' src='../../include/javascript/jquery-3.3.1.min.js'></script> <script type='text/javascript' src='../../include/javascript/jquery-3.3.1.min.js'></script>
</head> </head>
<body class='bg_000 grey'> <body class=''>
<?php <?php
echo "<h2 class='center' id='title_snapshot_view'>"; echo "<h2 class='center' id='title_snapshot_view'>";
echo __('Current data at %s', $last_timestamp); echo __('Current data at %s', $last_timestamp);

View File

@ -1498,7 +1498,7 @@ try {
$active_filters_div .= '<div class="label box-shadow">'.__('Current filter').'</div>'; $active_filters_div .= '<div class="label box-shadow">'.__('Current filter').'</div>';
$active_filters_div .= '<div id="current_filter" class="content">'; $active_filters_div .= '<div id="current_filter" class="content">';
if ($loaded_filter !== false) { if ($loaded_filter !== false) {
$active_filters_div .= io_safe_output($loaded_filter['id_name']); $active_filters_div .= htmlentities(io_safe_output($loaded_filter['id_name']));
} else { } else {
$active_filters_div .= __('Not set.'); $active_filters_div .= __('Not set.');
} }

View File

@ -352,12 +352,12 @@ if (is_metaconsole()) {
$filter_type = 0; $filter_type = 0;
} }
echo "<tr class='filter_save invisible'>"; echo "<tr class='filter_save' style='display: none;'>";
echo "<td colspan='6'>".ui_print_error_message('Define a name for the filter and click on Save as new filter again', '', true).'</td>'; echo "<td colspan='6'>".ui_print_error_message('Define a name for the filter and click on Save as new filter again', '', true).'</td>';
echo '</tr>'; echo '</tr>';
echo "<tr class='filter_save invisible'>"; echo "<tr class='filter_save' style='display: none;'>";
echo '<td><span id="filter_name_color"><b>'.__('Name').'</b></span></td>'; echo '<td><span id="filter_name_color"><b>'.__('Name').'</b></span></td>';
echo "<td colspan='2'>".html_print_input_text( echo "<td colspan='2'>".html_print_input_text(
@ -373,7 +373,7 @@ if (is_metaconsole()) {
echo "<td colspan='2'>".html_print_select_groups($config['id_user'], 'AR', $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false).'</td>'; echo "<td colspan='2'>".html_print_select_groups($config['id_user'], 'AR', $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false).'</td>';
echo '</tr>'; echo '</tr>';
$advanced_toggle = '<table class="w100p">'; $advanced_toggle = '<table style="width:100%">';
$advanced_toggle .= '<tr>'; $advanced_toggle .= '<tr>';
if ($netflow_disable_custom_lvfilters) { if ($netflow_disable_custom_lvfilters) {
@ -381,7 +381,7 @@ if (is_metaconsole()) {
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
} else { } else {
$advanced_toggle .= '<td><b>'.__('Filter').'</b></td>'; $advanced_toggle .= '<td><b>'.__('Filter').'</b></td>';
$advanced_toggle .= '<td colspan="2">'.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'class="mrgn_right_40px"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'class="mrgn_right_40px"', true).'</td>'; $advanced_toggle .= '<td colspan="2">'.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true).'</td>';
} }
@ -403,7 +403,7 @@ if (is_metaconsole()) {
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
} else { } else {
$advanced_toggle .= "<td class='bolder'>".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>'; $advanced_toggle .= "<td style='font-weight:bold;'>".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('ip_dst', $filter['ip_dst'], false, 40, 80, true).'</td>'; $advanced_toggle .= '<td colspan="2">'.html_print_input_text('ip_dst', $filter['ip_dst'], false, 40, 80, true).'</td>';
} }
@ -411,7 +411,7 @@ if (is_metaconsole()) {
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
} else { } else {
$advanced_toggle .= "<td class='bolder'>".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>'; $advanced_toggle .= "<td style='font-weight:bold;'>".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('ip_src', $filter['ip_src'], false, 40, 80, true).'</td>'; $advanced_toggle .= '<td colspan="2">'.html_print_input_text('ip_src', $filter['ip_src'], false, 40, 80, true).'</td>';
} }
@ -422,7 +422,7 @@ if (is_metaconsole()) {
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
} else { } else {
$advanced_toggle .= "<td class='bolder'>".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>'; $advanced_toggle .= "<td style='font-weight:bold;'>".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('dst_port', $filter['dst_port'], false, 40, 80, true).'</td>'; $advanced_toggle .= '<td colspan="2">'.html_print_input_text('dst_port', $filter['dst_port'], false, 40, 80, true).'</td>';
} }
@ -430,19 +430,19 @@ if (is_metaconsole()) {
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
} else { } else {
$advanced_toggle .= "<td class='bolder'>".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>'; $advanced_toggle .= "<td style='font-weight:bold;'>".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('src_port', $filter['src_port'], false, 40, 80, true).'</td>'; $advanced_toggle .= '<td colspan="2">'.html_print_input_text('src_port', $filter['src_port'], false, 40, 80, true).'</td>';
} }
$advanced_toggle .= '</tr>'; $advanced_toggle .= '</tr>';
$advanced_toggle .= "<tr class='filter_advance invisible'>"; $advanced_toggle .= "<tr class='filter_advance' style='display: none;'>";
if ($netflow_disable_custom_lvfilters) { if ($netflow_disable_custom_lvfilters) {
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
$advanced_toggle .= '<td></td>'; $advanced_toggle .= '<td></td>';
} else { } else {
$advanced_toggle .= '<td>'.ui_print_help_icon('pcap_filter', true).'</td>'; $advanced_toggle .= '<td>'.ui_print_help_icon('pcap_filter', true).'</td>';
$advanced_toggle .= "<td colspan='5'>".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "class='min-height-0px w90p'", true).'</td>'; $advanced_toggle .= "<td colspan='5'>".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true).'</td>';
} }
$advanced_toggle .= '</tr>'; $advanced_toggle .= '</tr>';
@ -490,14 +490,14 @@ if (is_metaconsole()) {
echo '</td></tr>'; echo '</td></tr>';
echo '</table>'; echo '</table>';
echo "<table width='100%' class='min-height-0px right'><tr><td>"; echo "<table class='' width='100%' style='border: 0px; text-align:right;'><tr><td>";
echo html_print_submit_button(__('Draw'), 'draw_button', false, 'class="sub upd"', true); echo html_print_submit_button(__('Draw'), 'draw_button', false, 'class="sub upd"', true);
if (!$netflow_disable_custom_lvfilters) { if (!$netflow_disable_custom_lvfilters) {
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
html_print_submit_button(__('Save as new filter'), 'save_button', false, ' class="sub upd mrgn_lft_5px" onClick="return defineFilterName();"'); html_print_submit_button(__('Save as new filter'), 'save_button', false, 'style="margin-left: 5px;" class="sub upd" onClick="return defineFilterName();"');
html_print_submit_button(__('Update current filter'), 'update_button', false, 'class="sub upd mrgn_lft_5px"'); html_print_submit_button(__('Update current filter'), 'update_button', false, 'style="margin-left: 5px;" class="sub upd"');
} }
} }
@ -670,11 +670,12 @@ if (is_metaconsole()) {
// Check right filter type // Check right filter type
$("#radiobtn0002").attr("checked", "checked"); $("#radiobtn0002").attr("checked", "checked");
} }
}); }
// Get filter values from DB // Get filter values from DB
<?php <?php
if (! defined('METACONSOLE')) { echo ');';
if (is_metaconsole() === false) {
echo 'jQuery.post ("ajax.php",'; echo 'jQuery.post ("ajax.php",';
} else { } else {
echo 'jQuery.post ("'.$config['homeurl'].'../../ajax.php",'; echo 'jQuery.post ("'.$config['homeurl'].'../../ajax.php",';
@ -701,8 +702,8 @@ if (is_metaconsole()) {
if (i == 'aggregate') if (i == 'aggregate')
$("#aggregate").val(val); $("#aggregate").val(val);
}); });
}, }
"json"); <?php echo ', "json");'; ?>
// Shows update filter button // Shows update filter button
$("#submit-update_button").show(); $("#submit-update_button").show();

View File

@ -195,8 +195,10 @@ if ($searchAgents) {
t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
t1.id_agente = $aux"; t1.id_agente = $aux";
if (count($id) >= 2) { $idCount = count($id);
for ($i = 1; $i < count($id); $i++) {
if ($idCount >= 2) {
for ($i = 1; $i < $idCount; $i++) {
$aux = $id[$i]['id_agent']; $aux = $id[$i]['id_agent'];
$search_sql .= " OR t1.id_agente = $aux"; $search_sql .= " OR t1.id_agente = $aux";
} }

View File

@ -1,24 +1,39 @@
<?php <?php
/**
* Data getter for policies searching
*
* @category Operation
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Get global data.
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config; global $config;
enterprise_include_once('include/functions_policies.php'); enterprise_include_once('include/functions_policies.php');
$searchpolicies = (bool) check_acl($config['id_user'], 0, 'AW');
$searchpolicies = check_acl($config['id_user'], 0, 'AW'); if ($searchpolicies === false) {
if (!$searchpolicies) {
$totalPolicies = 0; $totalPolicies = 0;
return; return;
} }
@ -38,6 +53,7 @@ switch ($sortField) {
case 'id': case 'id':
switch ($sort) { switch ($sort) {
case 'up': case 'up':
default:
$selectpolicieIDUp = $selected; $selectpolicieIDUp = $selected;
$order = [ $order = [
'field' => 'id', 'field' => 'id',
@ -58,6 +74,7 @@ switch ($sortField) {
case 'name': case 'name':
switch ($sort) { switch ($sort) {
case 'up': case 'up':
default:
$selectNameUp = $selected; $selectNameUp = $selected;
$order = [ $order = [
'field' => 'name', 'field' => 'name',
@ -78,6 +95,7 @@ switch ($sortField) {
case 'description': case 'description':
switch ($sort) { switch ($sort) {
case 'up': case 'up':
default:
$selectId_groupUp = $selected; $selectId_groupUp = $selected;
$order = [ $order = [
'field' => 'description', 'field' => 'description',
@ -98,6 +116,7 @@ switch ($sortField) {
case 'last_contact': case 'last_contact':
switch ($sort) { switch ($sort) {
case 'up': case 'up':
default:
$selectId_groupUp = $selected; $selectId_groupUp = $selected;
$order = [ $order = [
'field' => 'last_connect', 'field' => 'last_connect',
@ -118,6 +137,7 @@ switch ($sortField) {
case 'id_group': case 'id_group':
switch ($sort) { switch ($sort) {
case 'up': case 'up':
default:
$selectId_groupUp = $selected; $selectId_groupUp = $selected;
$order = [ $order = [
'field' => 'last_connect', 'field' => 'last_connect',
@ -138,6 +158,7 @@ switch ($sortField) {
case 'status': case 'status':
switch ($sort) { switch ($sort) {
case 'up': case 'up':
default:
$selectStatusUp = $selected; $selectStatusUp = $selected;
$order = [ $order = [
'field' => 'is_admin', 'field' => 'is_admin',
@ -174,11 +195,12 @@ switch ($sortField) {
break; break;
} }
if ($searchpolicies) { if ($searchpolicies === true) {
/* /*
We take the user groups to get policies that meet the requirements of the search We take the user groups to get policies that meet the requirements of the search
and which the user have permission on this groups and which the user have permission on this groups
*/ */
$user_groups = users_get_groups($config['id_user'], 'AR', false); $user_groups = users_get_groups($config['id_user'], 'AR', false);
$id_user_groups = array_keys($user_groups); $id_user_groups = array_keys($user_groups);
$id_user_groups_str = implode(',', $id_user_groups); $id_user_groups_str = implode(',', $id_user_groups);
@ -186,7 +208,15 @@ if ($searchpolicies) {
$sql = "SELECT id, name, description, id_group, status $sql = "SELECT id, name, description, id_group, status
FROM tpolicies FROM tpolicies
WHERE name LIKE '$stringSearchSQL' WHERE name LIKE '$stringSearchSQL'
AND id_group IN ($id_user_groups_str)"; AND
(id_group IN ($id_user_groups_str)
OR 1 = (
SELECT is_admin
FROM tusuario
WHERE id_user = 'admin'
)
)
";
} }
@ -194,11 +224,10 @@ if ($searchpolicies) {
$policies = db_process_sql($sql); $policies = db_process_sql($sql);
if ($policies !== false) { if ($policies !== false) {
$totalPolicies = count($policies); $totalPolicies = count($policies);
if ($only_count) { if ($only_count === true) {
unset($policies); unset($policies);
} }
} else { } else {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.756 %define version 7.0NG.756
%define release 210728 %define release 210811
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.756 %define version 7.0NG.756
%define release 210728 %define release 210811
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.756 %define version 7.0NG.756
%define release 210728 %define release 210811
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -105,7 +105,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('show_vc', 1), ('show_vc', 1),
('inventory_changes_blacklist', '1,2,20,21'), ('inventory_changes_blacklist', '1,2,20,21'),
('custom_report_front', 0), ('custom_report_front', 0),
('custom_report_front_font', 'lato.ttf'), ('custom_report_front_font', 'Lato-Regular.ttf'),
('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''), ('custom_report_front_header', ''),
('custom_report_front_footer', ''), ('custom_report_front_footer', ''),

View File

@ -5,25 +5,31 @@
#====================================================================== #======================================================================
# User and password for FTP connection # User and password for FTP connection
conf_ftp_user mario conf_ftp_user root
# Use "" if your password is in blank # Use "" if your password is in blank
conf_ftp_pass pulido conf_ftp_pass Password
#Port for FTP/SFTP connection
#conf_ftp_port 22
#Set this parameter to 1 if you want stablish an SFTP connection
conf_ftp_sftp 1
# Configure complete name of ftp file --> upload (Local) # Configure complete name of ftp file --> upload (Local)
conf_ftp_putfile /home/mariopc/Descargas/ejemplo.zip conf_ftp_putfile /tmp/test_upload.zip
# Configure name of ftp file --> upload (FTP server) # Configure name of ftp file --> upload (FTP server)
conf_ftp_putname prueba.zip conf_ftp_putname /tmp/test.zip
# Configure Ip for FTP Connection # Configure Ip for FTP Connection
conf_ftp_host localhost conf_ftp_host localhost
# Configure name of ftp file --> download (FTP server) # Configure name of ftp file --> download (FTP server)
conf_ftp_getfile prueba.zip conf_ftp_getfile /tmp/test.zip
# Configure complete name os ftp file --> download (Local) # Configure complete name os ftp file --> download (Local)
conf_ftp_getname prueba.zip conf_ftp_getname /tmp/test.zip
# Configure Operating System (Unix or Windows) # Configure Operating System (Unix or Windows)
conf_operating_system Unix conf_operating_system Unix
@ -34,10 +40,10 @@ conf_operating_system Unix
conf_ftp_compare write conf_ftp_compare write
conf_ftp_compare_file prueba.zip conf_ftp_compare_file /tmp/prueba.zip
conf_local_comp_file prueba.zip conf_local_comp_file /tmp/prueba.zip
conf_local_downcomp_file /tmp/prueba.zip conf_local_downcomp_file /tmp/prueba.zip

View File

@ -8,6 +8,7 @@ use strict;
use warnings; use warnings;
use Data::Dumper; use Data::Dumper;
use Net::FTP; use Net::FTP;
use Net::SFTP::Foreign;
use Time::HiRes qw ( gettimeofday ); use Time::HiRes qw ( gettimeofday );
my $archivo_cfg = $ARGV[0]; my $archivo_cfg = $ARGV[0];
@ -116,6 +117,14 @@ sub load_external_setup ($)
$plugin_setup{"conf_ftp_host"} = $1; $plugin_setup{"conf_ftp_host"} = $1;
} }
if ($parametro =~ m/^conf\_ftp\_port\s(.*)/i) {
$plugin_setup{"conf_ftp_port"} = $1;
}
if ($parametro =~ m/^conf\_ftp\_sftp\s(.*)/i) {
$plugin_setup{"conf_ftp_sftp"} = $1;
}
if ($parametro =~ m/^conf\_ftp\_putfile\s(.*)/i) { if ($parametro =~ m/^conf\_ftp\_putfile\s(.*)/i) {
$plugin_setup{"conf_ftp_putfile"} = $1; $plugin_setup{"conf_ftp_putfile"} = $1;
} }
@ -184,20 +193,38 @@ load_external_setup ($archivo_cfg);
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Start session in FTP server # Start session in FTP server
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
my $ftp;
my $ftp = Net::FTP->new($plugin_setup{"conf_ftp_host"}) or die("Unable to connect to server: $!");#Connect FTP server if (($plugin_setup{"conf_ftp_sftp"}) && ( $plugin_setup{"conf_ftp_sftp"} == 1)){
$ftp->login($plugin_setup{"conf_ftp_user"},$plugin_setup{"conf_ftp_pass"}) or die("Failed Login: $!");# Login at FTP server if ($plugin_setup{"conf_ftp_port"}){
#port => $plugin_setup{"port"},
$ftp = Net::SFTP::Foreign->new(host => $plugin_setup{"conf_ftp_host"}, port => $plugin_setup{"conf_ftp_port"}, stderr_discard => 1, user => $plugin_setup{"conf_ftp_user"} , password => $plugin_setup{"conf_ftp_pass"},expect_log_user => 'false');
if($ftp->error){
die($ftp->error);
}
}else{
$ftp = Net::SFTP::Foreign->new(host => $plugin_setup{"conf_ftp_host"}, stderr_discard => 1, user => $plugin_setup{"conf_ftp_user"} , password => $plugin_setup{"conf_ftp_pass"},expect_log_user => 'false');
if($ftp->error){
die($ftp->error);
}
}
} else {
if ($plugin_setup{"conf_ftp_port"}){
$ftp = Net::FTP->new(host => $plugin_setup{"conf_ftp_host"},port => $plugin_setup{"conf_ftp_port"}) or die("Unable to connect to server: $!");#Connect FTP server
}else{
$ftp = Net::FTP->new($plugin_setup{"conf_ftp_host"}) or die("Unable to connect to server: $!");#Connect FTP server
}
$ftp->login($plugin_setup{"conf_ftp_user"},$plugin_setup{"conf_ftp_pass"}) or die("Failed Login: $!");# Login at FTP server
#print_module ( "Disp_FTP_$plugin_setup{conf_ftp_host}" , "generic_proc", 1, " Determines whether FTP login to $plugin_setup{conf_ftp_host} has been successful or not" ); #print_module ( "Disp_FTP_$plugin_setup{conf_ftp_host}" , "generic_proc", 1, " Determines whether FTP login to $plugin_setup{conf_ftp_host} has been successful or not" );
}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Returns the module that shows the time and transfer rate.(Upload a file) # Returns the module that shows the time and transfer rate.(Upload a file)
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
my $clock0 = gettimeofday(); my $clock0 = gettimeofday();
$ftp->put($plugin_setup{"conf_ftp_putfile"},$plugin_setup{"conf_ftp_putname"});# Upload file at FTP server $ftp->put($plugin_setup{"conf_ftp_putfile"},$plugin_setup{"conf_ftp_putname"}) or die("Cannot upload file to server");# Upload file at FTP server
my $clock1 = gettimeofday(); my $clock1 = gettimeofday();
my $clockd = $clock1 - $clock0;# Calculate upload transfer time my $clockd = $clock1 - $clock0;# Calculate upload transfer time
$ftp->size($plugin_setup{"conf_ftp_putname"});# File size my $putrate = $ftp->stat($plugin_setup{"conf_ftp_putname"})->size/$clockd;# Calculate rate transfer
my $putrate = $ftp->size($plugin_setup{"conf_ftp_putname"})/$clockd;# Calculate rate transfer
my $time_puftp=sprintf("%.2f",$clockd); my $time_puftp=sprintf("%.2f",$clockd);
my $rate_puftp=sprintf("%.2f",$putrate); my $rate_puftp=sprintf("%.2f",$putrate);
@ -212,8 +239,8 @@ $ftp->login($plugin_setup{"conf_ftp_user"},$plugin_setup{"conf_ftp_pass"}) or di
$ftp->get($plugin_setup{"conf_ftp_getfile"},$plugin_setup{"conf_ftp_getname"}); $ftp->get($plugin_setup{"conf_ftp_getfile"},$plugin_setup{"conf_ftp_getname"});
my $clock3 = gettimeofday(); my $clock3 = gettimeofday();
my $clockg = $clock3 - $clock2; my $clockg = $clock3 - $clock2;
$ftp->size($plugin_setup{"conf_ftp_getname"}); #$ftp->stat($plugin_setup{"conf_ftp_getname"})->size;
my $getrate = $ftp->size($plugin_setup{"conf_ftp_getname"})/$clockg; my $getrate = $ftp->stat($plugin_setup{"conf_ftp_getname"})->size/$clockg;
my $time_getftp=sprintf("%.2f",$clockg); my $time_getftp=sprintf("%.2f",$clockg);
my $rate_getftp=sprintf("%.2f",$getrate); my $rate_getftp=sprintf("%.2f",$getrate);

View File

@ -102,6 +102,9 @@ def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterva
if graph.text == "Id does not exist in database.": if graph.text == "Id does not exist in database.":
print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation") print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation")
return None return None
if graph.text == "The user has not enough permissions for perform this action.":
print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation")
return None
except: except:
print("Error requested api url. skipping graph generation") print("Error requested api url. skipping graph generation")
return None return None

View File

@ -106,6 +106,9 @@ def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterva
if graph.text == "Id does not exist in database.": if graph.text == "Id does not exist in database.":
print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation") print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation")
return None return None
if graph.text == "The user has not enough permissions for perform this action.":
print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation")
return None
except: except:
print("Error requested api url. skipping graph generation") print("Error requested api url. skipping graph generation")

View File

@ -1,27 +1,169 @@
import requests, argparse, json, sys, os import requests, argparse, json, sys, os
from datetime import datetime
from base64 import b64decode
__version__='080621'
### Variables and arg parser ### ### Variables and arg parser ###
parser = argparse.ArgumentParser(description='Bot telegram cli') parser = argparse.ArgumentParser(description=f'Bot telegram cli, Version: {__version__}')
parser.add_argument('-m', '--message', help='Message to be send', required=True) parser.add_argument('-m', '--message', help='Message to be send', required=True)
parser.add_argument('-t', '--token', help='Bot token', required=True) parser.add_argument('-t', '--token', help='Bot token', required=True)
parser.add_argument('-c', '--chat_id', help='chat id to send messages', required=True) parser.add_argument('-c', '--chat_id', help='chat id to send messages', required=True)
parser.add_argument('--api_conf', help='Api configuration parameters in coma separate keypairs. EX "user=admin,pass=pandora,api_pass=1234,api_url=http://test.artica.es/pandora_console/include/api.php"')
parser.add_argument('--module_graph', help='Uses pandora API to generate a module graph and attach it to the alert needs module_id and interval parameters in coma separate keypairs. EX "module_id=55,interval=3600"')
parser.add_argument('--tmp_dir', help='Temporary path to store graph images', default='/tmp')
args = parser.parse_args() args = parser.parse_args()
def parse_dic(cValues):
"""convert coma separate keypairs into a dic. EX "test=5,house=8,market=2" wil return "{'test': '5', 'casa': '8', 'mercado': '2'}" """
data={}
try :
for kv in cValues.split(","):
k,v = kv.strip().split("=")
data[k.strip()]=v.strip()
except Exception as e :
print(f"Warning, error parsing keypairs values: {e}")
return data
def parse_api_conf(cConf):
"""Check apiconfiguration parameters """
if args.api_conf :
# Parse Api config
print ("Api config enable", file=sys.stderr)
apid = parse_dic(cConf)
if apid.get("user") is None:
print ("Warning. no user defined in api_conf keypairs, skiping graph generation.")
return None
if apid.get("pass") is None:
print ("Warning. no password defined in api_conf keypairs, skiping graph generation.")
return None
if apid.get("api_pass") is None:
print ("Warning. no api pass defined in api_conf keypairs, skiping graph generation.")
return None
if apid.get("api_url") is None:
apid['api_url'] = "http://127.0.0.1/pandora_console/include/api.php"
#print(f"api_url: {apid['api_url']}")
return apid
else:
return None
def parse_graph_conf(cGraph):
"""Check module graph parameters """
if cGraph :
# Parse Api config
graphd = parse_dic(cGraph)
if graphd.get("module_id") is None:
print ("Warning. no module_id defined in module_graph keypairs, skiping graph generation.")
return
if graphd.get("interval") is None:
graphd["interval"] = 3600
return graphd
else:
print("Warning. no module_graph keypairs defined, skiping graph generation")
return None
def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterval, sep="url_encode_separator_%7C") :
"""Call Pandorafms api to get graph"""
try:
url = f"{baseUrl}?op=get&op2=module_graph&id={moduleId}&other={graphInterval}%7C1&other_mode={sep}&apipass={apiPass}&api=1&user={pUser}&pass={pPass}"
graph = requests.get(url)
if graph.status_code != 200:
print (f"Error requested api url, status code: {graph.status_code}. Skiping graph generation")
return None
if graph.text == "auth error":
print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation")
return None
if graph.text == "Id does not exist in database.":
print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation")
return None
if graph.text == "The user has not enough permissions for perform this action.":
print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation")
return None
except:
print("Error requested api url. Skiping graph generation")
return None
return graph
def send(mssg, chatId, token): def send(mssg, chatId, token):
url = f"https://api.telegram.org/bot{token}/sendMessage" url = f"https://api.telegram.org/bot{token}/sendMessage"
headers = {'content-type': 'application/json'} headers = {'content-type': 'application/json'}
data = { data = {
"chat_id": chatId, "chat_id": chatId,
"text": mssg "text": mssg
} }
try:
response = requests.get(url, data=json.dumps(data), headers=headers) response = requests.get(url, data=json.dumps(data), headers=headers)
r = response.json() r = response.json()
print(r) print(r)
except Exception as e :
r = None
exit(f"Error requesting telegram api: {e}")
def sendMedia(mssg, chatId, token, filepath):
url = f"https://api.telegram.org/bot{token}/sendPhoto"
data = {
"chat_id": chatId,
"caption": mssg
}
try:
with open(filepath, "rb") as photog:
request = requests.post(url, data=data, files={'photo': (filepath, photog)})
r = request.json()
except Exception as e :
r = None
print(f"Error, cant add graph file: {e}")
if r is not None:
r = request.json()
print(r)
# Parse api config
filecap=None
if args.api_conf :
api = parse_api_conf(args.api_conf)
# Parse graph config
if api is not None:
graph_cfg = parse_graph_conf(args.module_graph)
## Generate graph
if graph_cfg is not None :
graph = get_graph_by_moduleid (api["api_url"],api["user"], api["pass"], api["api_pass"], graph_cfg["module_id"], graph_cfg["interval"])
if graph is not None:
try:
filename = f"{args.tmp_dir}/graph_{graph_cfg['module_id']}.{datetime.now().strftime('%s')}.png"
with open(filename, "wb") as f:
f.write(b64decode(graph.text))
f.close
print (f"Graph generated on temporary file {filename}", file=sys.stderr)
except Exception as e :
print(f"Error, cant generate graph file: {e}", file=sys.stderr)
filename = None
else: filename = None
if filename is not None:
filecap=f"graph_{graph_cfg['module_id']}.{datetime.now().strftime('%s')}.png"
# Send message
send(mssg=args.message, chatId=args.chat_id, token=args.token) send(mssg=args.message, chatId=args.chat_id, token=args.token)
if filecap is not None:
sendMedia(mssg='', chatId=args.chat_id, token=args.token, filepath=filename)
try:
os.remove(filename)
except Exception as e:
exit('Error: {e}')

View File

@ -4,3 +4,6 @@ python3 pandora-telegram-cli.py -t 1412764845:AAG-OxOKISOXwhITLFFNm6oq5YD2KI72fT
# Pandora FMS command definition example # Pandora FMS command definition example
python3 pandora-telegram-cli.py -t _field1_ -c _field2_ -m" _field3_" python3 pandora-telegram-cli.py -t _field1_ -c _field2_ -m" _field3_"
# New
python3 pandora-telegram-cli.py -m 'test message for telegram new bot script' -t 1874294647:AAHRBk4YDf1QZXh_WuZ8m7ONrAQoKbTW6eQ -c -261593656 --api_conf "user=admin,pass=pandora,api_pass=pandora,api_url=http://192.168.80.44:8080/pandora_console/include/api.php" --module_graph "module_id=402, interval=3600" --tmp_dir /tmp

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.756-210728 Version: 7.0NG.756-210811
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.756-210728" pandora_version="7.0NG.756-210811"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.756"; my $pandora_version = "7.0NG.756";
my $pandora_build = "210728"; my $pandora_build = "210811";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -1424,11 +1424,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
my $threshold = shift; my $threshold = shift;
my $period = $hours * 3600; # Hours to seconds my $period = $hours * 3600; # Hours to seconds
if($threshold == 0){ if($threshold == 0){
$params->{"other"} = $period . '%7C1%7C0%7C225'; $params->{"other"} = $period . '%7C1%7C0%7C225%7C""%7C14';
$cid = 'module_graph_' . $hours . 'h'; $cid = 'module_graph_' . $hours . 'h';
} }
else{ else{
$params->{"other"} = $period . '%7C1%7C1%7C225'; $params->{"other"} = $period . '%7C1%7C1%7C225%7C""%7C14';
$cid = 'module_graphth_' . $hours . 'h'; $cid = 'module_graphth_' . $hours . 'h';
} }
@ -1651,7 +1651,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
$field20 = subst_alert_macros ($field20, \%macros, $pa_config, $dbh, $agent, $module, $alert); $field20 = subst_alert_macros ($field20, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# Field 1 (Integria IMS API path) # Field 1 (Integria IMS API path)
my $api_path = $config_api_path . "/integria/include/api.php"; my $api_path = $config_api_path . "/include/api.php";
# Field 2 (Integria IMS API pass) # Field 2 (Integria IMS API pass)
my $api_pass = $config_api_pass; my $api_pass = $config_api_pass;
@ -3983,13 +3983,66 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
$alert_data .= " Custom: $trap_custom_oid"; $alert_data .= " Custom: $trap_custom_oid";
} }
# Assign default values to the _snmp_fx_ macros from variable bindings # Parse variables data.
my @custom_values = split("\t", $trap_custom_oid);
# Evaluate variable filters
my $filter_match = 1;
for (my $i = 1; $i <= 20; $i++) {
my $order_field = $alert->{'order_'.$i} - 1;
# Only values greater than 0 allowed.
next if $order_field < 0;
my $filter_name = '_snmp_f' . $i . '_';
my $filter_regex = safe_output ($alert->{$filter_name});
my $field_value = $custom_values[$order_field];
# No filter for the current binding var
next if ($filter_regex eq '');
# The referenced binding var does not exist
if (! defined ($field_value)) {
$filter_match = 0;
last;
}
# Evaluate the filter
eval {
local $SIG{__DIE__};
if ($field_value !~ m/$filter_regex/) {
$filter_match = 0;
}
};
# Probably an invalid regexp
if ($@) {
# Filter is ignored.
logger($pa_config, "Invalid regex in SNMP alert #".$alert->{'id_as'}.": [".$filter_regex."]", 3);
# Invalid regex are ignored, test next variables.
next;
}
# The filter did not match
last if ($filter_match == 0);
}
# A filter did not match
next if ($filter_match == 0);
# Assign values to _snmp_fx_ macros.
my $count; my $count;
my @custom_values = split ("\t", $trap_custom_oid); for ($count = 0; defined ($custom_values[$count]); $count++) {
for ($count = 1; defined ($custom_values[$count-1]); $count++) { my $macro_name = '_snmp_f' . ($count+1) . '_';
my $macro_name = '_snmp_f' . $count . '_'; my $target = $custom_values[$count];
my $order_field = $alert->{'order_'.$count};
if ($custom_values[$count] =~ m/= \S+: (.*)/) { if (!defined($target)) {
# Ignore emtpy data.
$macros{$macro_name} = '';
next;
}
if ($target =~ m/= \S+: (.*)/) {
my $value = $1; my $value = $1;
# Strip leading and trailing double quotes # Strip leading and trailing double quotes
@ -4010,40 +4063,6 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
# All variables # All variables
$macros{'_snmp_argv_'} = $trap_custom_oid; $macros{'_snmp_argv_'} = $trap_custom_oid;
# Evaluate _snmp_fx_ filters
my $filter_match = 1;
for (my $i = 1; $i <= 10; $i++) {
my $filter_name = '_snmp_f' . $i . '_';
my $filter_value = safe_output ($alert->{$filter_name});
# No filter for the current binding var
next if ($filter_value eq '');
# The referenced binding var does not exist
if (! defined ($macros{$filter_name})) {
$filter_match = 0;
last;
}
# Evaluate the filter
eval {
if ($macros{$filter_name} !~ m/$filter_value/) {
$filter_match = 0;
}
};
# Probably an invalid regexp
if ($@) {
last;
}
# The filter did not match
last if ($filter_match == 0);
}
# A filter did not match
next if ($filter_match == 0);
# Replace macros # Replace macros
$alert->{'al_field1'} = subst_alert_macros ($alert->{'al_field1'}, \%macros); $alert->{'al_field1'} = subst_alert_macros ($alert->{'al_field1'}, \%macros);
$alert->{'al_field2'} = subst_alert_macros ($alert->{'al_field2'}, \%macros); $alert->{'al_field2'} = subst_alert_macros ($alert->{'al_field2'}, \%macros);
@ -6458,7 +6477,7 @@ sub pandora_sync_agents_integria ($) {
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', ''); my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', ''); my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
my $api_path = $config_api_path . "/integria/include/api.php"; my $api_path = $config_api_path . "/include/api.php";
my @agents_string = ''; my @agents_string = '';
my @agents = get_db_rows ($dbh, 'SELECT * FROM tagente'); my @agents = get_db_rows ($dbh, 'SELECT * FROM tagente');
@ -6506,7 +6525,7 @@ sub pandora_get_integria_ticket_types($) {
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', ''); my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', ''); my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
my $api_path = $config_api_path . "/integria/include/api.php"; my $api_path = $config_api_path . "/include/api.php";
my $call_api = $api_path . '?' . my $call_api = $api_path . '?' .
'user=' . $config_integria_user . '&' . 'user=' . $config_integria_user . '&' .

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.756"; my $pandora_version = "7.0NG.756";
my $pandora_build = "210728"; my $pandora_build = "210811";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.756 %define version 7.0NG.756
%define release 210728 %define release 210811
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.756 %define version 7.0NG.756
%define release 210728 %define release 210811
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.756" PI_VERSION="7.0NG.756"
PI_BUILD="210728" PI_BUILD="210811"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.756 Build 210728"; my $version = "7.0NG.756 Build 210811";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -171,8 +171,9 @@ sub ha_keep_pandora_running($$) {
'SELECT count(*) AS "delayed" 'SELECT count(*) AS "delayed"
FROM tserver FROM tserver
WHERE ((status = -1) OR ( (unix_timestamp() - unix_timestamp(keepalive)) > (server_keepalive+1) AND status != 0 )) WHERE ((status = -1) OR ( (unix_timestamp() - unix_timestamp(keepalive)) > (server_keepalive+1) AND status != 0 ))
AND server_type != ? AND name = ?', AND server_type NOT IN (?, ?) AND name = ?',
PandoraFMS::Tools::SATELLITESERVER, PandoraFMS::Tools::SATELLITESERVER,
PandoraFMS::Tools::MFSERVER,
$conf->{'servername'} $conf->{'servername'}
); );

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.756 Build 210728"; my $version = "7.0NG.756 Build 210811";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);

View File

@ -64,6 +64,7 @@ export interface ItemProps extends Position, Size {
aclGroupId: number | null; aclGroupId: number | null;
cacheExpiration: number | null; cacheExpiration: number | null;
colorStatus: string; colorStatus: string;
cellId: number | null;
} }
export interface ItemClickEvent { export interface ItemClickEvent {
@ -140,6 +141,7 @@ export function itemBasePropsDecoder(data: AnyObject): ItemProps | never {
aclGroupId: parseIntOr(data.aclGroupId, null), aclGroupId: parseIntOr(data.aclGroupId, null),
cacheExpiration: parseIntOr(data.cacheExpiration, null), cacheExpiration: parseIntOr(data.cacheExpiration, null),
colorStatus: notEmptyStringOr(data.colorStatus, "#CCC"), colorStatus: notEmptyStringOr(data.colorStatus, "#CCC"),
cellId: parseIntOr(data.cellId, null),
...sizePropsDecoder(data), // Object spread. It will merge the properties of the two objects. ...sizePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
...positionPropsDecoder(data) // Object spread. It will merge the properties of the two objects. ...positionPropsDecoder(data) // Object spread. It will merge the properties of the two objects.
}; };

View File

@ -115,6 +115,12 @@ export default class Odometer extends Item<OdometerProps> {
"visual-console-container" "visual-console-container"
) as HTMLElement; ) as HTMLElement;
if (backgroundColor === null) {
backgroundColor = document.getElementById(
`visual-console-container-${this.props.cellId}`
) as HTMLElement;
}
if (backgroundColor.style.backgroundColor == "") { if (backgroundColor.style.backgroundColor == "") {
backgroundColor.style.backgroundColor = "#fff"; backgroundColor.style.backgroundColor = "#fff";
} }