Merge branch 'develop' into 'ent-5135-No-funciona-la-exploracion-SNMP-remota'

# Conflicts:
#   pandora_console/extras/mr/35.sql
This commit is contained in:
Alejandro Campos 2020-01-15 17:12:32 +01:00
commit c389769602
52 changed files with 466 additions and 201 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.742-200113 Version: 7.0NG.742-200115
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.742-200113" pandora_version="7.0NG.742-200115"
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

@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.742'; use constant AGENT_VERSION => '7.0NG.742';
use constant AGENT_BUILD => '200113'; use constant AGENT_BUILD => '200115';
# 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.742 %define version 7.0NG.742
%define release 200113 %define release 200115
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.742 %define version 7.0NG.742
%define release 200113 %define release 200115
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.742" PI_VERSION="7.0NG.742"
PI_BUILD="200113" PI_BUILD="200115"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{200113} {200115}
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.742(Build 200113)") #define PANDORA_VERSION ("7.0NG.742(Build 200115)")
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.742(Build 200113))" VALUE "ProductVersion", "(7.0NG.742(Build 200115))"
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.742-200113 Version: 7.0NG.742-200115
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.742-200113" pandora_version="7.0NG.742-200115"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -64,9 +64,11 @@ if (!empty($files)) {
$document_root = str_replace('\\', '/', io_safe_output($_SERVER['DOCUMENT_ROOT'])); $document_root = str_replace('\\', '/', io_safe_output($_SERVER['DOCUMENT_ROOT']));
$file['location'] = str_replace('\\', '/', io_safe_output($file['location'])); $file['location'] = str_replace('\\', '/', io_safe_output($file['location']));
$relative_path = str_replace($document_root, '', $file['location']); $relative_path = str_replace($document_root, '', $file['location']);
$file_path = base64_encode($relative_path); $file_name = explode('/', $file['location']);
$hash = md5($relative_path.$config['dbpass']); $file_decoded = $file_name[(count($file_name) - 1)];
$url = ui_get_full_url("include/get_file.php?file=$file_path&hash=$hash"); $file_path = base64_encode($file_decoded);
$hash = md5($file_path.$config['dbpass']);
$url = ui_get_full_url('include/get_file.php?file='.urlencode($file_path).'&hash='.$hash);
$date_format = ($config['date_format']) ? io_safe_output($config['date_format']) : 'F j, Y - H:m'; $date_format = ($config['date_format']) ? io_safe_output($config['date_format']) : 'F j, Y - H:m';
$data[0] = "<a href=\"$url\" target=\"_blank\">".$file['name'].'</a>'; $data[0] = "<a href=\"$url\" target=\"_blank\">".$file['name'].'</a>';

View File

@ -1,5 +1,7 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0; ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0;
ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0;
ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL;
COMMIT; COMMIT;

View File

