Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center

This commit is contained in:
Daniel Barbero Martin 2021-04-13 08:34:05 +02:00
commit aa31ed8f58
38 changed files with 175 additions and 88 deletions

View File

@ -46,4 +46,3 @@ Pandora FMS is a monitoring tool that not only measures if a parameter is right
<br />
<br />
![screenshot 4](http://wolf359.artica.es/public_images/pandora6.0sp3-sample-visual-console.png)

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.753-210412
Version: 7.0NG.753-210413
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.753"
PI_BUILD="210412"
PI_BUILD="210413"
OS_NAME=`uname -s`
FORCE=0
@ -166,7 +166,7 @@ uninstall () {
rm -f $DESTDIR/etc/newsyslog.d/pandora_agent.conf
# Remove systemd service if exists
if [ `systemctl --v 2> /dev/null | grep systemd | wc -l` != 0 ]
if [ `command -v systemctl` ]
then
PANDORA_AGENT_SERVICE="/etc/systemd/system/pandora_agent_daemon.service"
rm -f $PANDORA_AGENT_SERVICE
@ -482,7 +482,7 @@ install () {
fi
# Create systemd service
if [ `systemctl --v 2> /dev/null | grep systemd | wc -l` != 0 ]
if [ `command -v systemctl` ]
then
echo "Creating systemd service for pandora_agent_daemon"

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210412}
{210413}
ViewReadme
{Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.753-210412
Version: 7.0NG.753-210413
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1,6 +1,8 @@
START TRANSACTION;
ALTER TABLE `tagent_custom_fields` MODIFY COLUMN `combo_values` TEXT NOT NULL DEFAULT '';
ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT;
ALTER TABLE `treport_content_template` MODIFY `external_source` MEDIUMTEXT;
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event&#x20;name\",\"Event&#x20;type\",\"Source\",\"Agent&#x20;name&#x20;or&#x20;_agent_\",\"Event&#x20;severity\",\"ID&#x20;extra\",\"Tags&#x20;separated&#x20;by&#x20;commas\",\"Comments\",\"\",\"\"]' WHERE `name` = "Monitoring&#x20;Event";

View File

@ -811,7 +811,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`description` mediumtext,
`text_agent` text,
`text` TEXT,
`external_source` Text,
`external_source` mediumtext,
`treport_custom_sql_id` INTEGER UNSIGNED default 0,
`header_definition` TinyText default NULL,
`column_separator` TinyText default NULL,
@ -1741,6 +1741,7 @@ ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NUL
ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT;
-- ---------------------------------------------------------------------
-- Table `tmodule_relationship`

View File

@ -46,7 +46,7 @@ if (is_metaconsole() === true) {
}
if (is_ajax() === true) {
if (check_acl($config['id_user'], 0, 'AR') === false) {
if ((bool) check_acl($config['id_user'], 0, 'AR') === false) {
db_pandora_audit('ACL Violation', 'Trying to access Group Management');
include 'general/noaccess.php';
return;
@ -72,7 +72,7 @@ if (is_ajax() === true) {
return;
}
if (check_acl($config['id_user'], $id_group, 'AR') === false) {
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
@ -114,7 +114,7 @@ if (is_ajax() === true) {
);
$force_serialized = (bool) get_parameter('force_serialized', false);
if (check_acl($config['id_user'], $id_group, 'AR') === false) {
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
@ -265,15 +265,9 @@ if (is_ajax() === true) {
$tab = (string) get_parameter('tab', 'groups');
if ($tab != 'credbox' && ! check_acl(
$config['id_user'],
0,
'PM'
) && ! check_acl(
$config['id_user'],
0,
'AW'
)
if ($tab !== 'credbox'
&& (bool) check_acl($config['id_user'], 0, 'PM') === false
&& (bool) check_acl($config['id_user'], 0, 'AW') === false
) {
db_pandora_audit(
'ACL Violation',
@ -281,9 +275,9 @@ if ($tab != 'credbox' && ! check_acl(
);
include 'general/noaccess.php';
return;
} else if ($tab == 'credbox'
&& check_acl($config['id_user'], 0, 'UM') === false
&& check_acl($config['id_user'], 0, 'PM') === false
} else if ($tab === 'credbox'
&& (bool) check_acl($config['id_user'], 0, 'UM') === false
&& (bool) check_acl($config['id_user'], 0, 'PM') === false
) {
db_pandora_audit(
'ACL Violation',
@ -382,7 +376,7 @@ $delete_group = (bool) get_parameter('delete_group');
$pure = get_parameter('pure', 0);
// Create group.
if (($create_group) && (check_acl($config['id_user'], 0, 'PM') === true)) {
if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
$id_parent = (int) get_parameter('id_parent');
@ -506,7 +500,7 @@ if ($update_group) {
}
// Delete group.
if (($delete_group) && (check_acl($config['id_user'], 0, 'PM') === true)) {
if (($delete_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
$id_group = (int) get_parameter('id_group');
$usedGroup = groups_check_used($id_group);

View File

@ -66,6 +66,7 @@ if (is_ajax()) {
function ($counter, $server) use ($id_tag) {
if (metaconsole_connect($server) === NOERR) {
$counter += tags_get_local_modules_count($id_tag);
metaconsole_restore_db();
}
return $counter;
@ -83,6 +84,7 @@ if (is_ajax()) {
function ($counter, $server) use ($id_tag) {
if (metaconsole_connect($server) === NOERR) {
$counter += tags_get_policy_modules_count($id_tag);
metaconsole_restore_db();
}
return $counter;
@ -272,6 +274,7 @@ if (!empty($result)) {
function ($counter, $server) use ($tag_id) {
if (metaconsole_connect($server) === NOERR) {
$counter += tags_get_modules_count($tag_id);
metaconsole_restore_db();
}
return $counter;

View File

@ -260,21 +260,21 @@ if (isset($_GET['user_del'])) {
if (defined('METACONSOLE') && isset($_GET['delete_all'])) {
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
// Connect to the remote console
metaconsole_connect($server);
// Connect to the remote console.
if (metaconsole_connect($server) === NOERR) {
// Delete the user
$result = delete_user($id_user);
if ($result) {
db_pandora_audit(
'User management',
__('Deleted user %s from metaconsole', io_safe_input($id_user))
);
}
// Delete the user
$result = delete_user($id_user);
if ($result) {
db_pandora_audit(
'User management',
__('Deleted user %s from metaconsole', io_safe_input($id_user))
);
// Restore the db connection.
metaconsole_restore_db();
}
// Restore the db connection
metaconsole_restore_db();
// Log to the metaconsole too
if ($result) {
db_pandora_audit(

View File

@ -1381,6 +1381,12 @@ if ($get_extended_event) {
'EW',
$event['clean_tags'],
$childrens_ids
)) || (tags_checks_event_acl(
$config['id_user'],
$event['id_grupo'],
'ER',
$event['clean_tags'],
$childrens_ids
)))
) {
$tabs .= "<li><a href='#extended_event_responses_page' id='link_responses'>".html_print_image(
@ -1444,6 +1450,12 @@ if ($get_extended_event) {
'EW',
$event['clean_tags'],
$childrens_ids
)) || (tags_checks_event_acl(
$config['id_user'],
$event['id_grupo'],
'ER',
$event['clean_tags'],
$childrens_ids
)))
) {
$responses = events_page_responses($event);
@ -1465,15 +1477,21 @@ if ($get_extended_event) {
$related = events_page_related($event, $server);
}
$connected = true;
if ($meta) {
metaconsole_connect($server);
if (metaconsole_connect($server) === NOERR) {
$connected = true;
} else {
$connected = false;
}
}
$custom_fields = events_page_custom_fields($event);
if ($connected === true) {
$custom_fields = events_page_custom_fields($event);
$custom_data = events_page_custom_data($event);
}
$custom_data = events_page_custom_data($event);
if ($meta) {
if ($meta && $connected === true) {
metaconsole_restore_db();
}

View File

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

View File

@ -2858,7 +2858,11 @@ function can_user_access_node()
{
global $config;
$userinfo = get_user_info($config['id_user']);
static $userinfo;
if ($userinfo === null) {
$userinfo = get_user_info($config['id_user']);
}
if (is_metaconsole()) {
return $userinfo['is_admin'] == 1 ? 1 : $userinfo['metaconsole_access_node'];

View File

@ -697,6 +697,33 @@ function cron_list_table()
$args = unserialize($task['args']);
break;
case 'cron_task_generate_csv_log':
if ($manage_pandora) {
$data[0] = '<a href="'.$url;
$data[0] .= 'force_run=1&id_user_task='.$task['id'].'">';
$data[0] .= html_print_image(
'images/target.png',
true,
[
'title' => __('Force run'),
'class' => 'invert_filter',
]
);
$data[0] .= '</a>';
} else {
$data[0] = '';
}
$data[1] = $task['id_usuario'];
$data[2] = db_get_value(
'name',
'tuser_task',
'id',
$task['id_user_task']
);
$args = unserialize($task['args']);
break;
default:
// Ignore.
break;

View File

@ -3669,22 +3669,37 @@ function events_page_responses($event, $childrens_ids=[])
);
}
$table_responses->data[] = $data;
if ((tags_checks_event_acl(
$config['id_user'],
$event['id_grupo'],
'EM',
$event['clean_tags'],
$childrens_ids
)) || (tags_checks_event_acl(
$config['id_user'],
$event['id_grupo'],
'EW',
$event['clean_tags'],
$childrens_ids
))
) {
$table_responses->data[] = $data;
// Comments.
$data = [];
$data[0] = __('Comment');
$data[1] = '';
$data[2] = html_print_button(
__('Add comment'),
'comment_button',
false,
'$(\'#link_comments\').trigger(\'click\');',
'class="sub next w70p"',
true
);
// Comments.
$data = [];
$data[0] = __('Comment');
$data[1] = '';
$data[2] = html_print_button(
__('Add comment'),
'comment_button',
false,
'$(\'#link_comments\').trigger(\'click\');',
'class="sub next w70p"',
true
);
$table_responses->data[] = $data;
$table_responses->data[] = $data;
}
if (tags_checks_event_acl(
$config['id_user'],

View File

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

View File

@ -211,7 +211,7 @@ if (is_ajax()) {
$agents = array_reduce(
$rows,
function ($carry, $item) {
if ($carry[$item['id_tmetaconsole_setup']] === null) {
if ($carry[$item['id_tmetaconsole_setup']] === null) {
$carry[$item['id_tmetaconsole_setup']] = [];
}

View File

@ -1608,8 +1608,20 @@ try {
}
// Event responses.
$sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'";
$event_responses = db_get_all_rows_sql($sql_event_resp);
if (is_user_admin($config['id_user'])) {
$sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'";
$event_responses = db_get_all_rows_sql($sql_event_resp);
} else {
$id_groups = array_keys(users_get_groups(false, 'EW'));
$event_responses = db_get_all_rows_filter(
'tevent_response',
[
'id_group' => $id_groups,
'type' => 'command',
]
);
}
if ($config['event_replication'] != 1) {
if ($event_w && !$readonly) {

View File

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

View File

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

View File

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

View File

@ -1511,7 +1511,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`description` mediumtext,
`id_agent` int(10) unsigned NOT NULL default 0,
`text` TEXT,
`external_source` Text,
`external_source` mediumtext,
`treport_custom_sql_id` INTEGER UNSIGNED default 0,
`header_definition` TinyText,
`column_separator` TinyText,
@ -3114,7 +3114,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`description` mediumtext,
`text_agent` text,
`text` TEXT,
`external_source` Text,
`external_source` mediumtext,
`treport_custom_sql_id` INTEGER UNSIGNED default 0,
`header_definition` TinyText default NULL,
`column_separator` TinyText default NULL,

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.753-210412
Version: 7.0NG.753-210413
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.753
%define release 210412
%define release 210413
Summary: Pandora FMS Server
Name: %{name}
@ -82,7 +82,9 @@ install -m 0444 man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/
rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/PandoraFMS
rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/recon_scripts/PandoraFMS
install -m 0644 util/pandora_server_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server
if [ ! -f $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server ] ; then
install -m 0644 util/pandora_server_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server
fi
install -m 0640 conf/pandora_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/pandora/pandora_server.conf.new
install -m 0640 conf/tentacle_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/tentacle/tentacle_server.conf.new

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.753
%define release 210412
%define release 210413
Summary: Pandora FMS Server
Name: %{name}
@ -122,7 +122,12 @@ systemctl enable pandora_server.service
echo "/usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" > /etc/cron.hourly/pandora_db
chmod 750 /etc/cron.hourly/pandora_db
cp -aRf /usr/share/pandora_server/util/pandora_server_logrotate /etc/logrotate.d/pandora_server
if [ -d /etc/logrotate.d ] ; then
if [ ! -f /etc/logrotate.d/pandora_server ] ; then
cp -aRf /usr/share/pandora_server/util/pandora_server_logrotate /etc/logrotate.d/pandora_server
fi
fi
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.753"
PI_BUILD="210412"
PI_BUILD="210413"
MODE=$1
if [ $# -gt 1 ]; then
@ -354,9 +354,14 @@ install () {
if [ -d /etc/logrotate.d ]
then
[ -d $DESTDIR/etc/logrotate.d ] || mkdir -p $DESTDIR/etc/logrotate.d
echo "Creating logrotate.d entry for Pandora FMS log management"
cp util/pandora_server_logrotate $DESTDIR/etc/logrotate.d/pandora_server
if [ -f $DESTDIR/etc/logrotate.d/pandora_server ]
then
echo "A logrotate.d entry for Pandora FMS log management already exists, skipping creation"
else
echo "Creating logrotate.d entry for Pandora FMS log management"
[ -d $DESTDIR/etc/logrotate.d ] || mkdir -p $DESTDIR/etc/logrotate.d
cp util/pandora_server_logrotate $DESTDIR/etc/logrotate.d/pandora_server
fi
else
echo "Please add a log rotation schedule manually to your log rotation daemon (if any)"
fi

View File

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

View File

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