mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 11:29:12 +02:00
new console report pandora_enterprise#6367
This commit is contained in:
parent
66cb2b42c2
commit
01ba149280
@ -436,9 +436,22 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
||||
);
|
||||
$header_logout .= '</a></div>';
|
||||
|
||||
if (is_reporting_console_node() === true) {
|
||||
echo '<div class="header_left">';
|
||||
echo '<span class="header_title">';
|
||||
echo $config['custom_title_header'];
|
||||
echo '</span>';
|
||||
echo '<span class="header_subtitle">';
|
||||
echo $config['custom_subtitle_header'];
|
||||
echo '</span>';
|
||||
echo '</div>';
|
||||
echo '<div class="header_center"></div>';
|
||||
echo '<div class="header_right">'.$header_support, $header_docu, $header_user, $header_logout.'</div>';
|
||||
} else {
|
||||
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
|
||||
<div class="header_center">'.$header_searchbar.'</div>
|
||||
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
|
||||
}
|
||||
?>
|
||||
</div> <!-- Closes #table_header_inner -->
|
||||
</div> <!-- Closes #table_header -->
|
||||
|
@ -58,6 +58,10 @@ if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_men
|
||||
|
||||
// Start of full lateral menu.
|
||||
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
|
||||
$url_logo = ui_get_full_url('index.php');
|
||||
if (is_reporting_console_node() === false) {
|
||||
$url_logo = 'index.php?logged=1&sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist';
|
||||
}
|
||||
|
||||
// Header logo.
|
||||
html_print_div(
|
||||
@ -65,7 +69,7 @@ html_print_div(
|
||||
'class' => 'logo_green',
|
||||
'content' => html_print_anchor(
|
||||
[
|
||||
'href' => ui_get_full_url('index.php'),
|
||||
'href' => $url_logo,
|
||||
'content' => html_print_header_logo_image(
|
||||
$menuCollapsed,
|
||||
true
|
||||
|
103
pandora_console/general/reporting_console_node.php
Normal file
103
pandora_console/general/reporting_console_node.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Static page to lock access to console but console reporting
|
||||
*
|
||||
* @category Reporting
|
||||
* @package Pandora FMS
|
||||
* @subpackage Applications
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
// Begin.
|
||||
echo ui_require_css_file('maintenance', 'include/styles/', true);
|
||||
|
||||
$data = [];
|
||||
$data['id_node'] = $config['metaconsole_node_id'];
|
||||
$data['check_ver'] = $config['current_package'];
|
||||
$data['check_mr'] = $config['MR'];
|
||||
$data['collection_max_size'] = $config['collection_max_size'];
|
||||
$data['check_post_max_size'] = ini_get('post_max_size');
|
||||
$data['check_upload_max_filesize'] = ini_get('upload_max_filesize');
|
||||
$data['check_memory_limit'] = ini_get('memory_limit');
|
||||
$data['check_php_version'] = phpversion();
|
||||
|
||||
?>
|
||||
<html>
|
||||
<body class="responsive-height">
|
||||
<div class="responsive center padding-6">
|
||||
<p><?php echo __('Console only reporting node'); ?></p>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
html_print_image(
|
||||
'images/maintenance.png',
|
||||
false,
|
||||
[
|
||||
'class' => 'responsive',
|
||||
'width' => 800,
|
||||
]
|
||||
);
|
||||
?>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<p><?php echo __('Info'); ?></p>
|
||||
<ul class="container-list">
|
||||
<li>
|
||||
<span class=title>
|
||||
<?php echo __('Version'); ?>:
|
||||
</span>
|
||||
<span>
|
||||
<?php echo $config['current_package']; ?>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class=title>
|
||||
<?php echo __('Mr'); ?>:
|
||||
</span>
|
||||
<span>
|
||||
<?php echo $config['MR']; ?>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class=title>
|
||||
<?php echo __('Memory limit'); ?>:
|
||||
</span>
|
||||
<span>
|
||||
<?php echo ini_get('memory_limit'); ?>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class=title>
|
||||
<?php echo __('Php version'); ?>:
|
||||
</span>
|
||||
<span>
|
||||
<?php echo phpversion(); ?>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -28,15 +28,18 @@
|
||||
|
||||
// Begin.
|
||||
require_once 'include/config.php';
|
||||
require_once 'include/functions_menu.php';
|
||||
|
||||
check_login();
|
||||
|
||||
enterprise_include('godmode/menu.php');
|
||||
require_once 'include/functions_menu.php';
|
||||
|
||||
$access_console_node = !is_reporting_console_node();
|
||||
$menu_godmode = [];
|
||||
$menu_godmode['class'] = 'godmode';
|
||||
|
||||
if ($access_console_node === true) {
|
||||
enterprise_include('godmode/menu.php');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'AW') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'RR') === true
|
||||
@ -46,9 +49,11 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|
||||
$sub = [];
|
||||
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Start');
|
||||
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
|
||||
|
||||
if ($access_console_node === true) {
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true
|
||||
|| (bool) check_acl($config['id_user'], 0, 'PM') === true
|
||||
) {
|
||||
@ -73,6 +78,7 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|
||||
enterprise_hook('cloud_menu');
|
||||
enterprise_hook('console_task_menu');
|
||||
}
|
||||
}
|
||||
|
||||
// Add to menu.
|
||||
$menu_godmode['discovery']['text'] = __('Discovery');
|
||||
@ -81,7 +87,7 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true
|
||||
$menu_godmode['discovery']['sub'] = $sub;
|
||||
}
|
||||
|
||||
|
||||
if ($access_console_node === true) {
|
||||
$sub = [];
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true || (bool) check_acl($config['id_user'], 0, 'AD') === true) {
|
||||
$sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents');
|
||||
@ -383,6 +389,8 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
|
||||
$menu_godmode['gsetup']['sub'] = $sub;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) {
|
||||
$menu_godmode['gextensions']['text'] = __('Admin tools');
|
||||
@ -392,6 +400,7 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
|
||||
$sub = [];
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||
if ($access_console_node === true) {
|
||||
// Audit //meter en extensiones.
|
||||
$sub['godmode/audit_log']['text'] = __('System audit log');
|
||||
$sub['godmode/audit_log']['id'] = 'System audit log';
|
||||
@ -404,9 +413,12 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
|
||||
|
||||
$sub['godmode/setup/news']['text'] = __('Site news');
|
||||
$sub['godmode/setup/news']['id'] = 'Site news';
|
||||
}
|
||||
|
||||
$sub['godmode/setup/file_manager']['text'] = __('File manager');
|
||||
$sub['godmode/setup/file_manager']['id'] = 'File manager';
|
||||
|
||||
if ($access_console_node === true) {
|
||||
if (is_user_admin($config['id_user']) === true) {
|
||||
$sub['extensions/db_status']['text'] = __('DB Schema Check');
|
||||
$sub['extensions/db_status']['id'] = 'DB Schema Check';
|
||||
@ -418,10 +430,12 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
|
||||
enterprise_hook('elasticsearch_interface_menu');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$menu_godmode['gextensions']['sub'] = $sub;
|
||||
}
|
||||
|
||||
if ($access_console_node === true) {
|
||||
if (is_array($config['extensions']) === true) {
|
||||
$sub = [];
|
||||
$sub2 = [];
|
||||
@ -523,10 +537,11 @@ foreach ($rows as $row) {
|
||||
}
|
||||
|
||||
$menu_godmode['links']['sub'] = $sub;
|
||||
}
|
||||
|
||||
// Warp Manager.
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true && (bool) $config['enable_update_manager'] === true) {
|
||||
$menu_godmode['messages']['text'] = __('Warp Update');;
|
||||
$menu_godmode['messages']['text'] = __('Warp Update');
|
||||
$menu_godmode['messages']['id'] = 'god-um_messages';
|
||||
$menu_godmode['messages']['sec2'] = '';
|
||||
|
||||
@ -546,6 +561,7 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true && (bool) $config['en
|
||||
$menu_godmode['messages']['sub'] = $sub;
|
||||
}
|
||||
|
||||
if ($access_console_node === true) {
|
||||
// Module library.
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AR') === true) {
|
||||
$menu_godmode['gmodule_library']['text'] = __('Module library');
|
||||
@ -560,6 +576,7 @@ if ((bool) check_acl($config['id_user'], 0, 'AR') === true) {
|
||||
|
||||
$menu_godmode['gmodule_library']['sub'] = $sub;
|
||||
}
|
||||
}
|
||||
|
||||
if ((bool) $config['pure'] === false) {
|
||||
menu_print_menu($menu_godmode);
|
||||
|
@ -158,6 +158,12 @@ if ($classname_selected === null) {
|
||||
// Load classes and print selector.
|
||||
$wiz_data = [];
|
||||
foreach ($classes as $classpath) {
|
||||
if (is_reporting_console_node() === false) {
|
||||
if ($classpath !== '/var/www/html/pandora_console/godmode/wizards/DiscoveryTaskList.class.php') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$classname = basename($classpath, '.class.php');
|
||||
$obj = new $classname();
|
||||
|
||||
|
@ -497,6 +497,17 @@ $table->data[$i++][1] = html_print_checkbox_switch(
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[$i][0] = __('Enable console report').ui_print_help_tip(
|
||||
__('Enable console report'),
|
||||
true
|
||||
);
|
||||
$table->data[$i++][1] = html_print_checkbox_switch(
|
||||
'reporting_console_enable',
|
||||
1,
|
||||
$config['reporting_console_enable'],
|
||||
true
|
||||
);
|
||||
|
||||
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">';
|
||||
|
||||
echo '<fieldset>';
|
||||
|
@ -162,7 +162,9 @@ class DiscoveryTaskList extends HTML
|
||||
$ret = false;
|
||||
}
|
||||
|
||||
if (is_reporting_console_node() === false) {
|
||||
$ret2 = $this->showList();
|
||||
}
|
||||
|
||||
if ($ret === false && $ret2 === false) {
|
||||
include_once $config['homedir'].'/general/first_task/recon_view.php';
|
||||
|
@ -6065,3 +6065,50 @@ if (function_exists('str_contains') === false) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is reporting console node.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_reporting_console_node()
|
||||
{
|
||||
global $config;
|
||||
if (isset($config['reporting_console_enable']) === true
|
||||
&& (bool) $config['reporting_console_enable'] === true
|
||||
&& isset($config['reporting_console_node']) === true
|
||||
&& (bool) $config['reporting_console_node'] === true
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Acl reporting console node.
|
||||
*
|
||||
* @param string $path Path.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function acl_reporting_console_node($path)
|
||||
{
|
||||
if (is_reporting_console_node() === false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($path === 'godmode/servers/discovery'
|
||||
|| $path === 'operation/users/user_edit'
|
||||
|| $path === 'operation/users/user_edit_notifications'
|
||||
|| $path === 'godmode/setup/file_manager'
|
||||
|| $path === 'godmode/update_manager/update_manager'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
@ -358,6 +358,10 @@ function config_update_config()
|
||||
$error_update[] = __('Module Custom ID read only');
|
||||
}
|
||||
|
||||
if (config_update_value('reporting_console_enable', get_parameter('reporting_console_enable'), true) === false) {
|
||||
$error_update[] = __('Enable console report');
|
||||
}
|
||||
|
||||
if (config_update_value('unique_ip', get_parameter('unique_ip'), true) === false) {
|
||||
$error_update[] = __('Unique IP');
|
||||
}
|
||||
@ -2193,6 +2197,10 @@ function config_process_config()
|
||||
config_update_value('module_custom_id_ro', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['reporting_console_enable'])) {
|
||||
config_update_value('reporting_console_enable', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['elasticsearch_ip'])) {
|
||||
config_update_value('elasticsearch_ip', '');
|
||||
}
|
||||
|
@ -10,6 +10,14 @@
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.responsive-height {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 18px;
|
||||
font-family: "lato-bolder", "Open Sans", sans-serif;
|
||||
@ -58,3 +66,13 @@ a:hover {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.container-list {
|
||||
list-style: none;
|
||||
width: 20%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: space-around;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
@ -605,6 +605,13 @@ if (isset($config['id_user']) === false) {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_reporting_console_node() === false) {
|
||||
$_GET['sec'] = 'discovery';
|
||||
$_GET['sec2'] = 'godmode/servers/discovery';
|
||||
$_GET['wiz'] = 'tasklist';
|
||||
$home_page = '';
|
||||
}
|
||||
|
||||
db_logon($nick_in_db, $_SERVER['REMOTE_ADDR']);
|
||||
$_SESSION['id_usuario'] = $nick_in_db;
|
||||
$config['id_user'] = $nick_in_db;
|
||||
@ -624,8 +631,6 @@ if (isset($config['id_user']) === false) {
|
||||
config_prepare_session();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ==========================================================
|
||||
// -------- SET THE CUSTOM CONFIGS OF USER ------------------
|
||||
config_user_set_custom_config();
|
||||
@ -1042,6 +1047,13 @@ if ((bool) ($config['maintenance_mode'] ?? false) === true
|
||||
exit('</html>');
|
||||
}
|
||||
|
||||
if (is_reporting_console_node() === false
|
||||
&& (bool) users_is_admin() === false
|
||||
) {
|
||||
include 'general/reporting_console_node.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------
|
||||
* EXTENSIONS
|
||||
@ -1224,6 +1236,12 @@ if ($searchPage) {
|
||||
$sec2 = '';
|
||||
}
|
||||
|
||||
$acl_reporting_console_node = acl_reporting_console_node($page);
|
||||
if ($acl_reporting_console_node === false) {
|
||||
include 'general/reporting_console_node.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$page .= '.php';
|
||||
|
||||
// Enterprise ACL check.
|
||||
|
@ -25,9 +25,11 @@ enterprise_include('operation/menu.php');
|
||||
$menu_operation = [];
|
||||
$menu_operation['class'] = 'operation';
|
||||
|
||||
$access_console_node = !is_reporting_console_node();
|
||||
if ($access_console_node === true) {
|
||||
// Agent read, Server read.
|
||||
if (check_acl($config['id_user'], 0, 'AR')) {
|
||||
// View agents
|
||||
// View agents.
|
||||
$menu_operation['estado']['text'] = __('Monitoring');
|
||||
$menu_operation['estado']['sec2'] = 'operation/agentes/tactical';
|
||||
$menu_operation['estado']['refr'] = 0;
|
||||
@ -136,7 +138,7 @@ if (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], 0, '
|
||||
$sub2['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator');
|
||||
}
|
||||
|
||||
if (!empty($sub2)) {
|
||||
if (empty($sub2) === false) {
|
||||
$sub['snmpconsole']['sub2'] = $sub2;
|
||||
$sub['snmpconsole']['text'] = __('SNMP');
|
||||
$sub['snmpconsole']['id'] = 'SNMP';
|
||||
@ -149,7 +151,6 @@ enterprise_hook('cluster_menu');
|
||||
enterprise_hook('aws_menu');
|
||||
enterprise_hook('SAP_view');
|
||||
|
||||
|
||||
if (!empty($sub)) {
|
||||
$menu_operation['estado']['text'] = __('Monitoring');
|
||||
$menu_operation['estado']['sec2'] = 'operation/agentes/tactical';
|
||||
@ -171,6 +172,7 @@ if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, '
|
||||
|
||||
enterprise_hook('services_menu');
|
||||
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'VR') || check_acl($config['id_user'], 0, 'VW') || check_acl($config['id_user'], 0, 'VM')) {
|
||||
if (!isset($config['vc_favourite_view']) || $config['vc_favourite_view'] == 0) {
|
||||
// Visual console.
|
||||
@ -253,7 +255,6 @@ if (check_acl($config['id_user'], 0, 'VR') || check_acl($config['id_user'], 0, '
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, 'MW') || check_acl($config['id_user'], 0, 'MM')) {
|
||||
// INI GIS Maps.
|
||||
if ($config['activate_gis']) {
|
||||
@ -469,6 +470,7 @@ if (check_acl($config['id_user'], 0, 'ER')
|
||||
<?php
|
||||
$menu_operation['eventos']['sub'] = $sub;
|
||||
}
|
||||
}
|
||||
|
||||
// Workspace.
|
||||
$menu_operation['workspace']['text'] = __('Workspace');
|
||||
@ -487,7 +489,7 @@ $sub['operation/users/user_edit_notifications']['text'] = __('Configure user not
|
||||
$sub['operation/users/user_edit_notifications']['id'] = 'Configure user notifications';
|
||||
$sub['operation/users/user_edit_notifications']['refr'] = 0;
|
||||
|
||||
|
||||
if ($access_console_node === true) {
|
||||
// Incidents.
|
||||
$temp_sec2 = $sec2;
|
||||
$sec2 = 'incident';
|
||||
@ -521,10 +523,11 @@ $sub2['operation/messages/message_list']['text'] = __('Messages List');
|
||||
$sub2['operation/messages/message_edit&new_msg=1']['text'] = __('New message');
|
||||
|
||||
$sub['message_list']['sub2'] = $sub2;
|
||||
}
|
||||
|
||||
$menu_operation['workspace']['sub'] = $sub;
|
||||
|
||||
// End Workspace
|
||||
if ($access_console_node === true) {
|
||||
// Rest of options, all with AR privilege (or should events be with incidents?)
|
||||
// ~ if (check_acl ($config['id_user'], 0, "AR")) {
|
||||
// Extensions menu additions.
|
||||
@ -621,6 +624,8 @@ if (is_array($config['extensions'])) {
|
||||
}
|
||||
|
||||
// ~ }
|
||||
}
|
||||
|
||||
// Save operation menu array to use in operation/extensions.php view
|
||||
$operation_menu_array = $menu_operation;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user