@ -1195,6 +1195,8 @@ CREATE TABLE IF NOT EXISTS `tmap` (
`generation_method` INTEGER UNSIGNED NOT NULL default 0, `generation_method` INTEGER UNSIGNED NOT NULL default 0,
`generated` INTEGER UNSIGNED NOT NULL default 0, `generated` INTEGER UNSIGNED NOT NULL default 0,
`filter` TEXT, `filter` TEXT,
`id_group_map` INT(10) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`) PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@ -1401,6 +1403,7 @@ ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL; ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10); ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10);
ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL; ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL;
ALTER TABLE `tevent_filter` MODIFY COLUMN `severity` text NOT NULL;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tusuario` -- Table `tusuario`

View File

@ -55,7 +55,7 @@ if ($id) {
$id_group = $filter['id_group']; $id_group = $filter['id_group'];
$id_name = $filter['id_name']; $id_name = $filter['id_name'];
$event_type = $filter['event_type']; $event_type = $filter['event_type'];
$severity = $filter['severity']; $severity = explode(',', $filter['severity']);
$status = $filter['status']; $status = $filter['status'];
$search = $filter['search']; $search = $filter['search'];
$text_agent = $filter['text_agent']; $text_agent = $filter['text_agent'];
@ -123,7 +123,7 @@ if ($update || $create) {
$id_group_filter = get_parameter('id_group_filter'); $id_group_filter = get_parameter('id_group_filter');
$id_name = (string) get_parameter('id_name'); $id_name = (string) get_parameter('id_name');
$event_type = get_parameter('event_type', ''); $event_type = get_parameter('event_type', '');
$severity = get_parameter('severity', ''); $severity = implode(',', get_parameter('severity', -1));
$status = get_parameter('status', ''); $status = get_parameter('status', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$text_agent = get_parameter('text_agent', ''); $text_agent = get_parameter('text_agent', '');
@ -172,6 +172,8 @@ if ($update || $create) {
'user_comment' => $user_comment, 'user_comment' => $user_comment,
'filter_only_alert' => $filter_only_alert, 'filter_only_alert' => $filter_only_alert,
]; ];
$severity = explode(',', $severity);
} }
if ($update) { if ($update) {
@ -289,15 +291,24 @@ $table->data[3][1] = html_print_select(
true true
); );
if (empty($severity) && $severity !== '0') {
$severity = -1;
}
$table->data[4][0] = '<b>'.__('Severity').'</b>'; $table->data[4][0] = '<b>'.__('Severity').'</b>';
$table->data[4][1] = html_print_select( $table->data[4][1] = html_print_select(
get_priorities(), get_priorities(),
'severity', 'severity[]',
$severity, $severity,
'', '',
__('All'), __('All'),
'-1', -1,
true true,
true,
true,
'',
false,
'width: 175px'
); );
$fields = events_get_all_status(); $fields = events_get_all_status();

View File

@ -290,7 +290,7 @@ $table_aux = new stdClass();
foreach ($result_graphs as $graph) { foreach ($result_graphs as $graph) {
$data = []; $data = [];
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text(io_safe_output($graph['name']), 70).'</a>'; $data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
$data[1] = ui_print_truncate_text($graph['description'], 70); $data[1] = ui_print_truncate_text($graph['description'], 70);

View File

@ -1207,8 +1207,7 @@ switch ($action) {
$report_id_user = get_parameter('report_id_user'); $report_id_user = get_parameter('report_id_user');
$non_interactive = get_parameter('non_interactive', 0); $non_interactive = get_parameter('non_interactive', 0);
// Pretty font by default for pdf. $custom_font = $config['custom_report_front_font'];
$custom_font = 'FreeSans.ttf';
switch ($type_access_selected) { switch ($type_access_selected) {
case 'group_view': case 'group_view':
@ -1284,7 +1283,6 @@ switch ($action) {
$metaconsole_report = (int) is_metaconsole(); $metaconsole_report = (int) is_metaconsole();
if ($config['custom_report_front']) { if ($config['custom_report_front']) {
$custom_font = $config['custom_report_front_font'];
$logo = $config['custom_report_front_logo']; $logo = $config['custom_report_front_logo'];
$header = $config['custom_report_front_header']; $header = $config['custom_report_front_header'];
$first_page = $config['custom_report_front_firstpage']; $first_page = $config['custom_report_front_firstpage'];

View File

@ -1048,6 +1048,20 @@ $row++;
$row++; $row++;
$table_report->data[$row][0] = __('PDF font family');
$table_report->data[$row][1] = html_print_select(
$fonts,
'custom_report_front_font',
$config['custom_report_front_font'],
false,
__('Default'),
'',
true
);
$row++;
$table_report->data[$row][0] = __('Graph image height for HTML reports'); $table_report->data[$row][0] = __('Graph image height for HTML reports');
$table_report->data[$row][0] .= ui_print_help_tip( $table_report->data[$row][0] .= ui_print_help_tip(
__('This is the height in pixels of the module graph or custom graph in the reports (only: HTML)'), __('This is the height in pixels of the module graph or custom graph in the reports (only: HTML)'),
@ -1078,18 +1092,6 @@ $row++;
} }
} }
// Font
$table_report->data['custom_report_front-font'][0] = __('Custom report front').' - '.__('Font family');
$table_report->data['custom_report_front-font'][1] = html_print_select(
$fonts,
'custom_report_front_font',
$config['custom_report_front_font'],
false,
__('Default'),
'',
true
);
// Logo // Logo
$table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip( $table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip(
__("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."), __("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."),
@ -1397,7 +1399,6 @@ function edit_csv_divider () {
function display_custom_report_front (show,table) { function display_custom_report_front (show,table) {
if (show == true) { if (show == true) {
$('tr#'+table+'-custom_report_front-font').show();
$('tr#'+table+'-custom_report_front-logo').show(); $('tr#'+table+'-custom_report_front-logo').show();
$('tr#'+table+'-custom_report_front-preview').show(); $('tr#'+table+'-custom_report_front-preview').show();
$('tr#'+table+'-custom_report_front-header').show(); $('tr#'+table+'-custom_report_front-header').show();
@ -1405,7 +1406,6 @@ function display_custom_report_front (show,table) {
$('tr#'+table+'-custom_report_front-footer').show(); $('tr#'+table+'-custom_report_front-footer').show();
} }
else { else {
$('tr#'+table+'-custom_report_front-font').hide();
$('tr#'+table+'-custom_report_front-logo').hide(); $('tr#'+table+'-custom_report_front-logo').hide();
$('tr#'+table+'-custom_report_front-preview').hide(); $('tr#'+table+'-custom_report_front-preview').hide();
$('tr#'+table+'-custom_report_front-header').hide(); $('tr#'+table+'-custom_report_front-header').hide();

View File

@ -231,7 +231,7 @@ if ($save_event_filter) {
$values['id_name'] = get_parameter('id_name'); $values['id_name'] = get_parameter('id_name');
$values['id_group'] = get_parameter('id_group'); $values['id_group'] = get_parameter('id_group');
$values['event_type'] = get_parameter('event_type'); $values['event_type'] = get_parameter('event_type');
$values['severity'] = get_parameter('severity'); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
@ -278,7 +278,7 @@ if ($update_event_filter) {
$id = get_parameter('id'); $id = get_parameter('id');
$values['id_group'] = get_parameter('id_group'); $values['id_group'] = get_parameter('id_group');
$values['event_type'] = get_parameter('event_type'); $values['event_type'] = get_parameter('event_type');
$values['severity'] = get_parameter('severity'); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
@ -439,8 +439,10 @@ function load_form_filter() {
$("#id_group").val(val); $("#id_group").val(val);
if (i == 'event_type') if (i == 'event_type')
$("#event_type").val(val); $("#event_type").val(val);
if (i == 'severity') if (i == 'severity') {
$("#severity").val(val); const multiple = val.split(",");
$("#severity").val(multiple);
}
if (i == 'status') if (i == 'status')
$("#status").val(val); $("#status").val(val);
if (i == 'search') if (i == 'search')
@ -1583,7 +1585,7 @@ if ($get_list_events_agents) {
$id_agent = get_parameter('id_agent'); $id_agent = get_parameter('id_agent');
$server_id = get_parameter('server_id'); $server_id = get_parameter('server_id');
$event_type = get_parameter('event_type'); $event_type = get_parameter('event_type');
$severity = get_parameter('severity'); $severity = implode(',', get_parameter('severity', -1));
$status = get_parameter('status'); $status = get_parameter('status');
$search = get_parameter('search'); $search = get_parameter('search');
$id_agent_module = get_parameter('id_agent_module'); $id_agent_module = get_parameter('id_agent_module');

View File

@ -1340,6 +1340,10 @@ class NetworkMap
if ($rel['parent_type'] == NODE_MODULE if ($rel['parent_type'] == NODE_MODULE
&& $rel['child_type'] == NODE_MODULE && $rel['child_type'] == NODE_MODULE
) { ) {
// Keep std references.
$ref_id_parent = $id_parent;
$ref_id_child = $id_child;
// Module information available. // Module information available.
$id_parent = $rel['id_parent_source_data']; $id_parent = $rel['id_parent_source_data'];
$id_child = $rel['id_child_source_data']; $id_child = $rel['id_child_source_data'];
@ -1374,6 +1378,12 @@ class NetworkMap
'index' => $index, 'index' => $index,
'priority' => $priority, 'priority' => $priority,
]; ];
// Keep node reference mapping - low precedence relationship.
$rel_map[$ref_id_parent.'_'.$ref_id_child] = [
'index' => $index,
'priority' => $priority,
];
} }
} else if ($rel['parent_type'] == NODE_AGENT } else if ($rel['parent_type'] == NODE_AGENT
&& $rel['child_type'] == NODE_AGENT && $rel['child_type'] == NODE_AGENT

View File

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

View File

@ -3512,13 +3512,18 @@ function agents_get_status_animation($up=true)
function agents_get_agent_id_by_alias_regex($alias_regex, $flag='i', $limit=0) function agents_get_agent_id_by_alias_regex($alias_regex, $flag='i', $limit=0)
{ {
$agents_id = []; $agents_id = [];
$all_agents = agents_get_agents(false, ['id_agente', 'alias']); if (is_metaconsole()) {
$all_agents = agents_meta_get_agents('AR', '|');
} else {
$all_agents = agents_get_group_agents(0, true, 'lower', false, false, true, '|');
}
$agent_match = '/'.$alias_regex.'/'.$flag; $agent_match = '/'.$alias_regex.'/'.$flag;
foreach ($all_agents as $agent) { foreach ($all_agents as $agent_id => $agent_alias) {
$result_agent_match = preg_match($agent_match, $agent['alias']); $result_agent_match = preg_match($agent_match, $agent_alias);
if ($result_agent_match) { if ($result_agent_match) {
$agents_id[] = $agent['id_agente']; $agents_id[] = $agent_id;
$i++; $i++;
if ($i === $limit) { if ($i === $limit) {
break; break;

View File

@ -624,7 +624,37 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
break; break;
} }
return db_process_sql($update_sql); $result = db_process_sql($update_sql);
if ($result) {
switch ($status) {
case EVENT_STATUS_NEW:
$status_string = 'New';
break;
case EVENT_STATUS_VALIDATED:
$status_string = 'Validated';
break;
case EVENT_STATUS_INPROCESS:
$status_string = 'In process';
break;
default:
$status_string = '';
break;
}
events_comment(
$id_evento,
'',
'Change status to '.$status_string,
is_metaconsole() ? true : false,
$history
);
}
return $result;
} }
@ -751,43 +781,78 @@ function events_get_all(
} }
if (isset($filter['severity']) && $filter['severity'] > 0) { if (isset($filter['severity']) && $filter['severity'] > 0) {
switch ($filter['severity']) { if (is_array($filter['severity'])) {
case EVENT_CRIT_MAINTENANCE: if (!in_array(-1, $filter['severity'])) {
case EVENT_CRIT_INFORMATIONAL: $not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']);
case EVENT_CRIT_NORMAL: if ($not_normal !== false) {
case EVENT_CRIT_MINOR: unset($filter['severity'][$not_normal]);
case EVENT_CRIT_WARNING: $sql_filters[] = sprintf(
case EVENT_CRIT_MAJOR: ' AND criticity != %d',
case EVENT_CRIT_CRITICAL: EVENT_CRIT_NORMAL
default: );
$sql_filters[] = sprintf( } else {
' AND criticity = %d ', $critical_warning = array_search(EVENT_CRIT_WARNING_OR_CRITICAL, $filter['severity']);
$filter['severity'] if ($critical_warning !== false) {
); unset($filter['severity'][$critical_warning]);
break; $filter['severity'][] = EVENT_CRIT_WARNING;
$filter['severity'][] = EVENT_CRIT_CRITICAL;
}
case EVENT_CRIT_WARNING_OR_CRITICAL: $critical_normal = array_search(EVENT_CRIT_OR_NORMAL, $filter['severity']);
$sql_filters[] = sprintf( if ($critical_normal !== false) {
' AND (criticity = %d OR criticity = %d)', unset($filter['severity'][$critical_normal]);
EVENT_CRIT_WARNING, $filter['severity'][] = EVENT_CRIT_NORMAL;
EVENT_CRIT_CRITICAL $filter['severity'][] = EVENT_CRIT_CRITICAL;
); }
break;
case EVENT_CRIT_NOT_NORMAL: if (!empty($filter['severity'])) {
$sql_filters[] = sprintf( $filter['severity'] = implode(',', $filter['severity']);
' AND criticity != %d', $sql_filters[] = sprintf(
EVENT_CRIT_NORMAL ' AND criticity IN (%s)',
); $filter['severity']
break; );
}
}
}
} else {
switch ($filter['severity']) {
case EVENT_CRIT_MAINTENANCE:
case EVENT_CRIT_INFORMATIONAL:
case EVENT_CRIT_NORMAL:
case EVENT_CRIT_MINOR:
case EVENT_CRIT_WARNING:
case EVENT_CRIT_MAJOR:
case EVENT_CRIT_CRITICAL:
default:
$sql_filters[] = sprintf(
' AND criticity = %d ',
$filter['severity']
);
break;
case EVENT_CRIT_OR_NORMAL: case EVENT_CRIT_WARNING_OR_CRITICAL:
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND (criticity = %d OR criticity = %d)', ' AND (criticity = %d OR criticity = %d)',
EVENT_CRIT_NORMAL, EVENT_CRIT_WARNING,
EVENT_CRIT_CRITICAL EVENT_CRIT_CRITICAL
); );
break; break;
case EVENT_CRIT_NOT_NORMAL:
$sql_filters[] = sprintf(
' AND criticity != %d',
EVENT_CRIT_NORMAL
);
break;
case EVENT_CRIT_OR_NORMAL:
$sql_filters[] = sprintf(
' AND (criticity = %d OR criticity = %d)',
EVENT_CRIT_NORMAL,
EVENT_CRIT_CRITICAL
);
break;
}
} }
} }

View File

@ -106,12 +106,8 @@ if (!function_exists('mime_content_type')) {
finfo_close($finfo); finfo_close($finfo);
return $mimetype; return $mimetype;
} else { } else {
$temp = exec('file '.$filename); error_log('Warning: Cannot find finfo_open function. Fileinfo extension is not enabled. Please add "extension=fileinfo.so" or "extension=fileinfo.dll" in your php.ini');
if (isset($temp) && $temp != '') { return 'unknown';
return $temp;
} else {
return 'application/octet-stream';
}
} }
} }
@ -694,8 +690,9 @@ function filemanager_file_explorer(
$data[1] = '<a href="'.$url_file_clean.'">'.$fileinfo['name'].'</a>'; $data[1] = '<a href="'.$url_file_clean.'">'.$fileinfo['name'].'</a>';
} else { } else {
$hash = md5($relative_path.$config['dbpass']); $filename = base64_encode($relative_directory.'/'.$fileinfo['name']);
$data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode(base64_encode($relative_path)).'&hash='.$hash.'">'.$fileinfo['name'].'</a>'; $hash = md5($filename.$config['dbpass']);
$data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'">'.$fileinfo['name'].'</a>';
} }
// Notice that uploaded php files could be dangerous // Notice that uploaded php files could be dangerous
@ -755,8 +752,9 @@ function filemanager_file_explorer(
} }
if ((!$fileinfo['is_dir']) && ($download_button)) { if ((!$fileinfo['is_dir']) && ($download_button)) {
$hash = md5($fileinfo['realpath'].$config['dbpass']); $filename = base64_encode($fileinfo['name']);
$data[4] .= '<a href="include/get_file.php?file='.urlencode(base64_encode($fileinfo['realpath'])).'&hash='.$hash.'" style="vertical-align: 25%;">'; $hash = md5($filename.$config['dbpass']);
$data[4] .= '<a href="include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'" style="vertical-align: 25%;">';
$data[4] .= html_print_image('images/file.png', true); $data[4] .= html_print_image('images/file.png', true);
$data[4] .= '</a>'; $data[4] .= '</a>';
} }

View File

@ -1178,8 +1178,13 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
} }
// Minutes // Minutes
for ($i = 0; $i < 60; $i += 5) { for ($i = 0; $i < 60; $i++) {
$minutes[$i] = $i; $minutes[$i] = $i;
// If minute is not a multiple of 5, then add style to option in order to hide it from minute select but still is a valid value that input can adopt. We want this in case a value that is not a multiple of 5 is entered in module's data configuration.
if (($i % 5) != 0) {
$minutes_hidden_options[$i] = 'display: none;';
}
} }
// Month days // Month days
@ -1216,13 +1221,13 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
if ($to) { if ($to) {
$table->data[0][0] = html_print_select($hours, 'hour_to', $hour, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][0] = html_print_select($hours, 'hour_to', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
$table->data[0][2] = html_print_select($mdays, 'mday_to', $mday, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][2] = html_print_select($mdays, 'mday_to', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][3] = html_print_select($months, 'month_to', $month, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][3] = html_print_select($months, 'month_to', $month, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][4] = html_print_select($wdays, 'wday_to', $wday, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][4] = html_print_select($wdays, 'wday_to', $wday, '', __('Any'), '*', true, false, false, '', $disabled);
} else { } else {
$table->data[0][0] = html_print_select($hours, 'hour_from', $hour, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][0] = html_print_select($hours, 'hour_from', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
$table->data[0][2] = html_print_select($mdays, 'mday_from', $mday, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][2] = html_print_select($mdays, 'mday_from', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][3] = html_print_select($months, 'month_from', $month, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][3] = html_print_select($months, 'month_from', $month, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][4] = html_print_select($wdays, 'wday_from', $wday, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][4] = html_print_select($wdays, 'wday_from', $wday, '', __('Any'), '*', true, false, false, '', $disabled);

View File

@ -1453,6 +1453,20 @@ function networkmap_delete_nodes($id_map)
} }
/**
* Delete relations given id_map
*
* @param integer $id_map
* @return integer result
*/
function networkmap_delete_relations($id_map)
{
$result = db_process_sql_delete('trel_item', ['id_map' => $id_map]);
return $result;
}
function get_networkmaps($id) function get_networkmaps($id)
{ {
$groups = array_keys(users_get_groups(null, 'IW')); $groups = array_keys(users_get_groups(null, 'IW'));

View File

@ -190,6 +190,8 @@ function reporting_make_reporting_data(
$metaconsole_on = is_metaconsole(); $metaconsole_on = is_metaconsole();
$index_content = 0; $index_content = 0;
foreach ($contents as $content) { foreach ($contents as $content) {
$content['name'] = io_safe_input($content['name']);
$content['description'] = io_safe_input($content['description']);
if (!empty($content['id_agent_module']) && !empty($content['id_agent']) if (!empty($content['id_agent_module']) && !empty($content['id_agent'])
&& tags_has_user_acl_tags($config['id_user']) && tags_has_user_acl_tags($config['id_user'])
) { ) {
@ -4286,14 +4288,7 @@ function reporting_sql_graph(
case 'data': case 'data':
$data = []; $data = [];
foreach ($modules as $key => $value) { $data = db_get_all_rows_sql($content['external_source']);
$data[$value] = modules_get_agentmodule_data(
$value,
$content['period'],
$report['datetime']
);
}
$return['chart'] = $data; $return['chart'] = $data;
break; break;
} }
@ -7640,7 +7635,7 @@ function reporting_custom_graph(
$return['title'] = $content['name']; $return['title'] = $content['name'];
$return['landscape'] = $content['landscape']; $return['landscape'] = $content['landscape'];
$return['pagebreak'] = $content['pagebreak']; $return['pagebreak'] = $content['pagebreak'];
$return['subtitle'] = io_safe_output($graph['name']); $return['subtitle'] = $graph['name'];
$return['agent_name'] = $agent_alias; $return['agent_name'] = $agent_alias;
$return['module_name'] = $module_name; $return['module_name'] = $module_name;
$return['description'] = $content['description']; $return['description'] = $content['description'];

View File

@ -130,7 +130,7 @@ function html_do_report_info($report)
$html .= '</tr> $html .= '</tr>
<tr> <tr>
<td valign="top"><b>'.__('Description').': </b></td><td>'.io_safe_output($report['description']).'</td> <td valign="top"><b>'.__('Description').': </b></td><td>'.htmlspecialchars($report['description']).'</td>
</tr> </tr>
</table>'.'</div>'; </table>'.'</div>';

View File

@ -919,9 +919,10 @@ function servers_get_info($id_server=-1)
// Remote servers LAG Calculation (server_type != 0). // Remote servers LAG Calculation (server_type != 0).
if ($server['server_type'] != 0) { if ($server['server_type'] != 0) {
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
$result = db_get_row_sql( $result = db_get_row_sql(
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, 'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag"
FROM tagente_estado, tagente_modulo, tagente FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0 WHERE utimestamp > 0
AND tagente.disabled = 0 AND tagente.disabled = 0
@ -935,9 +936,10 @@ function servers_get_info($id_server=-1)
); );
} else { } else {
// Local/Dataserver server LAG calculation. // Local/Dataserver server LAG calculation.
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
$result = db_get_row_sql( $result = db_get_row_sql(
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, 'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag"
FROM tagente_estado, tagente_modulo, tagente FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0 WHERE utimestamp > 0
AND tagente.disabled = 0 AND tagente.disabled = 0

View File

@ -1593,6 +1593,7 @@ function visual_map_print_item(
case CLOCK: case CLOCK:
if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) { if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) {
$image_prefix = (is_metaconsole()) ? '../../' : '';
if ($width == 0) { if ($width == 0) {
if ($layoutData['id_metaconsole'] != 0) { if ($layoutData['id_metaconsole'] != 0) {
if ($layoutData['clock_animation'] == 'analogic_1') { if ($layoutData['clock_animation'] == 'analogic_1') {
@ -1606,17 +1607,16 @@ function visual_map_print_item(
} }
} else { } else {
if ($layoutData['clock_animation'] == 'analogic_1') { if ($layoutData['clock_animation'] == 'analogic_1') {
$img = '<img src="images/console/signes/clock.png" style="width:200px;height:240px;">'; $img = '<img src="'.$image_prefix.'images/console/signes/clock.png" style="width:200px;height:240px;">';
} else { } else {
if ($layoutData['time_format'] == 'time') { if ($layoutData['time_format'] == 'time') {
$img = '<img src="images/console/signes/digital-clock.png" style="width:200px;height:71px">'; $img = '<img src="'.$image_prefix.'images/console/signes/digital-clock.png" style="width:200px;height:71px">';
} else { } else {
$img = '<img src="images/console/signes/digital-clock.png" style="width:200px;height:91px">'; $img = '<img src="'.$image_prefix.'images/console/signes/digital-clock.png" style="width:200px;height:91px">';
} }
} }
} }
} else { } else {
$image_prefix = ($layoutData['id_metaconsole'] != 0) ? '../../' : '';
if ($layoutData['clock_animation'] == 'analogic_1') { if ($layoutData['clock_animation'] == 'analogic_1') {
$img = '<img src="'.$image_prefix.'images/console/signes/clock.png" style="width:'.$width.'px;height:'.($width + 40).'px;">'; $img = '<img src="'.$image_prefix.'images/console/signes/clock.png" style="width:'.$width.'px;height:'.($width + 40).'px;">';
} else { } else {
@ -1901,7 +1901,7 @@ function visual_map_print_item(
} }
} else { } else {
$is_meta = is_metaconsole(); $is_meta = is_metaconsole();
$agents_critical = agents_get_agents( $agents_critical = agents_get_agents(
[ [
'disabled' => 0, 'disabled' => 0,

View File

@ -29,29 +29,42 @@ if ($auth_method != 'ad' && $auth_method != 'ldap') {
$styleError = 'background:url("../images/err.png") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;'; $styleError = 'background:url("../images/err.png") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;';
$file = get_parameter('file', null); $file_raw = get_parameter('file', null);
$file = base64_decode($file); $file = base64_decode(urldecode($file_raw));
$hash = get_parameter('hash', null); $hash = get_parameter('hash', null);
$testHash = md5($file.$config['dbpass']); if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['dbpass']) || !isset($_SERVER['HTTP_REFERER'])) {
if ($hash != $testHash) {
echo "<h3 style='".$styleError."'>".__('Security error. Please contact the administrator.').'</h3>'; echo "<h3 style='".$styleError."'>".__('Security error. Please contact the administrator.').'</h3>';
} else if (!empty($file) && !empty($hash)) { } else {
// echo $file; $downloadable_file = '';
if (!file_exists($file)) { $parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
$file = $_SERVER['DOCUMENT_ROOT'].$file; $parse_sec2_query = explode('=', $parse_all_queries[1]);
if ($parse_sec2_query[0] === 'sec2') {
switch ($parse_sec2_query[1]) {
case 'godmode/setup/file_manager':
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file;
break;
case 'extensions/files_repo':
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
break;
default:
$downloadable_file = '';
// Do nothing
break;
}
} }
if (!file_exists($file)) { if ($downloadable_file === '' || !file_exists($downloadable_file)) {
echo "<h3 style='".$styleError."'>".__('File is missing in disk storage. Please contact the administrator.').'</h3>'; echo "<h3 style='".$styleError."'>".__('File is missing in disk storage. Please contact the administrator.').'</h3>';
} else { } else {
header('Content-type: aplication/octet-stream;'); header('Content-type: aplication/octet-stream;');
header('Content-type: '.mime_content_type($file).';'); header('Content-type: '.mime_content_type($downloadable_file).';');
header('Content-Length: '.filesize($file)); header('Content-Length: '.filesize($downloadable_file));
header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Content-Disposition: attachment; filename="'.basename($downloadable_file).'"');
readfile($file); readfile($downloadable_file);
} }
} }

View File

@ -214,8 +214,8 @@ function show_massive_response_dialog(
$("#button-submit_event_response").show(); $("#button-submit_event_response").show();
}, },
close: function() { close: function() {
$("#checkbox-all_validate_box").prop("checked", false);
$(".chk_val").prop("checked", false); $(".chk_val").prop("checked", false);
$("#event_response_command_window").dialog("close");
}, },
width: response["modal_width"], width: response["modal_width"],
height: response["modal_height"] height: response["modal_height"]

View File

@ -30,7 +30,6 @@ div.mini-criticity.h100p {
form.flex-row div.filter_input, form.flex-row div.filter_input,
form.flex-row ul { form.flex-row ul {
width: 30%; width: 30%;
min-width: 300px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: baseline; align-items: baseline;
@ -47,12 +46,13 @@ div.filter_input_little {
flex-direction: row; flex-direction: row;
align-items: baseline; align-items: baseline;
flex-wrap: nowrap; flex-wrap: nowrap;
margin: 0.5em 0 0.5em 1em; margin: 0.5em 0 0.5em 0em;
} }
form.flex-row div.filter_input.large { form.flex-row div.filter_input.large {
flex: 1; flex: 1;
min-width: 470px; min-width: 700px;
max-width: 100%;
} }
div.filter_input > label, div.filter_input > label,
@ -120,6 +120,8 @@ table.dataTable tbody td {
.filter_input { .filter_input {
align-items: center; align-items: center;
min-width: 400px;
max-width: 450px;
} }
.filter_input_little > select, .filter_input_little > select,

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.742'; $version = '7.0NG.742';
$build = '200113'; $build = '200115';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);
@ -965,9 +965,12 @@ function install_step4()
$step5 = mysqli_query( $step5 = mysqli_query(
$connection, $connection,
"GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host "CREATE USER pandora@$host IDENTIFIED BY '".$random_password."'"
IDENTIFIED BY '".$random_password."'"
); );
$step5 |= mysqli_query(
$connection,
"GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host"
);
mysqli_query($connection, 'FLUSH PRIVILEGES'); mysqli_query($connection, 'FLUSH PRIVILEGES');
check_generic($step5, "Established privileges for user pandora. A new random password has been generated: <b>$random_password</b><div class='warn'>Please write it down, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file</div>"); check_generic($step5, "Established privileges for user pandora. A new random password has been generated: <b>$random_password</b><div class='warn'>Please write it down, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file</div>");

View File

@ -81,8 +81,8 @@ if ($edit_networkmap) {
$id_group = $values['id_group']; $id_group = $values['id_group'];
// ACL for the network map. // ACL for the network map.
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) { if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit( db_pandora_audit(
@ -95,6 +95,9 @@ if ($edit_networkmap) {
$name = io_safe_output($values['name']); $name = io_safe_output($values['name']);
// Id group of the map itself, not data source.
$id_group_map = $values['id_group_map'];
$description = $values['description']; $description = $values['description'];
$filter = json_decode($values['filter'], true); $filter = json_decode($values['filter'], true);
@ -267,8 +270,8 @@ if ($not_found) {
$config['id_user'], $config['id_user'],
'AR', 'AR',
true, true,
'id_group', 'id_group_map',
$id_group, $id_group_map,
'', '',
'', '',
'', '',
@ -329,6 +332,28 @@ if ($not_found) {
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask'); $table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source); $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
$table->data['source_data_group'][0] = __('Source group');
$table->data['source_data_group'][1] = html_print_select_groups(
$config['id_user'],
'AR',
true,
'id_group',
$id_group,
'',
'',
'',
true
);
$table->data['source_data_group'][1] .= html_print_image(
'images/error.png',
true,
[
'id' => 'group_change_warning',
'title' => __('Source id group changed. All elements in networkmap will be lost.'),
'style' => 'display : none',
]
);
$table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:'); $table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:');
$table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox( $table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox(
'dont_show_subgroups', 'dont_show_subgroups',
@ -379,7 +404,7 @@ if ($not_found) {
$table->data['kval'][0] = __('Default ideal node separation'); $table->data['kval'][0] = __('Default ideal node separation');
$table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true); $table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true);
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">'; echo '<form id="networkmap_options_form" method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_table($table); html_print_table($table);
@ -420,8 +445,11 @@ $(document).ready(function() {
.css('display', 'none'); .css('display', 'none');
$("#form_editor-source_data_dont_show_subgroups") $("#form_editor-source_data_dont_show_subgroups")
.css('display', 'none'); .css('display', 'none');
$("#form_editor-source_data_group")
.css('display', 'none');
$("#form_editor-source_data_recon_task") $("#form_editor-source_data_recon_task")
.css('display', ''); .css('display', '');
} }
else if (source == 'ip_mask') { else if (source == 'ip_mask') {
$("#form_editor-source_data_ip_mask") $("#form_editor-source_data_ip_mask")
@ -430,6 +458,8 @@ $(document).ready(function() {
.css('display', 'none'); .css('display', 'none');
$("#form_editor-source_data_dont_show_subgroups") $("#form_editor-source_data_dont_show_subgroups")
.css('display', 'none'); .css('display', 'none');
$("#form_editor-source_data_group")
.css('display', 'none');
} }
else if (source == 'group') { else if (source == 'group') {
$("#form_editor-source_data_ip_mask") $("#form_editor-source_data_ip_mask")
@ -438,6 +468,8 @@ $(document).ready(function() {
.css('display', 'none'); .css('display', 'none');
$("#form_editor-source_data_dont_show_subgroups") $("#form_editor-source_data_dont_show_subgroups")
.css('display', ''); .css('display', '');
$("#form_editor-source_data_group")
.css('display', '');
} }
}); });
@ -508,5 +540,53 @@ $(document).ready(function() {
$("input[name='source']").trigger("change"); $("input[name='source']").trigger("change");
$("#method").trigger("change"); $("#method").trigger("change");
// Control if id_group has changed.
var id_group_old = $("#id_group").val();
var id_group_changed = false;
$("#id_group").on('change',{id_group_old: id_group_old}, function () {
var id_group_new = $("#id_group").val();
if((id_group_old != id_group_new) && (update_networkmap == 1 )) {
id_group_changed = true;
$("#group_change_warning").show();
} else {
id_group_changed = false;
$("#group_change_warning").hide();
}
});
var update_networkmap = 0;
// Show advice if id_group has changed.
update_networkmap = $("input[name='update_networkmap']").val();
$( "#submit-crt" ).click(function( event ) {
if(update_networkmap == 1 && id_group_changed === true) {
confirmDialog({
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('Source id group changed. All elements in Networkmap will be lost'); ?>',
ok: '<?php echo __('OK'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onDeny: function() {
// Continue execution.
return false;
},
onAccept: function () {
// Submit form
$("#networkmap_options_form").submit();
}
})
event.preventDefault();
}
}); });
});
</script> </script>

View File

@ -12,10 +12,10 @@
// Load global variables // Load global variables
global $config; global $config;
// Check user credentials // Check user credentials.
check_login(); check_login();
// General ACL for the network maps // General ACL for the network maps.
$networkmaps_read = check_acl($config['id_user'], 0, 'MR'); $networkmaps_read = check_acl($config['id_user'], 0, 'MR');
$networkmaps_write = check_acl($config['id_user'], 0, 'MW'); $networkmaps_write = check_acl($config['id_user'], 0, 'MW');
$networkmaps_manage = check_acl($config['id_user'], 0, 'MM'); $networkmaps_manage = check_acl($config['id_user'], 0, 'MM');
@ -53,11 +53,12 @@ if (enterprise_installed()) {
if ($save_empty_networkmap) { if ($save_empty_networkmap) {
$id_group = (int) get_parameter('id_group', 0); $id_group = (int) get_parameter('id_group', 0);
$id_group_map = (int) get_paramater('id_group_map', 0);
// ACL for the network map // ACL for the network map.
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) { if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit( db_pandora_audit(
@ -93,6 +94,7 @@ if (enterprise_installed()) {
$values['description'] = $description; $values['description'] = $description;
$values['source'] = 0; $values['source'] = 0;
$values['source_data'] = $id_group; $values['source_data'] = $id_group;
$values['id_group_map'] = $id_group_map;
if (!$networkmap_write && !$networkmap_manage) { if (!$networkmap_write && !$networkmap_manage) {
@ -139,10 +141,12 @@ if (enterprise_installed()) {
} }
} else if ($update_empty_networkmap) { } else if ($update_empty_networkmap) {
$id_group = (int) get_parameter('id_group', 0); $id_group = (int) get_parameter('id_group', 0);
$id_group_map = (int) get_parameter('id_group_map', 0);
// ACL for the new network map // ACL for the new network map
$networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW'); $networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM'); $networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) { if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit( db_pandora_audit(
@ -221,11 +225,13 @@ if ($new_networkmap || $save_networkmap) {
if ($save_networkmap) { if ($save_networkmap) {
$id_group = (int) get_parameter('id_group', 0); $id_group = (int) get_parameter('id_group', 0);
$id_group_map = (int) get_parameter('id_group_map', 0);
// ACL for the network map // ACL for the network map
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) { if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit( db_pandora_audit(
@ -282,6 +288,7 @@ if ($new_networkmap || $save_networkmap) {
$values['height'] = $height; $values['height'] = $height;
$values['id_user'] = $config['id_user']; $values['id_user'] = $config['id_user'];
$values['description'] = $description; $values['description'] = $description;
$values['id_group_map'] = $id_group_map;
switch ($method) { switch ($method) {
case 'twopi': case 'twopi':
@ -401,8 +408,10 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
return; return;
} }
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id); // ACL for the network map.
if ($id_group_old === false) { $id_group_map_old = db_get_value('id_group_map', 'tmap', 'id', $id);
if ($id_group_map_old === false) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to accessnode graph builder' 'Trying to accessnode graph builder'
@ -411,9 +420,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
return; return;
} }
// ACL for the network map $networkmap_write = check_acl($config['id_user'], $id_group_map_old, 'MW');
$networkmap_write = check_acl($config['id_user'], $id_group_old, 'MW'); $networkmap_manage = check_acl($config['id_user'], $id_group_map_old, 'MM');
$networkmap_manage = check_acl($config['id_user'], $id_group_old, 'MM');
if (!$networkmap_write && !$networkmap_manage) { if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit( db_pandora_audit(
@ -426,10 +434,14 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
if ($update_networkmap) { if ($update_networkmap) {
$id_group = (int) get_parameter('id_group', 0); $id_group = (int) get_parameter('id_group', 0);
// Get id of old group source to check changes.
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id);
// ACL for the new network map // ACL for the new network map
$networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW'); $id_group_map = (int) get_parameter('id_group_map', 0);
$networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM'); $networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) { if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit( db_pandora_audit(
@ -456,6 +468,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
$values = []; $values = [];
$values['name'] = $name; $values['name'] = $name;
$values['id_group'] = $id_group; $values['id_group'] = $id_group;
$values['id_group_map'] = $id_group_map;
$description = get_parameter('description', ''); $description = get_parameter('description', '');
$values['description'] = $description; $values['description'] = $description;
@ -493,6 +506,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
// If change the group, the map must be regenerated // If change the group, the map must be regenerated
if ($id_group != $id_group_old) { if ($id_group != $id_group_old) {
networkmap_delete_nodes($id); networkmap_delete_nodes($id);
// Delete relations.
networkmap_delete_relations($id);
} }
$networkmap_write = $networkmap_write_new; $networkmap_write = $networkmap_write_new;
@ -701,9 +716,9 @@ switch ($tab) {
$network_maps = db_get_all_rows_filter( $network_maps = db_get_all_rows_filter(
'tmap', 'tmap',
[ [
'id_group' => $id_groups, 'id_group_map' => $id_groups,
'limit' => $limit, 'limit' => $limit,
'offset' => $offset, 'offset' => $offset,
] ]
); );
@ -712,9 +727,9 @@ switch ($tab) {
foreach ($network_maps as $network_map) { foreach ($network_maps as $network_map) {
// ACL for the network map // ACL for the network map
$networkmap_read = check_acl($config['id_user'], $network_map['id_group'], 'MR'); $networkmap_read = check_acl($config['id_user'], $network_map['id_group_map'], 'MR');
$networkmap_write = check_acl($config['id_user'], $network_map['id_group'], 'MW'); $networkmap_write = check_acl($config['id_user'], $network_map['id_group_map'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $network_map['id_group'], 'MM'); $networkmap_manage = check_acl($config['id_user'], $network_map['id_group_map'], 'MM');
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) { if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
db_pandora_audit( db_pandora_audit(
@ -722,7 +737,7 @@ switch ($tab) {
'Trying to access networkmap enterprise' 'Trying to access networkmap enterprise'
); );
include 'general/noaccess.php'; include 'general/noaccess.php';
return; continue;
} }
$data = []; $data = [];
@ -768,7 +783,7 @@ switch ($tab) {
} }
} }
$data['groups'] = ui_print_group_icon($network_map['id_group'], true); $data['groups'] = ui_print_group_icon($network_map['id_group_map'], true);
if ($networkmap_write || $networkmap_manage) { if ($networkmap_write || $networkmap_manage) {
$table->cellclass[] = [ $table->cellclass[] = [

View File

@ -576,8 +576,8 @@ if (is_ajax()) {
$filter = json_encode($array_filter); $filter = json_encode($array_filter);
// ACL for the network map. // ACL for the network map.
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW'); $networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM'); $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM');
if (!$networkmap_write && !$networkmap_manage) { if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit( db_pandora_audit(
@ -800,9 +800,9 @@ if ($networkmap === false) {
return; return;
} else { } else {
// ACL for the network map. // ACL for the network map.
$networkmap_read = check_acl($config['id_user'], $networkmap['id_group'], 'MR'); $networkmap_read = check_acl($config['id_user'], $networkmap['id_group_map'], 'MR');
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW'); $networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM'); $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM');
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) { if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
db_pandora_audit( db_pandora_audit(

View File

@ -135,6 +135,10 @@ $id_agent = get_parameter(
'filter[id_agent]', 'filter[id_agent]',
$filter['id_agent'] $filter['id_agent']
); );
$text_module = get_parameter(
'filter[text_module]',
$filter['text_module']
);
$id_agent_module = get_parameter( $id_agent_module = get_parameter(
'filter[id_agent_module]', 'filter[id_agent_module]',
$filter['id_agent_module'] $filter['id_agent_module']
@ -210,10 +214,38 @@ $id_source_event = get_parameter(
$filter['id_source_event'] $filter['id_source_event']
); );
$server_id = get_parameter(
'filter[server_id]',
$filter['id_server_meta']
);
if (is_metaconsole()) {
// Connect to node database.
$id_node = $server_id;
if ($id_node != 0) {
if (metaconsole_connect(null, $id_node) != NOERR) {
return false;
}
}
}
if (empty($text_agent) && !empty($id_agent)) { if (empty($text_agent) && !empty($id_agent)) {
$text_agent = agents_get_alias($id_agent); $text_agent = agents_get_alias($id_agent);
} }
if (empty($text_module) && !empty($id_agent_module)) {
$text_module = modules_get_agentmodule_name($id_agent_module);
$text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module));
}
if (is_metaconsole()) {
// Return to metaconsole database.
if ($id_node != 0) {
metaconsole_restore_db();
}
}
// Ajax responses. // Ajax responses.
if (is_ajax()) { if (is_ajax()) {
$get_events = get_parameter('get_events', 0); $get_events = get_parameter('get_events', 0);
@ -862,22 +894,6 @@ $in = '<div class="filter_input"><label>'.__('Event type').'</label>';
$in .= $data.'</div>'; $in .= $data.'</div>';
$inputs[] = $in; $inputs[] = $in;
// Criticity - severity.
$severity_select .= html_print_select(
get_priorities(),
'severity',
$severity,
'',
__('All'),
'-1',
true,
false,
false
);
$in = '<div class="filter_input"><label>'.__('Severity').'</label>';
$in .= $severity_select.'</div>';
$inputs[] = $in;
// Event status. // Event status.
$data = html_print_select( $data = html_print_select(
events_get_all_status(), events_get_all_status(),
@ -929,6 +945,28 @@ $in = '<div class="filter_input"><label>'.__('Free search').'</label>';
$in .= $data.'</div>'; $in .= $data.'</div>';
$inputs[] = $in; $inputs[] = $in;
if (empty($severity) && $severity !== '0') {
$severity = -1;
}
// Criticity - severity.
$data = html_print_select(
get_priorities(),
'severity',
$severity,
'',
__('All'),
-1,
true,
true,
true,
'',
false
);
$in = '<div class="filter_input"><label>'.__('Severity').'</label>';
$in .= $data.'</div>';
$inputs[] = $in;
$buttons = []; $buttons = [];
$buttons[] = [ $buttons[] = [
@ -1083,8 +1121,6 @@ if (is_metaconsole()) {
$adv_inputs[] = $in; $adv_inputs[] = $in;
} }
// Gap.
$adv_inputs[] = '<div class="filter_input"></div>';
// Date from. // Date from.
$data = html_print_input_text( $data = html_print_input_text(
@ -1634,6 +1670,10 @@ function process_datatables_callback(table, settings) {
} }
// Uncheck checkbox to select all.
if ($('#checkbox-all_validate_box').length) {
$('#checkbox-all_validate_box').uncheck();
}
} }
function process_datatables_item(item) { function process_datatables_item(item) {

View File

@ -87,8 +87,8 @@ if ($layout) {
$id_layout, $id_layout,
true, true,
true, true,
$width, $bwidth,
$height, $bheight,
'../../', '../../',
true, true,
true, true,
@ -196,7 +196,6 @@ $ignored_params['refr'] = '';
$('body').css('background-color','<?php echo $layout['background_color']; ?>'); $('body').css('background-color','<?php echo $layout['background_color']; ?>');
$('body').css('margin','0'); $('body').css('margin','0');
$('body').css('height','100%');
$('body').css('overflow','hidden'); $('body').css('overflow','hidden');
$(".module_graph .menu_graph").css('display','none'); $(".module_graph .menu_graph").css('display','none');

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.742 %define version 7.0NG.742
%define release 200113 %define release 200115
# 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.742 %define version 7.0NG.742
%define release 200113 %define release 200115
# 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.742 %define version 7.0NG.742
%define release 200113 %define release 200115
%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

@ -1099,7 +1099,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`id_name` varchar(600) NOT NULL, `id_name` varchar(600) NOT NULL,
`id_group` int(10) NOT NULL default 0, `id_group` int(10) NOT NULL default 0,
`event_type` text NOT NULL, `event_type` text NOT NULL,
`severity` int(10) NOT NULL default -1, `severity` text NOT NULL,
`status` int(10) NOT NULL default -1, `status` int(10) NOT NULL default -1,
`search` TEXT, `search` TEXT,
`text_agent` TEXT, `text_agent` TEXT,
@ -2189,6 +2189,7 @@ CREATE TABLE IF NOT EXISTS `tmap` (
`generation_method` INTEGER UNSIGNED NOT NULL default 0, `generation_method` INTEGER UNSIGNED NOT NULL default 0,
`generated` INTEGER UNSIGNED NOT NULL default 0, `generated` INTEGER UNSIGNED NOT NULL default 0,
`filter` TEXT, `filter` TEXT,
`id_group_map` INT(10) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`) PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.742-200113 Version: 7.0NG.742-200115
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.742-200113" pandora_version="7.0NG.742-200115"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -45,7 +45,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.742"; my $pandora_version = "7.0NG.742";
my $pandora_build = "200113"; my $pandora_build = "200115";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -32,7 +32,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.742"; my $pandora_version = "7.0NG.742";
my $pandora_build = "200113"; my $pandora_build = "200115";
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.742 %define version 7.0NG.742
%define release 200113 %define release 200115
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.742 %define version 7.0NG.742
%define release 200113 %define release 200115
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.742 PS200113"; my $version = "7.0NG.742 PS200115";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

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.742 PS200113"; my $version = "7.0NG.742 PS200115";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);