Merge remote-tracking branch 'origin/develop' into ent-5785-Nuevo-informe-inventario-de-agentes

This commit is contained in:
alejandro.campos@artica.es 2021-06-04 10:32:45 +02:00
commit 70946af507
167 changed files with 3946 additions and 1662 deletions

View File

@ -254,6 +254,8 @@ server_dependencies=" \
perl(Geo::IP) \ perl(Geo::IP) \
perl(IO::Socket::INET6) \ perl(IO::Socket::INET6) \
perl(XML::Twig) \ perl(XML::Twig) \
expect \
openssh-clients \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm" http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"

View File

@ -11,7 +11,7 @@ RUN dnf install -y --setopt=tsflags=nodocs \
RUN dnf module reset -y php && dnf module install -y php:remi-7.3 RUN dnf module reset -y php && dnf module install -y php:remi-7.3
RUN dnf config-manager --set-enabled powertools RUN dnf config-manager --set-enabled powertools
# Install console # Install console dependencies
RUN dnf install -y --setopt=tsflags=nodocs \ RUN dnf install -y --setopt=tsflags=nodocs \
php \ php \
php-mcrypt \php-cli \ php-mcrypt \php-cli \
@ -91,9 +91,9 @@ RUN dnf install -y --setopt=tsflags=nodocs \
php-yaml php-yaml
RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/ RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/
# not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts # Not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts
# Install server # Install server dependencies
RUN dnf install -y --setopt=tsflags=nodocs \ RUN dnf install -y --setopt=tsflags=nodocs \
GeoIP \ GeoIP \
@ -256,16 +256,18 @@ RUN dnf install -y --setopt=tsflags=nodocs \
nmap \ nmap \
net-snmp-utils \ net-snmp-utils \
sudo \ sudo \
expect \
openssh-clients \
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.artica.es/centos8/wmi-1.3.14-4.el7.art.x86_64.rpm http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm
# install utils # Install utils
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
# SDK VMware perl dependencies # SDK VMware perl dependencies
RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm
# Instant client Oracle # Instant client Oracle
RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm
# Install Phantom
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.754-210513 Version: 7.0NG.754-210528
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.754-210513" pandora_version="7.0NG.754-210528"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.754'; use constant AGENT_VERSION => '7.0NG.754';
use constant AGENT_BUILD => '210513'; use constant AGENT_BUILD => '210528';
# 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;
@ -2331,9 +2331,6 @@ sub launch_tentacle_proxy () {
#Execute tentacle server as a daemon #Execute tentacle server as a daemon
my $new_process = "tentacle_server -a ".$Conf{'proxy_address'}." -p ".$Conf{'proxy_port'}." -b ".$Conf{'server_ip'}." -g ".$Conf{'server_port'}." -c ".$Conf{'proxy_max_connection'}." -t ".$Conf{'proxy_timeout'}; my $new_process = "tentacle_server -a ".$Conf{'proxy_address'}." -p ".$Conf{'proxy_port'}." -b ".$Conf{'server_ip'}." -g ".$Conf{'server_port'}." -c ".$Conf{'proxy_max_connection'}." -t ".$Conf{'proxy_timeout'};
$new_process .= ' -C' if ($Conf{'server_ssl'} eq '1');
log_message ('setup', 'Proxy mode enabled'); log_message ('setup', 'Proxy mode enabled');
exec ($new_process); exec ($new_process);
} }

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.754 %define version 7.0NG.754
%define release 210513 %define release 210528
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.754 %define version 7.0NG.754
%define release 210513 %define release 210528
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.754" PI_VERSION="7.0NG.754"
PI_BUILD="210513" PI_BUILD="210528"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -3,7 +3,7 @@
######################################################################## ########################################################################
# Pandora FMS - Remote Event Tool (via WEB API) # Pandora FMS - Remote Event Tool (via WEB API)
######################################################################## ########################################################################
# Copyright (c) 2013 Artica Soluciones Tecnologicas S.L # Copyright (c) 2021 Artica Soluciones Tecnologicas S.L
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 2 # modify it under the terms of the GNU General Public License version 2
@ -12,6 +12,7 @@
# Includes list # Includes list
use strict; use strict;
use LWP::Simple; use LWP::Simple;
use LWP::UserAgent;
use MIME::Base64; use MIME::Base64;
use lib '/usr/lib/perl5'; use lib '/usr/lib/perl5';
use PandoraFMS::Tools; use PandoraFMS::Tools;
@ -32,40 +33,41 @@ sub help_screen{
\t$0 -p <path_to_consoleAPI> -u <credentials> -create_event <options> \t$0 -p <path_to_consoleAPI> -u <credentials> -create_event <options>
Where options:\n Where options:\n
-u <credentials> : API credentials separated by comma: <api_pass>,<user>,<pass> -u <credentials> : API credentials separated by comma: <api_pass>,<user>,<pass>
-name <event_name> : Free text -name <event_name> : Free text (surrounded by single-quotes, for security reasons)
-group <id_group> : Group ID (use 0 for 'all') -group <id_group> : Group ID (use 0 for 'all')
-agent : Agent ID
Optional parameters: Optional parameters:
[-status <status>] : 0 New, 1 Validated, 2 In process [-agent <id_agent] : Agent ID
[-user <id_user>] : User comment (use in combination with -comment option) [-status <status>] : 0 New, 1 Validated, 2 In process
[-type <event_type>] : unknown, alert_fired, alert_recovered, alert_ceased [-user <id_user>] : User comment (use in combination with -comment option)
[-type <event_type>] : unknown, alert_fired, alert_recovered, alert_ceased
alert_manual_validation, system, error, new_agent alert_manual_validation, system, error, new_agent
configuration_change, going_unknown, going_down_critical, configuration_change, going_unknown, going_down_critical,
going_down_warning, going_up_normal going_down_warning, going_up_normal
[-severity <severity>] : 0 Maintance, [-severity <severity>] : 0 Maintance,
1 Informative, 1 Informative,
2 Normal, 2 Normal,
3 Warning, 3 Warning,
4 Crit, 4 Crit,
5 Minor, 5 Minor,
6 Major 6 Major
[-am <id_agent_module>] : ID Agent Module linked to event [-am <id_agent_module>] : ID Agent Module linked to event
[-alert <id_alert_am>] : ID Alert Module linked to event [-alert <id_alert_am>] : ID Alert Module linked to event
[-c_instructions <critical_instructions>] [-c_instructions <critical_instructions>]
[-w_instructions <warning_instructions>] [-w_instructions <warning_instructions>]
[-u_instructions <unknown_instructions>] [-u_instructions <unknown_instructions>]
[-user_comment <comment>] [-user_comment <comment>] : Free text (surrounded by single-quotes, for security reasons)
[-owner_user <owner event>] : Use the login name, not the descriptive [-owner_user <owner event>] : Use the login name, not the descriptive
[-source <source>] : (By default 'Pandora') [-source <source>] : (By default 'Pandora')
[-tag <tags>] : Tag (must exist in the system to be imported) [-tag <tags>] : Tag (must exist in the system to be imported)
[-custom_data <custom_data>]: Custom data has to be in JSON format. Example: -custom_data \'{\"test1\" : \"t1\", \"test2\": \"2\"}\' [-custom_data <custom_data>]: Custom data has to be in JSON format. Example: -custom_data \'{\"test1\" : \"t1\", \"test2\": \"2\"}\'
[-id_extra <id extra>] : Id extra [-id_extra <id extra>] : Id extra
[-agent_name <Agent name>] : Agent name, Not to be confused with the alias. [-agent_name <Agent name>] : Agent name, Not to be confused with the alias.
[-force_create_agent<0 o 1>]: Force the creation of agent through an event this will create when it is 1. [-force_create_agent<0 o 1>] : Force the creation of agent through an event this will create when it is 1.
[-server_id <server_id>] : The pandora node server_id\n\n"; [-separator '<char/s>'] : If you use the vertical bar `|` in the event name, you must set other character for send the info. This must be surrounded by single-quotes
[-server_id <server_id>] : The pandora node server_id\n\n";
print "Example of event generation:\n\n"; print "Example of event generation:\n\n";
@ -88,7 +90,7 @@ Optional parameters:
############################################################################## ##############################################################################
sub tool_api_init () { sub tool_api_init () {
print "\nPandora FMS Remote Event Tool Copyright (c) 2013-2015 Artica ST\n"; print "\nPandora FMS Remote Event Tool Copyright (c) 2013-2021 Artica ST\n";
print "This program is Free Software, licensed under the terms of GPL License v2\n"; print "This program is Free Software, licensed under the terms of GPL License v2\n";
print "You can download latest versions and documentation at http://www.pandorafms.org\n\n"; print "You can download latest versions and documentation at http://www.pandorafms.org\n\n";
@ -120,7 +122,7 @@ sub tool_api_main () {
my $db_user; my $db_user;
my $db_pass; my $db_pass;
my @db_info; my @db_info;
my $id_agent; my $id_agent = '0';
my $id_user = ''; my $id_user = '';
my $status = ''; my $status = '';
my $id_agent_module = ''; my $id_agent_module = '';
@ -141,6 +143,7 @@ sub tool_api_main () {
my $call_api; my $call_api;
my $custom_data = ""; my $custom_data = "";
my $server_id = 0; my $server_id = 0;
my $separator = '|';
#~ help or api path (required) #~ help or api path (required)
if ($ARGV[0] eq '-h') { if ($ARGV[0] eq '-h') {
@ -185,12 +188,18 @@ sub tool_api_main () {
if ($line eq '-agent') { if ($line eq '-agent') {
$id_agent = $ARGV[$i + 1]; $id_agent = $ARGV[$i + 1];
# If not defined, send 0 for API.
if ($id_agent eq undef) {
$id_agent = '0';
}
} }
if ($line eq '-group') { if ($line eq '-group') {
$id_group = $ARGV[$i + 1]; $id_group = $ARGV[$i + 1];
} }
if ($line eq '-name') { if ($line eq '-name') {
$event_name = $ARGV[$i + 1]; $event_name = $ARGV[$i + 1];
$event_name =~ s/#/%23/g;
} }
if ($line eq '-type') { if ($line eq '-type') {
$event_type = $ARGV[$i + 1]; $event_type = $ARGV[$i + 1];
@ -250,50 +259,49 @@ sub tool_api_main () {
if ($line eq '-server_id') { if ($line eq '-server_id') {
$server_id = $ARGV[$i + 1]; $server_id = $ARGV[$i + 1];
} }
if ($line eq '-separator') {
$separator = $ARGV[$i + 1];
}
$i++; $i++;
} }
if ($event_name eq "") { if ($event_name eq "") {
print "[ERROR] Missing id agent! Read help info:\n\n"; print "[ERROR] Missing event name! Read help info:\n\n";
help_screen (); help_screen ();
} }
if ($id_group eq "") { if ($id_group eq "") {
print "[ERROR] Missing event group! Read help info:\n\n"; print "[ERROR] Missing event group! Read help info:\n\n";
help_screen (); help_screen ();
} }
if ($id_agent eq "" && $agent_name eq "") {
print "[ERROR] Missing id agent! and agent_name Read help info:\n\n";
help_screen ();
}
$data_event = $event_name . $data_event = $event_name .
"|" . $id_group . $separator . $id_group .
"|" . $id_agent . $separator . $id_agent .
"|" . $status . $separator . $status .
"|" . $id_user . $separator . $id_user .
"|" . $event_type . $separator . $event_type .
"|" . $severity . $separator . $severity .
"|" . $id_agent_module . $separator . $id_agent_module .
"|" . $id_alert_am . $separator . $id_alert_am .
"|" . $critical_instructions . $separator . $critical_instructions .
"|" . $warning_instructions . $separator . $warning_instructions .
"|" . $unknown_instructions . $separator . $unknown_instructions .
"|" . $user_comment . $separator . $user_comment .
"|" . $owner_user . $separator . $owner_user .
"|" . $source . $separator . $source .
"|" . $tags . $separator . $tags .
"|" . $custom_data . $separator . $custom_data .
"|" . $server_id . $separator . $server_id .
"|" . $id_extra . $separator . $id_extra .
"|" . $agent_name . $separator . $agent_name .
"|" . $force_create_agent; $separator . $force_create_agent;
$call_api = $api_path . '?' . $call_api = $api_path . '?' .
'op=set&' . 'op=set&' .
'op2=create_event&' . 'op2=create_event&' .
'other=' . $data_event .'&' . 'other=' . $data_event .'&' .
'other_mode=url_encode_separator_|&' . 'other_mode=url_encode_separator_'.$separator.'&' .
'apipass=' . $api_pass . '&' . 'apipass=' . $api_pass . '&' .
'user=' . $db_user . '&' . 'user=' . $db_user . '&' .
'pass=' . $db_pass; 'pass=' . $db_pass;
@ -321,7 +329,8 @@ sub tool_api_main () {
exit; exit;
} }
else { else {
my $content = get($call_api); my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
my $content = $ua->get($call_api);
if ($option eq '-create_event') { if ($option eq '-create_event') {
if ($content eq undef) { if ($content eq undef) {
@ -329,7 +338,7 @@ sub tool_api_main () {
help_screen(); help_screen();
} }
else { else {
print "Event ID: $content"; print "Event ID: $content->{'_content'}";
} }
} }
elsif ($option eq '-validate_event') { elsif ($option eq '-validate_event') {

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{210513} {210528}
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.754 Build 210513") #define PANDORA_VERSION ("7.0NG.754 Build 210528")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -423,7 +423,7 @@ Pandora_Windows_Service::killTentacleProxy() {
int int
Pandora_Windows_Service::launchTentacleProxy() { Pandora_Windows_Service::launchTentacleProxy() {
string server_ip, server_port, proxy_max_connections, proxy_timeout, server_ssl; string server_ip, server_port, proxy_max_connections, proxy_timeout;
string proxy_cmd, proxy_address, proxy_port; string proxy_cmd, proxy_address, proxy_port;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
STARTUPINFO si; STARTUPINFO si;
@ -451,15 +451,6 @@ Pandora_Windows_Service::launchTentacleProxy() {
server_port = "41121"; server_port = "41121";
} }
server_ssl = conf->getValue("server_ssl");
if (server_ssl == "1") {
proxy_cmd = "tentacle_server.exe -C";
}
else {
proxy_cmd = "tentacle_server.exe";
}
// Proxy address. // Proxy address.
proxy_address = conf->getValue("proxy_address"); proxy_address = conf->getValue("proxy_address");
if (proxy_address == "") { if (proxy_address == "") {
@ -472,7 +463,7 @@ Pandora_Windows_Service::launchTentacleProxy() {
proxy_port = "41121"; proxy_port = "41121";
} }
proxy_cmd += " -b " + server_ip + " -g " + server_port + " -c " + proxy_max_connections + " -t " + proxy_timeout + " -a " + proxy_address + " -p " + proxy_port; proxy_cmd = "tentacle_server.exe -b " + server_ip + " -g " + server_port + " -c " + proxy_max_connections + " -t " + proxy_timeout + " -a " + proxy_address + " -p " + proxy_port;
ZeroMemory (&si, sizeof (si)); ZeroMemory (&si, sizeof (si));
ZeroMemory (&pi, sizeof (pi)); ZeroMemory (&pi, sizeof (pi));

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.754(Build 210513))" VALUE "ProductVersion", "(7.0NG.754(Build 210528))"
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.754-210513 Version: 7.0NG.754-210528
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.754-210513" pandora_version="7.0NG.754-210528"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -31,18 +31,18 @@ require 'vendor/autoload.php';
define('AJAX', true); define('AJAX', true);
if (!defined('__PAN_XHPROF__')) { if (defined('__PAN_XHPROF__') === false) {
define('__PAN_XHPROF__', 0); define('__PAN_XHPROF__', 0);
} }
if (__PAN_XHPROF__ === 1) { if (__PAN_XHPROF__ === 1) {
if (function_exists('tideways_xhprof_enable')) { if (function_exists('tideways_xhprof_enable') === true) {
tideways_xhprof_enable(); tideways_xhprof_enable();
} }
} }
if ((! file_exists('include/config.php')) if (file_exists('include/config.php') === false
|| (! is_readable('include/config.php')) || is_readable('include/config.php') === false
) { ) {
exit; exit;
} }
@ -57,11 +57,11 @@ require_once 'include/auth/mysql.php';
if (isset($config['console_log_enabled']) === true if (isset($config['console_log_enabled']) === true
&& $config['console_log_enabled'] == 1 && $config['console_log_enabled'] == 1
) { ) {
ini_set('log_errors', 1); ini_set('log_errors', true);
ini_set('error_log', $config['homedir'].'/log/console.log'); ini_set('error_log', $config['homedir'].'/log/console.log');
} else { } else {
ini_set('log_errors', 0); ini_set('log_errors', false);
ini_set('error_log', null); ini_set('error_log', '');
} }
// Sometimes input is badly retrieved from caller... // Sometimes input is badly retrieved from caller...
@ -98,9 +98,11 @@ if (isset($_GET['loginhash']) === true) {
} }
} }
// Another auth class example: PandoraFMS\Dashboard\Manager.
$auth_class = io_safe_output( $auth_class = io_safe_output(
get_parameter('auth_class', 'PandoraFMS\Dashboard\Manager') get_parameter('auth_class', 'PandoraFMS\User')
); );
$public_hash = get_parameter('auth_hash', false); $public_hash = get_parameter('auth_hash', false);
$public_login = false; $public_login = false;
// Check user. // Check user.
@ -124,7 +126,7 @@ if (class_exists($auth_class) === false || $public_hash === false) {
ob_start(); ob_start();
// Enterprise support. // Enterprise support.
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php') === true) {
include_once ENTERPRISE_DIR.'/load_enterprise.php'; include_once ENTERPRISE_DIR.'/load_enterprise.php';
} }
@ -142,12 +144,12 @@ if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
); );
} }
if (is_metaconsole()) { if (is_metaconsole() === true) {
// Backward compatibility. // Backward compatibility.
define('METACONSOLE', true); define('METACONSOLE', true);
} }
if (file_exists($page)) { if (file_exists($page) === true) {
include_once $page; include_once $page;
} else { } else {
echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>'; echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>';
@ -172,7 +174,7 @@ if (isset($config['force_instant_logout']) === true
header_remove('Set-Cookie'); header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/'); setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
if ($config['auth'] == 'saml') { if ($config['auth'] === 'saml') {
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
$as = new SimpleSAML_Auth_Simple('PandoraFMS'); $as = new SimpleSAML_Auth_Simple('PandoraFMS');
$as->logout(); $as->logout();

View File

@ -1,16 +1,29 @@
<?php <?php
/** /**
* Pandora FMS - http://pandorafms.com * Agents/Modules Monitoring view.
* ================================================== *
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * @category Operations
* Please see http://pandorafms.org for full contribution list * @package Pandora FMS
* This program is free software; you can redistribute it and/or * @subpackage Opensource
* modify it under the terms of the GNU General Public License * @version 1.0.0
* as published by the Free Software Foundation; version 2 * @license See below
* 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. * | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/ */
// Begin. // Begin.
@ -435,14 +448,25 @@ function mainAgentsModules()
if ($config['pure'] == 0) { if ($config['pure'] == 0) {
// Header. // Header.
ui_print_page_header( ui_print_standard_header(
__('Agents/Modules'), __('Agents/Modules'),
'images/module.png', 'images/module.png',
false, false,
'', '',
false, false,
$updated_time (array) $updated_time,
[
[
'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('Views'),
],
]
); );
echo '<table class="w100p">'; echo '<table class="w100p">';
echo '<tr>'; echo '<tr>';
echo "<td> <span class='float-right'>".$fullscreen['text'].'</span> </td>'; echo "<td> <span class='float-right'>".$fullscreen['text'].'</span> </td>';

View File

@ -246,13 +246,24 @@ function mainModuleGroups()
$array_data[$value['id_grupo']][$value['id_mg']] = $value; $array_data[$value['id_grupo']][$value['id_mg']] = $value;
} }
ui_print_page_header( // Header.
ui_print_standard_header(
__('Combined table of agent group and module group'), __('Combined table of agent group and module group'),
'images/module_group.png', 'images/module_group.png',
false, false,
'', '',
false, false,
'' [],
[
[
'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('Views'),
],
]
); );
echo "<table cellpadding='4' cellspacing='4' class='databox filters bolder margin-bottom-10' width='100%'> echo "<table cellpadding='4' cellspacing='4' class='databox filters bolder margin-bottom-10' width='100%'>

View File

@ -53,13 +53,24 @@ function pandora_realtime_graphs()
$hide_header = get_parameter('hide_header', 0); $hide_header = get_parameter('hide_header', 0);
if ($hide_header === 0) { if ($hide_header === 0) {
ui_print_page_header( // Header.
ui_print_standard_header(
__('Realtime graphs'), __('Realtime graphs'),
'images/extensions.png', 'images/extensions.png',
false, false,
'real_time_view', 'real_time_view',
false, false,
$onheader $onheader,
[
[
'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('Views'),
],
]
); );
} }

View File

@ -1,29 +1,43 @@
<?php <?php
/**
* Resource registration.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com /**
// ================================================== * Remember the hard-coded values.
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * -- id_modulo now uses tmodule.
// Please see http://pandorafms.org for full contribution list * -- ---------------------------.
// This program is free software; you can redistribute it and/or * -- 1 - Data server modules (agent related modules)
// modify it under the terms of the GNU General Public License * -- 2 - Network server modules
// as published by the Free Software Foundation; version 2 * -- 4 - Plugin server
// This program is distributed in the hope that it will be useful, * -- 5 - Predictive server
// but WITHOUT ANY WARRANTY; without even the implied warranty of * -- 6 - WMI server
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -- 7 - WEB Server (enteprise)
// GNU General Public License for more details. * In the xml is the tag "module_source"
// Remember the hard-coded values */
/*
-- id_modulo now uses tmodule
-- ---------------------------
-- 1 - Data server modules (agent related modules)
-- 2 - Network server modules
-- 4 - Plugin server
-- 5 - Predictive server
-- 6 - WMI server
-- 7 - WEB Server (enteprise)
In the xml is the tag "module_source"
*/
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
enterprise_include_once('include/functions_local_components.php'); enterprise_include_once('include/functions_local_components.php');
@ -1096,6 +1110,7 @@ function resource_registration_extension_main()
} }
$xml = simplexml_load_file($_FILES['resource_upload']['tmp_name'], null, LIBXML_NOCDATA); $xml = simplexml_load_file($_FILES['resource_upload']['tmp_name'], null, LIBXML_NOCDATA);
if ($xml === false) { if ($xml === false) {
ui_print_error_message( ui_print_error_message(
__('Error uploading resource. Check if the selected file is a valid resource template in .ptr format') __('Error uploading resource. Check if the selected file is a valid resource template in .ptr format')

View File

@ -82,3 +82,4 @@ include/lib/WSManager.php
include/lib/WebSocketServer.php include/lib/WebSocketServer.php
include/lib/WebSocketUser.php include/lib/WebSocketUser.php
operation/network/network_explorer.php operation/network/network_explorer.php
operation/vsual_console/pure_ajax.php

View File

@ -1,9 +1,24 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_user` VARCHAR(60);
ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_pass` VARCHAR(45);
ALTER TABLE `tperfil` DROP COLUMN `incident_view`;
ALTER TABLE `tperfil` DROP COLUMN `incident_edit`;
ALTER TABLE `tperfil` DROP COLUMN `incident_management`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field16` TEXT NOT NULL AFTER `al_field15`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field16` TEXT NOT NULL AFTER `al_field15`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field17` TEXT NOT NULL AFTER `al_field16`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field17` TEXT NOT NULL AFTER `al_field16`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field18` TEXT NOT NULL AFTER `al_field17`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field18` TEXT NOT NULL AFTER `al_field17`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field19` TEXT NOT NULL AFTER `al_field18`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field19` TEXT NOT NULL AFTER `al_field18`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field20` TEXT NOT NULL AFTER `al_field19`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field20` TEXT NOT NULL AFTER `al_field19`;
SET @st_oum755 = (SELECT IF(
(SELECT COUNT(*) FROM tconfig WHERE token LIKE 'meta_custom_logo' AND value like 'logo_pandora_metaconsola.png') > 0,
"UPDATE `tconfig` set value = 'pandoraFMS_metaconsole_full.svg' WHERE token LIKE 'meta_custom_logo'",
"SELECT 1"
));
PREPARE pr_oum755 FROM @st_oum755;
EXECUTE pr_oum755;
DEALLOCATE PREPARE pr_oum755;
COMMIT; COMMIT;

View File

@ -1019,7 +1019,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
-- Criticity: 5 - Minor -- Criticity: 5 - Minor
-- Criticity: 6 - Major -- Criticity: 6 - Major
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL; ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(50,5) default NULL;
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0'; ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tmetaconsole_event` ADD INDEX `server_id` (`server_id`); ALTER TABLE `tmetaconsole_event` ADD INDEX `server_id` (`server_id`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_timestamp_idx` (`timestamp`); ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_timestamp_idx` (`timestamp`);
@ -1072,7 +1072,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
-- Criticity: 5 - Minor -- Criticity: 5 - Minor
-- Criticity: 6 - Major -- Criticity: 6 - Major
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL; ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(50,5) default NULL;
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0'; ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_estado_idx` (`estado`); ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_estado_idx` (`estado`);
ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_timestamp_idx` (`timestamp`); ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_timestamp_idx` (`timestamp`);
@ -1532,6 +1532,8 @@ ALTER TABLE `tusuario` MODIFY COLUMN `default_event_filter` int(10) unsigned NOT
ADD CONSTRAINT `fk_filter_id` FOREIGN KEY `fk_filter_id` (`id_filter`) REFERENCES `tevent_filter` (`id_filter`) ON DELETE SET NULL ON UPDATE RESTRICT, ADD CONSTRAINT `fk_filter_id` FOREIGN KEY `fk_filter_id` (`id_filter`) REFERENCES `tevent_filter` (`id_filter`) ON DELETE SET NULL ON UPDATE RESTRICT,
DROP FOREIGN KEY `fk_id_filter`, DROP FOREIGN KEY `fk_id_filter`,
DROP INDEX `fk_id_filter`; DROP INDEX `fk_id_filter`;
ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_user` VARCHAR(60);
ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_pass` VARCHAR(45);
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1554,7 +1556,7 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `debug_content` varchar(200);
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_datos` -- Table `tagente_datos`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tagente_datos MODIFY `datos` double(22,5); ALTER TABLE tagente_datos MODIFY `datos` double(50,5);
ALTER TABLE `tagente_datos` DROP INDEX `data_index1`, ADD INDEX `data_index1` (`id_agente_modulo`, `utimestamp`); ALTER TABLE `tagente_datos` DROP INDEX `data_index1`, ADD INDEX `data_index1` (`id_agente_modulo`, `utimestamp`);
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1565,7 +1567,7 @@ ALTER TABLE `tagente_datos_string` MODIFY COLUMN `datos` mediumtext NOT NULL, DR
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_datos_inc` -- Table `tagente_datos_inc`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tagente_datos_inc MODIFY `datos` double(22,5); ALTER TABLE tagente_datos_inc MODIFY `datos` double(50,5);
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tnetwork_component` -- Table `tnetwork_component`
@ -2339,7 +2341,7 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tevento` -- Table `tevento`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL; ALTER TABLE `tevento` ADD COLUMN `data` double(50,5) default NULL;
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0'; ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
@ -4030,3 +4032,6 @@ DELETE FROM `tconfig` WHERE `token` = 'ipam_installed';
DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id'; DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id';
ALTER TABLE `tperfil` DROP COLUMN `incident_view`;
ALTER TABLE `tperfil` DROP COLUMN `incident_edit`;
ALTER TABLE `tperfil` DROP COLUMN `incident_management`;

View File

@ -192,15 +192,15 @@ if (check_login()) {
echo " echo "
</div> </div>
<div class='right height_30px'> <div class='btn_update_online_open height_30px'>
</div>
<div class='modalokbutton cerrar'> <div class='modalokbutton cerrar'>
<span class='modalokbuttontext'>OK</span> <span class='modalokbuttontext'>OK</span>
</div>"; </div>";
if ($open) { if ($open) {
echo "<div class='modalgobutton gopandora'> echo "<div class='modalgobutton gopandora'>
<span class='modalgobuttontext'>About Enterprise</span> <span class='modalgobuttontext'>About Enterprise</span>
</div>"; </div></div>";
} }
} }

View File

@ -24,12 +24,20 @@ if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'],
return; return;
} }
\ui_print_page_header( // Header.
__('Monitoring').' &raquo; '.__('Clusters'), ui_print_standard_header(
__('Clusters'),
'images/chart.png', 'images/chart.png',
false, false,
'', '',
false false,
[],
[
[
'link' => '',
'label' => __('Monitoring'),
],
]
); );
ui_require_css_file('first_task'); ui_require_css_file('first_task');

View File

@ -88,7 +88,6 @@ if (check_acl($config['id_user'], 0, 'AW')
|| check_acl($config['id_user'], 0, 'LM') || check_acl($config['id_user'], 0, 'LM')
|| check_acl($config['id_user'], 0, 'UM') || check_acl($config['id_user'], 0, 'UM')
|| check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], 0, 'LW')
|| check_acl($config['id_user'], 0, 'IW')
|| check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EW')
|| check_acl($config['id_user'], 0, 'DW') || check_acl($config['id_user'], 0, 'DW')
) { ) {

View File

@ -39,7 +39,7 @@ $offset = (int) get_parameter('offset', 0);
// See if id_agente is set (either POST or GET, otherwise -1 // See if id_agente is set (either POST or GET, otherwise -1
$id_agent = (int) get_parameter('id_agente'); $id_agent = (int) get_parameter('id_agente');
$groups = users_get_groups($config['id_user'], 'IR'); $groups = users_get_groups($config['id_user'], 'AR');
$filter = ' AND id_agent = '.$id_agent; $filter = ' AND id_agent = '.$id_agent;
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent; $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent;
@ -55,7 +55,7 @@ $params = [
agents_get_name($id_agent), agents_get_name($id_agent),
]; ];
$result = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents', $params, false, 'json', ','); $result = integria_api_call(null, null, null, null, 'get_incidents', $params, false, 'json', ',');
$result = json_decode($result, true); $result = json_decode($result, true);

View File

@ -1,17 +1,32 @@
<?php <?php
/**
* Agents defined view.
*
* @category Manage Agents.
* @package Pandora FMS
* @subpackage Resources.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Begin.
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
check_login(); check_login();
// Take some parameters (GET). // Take some parameters (GET).
@ -76,13 +91,23 @@ $viewtab['active'] = false;
$onheader = ['view' => $viewtab]; $onheader = ['view' => $viewtab];
// Header. // Header.
ui_print_page_header( ui_print_standard_header(
__('Agents defined in %s', get_product_name()), __('Agents defined in %s', get_product_name()),
'images/agent.png', 'images/agent.png',
false, false,
'', '',
true, true,
$onheader $onheader,
[
[
'link' => '',
'label' => __('Resources'),
],
[
'link' => '',
'label' => __('Manage agents'),
],
]
); );
if (is_central_policies_on_node()) { if (is_central_policies_on_node()) {

View File

@ -1130,7 +1130,6 @@ foreach ($modules as $module) {
[ [
'alt' => __('Enable module'), 'alt' => __('Enable module'),
'title' => __('Enable module'), 'title' => __('Enable module'),
'class' => 'invert_filter_important',
] ]
).'</a>'; ).'</a>';
} else { } else {

View File

@ -1,17 +1,32 @@
<?php <?php
/**
* Common editor fields.
*
* @category Module manager
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_categories.php'; require_once $config['homedir'].'/include/functions_categories.php';
require_once $config['homedir'].'/include/graphs/functions_d3.php'; require_once $config['homedir'].'/include/graphs/functions_d3.php';
@ -19,7 +34,9 @@ require_once $config['homedir'].'/include/graphs/functions_d3.php';
include_javascript_d3(); include_javascript_d3();
global $config;function prepend_table_simple($row, $id=false) global $config;
function prepend_table_simple($row, $id=false)
{ {
global $table_simple; global $table_simple;
@ -1574,10 +1591,6 @@ $(document).ready (function () {
}); });
disabled_two_tailed(disabledBecauseInPolicy); disabled_two_tailed(disabledBecauseInPolicy);
$('#checkbox-dynamic_two_tailed').change (function() {
disabled_two_tailed(disabledBecauseInPolicy);
});
//Dynamic_options_advance; //Dynamic_options_advance;
$('.hide_dinamic').hide(); $('.hide_dinamic').hide();
@ -1646,15 +1659,10 @@ function disabled_status (disabledBecauseInPolicy) {
} }
function disabled_two_tailed (disabledBecauseInPolicy) { function disabled_two_tailed (disabledBecauseInPolicy) {
if($('#checkbox-dynamic_two_tailed').prop('checked')){ if (disabledBecauseInPolicy == 1){
$('#text-dynamic_max').prop('readonly', false); $('#text-dynamic_max')
$('#text-dynamic_max').removeClass('readonly'); .prop('readonly', true)
} .addClass('readonly');
else{
if (disabledBecauseInPolicy == 0){
$('#text-dynamic_max').prop('readonly', true);
$('#text-dynamic_max').addClass('readonly');
}
} }
} }

View File

@ -108,7 +108,8 @@ if ((bool) $adopt === false) {
65, 65,
$plugin_parameter, $plugin_parameter,
$disabledTextBecauseInPolicy, $disabledTextBecauseInPolicy,
true true,
'resizev'
); );
} else { } else {
$data[1] = html_print_textarea( $data[1] = html_print_textarea(

View File

@ -43,7 +43,7 @@ if (is_ajax()) {
if ($get_integria_ticket_custom_types) { if ($get_integria_ticket_custom_types) {
$ticket_type_id = get_parameter('ticket_type_id'); $ticket_type_id = get_parameter('ticket_type_id');
$api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_fields', $ticket_type_id, false, 'json'); $api_call = integria_api_call(null, null, null, null, 'get_incident_fields', $ticket_type_id, false, 'json');
echo $api_call; echo $api_call;
return; return;

View File

@ -15,7 +15,7 @@ global $config;
check_login(); check_login();
$gis_w = check_acl($config['id_user'], 0, 'MW'); $gis_w = check_acl($config['id_user'], 0, 'MW', false, true, true);
$gis_m = check_acl($config['id_user'], 0, 'MM'); $gis_m = check_acl($config['id_user'], 0, 'MM');
$access = ($gis_w == true) ? 'MW' : (($gis_m == true) ? 'MM' : 'MW'); $access = ($gis_w == true) ? 'MW' : (($gis_m == true) ? 'MM' : 'MW');
@ -490,7 +490,7 @@ if (users_can_manage_group_all('MM') === true) {
$table->data[2][0] = __('Group'); $table->data[2][0] = __('Group');
$table->data[2][1] = html_print_select_groups( $table->data[2][1] = html_print_select_groups(
false, false,
'IW', 'AR',
$return_all_group, $return_all_group,
'map_group_id', 'map_group_id',
$map_group_id, $map_group_id,

View File

@ -95,7 +95,7 @@ if ($id_group) {
} }
// Header // Header
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
agents_meta_print_header(); agents_meta_print_header();
$sec = 'advanced'; $sec = 'advanced';
} else { } else {
@ -105,13 +105,24 @@ if (defined('METACONSOLE')) {
$title_in_header = __('Create group'); $title_in_header = __('Create group');
} }
ui_print_page_header( // Header.
ui_print_standard_header(
$title_in_header, $title_in_header,
'images/group.png', 'images/group.png',
false, false,
'', '',
true, false,
'' [],
[
[
'link' => '',
'label' => __('Profiles'),
],
[
'link' => '',
'label' => __('Manage agents group'),
],
]
); );
$sec = 'gagente'; $sec = 'gagente';
} }

View File

@ -333,6 +333,7 @@ $title = __('Groups defined in %s', get_product_name());
switch ($tab) { switch ($tab) {
case 'tree': case 'tree':
$buttons['tree']['active'] = true; $buttons['tree']['active'] = true;
$title .= sprintf(' &raquo; %s', __('Tree view'));
break; break;
case 'credbox': case 'credbox':
@ -343,23 +344,38 @@ switch ($tab) {
case 'groups': case 'groups':
default: default:
$buttons['groups']['active'] = true; $buttons['groups']['active'] = true;
$title .= sprintf(' &raquo; %s', __('Table view'));
break; break;
} }
// Header. // Header.
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
agents_meta_print_header(); agents_meta_print_header();
echo '<div class="notify">'; html_print_div(
echo __('Edit or delete groups can cause problems with synchronization'); [
echo '</div>'; 'class' => 'notify',
'content' => __('Edit or delete groups can cause problems with synchronization'),
]
);
} else { } else {
ui_print_page_header( // Header.
ui_print_standard_header(
$title, $title,
'images/group.png', 'images/group.png',
false, false,
'', '',
true, false,
$buttons $buttons,
[
[
'link' => '',
'label' => __('Profiles'),
],
[
'link' => '',
'label' => __('Manage agents group'),
],
]
); );
} }
@ -471,7 +487,7 @@ if ($update_group) {
$values = [ $values = [
'nombre' => $name, 'nombre' => $name,
'icon' => empty($icon) ? '' : substr($icon, 0, -4), 'icon' => empty($icon) ? '' : substr($icon, 0, -4),
'parent' => $id_parent == -1 ? 0 : $id_parent, 'parent' => ($id_parent == -1) ? 0 : $id_parent,
'disabled' => !$alerts_enabled, 'disabled' => !$alerts_enabled,
'custom_id' => $custom_id, 'custom_id' => $custom_id,
'id_skin' => $skin, 'id_skin' => $skin,

View File

@ -58,12 +58,27 @@ $buttons['view'] = [
$tab = get_parameter('tab', 'view'); $tab = get_parameter('tab', 'view');
if ($tab != 'search_module') { if ($tab !== 'search_module') {
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;
} }
ui_print_page_header(__('Module Library').' &raquo; '.__('View'), '', false, 'module_library', true, $buttons); $headerTitle = ($tab === 'categories') ? __('Categories') : __('Main view');
// Header.
ui_print_standard_header(
$headerTitle,
'',
false,
'module_library',
true,
$buttons,
[
[
'link' => '',
'label' => __('Module library'),
],
]
);
// Styles. // Styles.
ui_require_css_file('module_library'); ui_require_css_file('module_library');

View File

@ -20,15 +20,6 @@ require_once $config['homedir'].'/include/functions_html.php';
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'IW')) {
db_pandora_audit(
'ACL Violation',
'Trying to access event viewer'
);
include 'general/noaccess.php';
return;
}
// id report // id report
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');

View File

@ -26,10 +26,9 @@
* ============================================================================ * ============================================================================
*/ */
// Begin.
global $config; global $config;
if (is_ajax()) { if (is_ajax()) {
$search_agents = (bool) get_parameter('search_agents'); $search_agents = (bool) get_parameter('search_agents');
@ -319,7 +318,7 @@ if ($edit_graph) {
'view' => [ 'view' => [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$id_graph.'">'.html_print_image( 'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$id_graph.'">'.html_print_image(
'images/operation.png', 'images/eye.png',
true, true,
[ [
'title' => __('View graph'), 'title' => __('View graph'),
@ -340,37 +339,43 @@ if ($edit_graph) {
$head = __('Graph builder'); $head = __('Graph builder');
if (isset($name)) { if (isset($name) === true) {
$head .= ' - '.$name; $head .= ' &raquo; '.$name;
} }
// Header. // Header.
$tab = get_parameter('tab', ''); $tab = get_parameter('tab');
switch ($tab) { switch ($tab) {
default: case 'graph_editor':
case 'main': $headerHelp = '';
ui_print_page_header(
$head,
'images/chart.png',
false,
'graph_builder',
false,
$buttons
);
break; break;
case 'graph_editor': case 'main':
ui_print_page_header( default:
$head, $headerHelp = 'graph_builder';
'images/chart.png',
false,
'',
false,
$buttons
);
break; break;
} }
// Header.
ui_print_standard_header(
$head,
'images/chart.png',
false,
$headerHelp,
false,
[$buttons],
[
[
'link' => '',
'label' => __('Reporting'),
],
[
'link' => '',
'label' => __('Custom graphs'),
],
]
);
if ($add_graph) { if ($add_graph) {
ui_print_result_message( ui_print_result_message(
$id_graph, $id_graph,
@ -418,7 +423,8 @@ if (!$delete_module) {
$chunk1 = explode('|', $chunkdata); $chunk1 = explode('|', $chunkdata);
$modules = ''; $modules = '';
$weights = ''; $weights = '';
for ($a = 0; $a < count($chunk1); $a++) { $chunkCount = count($chunk1);
for ($a = 0; $a < $chunkCount; $a++) {
$chunk2[$a] = []; $chunk2[$a] = [];
$chunk2[$a] = explode(',', $chunk1[$a]); $chunk2[$a] = explode(',', $chunk1[$a]);
if (strpos($modules, $chunk2[$a][1]) == 0) { if (strpos($modules, $chunk2[$a][1]) == 0) {
@ -450,4 +456,8 @@ switch ($active_tab) {
case 'graph_editor': case 'graph_editor':
include_once 'godmode/reporting/graph_builder.graph_editor.php'; include_once 'godmode/reporting/graph_builder.graph_editor.php';
break; break;
default:
// Nothing to do.
break;
} }

View File

@ -1,19 +1,35 @@
<?php <?php
// Pandora FMS - http://pandorafms.com /**
// ================================================== * Custom graph containers
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas *
// Please see http://pandorafms.org for full contribution list * @category Reporting
// This program is free software; you can redistribute it and/or * @package Pandora FMS
// modify it under the terms of the GNU General Public License * @subpackage Community
// as published by the Free Software Foundation for version 2. * @version 1.0.0
// This program is distributed in the hope that it will be useful, * @license See below
// 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. * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
// Load global variables * | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config; global $config;
// Check user credentials // Check user credentials.
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'RR') || enterprise_installed() === false) { if (! check_acl($config['id_user'], 0, 'RR') || enterprise_installed() === false) {
@ -87,8 +103,26 @@ $buttons['graph_container'] = [
] ]
).'</a>', ).'</a>',
]; ];
// Header
ui_print_page_header(__('Graph container'), '', false, '', false, $buttons); // Header.
ui_print_standard_header(
__('Graph container'),
'',
false,
'',
false,
$buttons,
[
[
'link' => '',
'label' => __('Reporting'),
],
[
'link' => '',
'label' => __('Custom graphs'),
],
]
);
$container = folder_get_folders(); $container = folder_get_folders();

View File

@ -1,16 +1,32 @@
<?php <?php
// Pandora FMS - http://pandorafms.com /**
// ================================================== * Reporting graphs.
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas *
// Please see http://pandorafms.org for full contribution list * @category Reporting
// This program is free software; you can redistribute it and/or * @package Pandora FMS
// modify it under the terms of the GNU General Public License * @subpackage Community
// as published by the Free Software Foundation for version 2. * @version 1.0.0
// This program is distributed in the hope that it will be useful, * @license See below
// 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. * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
// Load global variables * | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config; global $config;
require_once 'include/functions_custom_graphs.php'; require_once 'include/functions_custom_graphs.php';
@ -99,8 +115,25 @@ $view_graph = (bool) get_parameter('view_graph');
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');
$multiple_delete = (bool) get_parameter('multiple_delete', 0); $multiple_delete = (bool) get_parameter('multiple_delete', 0);
// Header // Header.
ui_print_page_header(__('Reporting').' &raquo; '.__('Custom graphs'), 'images/chart.png', false, '', false, $buttons); ui_print_standard_header(
__('List of custom graphs'),
'images/chart.png',
false,
'',
false,
$buttons,
[
[
'link' => '',
'label' => __('Reporting'),
],
[
'link' => '',
'label' => __('Custom graphs'),
],
]
);
// Delete module SQL code // Delete module SQL code
if ($delete_graph) { if ($delete_graph) {

View File

@ -1,16 +1,32 @@
<?php <?php
/**
* Map builder console.
*
* @category Topology maps
* @package Pandora FMS
* @subpackage Visual consoles
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Begin.
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config; global $config;
require_once $config['homedir'].'/include/functions_visual_map.php'; require_once $config['homedir'].'/include/functions_visual_map.php';
@ -32,9 +48,7 @@ if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
exit; exit;
} }
if ($is_metaconsole === false) {
if (!$is_metaconsole) {
$url_visual_console = 'index.php?sec=network&sec2=godmode/reporting/map_builder'; $url_visual_console = 'index.php?sec=network&sec2=godmode/reporting/map_builder';
$url_visual_console_favorite = 'index.php?sec=network&sec2=godmode/reporting/visual_console_favorite'; $url_visual_console_favorite = 'index.php?sec=network&sec2=godmode/reporting/visual_console_favorite';
$url_visual_console_template = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template'; $url_visual_console_template = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template';
@ -102,14 +116,24 @@ if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
]; ];
} }
if (!$is_metaconsole) { if ($is_metaconsole === false) {
ui_print_page_header( ui_print_standard_header(
__('Reporting').' &raquo; '.__('Visual Console'), __('Visual Console List'),
'images/op_reporting.png', 'images/op_reporting.png',
false, false,
'', '',
false, true,
$buttons $buttons,
[
[
'link' => '',
'label' => __('Topology maps'),
],
[
'link' => '',
'label' => __('Visual console'),
],
]
); );
} else { } else {
ui_meta_print_header( ui_meta_print_header(

View File

@ -567,17 +567,24 @@ switch ($action) {
// Print header. // Print header.
ui_meta_print_header(__('Reporting'), '', $buttons); ui_meta_print_header(__('Reporting'), '', $buttons);
} else { } else {
// Page header for normal console. // Header.
ui_print_page_header( ui_print_standard_header(
__('Custom reporting'), __('List of reports'),
'images/op_reporting.png', 'images/op_reporting.png',
false, false,
'', '',
false, false,
$buttons, $buttons,
false, [
'', [
60 'link' => '',
'label' => __('Reporting'),
],
[
'link' => '',
'label' => __('Custom reports'),
],
]
); );
} }
@ -2500,7 +2507,7 @@ switch ($action) {
0 0
); );
$values['exception_condition'] = (int) get_parameter( $values['exception_condition'] = (int) get_parameter(
'radiobutton_exception_condition', 'exception_condition',
0 0
); );
$values['exception_condition_value'] = get_parameter( $values['exception_condition_value'] = get_parameter(
@ -3173,17 +3180,24 @@ switch ($action) {
// Print header. // Print header.
ui_meta_print_header(__('Reporting'), '', $buttons); ui_meta_print_header(__('Reporting'), '', $buttons);
} else { } else {
// Page header for normal console. // Header.
ui_print_page_header( ui_print_standard_header(
$subsection, $subsection,
'images/op_reporting.png', 'images/op_reporting.png',
false, false,
'', '',
false, false,
$buttons, $buttons,
false, [
'', [
60 'link' => '',
'label' => __('Reporting'),
],
[
'link' => '',
'label' => __('Custom reports'),
],
]
); );
} }
@ -3237,7 +3251,7 @@ if ($enterpriseEnable) {
$buttons['view'] = [ $buttons['view'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$idReport.'&pure='.$pure.'">'.html_print_image( 'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$idReport.'&pure='.$pure.'">'.html_print_image(
'images/operation.png', 'images/eye.png',
true, true,
[ [
'title' => __('View report'), 'title' => __('View report'),
@ -3279,17 +3293,25 @@ if ($enterpriseEnable && defined('METACONSOLE')) {
} else { } else {
$tab_builder = ($activeTab === 'item_editor') ? 'reporting_item_editor_tab' : ''; $tab_builder = ($activeTab === 'item_editor') ? 'reporting_item_editor_tab' : '';
if ($action !== 'update' && !is_metaconsole()) { if ($action !== 'update' && is_metaconsole() === false) {
ui_print_page_header( // Header.
ui_print_standard_header(
$textReportName, $textReportName,
'images/op_reporting.png', 'images/op_reporting.png',
false, false,
$tab_builder, $tab_builder,
false, false,
$buttons, $buttons,
false, [
'', [
60 'link' => '',
'label' => __('Reporting'),
],
[
'link' => '',
'label' => __('Custom reports'),
],
]
); );
} }
} }
@ -3319,17 +3341,25 @@ if ($resultOperationDB !== null) {
$activeTab = 'list_items'; $activeTab = 'list_items';
$buttons[$activeTab]['active'] = true; $buttons[$activeTab]['active'] = true;
if (!is_metaconsole()) { if (is_metaconsole() === false) {
ui_print_page_header( // Header.
ui_print_standard_header(
$textReportName, $textReportName,
'images/op_reporting.png', 'images/op_reporting.png',
false, false,
$helpers, $helpers,
false, false,
$buttons, $buttons,
false, [
'', [
60 'link' => '',
'label' => __('Reporting'),
],
[
'link' => '',
'label' => __('Custom reports'),
],
]
); );
} }
} }

View File

@ -1,19 +1,38 @@
<?php <?php
// Pandora FMS - http://pandorafms.com /**
// ================================================== * Extension to manage a list of gateways and the node address where they should
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * point to.
// Please see http://pandorafms.org for full contribution list *
// This program is free software; you can redistribute it and/or * @category Extensions
// modify it under the terms of the GNU General Public License * @package Pandora FMS
// as published by the Free Software Foundation for version 2. * @subpackage Community
// This program is distributed in the hope that it will be useful, * @version 1.0.0
// but WITHOUT ANY WARRANTY; without even the implied warranty of * @license See below
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
// GNU General Public License for more details. * ______ ___ _______ _______ ________
// Login check * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config; global $config;
global $statusProcessInDB; global $statusProcessInDB;
use PandoraFMS\User;
check_login(); check_login();
require_once $config['homedir'].'/include/functions_visual_map.php'; require_once $config['homedir'].'/include/functions_visual_map.php';
@ -753,8 +772,8 @@ if (!defined('METACONSOLE')) {
$url_view = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='.$idVisualConsole.'&refr='.$view_refresh; $url_view = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='.$idVisualConsole.'&refr='.$view_refresh;
} }
// Hash for auto-auth in public link // Hash for auto-auth in public link.
$hash = md5($config['dbpass'].$idVisualConsole.$config['id_user']); $hash = User::generatePublicHash();
$buttons = []; $buttons = [];
@ -810,14 +829,25 @@ $buttons[$activeTab]['active'] = true;
$tab_builder = ($activeTab === 'editor') ? 'visual_console_editor_editor_tab' : ''; $tab_builder = ($activeTab === 'editor') ? 'visual_console_editor_editor_tab' : '';
if (!defined('METACONSOLE')) { if (is_metaconsole() === false) {
ui_print_page_header( // Header.
ui_print_standard_header(
$visualConsoleName, $visualConsoleName,
'images/visual_console.png', 'images/visual_console.png',
false, false,
$tab_builder, $tab_builder,
false, false,
$buttons $buttons,
[
[
'link' => '',
'label' => __('Topology maps'),
],
[
'link' => '',
'label' => __('Visual console'),
],
]
); );
} }

View File

@ -1,19 +1,38 @@
<?php <?php
// Pandora FMS - http://pandorafms.com /**
// ================================================== * Favorite visual console.
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas *
// Please see http://pandorafms.org for full contribution list * @category Topology maps
// This program is free software; you can redistribute it and/or * @package Pandora FMS
// modify it under the terms of the GNU General Public License * @subpackage Visual consoles
// as published by the Free Software Foundation for version 2. * @version 1.0.0
// This program is distributed in the hope that it will be useful, * @license See below
// 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. * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config; global $config;
require_once $config['homedir'].'/include/functions_visual_map.php'; require_once $config['homedir'].'/include/functions_visual_map.php';
// Breadcrumb.
require_once $config['homedir'].'/include/class/HTML.class.php';
ui_require_css_file('discovery');
// ACL for the general permission // ACL for the general permission
$vconsoles_read = check_acl($config['id_user'], 0, 'VR'); $vconsoles_read = check_acl($config['id_user'], 0, 'VR');
$vconsoles_write = check_acl($config['id_user'], 0, 'VW'); $vconsoles_write = check_acl($config['id_user'], 0, 'VW');
@ -32,7 +51,7 @@ if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
} }
if (!$is_metaconsole) { if ($is_metaconsole === false) {
$url_visual_console = 'index.php?sec=network&sec2=godmode/reporting/map_builder'; $url_visual_console = 'index.php?sec=network&sec2=godmode/reporting/map_builder';
$url_visual_console_favorite = 'index.php?sec=network&sec2=godmode/reporting/visual_console_favorite'; $url_visual_console_favorite = 'index.php?sec=network&sec2=godmode/reporting/visual_console_favorite';
$url_visual_console_template = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template'; $url_visual_console_template = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template';
@ -94,14 +113,24 @@ if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
]; ];
} }
if (!$is_metaconsole) { if ($is_metaconsole === false) {
ui_print_page_header( ui_print_standard_header(
__('Reporting').' &raquo; '.__('Visual Favourite Console'), __('Favourite Visual Console'),
'images/op_reporting.png', 'images/op_reporting.png',
false, false,
'', '',
false, true,
$buttons $buttons,
[
[
'link' => '',
'label' => __('Topology maps'),
],
[
'link' => '',
'label' => __('Visual console'),
],
]
); );
} else { } else {
ui_meta_print_header( ui_meta_print_header(

View File

@ -386,10 +386,10 @@ function check_process (id_server) {
parameters, parameters,
function (data) { function (data) {
if (data['correct']) { if (data['correct']) {
$("#check_exec_server img").attr("src", <?php echo 'images/dot_green.png'; ?>); $("#check_exec_server img").attr("src", "images/dot_green.png");
} }
else { else {
$("#check_exec_server img").attr("src", <?php echo 'images/dot_red.png'; ?>); $("#check_exec_server img").attr("src", "images/dot_red.png");
$("#check_error_message").empty(); $("#check_error_message").empty();
$("#check_error_message").append("<span>" + data['message'] + "</span>"); $("#check_error_message").append("<span>" + data['message'] + "</span>");
} }

View File

@ -1,17 +1,32 @@
<?php <?php
/**
* OS Edition
*
* @category Server
* @package Pandora FMS
* @subpackage Godmode
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Begin.
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config; global $config;
check_login(); check_login();
@ -45,8 +60,8 @@ if ($idOS) {
$message = ''; $message = '';
switch ($action) { switch ($action) {
default:
case 'new': case 'new':
default:
$actionHidden = 'save'; $actionHidden = 'save';
$textButton = __('Create'); $textButton = __('Create');
$classButton = 'class="sub next"'; $classButton = 'class="sub next"';
@ -183,12 +198,31 @@ $buttons = [
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;
if (!is_metaconsole()) { $headerTitle = ($tab === 'builder') ? __('Edit OS') : __('List of OS');
if (is_metaconsole() === false) {
// Header. // Header.
ui_print_page_header(__('Edit OS'), '', false, '', true, $buttons); ui_print_standard_header(
$headerTitle,
'',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Servers'),
],
[
'link' => '',
'label' => __('Edit OS'),
],
]
);
} }
if (!empty($id_message)) { if (empty($id_message) === false) {
switch ($id_message) { switch ($id_message) {
case 1: case 1:
echo ui_print_success_message(__('Success creating OS'), '', true); echo ui_print_success_message(__('Success creating OS'), '', true);
@ -226,13 +260,11 @@ if (!empty($id_message)) {
switch ($tab) { switch ($tab) {
case 'list': case 'list':
default:
include_once $config['homedir'].'/godmode/setup/os.list.php'; include_once $config['homedir'].'/godmode/setup/os.list.php';
return; break;
break;
case 'builder': case 'builder':
include_once $config['homedir'].'/godmode/setup/os.builder.php'; include_once $config['homedir'].'/godmode/setup/os.builder.php';
return; break;
break;
} }

View File

@ -34,9 +34,11 @@ check_login();
if (is_ajax()) { if (is_ajax()) {
$test_address = get_parameter('test_address', ''); $test_address = get_parameter('test_address', '');
$params = get_parameter('params', '');
$res = send_test_email( $res = send_test_email(
$test_address $test_address,
$params
); );
echo $res; echo $res;
@ -709,12 +711,25 @@ function perform_email_test () {
$('#email_test_failure_message').hide(); $('#email_test_failure_message').hide();
var test_address = $('#text-email_test_address').val(); var test_address = $('#text-email_test_address').val();
params = {
email_smtpServer : $('#text-email_smtpServer').val(),
email_smtpPort : $('#text-email_smtpPort').val(),
email_username : $('#text-email_username').val(),
email_password : $('#password-email_password').val(),
email_encryption : $( "#email_encryption option:selected" ).val(),
email_from_dir : $('#text-email_from_dir').val(),
email_from_name : $('#text-email_from_name').val()
};
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
data: "page=godmode/setup/setup_general&test_address="+test_address, data : {
dataType: "html", page: "godmode/setup/setup_general",
test_address: test_address,
params: params
},
dataType: "json",
success: function(data) { success: function(data) {
if (parseInt(data) === 1) { if (parseInt(data) === 1) {
$('#email_test_sent_message').show(); $('#email_test_sent_message').show();

View File

@ -41,8 +41,10 @@ if (is_ajax()) {
$integria_pass = get_parameter('integria_pass', ''); $integria_pass = get_parameter('integria_pass', '');
$integria_api_hostname = get_parameter('api_hostname', ''); $integria_api_hostname = get_parameter('api_hostname', '');
$integria_api_pass = get_parameter('api_pass', ''); $integria_api_pass = get_parameter('api_pass', '');
$user_level_conf = get_parameter('user_level_conf', 0);
$user_level_conf_bool = $user_level_conf === 'true' ? true : false;
$login_result = integria_api_call($integria_api_hostname, $integria_user, $integria_pass, $integria_api_pass, 'get_login', []); $login_result = integria_api_call($integria_api_hostname, $integria_user, $integria_pass, $integria_api_pass, 'get_login', [], false, '', '', $user_level_conf_bool);
if ($login_result != false) { if ($login_result != false) {
echo json_encode(['login' => 1]); echo json_encode(['login' => 1]);
@ -53,7 +55,7 @@ if (is_ajax()) {
return; return;
} }
$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []); $has_connection = integria_api_call(null, null, null, null, 'get_login', []);
if ($has_connection === false && $config['integria_enabled']) { if ($has_connection === false && $config['integria_enabled']) {
ui_print_error_message(__('Integria IMS API is not reachable')); ui_print_error_message(__('Integria IMS API is not reachable'));
@ -86,7 +88,7 @@ if (get_parameter('update_config', 0) == 1) {
); );
} }
$ticket_types = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types', '', false, 'json'); $ticket_types = integria_api_call(null, null, null, null, 'get_types', '', false, 'json');
$types_string = ''; $types_string = '';
@ -216,19 +218,19 @@ $integria_users_values = [];
$integria_types_values = []; $integria_types_values = [];
$integria_status_values = []; $integria_status_values = [];
$integria_groups_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_groups', []); $integria_groups_csv = integria_api_call(null, null, null, null, 'get_groups', []);
get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values); get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values);
$integria_status_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents_status', []); $integria_status_csv = integria_api_call(null, null, null, null, 'get_incidents_status', []);
get_array_from_csv_data_pair($integria_status_csv, $integria_status_values); get_array_from_csv_data_pair($integria_status_csv, $integria_status_values);
$integria_criticity_levels_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_priorities', []); $integria_criticity_levels_csv = integria_api_call(null, null, null, null, 'get_incident_priorities', []);
get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values); get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values);
$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users', []); $integria_users_csv = integria_api_call(null, null, null, null, 'get_users', []);
$csv_array = explode("\n", $integria_users_csv); $csv_array = explode("\n", $integria_users_csv);
@ -238,7 +240,7 @@ foreach ($csv_array as $csv_line) {
} }
} }
$integria_types_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types', []); $integria_types_csv = integria_api_call(null, null, null, null, 'get_types', []);
get_array_from_csv_data_pair($integria_types_csv, $integria_types_values); get_array_from_csv_data_pair($integria_types_csv, $integria_types_values);
@ -267,6 +269,12 @@ $table_remote->class = 'databox filters';
$table_remote->size['name'] = '30%'; $table_remote->size['name'] = '30%';
$table_remote->style['name'] = 'font-weight: bold'; $table_remote->style['name'] = 'font-weight: bold';
// Enable eHorus user configuration.
$row = [];
$row['name'] = ('Integria configuration at user level');
$row['control'] = html_print_checkbox_switch('integria_user_level_conf', 1, $config['integria_user_level_conf'], true);
$table_remote->data['integria_user_level_conf'] = $row;
// Integria user. // Integria user.
$row = []; $row = [];
$row['name'] = __('User'); $row['name'] = __('User');
@ -629,6 +637,29 @@ echo '</form>';
<script type="text/javascript"> <script type="text/javascript">
if($('input:checkbox[name="integria_user_level_conf"]').is(':checked'))
{
$('#integria-remote-setup-integria_user').hide();
$('#integria-remote-setup-integria_pass').hide()
}
var handleUserLevel = function(event) {
var is_checked = $('input:checkbox[name="integria_enabled"]').is(':checked');
var is_checked_userlevel = $('input:checkbox[name="integria_user_level_conf"]').is(':checked');
if (event.target.value == '1' && is_checked && !is_checked_userlevel) {
showUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', true);
}
else {
hideUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', false);
};
}
$('input:checkbox[name="integria_enabled"]').change(handleEnable);
$('input:checkbox[name="integria_user_level_conf"]').change(handleUserLevel);
if(!$('input:checkbox[name="integria_enabled"]').is(':checked')) { if(!$('input:checkbox[name="integria_enabled"]').is(':checked')) {
$('#form_remote').hide(); $('#form_remote').hide();
$('#form_custom_response_settings').hide(); $('#form_custom_response_settings').hide();
@ -720,6 +751,7 @@ echo '</form>';
var integria_pass = $('input[name=integria_pass]').val(); var integria_pass = $('input[name=integria_pass]').val();
var api_hostname = $('input[name=integria_hostname]').val(); var api_hostname = $('input[name=integria_hostname]').val();
var api_pass = $('input[name=integria_api_pass]').val(); var api_pass = $('input[name=integria_api_pass]').val();
var user_level_conf = $('input:checkbox[name="integria_user_level_conf"]').is(':checked');
var data = { var data = {
page: 'godmode/setup/setup_integria', page: 'godmode/setup/setup_integria',
@ -728,6 +760,7 @@ echo '</form>';
integria_pass: integria_pass, integria_pass: integria_pass,
api_hostname: api_hostname, api_hostname: api_hostname,
api_pass: api_pass, api_pass: api_pass,
user_level_conf: user_level_conf,
} }
// AJAX call to check API connection. // AJAX call to check API connection.

View File

@ -24,15 +24,6 @@ require_once 'include/functions_ui.php';
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'IR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access netflow setup'
);
include 'general/noaccess.php';
return;
}
$update = (bool) get_parameter('update'); $update = (bool) get_parameter('update');
$table->width = '100%'; $table->width = '100%';

View File

@ -1257,7 +1257,14 @@ if ($create_alert || $update_alert) {
foreach ($other_actions as $action) { foreach ($other_actions as $action) {
$data[1] .= '<tr>'; $data[1] .= '<tr>';
$data[1] .= '<td>'.alerts_get_alert_action_name($action['alert_type']).'</td>'; $data[1] .= '<td>'.alerts_get_alert_action_name($action['alert_type']).'</td>';
$data[1] .= '<td> <a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_alert&delete_action=1&action_id='.$action['id'].'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a> </td>'; $data[1] .= '<td> <a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_alert&delete_action=1&action_id='.$action['id'].'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image(
'images/cross.png',
true,
[
'border' => '0',
'alt' => __('Delete'),
]
).'</a> </td>';
$data[1] .= '</tr>'; $data[1] .= '</tr>';
} }
} }
@ -1278,7 +1285,34 @@ if ($create_alert || $update_alert) {
} }
if (check_acl_restricted_all($config['id_user'], $row['id_group'], 'LW')) { if (check_acl_restricted_all($config['id_user'], $row['id_group'], 'LW')) {
$data[8] = '<a href="index.php?'.'sec=snmpconsole&'.'sec2=godmode/snmpconsole/snmp_alert&'.'duplicate_alert=1&'.'id_alert_snmp='.$row['id_as'].'">'.html_print_image('images/copy.png', true, ['alt' => __('Duplicate'), 'title' => __('Duplicate'), 'class' => 'invert_filter']).'</a>'.'<a href="index.php?'.'sec=snmpconsole&'.'sec2=godmode/snmpconsole/snmp_alert&'.'update_alert=1&'.'id_alert_snmp='.$row['id_as'].'">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Update'), 'class' => 'invert_filter']).'</a>'.'<a href="javascript:show_add_action_snmp(\''.$row['id_as'].'\');">'.html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']).'</a>'.'<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_alert&delete_alert='.$row['id_as'].'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'class' => 'invert_filter', 'alt' => __('Delete')]).'</a>'; $data[8] = '<a href="index.php?'.'sec=snmpconsole&'.'sec2=godmode/snmpconsole/snmp_alert&'.'duplicate_alert=1&'.'id_alert_snmp='.$row['id_as'].'">'.html_print_image(
'images/copy.png',
true,
[
'alt' => __('Duplicate'),
'title' => __('Duplicate'),
]
).'</a>'.'<a href="index.php?'.'sec=snmpconsole&'.'sec2=godmode/snmpconsole/snmp_alert&'.'update_alert=1&'.'id_alert_snmp='.$row['id_as'].'">'.html_print_image(
'images/config.png',
true,
[
'border' => '0',
'alt' => __('Update'),
]
).'</a>'.'<a href="javascript:show_add_action_snmp(\''.$row['id_as'].'\');">'.html_print_image(
'images/add.png',
true,
[
'title' => __('Add action'),
]
).'</a>'.'<a href="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_alert&delete_alert='.$row['id_as'].'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image(
'images/cross.png',
true,
[
'border' => '0',
'alt' => __('Delete'),
]
).'</a>';
$data[9] = html_print_checkbox_extended( $data[9] = html_print_checkbox_extended(
@ -1409,7 +1443,7 @@ if ($create_alert || $update_alert) {
echo '<div class="right mrgn_lft_10px;">'; echo '<div class="right mrgn_lft_10px;">';
html_print_input_hidden('multiple_delete', 1); html_print_input_hidden('multiple_delete', 1);
html_print_submit_button(__('Delete selected'), 'delete_button', false, 'class="sub delete"'); html_print_submit_button(__('Delete selected'), 'delete_button', false, 'class="sub delete mrgn_btn_10px"');
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';
} }

View File

@ -32,15 +32,36 @@ $index_post = (int) get_parameter('index_post', 0);
// Create/update header // Create/update header
if ($edit_filter > -2) { if ($edit_filter > -2) {
if ($edit_filter > -1) { if ($edit_filter > -1) {
ui_print_page_header(__('SNMP Console').' &raquo; '.__('Update filter'), 'images/op_snmp.png', false, '', false); $activeFilterCaption = ' &raquo; '.__('Update filter');
} else { } else {
ui_print_page_header(__('SNMP Console').' &raquo; '.__('Create filter'), 'images/op_snmp.png', false, '', false); $activeFilterCaption = ' &raquo; '.__('Create filter');
} }
} else { } else {
// Overview header // Overview header
ui_print_page_header(__('SNMP Console').' &raquo; '.__('Filter overview'), 'images/op_snmp.png', false, '', false); $activeFilterCaption = ' &raquo; '.__('Filter overview');
} }
// Header.
ui_print_standard_header(
__('SNMP Console').$activeFilterCaption,
'images/op_snmp.png',
false,
'',
false,
[],
[
[
'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('SMNP'),
],
]
);
// Create/update filter // Create/update filter
if ($update_filter > -2) { if ($update_filter > -2) {
// UPDATE // UPDATE

View File

@ -33,14 +33,27 @@ $snmp_type = (int) get_parameter('snmp_type', 0);
$snmp_value = (string) get_parameter('snmp_value', ''); $snmp_value = (string) get_parameter('snmp_value', '');
$generate_trap = (bool) get_parameter('generate_trap', 0); $generate_trap = (bool) get_parameter('generate_trap', 0);
ui_print_page_header( // Header.
ui_print_standard_header(
__('SNMP Trap generator'), __('SNMP Trap generator'),
'images/op_snmp.png', 'images/op_snmp.png',
false, false,
'snmp_trap_generator_view', 'snmp_trap_generator_view',
false false,
[],
[
[
'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('SMNP'),
],
]
); );
if ($generate_trap) { if ($generate_trap) {
$result = true; $result = true;
$error = ''; $error = '';

View File

@ -85,11 +85,6 @@ if ($id_profile || $new_profile) {
// Name // Name
$name = ''; $name = '';
// Incidents
$incident_view = 0;
$incident_edit = 0;
$incident_management = 0;
// Agents // Agents
$agent_view = 0; $agent_view = 0;
$agent_edit = 0; $agent_edit = 0;
@ -148,11 +143,6 @@ if ($id_profile || $new_profile) {
// Name // Name
$name = $profile['name']; $name = $profile['name'];
// Incidents
$incident_view = (bool) $profile['incident_view'];
$incident_edit = (bool) $profile['incident_edit'];
$incident_management = (bool) $profile['incident_management'];
// Agents // Agents
$agent_view = (bool) $profile['agent_view']; $agent_view = (bool) $profile['agent_view'];
$agent_edit = (bool) $profile['agent_edit']; $agent_edit = (bool) $profile['agent_edit'];
@ -197,7 +187,7 @@ if ($id_profile || $new_profile) {
); );
enterprise_include_once('include/functions_audit.php'); enterprise_include_once('include/functions_audit.php');
$info = 'Name: '.$name.' Incident view: '.$incident_view.' Incident edit: '.$incident_edit.' Incident management: '.$incident_management.' Agent view: '.$agent_view.' Agent edit: '.$agent_edit.' Agent disable: '.$agent_disable.' Alert edit: '.$alert_edit.' Alert management: '.$alert_management.' User management: '.$user_management.' DB management: '.$db_management.' Event view: '.$event_view.' Event edit: '.$event_edit.' Event management: '.$event_management.' Report view: '.$report_view.' Report edit: '.$report_edit.' Report management: '.$report_management.' Network map view: '.$map_view.' Network map edit: '.$map_edit.' Network map management: '.$map_management.' Visual console view: '.$vconsole_view.' Visual console edit: '.$vconsole_edit.' Visual console management: '.$vconsole_management.' '.get_product_name().' Management: '.$pandora_management; $info = 'Name: '.$name.' Agent view: '.$agent_view.' Agent edit: '.$agent_edit.' Agent disable: '.$agent_disable.' Alert edit: '.$alert_edit.' Alert management: '.$alert_management.' User management: '.$user_management.' DB management: '.$db_management.' Event view: '.$event_view.' Event edit: '.$event_edit.' Event management: '.$event_management.' Report view: '.$report_view.' Report edit: '.$report_edit.' Report management: '.$report_management.' Network map view: '.$map_view.' Network map edit: '.$map_edit.' Network map management: '.$map_management.' Visual console view: '.$vconsole_view.' Visual console edit: '.$vconsole_edit.' Visual console management: '.$vconsole_management.' '.get_product_name().' Management: '.$pandora_management;
enterprise_hook('audit_pandora_enterprise', [$id_audit, $info]); enterprise_hook('audit_pandora_enterprise', [$id_audit, $info]);
@ -319,21 +309,6 @@ if ($id_profile || $new_profile) {
$table->data['VM'] = $row; $table->data['VM'] = $row;
$table->data[] = '<hr>'; $table->data[] = '<hr>';
// Incidents
$row = [];
$row['name'] = __('View incidents');
$row['input'] = html_print_checkbox('incident_view', 1, $incident_view, true);
$table->data['IR'] = $row;
$row = [];
$row['name'] = __('Edit incidents');
$row['input'] = html_print_checkbox('incident_edit', 1, $incident_edit, true, false, 'autoclick_profile_users(\'incident_edit\', \'incident_view\', \'false\')');
$table->data['IW'] = $row;
$row = [];
$row['name'] = __('Manage incidents');
$row['input'] = html_print_checkbox('incident_management', 1, $incident_management, true, false, 'autoclick_profile_users(\'incident_management\', \'incident_view\', \'incident_edit\');');
$table->data['IM'] = $row;
$table->data[] = '<hr>';
$disable_option = 'javascript: return false;'; $disable_option = 'javascript: return false;';
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) { if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
$disable_option = ''; $disable_option = '';

View File

@ -439,6 +439,12 @@ if ($create_user) {
if ($result) { if ($result) {
$res = save_pass_history($id, $password_new); $res = save_pass_history($id, $password_new);
} else {
$is_err = true;
$user_info = $values;
$password_new = '';
$password_confirm = '';
$new_user = true;
} }
db_pandora_audit( db_pandora_audit(

View File

@ -107,11 +107,6 @@ if ($delete_profile) {
if ($create_profile || $update_profile) { if ($create_profile || $update_profile) {
$name = get_parameter('name'); $name = get_parameter('name');
// Incidents
$incident_view = (bool) get_parameter('incident_view');
$incident_edit = (bool) get_parameter('incident_edit');
$incident_management = (bool) get_parameter('incident_management');
// Agents // Agents
$agent_view = (bool) get_parameter('agent_view'); $agent_view = (bool) get_parameter('agent_view');
$agent_edit = (bool) get_parameter('agent_edit'); $agent_edit = (bool) get_parameter('agent_edit');
@ -152,9 +147,6 @@ if ($create_profile || $update_profile) {
$values = [ $values = [
'name' => $name, 'name' => $name,
'incident_view' => $incident_view,
'incident_edit' => $incident_edit,
'incident_management' => $incident_management,
'agent_view' => $agent_view, 'agent_view' => $agent_view,
'agent_edit' => $agent_edit, 'agent_edit' => $agent_edit,
'agent_disable' => $agent_disable, 'agent_disable' => $agent_disable,
@ -183,10 +175,7 @@ if ($update_profile) {
if ($name) { if ($name) {
$ret = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]); $ret = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]);
if ($ret !== false) { if ($ret !== false) {
$info = '{"Name":"'.$incident_view.'", $info = '{"Name":"'.$name.'",
"Incident view":"'.$incident_view.'",
"Incident edit":"'.$incident_edit.'",
"Incident management":"'.$incident_management.'",
"Agent view":"'.$agent_view.'", "Agent view":"'.$agent_view.'",
"Agent edit":"'.$agent_edit.'", "Agent edit":"'.$agent_edit.'",
"Agent disable":"'.$agent_disable.'", "Agent disable":"'.$agent_disable.'",
@ -234,10 +223,7 @@ if ($create_profile) {
if ($ret !== false) { if ($ret !== false) {
ui_print_success_message(__('Successfully created')); ui_print_success_message(__('Successfully created'));
$info = '{"Name":"'.$incident_view.'", $info = '{"Name":"'.$name.'",
"Incident view":"'.$incident_view.'",
"Incident edit":"'.$incident_edit.'",
"Incident management":"'.$incident_management.'",
"Agent view":"'.$agent_view.'", "Agent view":"'.$agent_view.'",
"Agent edit":"'.$agent_edit.'", "Agent edit":"'.$agent_edit.'",
"Agent disable":"'.$agent_disable.'", "Agent disable":"'.$agent_disable.'",
@ -289,9 +275,6 @@ $table->align = [];
$table->head['profiles'] = __('Profiles'); $table->head['profiles'] = __('Profiles');
$table->head['IR'] = 'IR';
$table->head['IW'] = 'IW';
$table->head['IM'] = 'IM';
$table->head['AR'] = 'AR'; $table->head['AR'] = 'AR';
$table->head['AW'] = 'AW'; $table->head['AW'] = 'AW';
$table->head['AD'] = 'AD'; $table->head['AD'] = 'AD';
@ -317,9 +300,6 @@ $table->head['operations'] = '<span title="Operations">'.__('Op.').'</span>';
$table->align = array_fill(1, 11, 'center'); $table->align = array_fill(1, 11, 'center');
$table->size['profiles'] = '200px'; $table->size['profiles'] = '200px';
$table->size['IR'] = '10px';
$table->size['IW'] = '10px';
$table->size['IM'] = '10px';
$table->size['AR'] = '10px'; $table->size['AR'] = '10px';
$table->size['AW'] = '10px'; $table->size['AW'] = '10px';
$table->size['AD'] = '10px'; $table->size['AD'] = '10px';
@ -358,9 +338,6 @@ $img = html_print_image(
foreach ($profiles as $profile) { foreach ($profiles as $profile) {
$data['profiles'] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.$profile['name'].'</a>'; $data['profiles'] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.$profile['name'].'</a>';
$data['IR'] = ($profile['incident_view'] ? $img : '');
$data['IW'] = ($profile['incident_edit'] ? $img : '');
$data['IM'] = ($profile['incident_management'] ? $img : '');
$data['AR'] = ($profile['agent_view'] ? $img : ''); $data['AR'] = ($profile['agent_view'] ? $img : '');
$data['AW'] = ($profile['agent_edit'] ? $img : ''); $data['AW'] = ($profile['agent_edit'] ? $img : '');
$data['AD'] = ($profile['agent_disable'] ? $img : ''); $data['AD'] = ($profile['agent_disable'] ? $img : '');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 B

After

Width:  |  Height:  |  Size: 566 B

View File

@ -27,12 +27,28 @@ ob_clean();
// * q // * q
// * id_group // * id_group
$search_agents = (bool) get_parameter('search_agents'); $search_agents = (bool) get_parameter('search_agents');
$get_agents_interfaces = (bool) get_parameter('get_agents_interfaces');
$id_agents = get_parameter('id_agents', []);
$get_agents_group = (bool) get_parameter('get_agents_group', false); $get_agents_group = (bool) get_parameter('get_agents_group', false);
$force_local = (bool) get_parameter('force_local', false); $force_local = (bool) get_parameter('force_local', false);
if (https_is_running()) { if (https_is_running()) {
header('Content-type: application/json'); header('Content-type: application/json');
} }
if ($get_agents_interfaces) {
$agents_interfaces = agents_get_network_interfaces($id_agents);
// Include alias per agent.
foreach ($agents_interfaces as $key => $value) {
$agent_alias = agents_get_alias($key);
$agents_interfaces[$key]['agent_alias'] = $agent_alias;
}
echo json_encode($agents_interfaces);
return;
}
if ($get_agents_group) { if ($get_agents_group) {
$id_group = (int) get_parameter('id_group', -1); $id_group = (int) get_parameter('id_group', -1);
$mode = (string) get_parameter('mode', 'json'); $mode = (string) get_parameter('mode', 'json');

View File

@ -35,7 +35,7 @@ if (check_login()) {
$search_term = get_parameter('search_term', ''); $search_term = get_parameter('search_term', '');
if ($get_users) { if ($get_users) {
$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users', []); $integria_users_csv = integria_api_call(null, null, null, null, 'get_users', []);
$csv_array = explode("\n", $integria_users_csv); $csv_array = explode("\n", $integria_users_csv);

View File

@ -312,7 +312,7 @@ class AgentWizard extends HTML
$this->idPolicy = get_parameter('id', ''); $this->idPolicy = get_parameter('id', '');
$this->targetIp = get_parameter('targetIp', ''); $this->targetIp = get_parameter('targetIp', '');
if (!empty($this->idAgent)) { if (empty($this->idAgent) === false) {
$array_aux = db_get_all_rows_sql( $array_aux = db_get_all_rows_sql(
sprintf( sprintf(
'SELECT ip FROM taddress ta 'SELECT ip FROM taddress ta
@ -1582,6 +1582,10 @@ class AgentWizard extends HTML
if ($candidate['execution_type'] === 0 if ($candidate['execution_type'] === 0
|| $candidate['execution_type'] === EXECUTION_TYPE_NETWORK || $candidate['execution_type'] === EXECUTION_TYPE_NETWORK
) { ) {
if (substr($candidate['value'], 0, 1) !== '.') {
$candidate['value'] = '.'.$candidate['value'];
}
if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) {
$values['id_module'] = MODULE_DATA; $values['id_module'] = MODULE_DATA;
$values['module_interval'] = 1; $values['module_interval'] = 1;
@ -1687,28 +1691,43 @@ class AgentWizard extends HTML
) )
); );
if ($fieldsPlugin !== false) { if ($this->wizardSection === 'snmp_interfaces_explorer'
$fieldsPlugin = json_decode($fieldsPlugin, true); && empty($candidate['macros']) === false
$i = 1; ) {
foreach ($infoMacros as $key => $value) { // Use definition provided.
if (empty(preg_match('/_snmp_field/', $key)) === false) { $values['id_plugin'] = $candidate['id_plugin'];
$new_macros = []; $values['macros'] = base64_decode($candidate['macros']);
foreach ($fieldsPlugin as $k => $v) { } else {
if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) { $fieldsPlugin = db_get_value_sql(
$fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin( sprintf(
$value, 'SELECT macros FROM tplugin WHERE id=%d',
$infoMacros['macros'] (int) $infoMacros['server_plugin']
); )
$i++; );
continue;
if ($fieldsPlugin !== false) {
$fieldsPlugin = json_decode($fieldsPlugin, true);
$i = 1;
foreach ($infoMacros as $key => $value) {
if (empty(preg_match('/_snmp_field/', $key)) === false) {
$new_macros = [];
foreach ($fieldsPlugin as $k => $v) {
if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) {
$fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin(
$value,
$infoMacros['macros']
);
$i++;
continue;
}
} }
} }
} }
} }
}
$values['id_plugin'] = $infoMacros['server_plugin']; $values['id_plugin'] = $infoMacros['server_plugin'];
$values['macros'] = json_encode($fieldsPlugin); $values['macros'] = json_encode($fieldsPlugin);
}
} }
} }
} else if ($this->protocol === 'wmi') { } else if ($this->protocol === 'wmi') {
@ -1947,6 +1966,10 @@ class AgentWizard extends HTML
|| $candidate['execution_type'] === EXECUTION_TYPE_NETWORK || $candidate['execution_type'] === EXECUTION_TYPE_NETWORK
) { ) {
if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) {
if (substr($candidate['value'], 0, 1) !== '.') {
$candidate['value'] = '.'.$candidate['value'];
}
$tmp->module_interval(300); $tmp->module_interval(300);
$tmp->id_modulo(MODULE_DATA); $tmp->id_modulo(MODULE_DATA);
$tmp->updateConfigurationData( $tmp->updateConfigurationData(
@ -2086,7 +2109,7 @@ class AgentWizard extends HTML
$tmp->id_modulo(MODULE_PLUGIN); $tmp->id_modulo(MODULE_PLUGIN);
if ($this->wizardSection === 'snmp_interfaces_explorer' if ($this->wizardSection === 'snmp_interfaces_explorer'
&& empty($candidate['macros']) === true && empty($candidate['macros']) === false
) { ) {
// Use definition provided. // Use definition provided.
$tmp->id_plugin($candidate['id_plugin']); $tmp->id_plugin($candidate['id_plugin']);

View File

@ -488,7 +488,7 @@ class AgentsAlerts extends HTML
$nagents = count(agents_get_agents($filter_count)); $nagents = count(agents_get_agents($filter_count));
if ($agents == false) { if ($agents === false || empty($agents_with_alerts) === true) {
ui_print_info_message( ui_print_info_message(
[ [
'no_close' => true, 'no_close' => true,
@ -729,37 +729,24 @@ class AgentsAlerts extends HTML
public function loadHeader() public function loadHeader()
{ {
if ($this->pure == 0) { if ($this->pure == 0) {
// Breadcrums. // Header.
$this->setBreadcrum([]); ui_print_standard_header(
$this->prepareBreadcrum(
[
[
'link' => '',
'label' => __('Monitoring'),
'selected' => false,
],
[
'link' => '',
'label' => __('Views'),
'selected' => true,
],
],
true
);
ui_print_page_header(
__('Agents/Alerts'), __('Agents/Alerts'),
'', '',
false, false,
'', '',
true,
'',
false, false,
'', [],
GENERIC_SIZE_TEXT, [
'', [
$this->printHeader(true) 'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('Views'),
],
]
); );
} }

View File

@ -867,6 +867,7 @@ class HTML
} }
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= html_print_csrf_hidden(true);
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) { if ($rawjs) {
@ -1002,6 +1003,7 @@ class HTML
$output .= '</div>'; $output .= '</div>';
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= html_print_csrf_hidden(true);
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) { if ($rawjs) {
@ -1073,6 +1075,7 @@ class HTML
$output .= '</div>'; $output .= '</div>';
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= html_print_csrf_hidden(true);
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) { if ($rawjs) {

View File

@ -3207,7 +3207,7 @@ class NetworkMap
$table->data[0][0] = __('Group'); $table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups( $table->data[0][1] = html_print_select_groups(
false, false,
'IW', 'AR',
false, false,
'group_for_show_agents', 'group_for_show_agents',
-1, -1,

View File

@ -424,7 +424,7 @@ class OrderInterpreter extends Wizard
} }
if ($iterator === 0) { if ($iterator === 0) {
echo __('No results found'); echo __('Press enter to search');
} }
echo '</div>'; echo '</div>';

View File

@ -279,8 +279,10 @@ class Tree
protected function getTagJoin() protected function getTagJoin()
{ {
return 'INNER JOIN ttag_module ttm return 'INNER JOIN tagente_modulo tam
ON tam.id_agente_modulo = ttm.id_agente_modulo'; ON ta.id_agente = tam.id_agente
INNER JOIN ttag_module ttm
ON tam.id_agente_modulo = ttm.id_agente_modulo';
} }
@ -931,11 +933,16 @@ class Tree
$agent_status_filter = $this->getAgentStatusFilter(); $agent_status_filter = $this->getAgentStatusFilter();
$module_search_filter = $this->getModuleSearchFilter(); $module_search_filter = $this->getModuleSearchFilter();
$module_status_inner = ''; $module_status_inner = '';
$module_status_filter = $this->getModuleStatusFilterFromTestado(); $module_search_inner = '';
if (!empty($module_status_filter)) { $module_search_filter = '';
$module_status_inner = ' if (!empty($this->filter['searchModule'])) {
INNER JOIN tagente_estado tae $module_search_inner = '
ON tae.id_agente_modulo = tam.id_agente_modulo'; INNER JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente
INNER JOIN tagente_estado tae
ON tae.id_agente_modulo = tam.id_agente_modulo';
$module_search_filter = "AND tam.disabled = 0
AND tam.nombre LIKE '%%".$this->filter['searchModule']."%%' ".$this->getModuleStatusFilterFromTestado();
} }
$sql_model = "SELECT %s FROM $sql_model = "SELECT %s FROM
@ -944,13 +951,11 @@ class Tree
FROM tagente ta FROM tagente ta
LEFT JOIN tagent_secondary_group tasg LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent ON ta.id_agente = tasg.id_agent
INNER JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente
$inner_inside $inner_inside
$module_status_inner $module_status_inner
$group_inner $group_inner
$module_search_inner
WHERE ta.disabled = 0 WHERE ta.disabled = 0
AND tam.disabled = 0
%s %s
$agent_search_filter $agent_search_filter
$agent_status_filter $agent_status_filter
@ -973,6 +978,7 @@ class Tree
$inner $inner
GROUP BY g GROUP BY g
ORDER BY $order_by_final"; ORDER BY $order_by_final";
hd($sql, true);
return $sql; return $sql;
} }
@ -1020,7 +1026,7 @@ class Tree
$agent_search_filter = $this->getAgentSearchFilter(); $agent_search_filter = $this->getAgentSearchFilter();
$agent_status_filter = $this->getAgentStatusFilter(); $agent_status_filter = $this->getAgentStatusFilter();
$module_search_filter = $this->getModuleSearchFilter(); $module_search_filter = $this->getModuleSearchFilter();
$module_status_filter = $this->getModuleStatusFilterFromTestado($this->filter['statusModule']); $module_status_filter = $this->getModuleStatusFilter();
$condition = $this->L2condition; $condition = $this->L2condition;
$condition_inside = $this->L2conditionInside; $condition_inside = $this->L2conditionInside;

View File

@ -31,6 +31,8 @@ class TreeModuleGroup extends Tree
'tmg.id_mg AS id', 'tmg.id_mg AS id',
]; ];
$this->L1inner = 'INNER JOIN tmodule_group tmg ON tmg.id_mg = x2.g'; $this->L1inner = 'INNER JOIN tmodule_group tmg ON tmg.id_mg = x2.g';
$this->L1innerInside = 'INNER JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente';
$this->L1orderByFinal = 'tmg.name'; $this->L1orderByFinal = 'tmg.name';
$this->L2condition = 'AND tam.id_module_group = '.$this->rootID; $this->L2condition = 'AND tam.id_module_group = '.$this->rootID;

View File

@ -27,6 +27,8 @@ class TreeTag extends Tree
$this->L1fieldName = 'id_tag'; $this->L1fieldName = 'id_tag';
$this->L1fieldNameSql = 'ttm.id_tag'; $this->L1fieldNameSql = 'ttm.id_tag';
$this->L1innerInside = ' $this->L1innerInside = '
INNER JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente
INNER JOIN ttag_module ttm INNER JOIN ttag_module ttm
ON ttm.id_agente_modulo = tam.id_agente_modulo ON ttm.id_agente_modulo = tam.id_agente_modulo
'; ';

View File

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

View File

@ -2281,9 +2281,6 @@ function check_login($output=true)
* Check access privileges to resources * Check access privileges to resources
* *
* Access can be: * Access can be:
* IR - Incident/report Read
* IW - Incident/report Write
* IM - Incident/report Management
* AR - Agent Read * AR - Agent Read
* AW - Agent Write * AW - Agent Write
* LW - Alert Write * LW - Alert Write
@ -2374,9 +2371,6 @@ function check_acl_one_of_groups($id_user, $groups, $access, $cache=true)
* Check access privileges to resources (write or management is not allowed for 'all' group ) * Check access privileges to resources (write or management is not allowed for 'all' group )
* *
* Access can be: * Access can be:
* IR - Incident/report Read
* IW - Incident/report Write
* IM - Incident/report Management
* AR - Agent Read * AR - Agent Read
* AW - Agent Write * AW - Agent Write
* LW - Alert Write * LW - Alert Write
@ -2445,18 +2439,6 @@ function check_acl_restricted_all($id_user, $id_group, $access, $onlyOneGroup=fa
function get_acl_column($access) function get_acl_column($access)
{ {
switch ($access) { switch ($access) {
case 'IR':
return 'incident_view';
break;
case 'IW':
return 'incident_edit';
break;
case 'IM':
return 'incident_management';
break;
case 'AR': case 'AR':
return 'agent_view'; return 'agent_view';
@ -2552,10 +2534,7 @@ function get_users_acl($id_user)
$rowdup = $users_acl_cache[$id_user]; $rowdup = $users_acl_cache[$id_user];
} else { } else {
$query = sprintf( $query = sprintf(
"SELECT sum(tperfil.incident_view) as incident_view, "SELECT sum(tperfil.agent_view) as agent_view,
sum(tperfil.incident_edit) as incident_edit,
sum(tperfil.incident_management) as incident_management,
sum(tperfil.agent_view) as agent_view,
sum(tperfil.agent_edit) as agent_edit, sum(tperfil.agent_edit) as agent_edit,
sum(tperfil.alert_edit) as alert_edit, sum(tperfil.alert_edit) as alert_edit,
sum(tperfil.alert_management) as alert_management, sum(tperfil.alert_management) as alert_management,
@ -5960,27 +5939,57 @@ function get_data_multiplier($unit)
/** /**
* Send test email to check email setups. * Send test email to check email setups.
* *
* @param string $to Target email account. * @param string $to Target email account.
* @param array $params Array with connection data.
* Available fields:
* 'email_smtpServer',
* 'email_smtpPort',
* 'email_username',
* 'email_password',
* 'email_encryption',
* 'email_from_dir',
* 'email_from_name',
* *
* @return integer Status of the email send task. * @return integer Status of the email send task.
*/ */
function send_test_email( function send_test_email(
string $to string $to,
array $params=null
) { ) {
global $config; global $config;
$valid_params = [
'email_smtpServer',
'email_smtpPort',
'email_username',
'email_password',
'email_encryption',
'email_from_dir',
'email_from_name',
];
if (empty($params) === true) {
foreach ($valid_params as $token) {
$params[$token] = $config[$token];
}
} else {
if (array_diff($valid_params, array_keys($params)) === false) {
return false;
}
}
$result = false; $result = false;
try { try {
$transport = new Swift_SmtpTransport( $transport = new Swift_SmtpTransport(
$config['email_smtpServer'], $params['email_smtpServer'],
$config['email_smtpPort'] $params['email_smtpPort']
); );
$transport->setUsername($config['email_username']); $transport->setUsername($params['email_username']);
$transport->setPassword($config['email_password']); $transport->setPassword($params['email_password']);
if ($config['email_encryption']) { if ($params['email_encryption']) {
$transport->setEncryption($config['email_encryption']); $transport->setEncryption($params['email_encryption']);
} }
$mailer = new Swift_Mailer($transport); $mailer = new Swift_Mailer($transport);
@ -5989,8 +5998,8 @@ function send_test_email(
$message->setFrom( $message->setFrom(
[ [
$config['email_from_dir'] => io_safe_output( $params['email_from_dir'] => io_safe_output(
$config['email_from_name'] $params['email_from_name']
), ),
] ]
); );

View File

@ -503,7 +503,7 @@ function api_get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db)
$returnAllColumns = ( $other['data'][2] == '1' ? true : false); $returnAllColumns = ( $other['data'][2] == '1' ? true : false);
} }
$groups = users_get_groups($user_in_db, 'IR', $returnAllGroup, $returnAllColumns); $groups = users_get_groups($user_in_db, 'AR', $returnAllGroup, $returnAllColumns);
$data_groups = []; $data_groups = [];
foreach ($groups as $id => $group) { foreach ($groups as $id => $group) {
@ -7541,6 +7541,305 @@ function api_set_planned_downtimes_additem($id, $thrash1, $other, $thrash3)
} }
/**
* Edit planned Downtime.
* e.g.: api.php?op=set&op2=planned_downtimes_edit&apipass=1234&user=admin&pass=pandora&id=2&other=testing2|test2|2021/05/10|2021/06/12|19:03:03|19:55:00|0|0|0|0|0|0|0|0|1|31|quiet|once|weekly&other_mode=url_encode_separator_|
*
* @param $id id of planned downtime.
* @param $thrash1 Don't use.
* @param array $other
* The first index contains a list of agent Ids.
* The second index contains a list of module names.
* The list separator is the character ';'.
* @param $thrash3 Don't use.
*/
function api_set_planned_downtimes_edit($id, $thrash1, $other, $thrash3)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'PM')) {
returnError('forbidden', 'string');
return;
}
if ($id == '') {
returnError(
'id cannot be left blank.'
);
return;
}
if (db_get_value('id', 'tplanned_downtime', 'id', $id) === false) {
returnError(
'id does not exist'
);
return;
}
if ($other['data'] == '') {
returnError(
'data cannot be left blank.'
);
return;
}
$values = [];
if (!empty($other['data'][0])) {
$values['name'] = io_safe_input($other['data'][0]);
}
if (!empty($other['data'][1])) {
$values['description'] = io_safe_input($other['data'][1]);
}
if (!empty($other['data'][2]) && !empty($other['data'][4])) {
$date_from = strtotime(html_entity_decode($other['data'][2].' '.$other['data'][4]));
$values['date_from'] = io_safe_input($date_from);
}
if (!empty($other['data'][4])) {
$values['periodically_time_from'] = io_safe_input($other['data'][4]);
}
if (!empty($other['data'][3]) && !empty($other['data'][5])) {
$date_to = strtotime(html_entity_decode($other['data'][3].' '.$other['data'][5]));
$values['date_to'] = io_safe_input($date_to);
}
if (!empty($other['data'][5])) {
$values['periodically_time_to'] = io_safe_input($other['data'][5]);
}
if ($other['data'][6] != '') {
$values['id_group'] = io_safe_input($other['data'][6]);
}
if ($other['data'][7] != '') {
$values['monday'] = io_safe_input($other['data'][7]);
}
if ($other['data'][8] != '') {
$values['tuesday'] = io_safe_input($other['data'][8]);
}
if ($other['data'][9] != '') {
$values['wednesday'] = io_safe_input($other['data'][9]);
}
if ($other['data'][10] != '') {
$values['thursday'] = io_safe_input($other['data'][10]);
}
if ($other['data'][11] != '') {
$values['friday'] = io_safe_input($other['data'][11]);
}
if ($other['data'][12] != '') {
$values['saturday'] = io_safe_input($other['data'][12]);
}
if ($other['data'][13] != '') {
$values['sunday'] = io_safe_input($other['data'][13]);
}
if (!empty($other['data'][14])) {
$values['periodically_day_from'] = io_safe_input($other['data'][14]);
}
if (!empty($other['data'][15])) {
$values['periodically_day_to'] = io_safe_input($other['data'][15]);
}
if (!empty($other['data'][16])) {
$values['type_downtime'] = io_safe_input($other['data'][16]);
}
if (!empty($other['data'][17])) {
$values['type_execution'] = io_safe_input($other['data'][17]);
}
if (!empty($other['data'][18])) {
$values['type_periodicity'] = io_safe_input($other['data'][18]);
}
$res = db_process_sql_update('tplanned_downtime', $values, ['id' => $id]);
if ($res === false) {
returnError('Planned downtime could not be updated');
} else {
returnData(
'string',
[
'type' => 'string',
'data' => __('Planned downtime updated'),
]
);
}
}
/**
* Delete agents in planned Downtime.
* e.g.: pi.php?op=set&op2=planned_downtimes_delete_agents&apipass=1234&user=admin&pass=pandora&id=4&other=1;2;3&other_mode=url_encode_separator_|
*
* @param $id id of planned downtime.
* @param $thrash1 Don't use.
* @param array $other
* The first index contains a list of agent Ids.
* The list separator is the character ';'.
* @param $thrash3 Don't use.
*/
function api_set_planned_downtimes_delete_agents($id, $thrash1, $other, $thrash3)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'PM')) {
returnError('forbidden', 'string');
return;
}
if ($id == '') {
returnError(
'id cannot be left blank.'
);
return;
}
if (db_get_value('id', 'tplanned_downtime', 'id', $id) === false) {
returnError(
'id does not exist'
);
return;
}
if ($other['data'] == '') {
returnError(
'data cannot be left blank.'
);
return;
}
if (!empty($other['data'][0])) {
$agents = io_safe_input($other['data']);
$agents = explode(';', $agents);
$results = false;
foreach ($agents as $agent) {
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents WHERE id_agent = %d AND id_downtime = %d', $agent, $id)) !== false) {
$result = db_process_sql_delete('tplanned_downtime_agents', ['id_agent' => $agent]);
db_process_sql_delete('tplanned_downtime_modules', ['id_agent' => $agent]);
if ($result == false) {
returnError(" Agent $agent could not be deleted.");
} else {
$results = true;
}
} else {
returnError(" Agent $agent is not in planned downtime.");
}
}
if ($results) {
returnData(
'string',
[
'type' => 'string',
'data' => __(' Agents deleted'),
]
);
}
}
}
/**
* Add agents planned Downtime.
* e.g.: api.php?op=set&op2=planned_downtimes_add_agents&apipass=1234&user=admin&pass=pandora&id=4&other=1;2;3&other_mode=url_encode_separator_|
*
* @param $id id of planned downtime.
* @param $thrash1 Don't use.
* @param array $other
* The first index contains a list of agent Ids.
* The list separator is the character ';'.
* @param $thrash3 Don't use.
*/
function api_set_planned_downtimes_add_agents($id, $thrash1, $other, $thrash3)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'PM')) {
returnError('forbidden', 'string');
return;
}
if ($id == '') {
returnError(
'id cannot be left blank.'
);
return;
}
if (db_get_value('id', 'tplanned_downtime', 'id', $id) === false) {
returnError(
'id does not exist'
);
return;
}
if ($other['data'] == '') {
returnError(
'data cannot be left blank.'
);
return;
}
if (!empty($other['data'][0])) {
$agents = io_safe_input($other['data']);
$agents = explode(';', $agents);
$results = false;
foreach ($agents as $agent) {
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {
$res = db_process_sql_insert(
'tplanned_downtime_agents',
[
'id_agent' => $agent,
'id_downtime' => $id,
'all_modules' => 0,
'manually_disabled' => 0,
]
);
if ($res) {
$results = true;
}
} else {
returnError(" Agent $agent is already at the planned downtime.");
}
}
if ($results) {
returnData(
'string',
[
'type' => 'string',
'data' => __(' Agents added'),
]
);
}
}
}
/** /**
* Update data module in policy. And return id from new module. * Update data module in policy. And return id from new module.
* *
@ -11672,9 +11971,6 @@ function api_get_user_profiles_info($thrash1, $thrash2, $thrash3, $returnType)
[ [
'id_perfil', 'id_perfil',
'name', 'name',
'incident_view as IR',
'incident_edit as IW',
'incident_management as IM',
'agent_view as AR', 'agent_view as AR',
'agent_edit as AW', 'agent_edit as AW',
'agent_disable as AD', 'agent_disable as AD',
@ -11727,29 +12023,26 @@ function api_set_create_user_profile_info($thrash1, $thrash2, $other, $returnTyp
$values = [ $values = [
'name' => (string) $other['data'][0], 'name' => (string) $other['data'][0],
'incident_view' => (bool) $other['data'][1] ? 1 : 0, 'agent_view' => (bool) $other['data'][1] ? 1 : 0,
'incident_edit' => (bool) $other['data'][2] ? 1 : 0, 'agent_edit' => (bool) $other['data'][2] ? 1 : 0,
'incident_management' => (bool) $other['data'][3] ? 1 : 0, 'agent_disable' => (bool) $other['data'][3] ? 1 : 0,
'agent_view' => (bool) $other['data'][4] ? 1 : 0, 'alert_edit' => (bool) $other['data'][4] ? 1 : 0,
'agent_edit' => (bool) $other['data'][5] ? 1 : 0, 'alert_management' => (bool) $other['data'][5] ? 1 : 0,
'agent_disable' => (bool) $other['data'][6] ? 1 : 0, 'user_management' => (bool) $other['data'][6] ? 1 : 0,
'alert_edit' => (bool) $other['data'][7] ? 1 : 0, 'db_management' => (bool) $other['data'][7] ? 1 : 0,
'alert_management' => (bool) $other['data'][8] ? 1 : 0, 'event_view' => (bool) $other['data'][8] ? 1 : 0,
'user_management' => (bool) $other['data'][9] ? 1 : 0, 'event_edit' => (bool) $other['data'][9] ? 1 : 0,
'db_management' => (bool) $other['data'][10] ? 1 : 0, 'event_management' => (bool) $other['data'][10] ? 1 : 0,
'event_view' => (bool) $other['data'][11] ? 1 : 0, 'report_view' => (bool) $other['data'][11] ? 1 : 0,
'event_edit' => (bool) $other['data'][12] ? 1 : 0, 'report_edit' => (bool) $other['data'][12] ? 1 : 0,
'event_management' => (bool) $other['data'][13] ? 1 : 0, 'report_management' => (bool) $other['data'][13] ? 1 : 0,
'report_view' => (bool) $other['data'][14] ? 1 : 0, 'map_view' => (bool) $other['data'][14] ? 1 : 0,
'report_edit' => (bool) $other['data'][15] ? 1 : 0, 'map_edit' => (bool) $other['data'][15] ? 1 : 0,
'report_management' => (bool) $other['data'][16] ? 1 : 0, 'map_management' => (bool) $other['data'][16] ? 1 : 0,
'map_view' => (bool) $other['data'][17] ? 1 : 0, 'vconsole_view' => (bool) $other['data'][17] ? 1 : 0,
'map_edit' => (bool) $other['data'][18] ? 1 : 0, 'vconsole_edit' => (bool) $other['data'][18] ? 1 : 0,
'map_management' => (bool) $other['data'][19] ? 1 : 0, 'vconsole_management' => (bool) $other['data'][19] ? 1 : 0,
'vconsole_view' => (bool) $other['data'][20] ? 1 : 0, 'pandora_management' => (bool) $other['data'][20] ? 1 : 0,
'vconsole_edit' => (bool) $other['data'][21] ? 1 : 0,
'vconsole_management' => (bool) $other['data'][22] ? 1 : 0,
'pandora_management' => (bool) $other['data'][23] ? 1 : 0,
]; ];
$return = db_process_sql_insert('tperfil', $values); $return = db_process_sql_insert('tperfil', $values);
@ -11789,29 +12082,26 @@ function api_set_update_user_profile_info($id_profile, $thrash1, $other, $return
$values = [ $values = [
'name' => $other['data'][0] == '' ? $profile['name'] : (string) $other['data'][0], 'name' => $other['data'][0] == '' ? $profile['name'] : (string) $other['data'][0],
'incident_view' => $other['data'][1] == '' ? $profile['incident_view'] : (bool) $other['data'][1] ? 1 : 0, 'agent_view' => $other['data'][1] == '' ? $profile['agent_view'] : (bool) $other['data'][1] ? 1 : 0,
'incident_edit' => $other['data'][2] == '' ? $profile['incident_edit'] : (bool) $other['data'][2] ? 1 : 0, 'agent_edit' => $other['data'][2] == '' ? $profile['agent_edit'] : (bool) $other['data'][2] ? 1 : 0,
'incident_management' => $other['data'][3] == '' ? $profile['incident_management'] : (bool) $other['data'][3] ? 1 : 0, 'agent_disable' => $other['data'][3] == '' ? $profile['agent_disable'] : (bool) $other['data'][3] ? 1 : 0,
'agent_view' => $other['data'][4] == '' ? $profile['agent_view'] : (bool) $other['data'][4] ? 1 : 0, 'alert_edit' => $other['data'][4] == '' ? $profile['alert_edit'] : (bool) $other['data'][4] ? 1 : 0,
'agent_edit' => $other['data'][5] == '' ? $profile['agent_edit'] : (bool) $other['data'][5] ? 1 : 0, 'alert_management' => $other['data'][5] == '' ? $profile['alert_management'] : (bool) $other['data'][5] ? 1 : 0,
'agent_disable' => $other['data'][6] == '' ? $profile['agent_disable'] : (bool) $other['data'][6] ? 1 : 0, 'user_management' => $other['data'][6] == '' ? $profile['user_management'] : (bool) $other['data'][6] ? 1 : 0,
'alert_edit' => $other['data'][7] == '' ? $profile['alert_edit'] : (bool) $other['data'][7] ? 1 : 0, 'db_management' => $other['data'][7] == '' ? $profile['db_management'] : (bool) $other['data'][7] ? 1 : 0,
'alert_management' => $other['data'][8] == '' ? $profile['alert_management'] : (bool) $other['data'][8] ? 1 : 0, 'event_view' => $other['data'][8] == '' ? $profile['event_view'] : (bool) $other['data'][8] ? 1 : 0,
'user_management' => $other['data'][9] == '' ? $profile['user_management'] : (bool) $other['data'][9] ? 1 : 0, 'event_edit' => $other['data'][9] == '' ? $profile['event_edit'] : (bool) $other['data'][9] ? 1 : 0,
'db_management' => $other['data'][10] == '' ? $profile['db_management'] : (bool) $other['data'][10] ? 1 : 0, 'event_management' => $other['data'][10] == '' ? $profile['event_management'] : (bool) $other['data'][10] ? 1 : 0,
'event_view' => $other['data'][11] == '' ? $profile['event_view'] : (bool) $other['data'][11] ? 1 : 0, 'report_view' => $other['data'][11] == '' ? $profile['report_view'] : (bool) $other['data'][11] ? 1 : 0,
'event_edit' => $other['data'][12] == '' ? $profile['event_edit'] : (bool) $other['data'][12] ? 1 : 0, 'report_edit' => $other['data'][12] == '' ? $profile['report_edit'] : (bool) $other['data'][12] ? 1 : 0,
'event_management' => $other['data'][13] == '' ? $profile['event_management'] : (bool) $other['data'][13] ? 1 : 0, 'report_management' => $other['data'][13] == '' ? $profile['report_management'] : (bool) $other['data'][13] ? 1 : 0,
'report_view' => $other['data'][14] == '' ? $profile['report_view'] : (bool) $other['data'][14] ? 1 : 0, 'map_view' => $other['data'][14] == '' ? $profile['map_view'] : (bool) $other['data'][14] ? 1 : 0,
'report_edit' => $other['data'][15] == '' ? $profile['report_edit'] : (bool) $other['data'][15] ? 1 : 0, 'map_edit' => $other['data'][15] == '' ? $profile['map_edit'] : (bool) $other['data'][15] ? 1 : 0,
'report_management' => $other['data'][16] == '' ? $profile['report_management'] : (bool) $other['data'][16] ? 1 : 0, 'map_management' => $other['data'][16] == '' ? $profile['map_management'] : (bool) $other['data'][16] ? 1 : 0,
'map_view' => $other['data'][17] == '' ? $profile['map_view'] : (bool) $other['data'][17] ? 1 : 0, 'vconsole_view' => $other['data'][17] == '' ? $profile['vconsole_view'] : (bool) $other['data'][17] ? 1 : 0,
'map_edit' => $other['data'][18] == '' ? $profile['map_edit'] : (bool) $other['data'][18] ? 1 : 0, 'vconsole_edit' => $other['data'][18] == '' ? $profile['vconsole_edit'] : (bool) $other['data'][18] ? 1 : 0,
'map_management' => $other['data'][19] == '' ? $profile['map_management'] : (bool) $other['data'][19] ? 1 : 0, 'vconsole_management' => $other['data'][19] == '' ? $profile['vconsole_management'] : (bool) $other['data'][19] ? 1 : 0,
'vconsole_view' => $other['data'][20] == '' ? $profile['vconsole_view'] : (bool) $other['data'][20] ? 1 : 0, 'pandora_management' => $other['data'][20] == '' ? $profile['pandora_management'] : (bool) $other['data'][20] ? 1 : 0,
'vconsole_edit' => $other['data'][21] == '' ? $profile['vconsole_edit'] : (bool) $other['data'][21] ? 1 : 0,
'vconsole_management' => $other['data'][22] == '' ? $profile['vconsole_management'] : (bool) $other['data'][22] ? 1 : 0,
'pandora_management' => $other['data'][23] == '' ? $profile['pandora_management'] : (bool) $other['data'][23] ? 1 : 0,
]; ];
$return = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]); $return = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]);
@ -11859,101 +12149,6 @@ function api_set_delete_user_profile_info($id_profile, $thrash1, $thrash2, $retu
} }
/**
* Create new incident in Pandora.
*
* @param $thrash1 Don't use.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param is <title>;<description>;
* <origin>;<priority>;<state>;<group> in this order and separator char
* (after text ; ) and separator (pass in param othermode as
* othermode=url_encode_separator_<separator>)
* example:
*
* api.php?op=set&op2=new_incident&other=titulo|descripcion%20texto|Logfiles|2|10|12&other_mode=url_encode_separator_|
*
* @param $thrash3 Don't use.
*/
function api_set_new_incident($thrash1, $thrash2, $other, $thrash3)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'IW')) {
returnError('forbidden', 'string');
return;
}
$title = $other['data'][0];
$description = $other['data'][1];
$origin = $other['data'][2];
$priority = $other['data'][3];
$id_creator = 'API';
$state = $other['data'][4];
$group = $other['data'][5];
$values = [
'inicio' => 'NOW()',
'actualizacion' => 'NOW()',
'titulo' => $title,
'descripcion' => $description,
'id_usuario' => 'API',
'origen' => $origin,
'estado' => $state,
'prioridad' => $priority,
'id_grupo' => $group,
'id_creator' => $id_creator,
];
$idIncident = db_process_sql_insert('tincidencia', $values);
if ($idIncident === false) {
returnError('A new incident could not be created.');
} else {
returnData('string', ['type' => 'string', 'data' => $idIncident]);
}
}
/**
* Add note into a incident.
*
* @param $id string Username author of note.
* @param $id2 integer ID of incident.
* @param $other string Note.
* @param $thrash2 Don't use.
*/
function api_set_new_note_incident($id, $id2, $other, $thrash2)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'IW')) {
returnError('forbidden', 'string');
return;
}
$values = [
'id_usuario' => $id,
'id_incident' => $id2,
'nota' => $other['data'],
];
$idNote = db_process_sql_insert('tnota', $values);
if ($idNote === false) {
returnError('A new incident could not be created+.');
} else {
returnData('string', ['type' => 'string', 'data' => $idNote]);
}
}
/** /**
* Disable a module, given agent and module name. * Disable a module, given agent and module name.
* *
@ -12922,8 +13117,10 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$error_msg = ''; $error_msg = '';
if ($other['data'][2] != '') { if ($other['data'][2] != '') {
// Id agent assignment. If come from pandora_revent, id_agent can be 0.
$id_agent = $other['data'][2]; $id_agent = $other['data'][2];
if (is_metaconsole()) { // To the next if is metaconsole and id_agent is not none.
if (is_metaconsole() === true && $id_agent > 0) {
// On metaconsole, connect with the node to check the permissions // On metaconsole, connect with the node to check the permissions
if (empty($values['server_id'])) { if (empty($values['server_id'])) {
$agent_cache = db_get_row('tmetaconsole_agent', 'id_tagente', $id_agent); $agent_cache = db_get_row('tmetaconsole_agent', 'id_tagente', $id_agent);
@ -12946,7 +13143,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$values['id_agente'] = $id_agent; $values['id_agente'] = $id_agent;
if (!util_api_check_agent_and_print_error($id_agent, 'string', 'AR')) { if ((int) $id_agent > 0 && util_api_check_agent_and_print_error($id_agent, 'string', 'AR') === false) {
if (is_metaconsole()) { if (is_metaconsole()) {
metaconsole_restore_db(); metaconsole_restore_db();
} }

View File

@ -1032,6 +1032,14 @@ function config_update_config()
$error_update[] = __('Custom subtitle header'); $error_update[] = __('Custom subtitle header');
} }
if (!config_update_value('meta_custom_title_header', (string) get_parameter('meta_custom_title_header'))) {
$error_update[] = __('Meta custom title header');
}
if (!config_update_value('meta_custom_subtitle_header', (string) get_parameter('meta_custom_subtitle_header'))) {
$error_update[] = __('Meta custom subtitle header');
}
if (!config_update_value('custom_title1_login', (string) get_parameter('custom_title1_login'))) { if (!config_update_value('custom_title1_login', (string) get_parameter('custom_title1_login'))) {
$error_update[] = __('Custom title1 login'); $error_update[] = __('Custom title1 login');
} }
@ -1060,10 +1068,6 @@ function config_update_config()
$error_update[] = __('Copyright notice'); $error_update[] = __('Copyright notice');
} }
if (!config_update_value('meta_custom_logo', (string) get_parameter('meta_custom_logo'))) {
$error_update[] = __('Custom logo metaconsole');
}
if (!config_update_value('meta_custom_logo_white_bg', (string) get_parameter('meta_custom_logo_white_bg'))) { if (!config_update_value('meta_custom_logo_white_bg', (string) get_parameter('meta_custom_logo_white_bg'))) {
$error_update[] = __('Custom logo metaconsole (white background)'); $error_update[] = __('Custom logo metaconsole (white background)');
} }
@ -1642,6 +1646,10 @@ function config_update_config()
break; break;
case 'integria': case 'integria':
if (!config_update_value('integria_user_level_conf', (int) get_parameter('integria_user_level_conf', 0))) {
$error_update[] = __('Integria user login');
}
if (!config_update_value('integria_enabled', (int) get_parameter('integria_enabled', 0))) { if (!config_update_value('integria_enabled', (int) get_parameter('integria_enabled', 0))) {
$error_update[] = __('Enable Integria IMS'); $error_update[] = __('Enable Integria IMS');
} }
@ -2287,6 +2295,20 @@ function config_process_config()
config_update_value('custom_logo_collapsed', 'pandora_logo_green_collapsed.png'); config_update_value('custom_logo_collapsed', 'pandora_logo_green_collapsed.png');
} }
if (is_metaconsole()) {
if (!isset($config['meta_custom_logo'])) {
config_update_value('meta_custom_logo', 'pandoraFMS_metaconsole_full.svg');
}
if (!isset($config['meta_custom_logo_collapsed'])) {
config_update_value('meta_custom_logo_collapsed', 'pandoraFMS_metaconsole_collapse.svg');
}
if (!isset($config['meta_menu_type'])) {
config_update_value('meta_menu_type', 'classic');
}
}
if (!isset($config['custom_logo_white_bg'])) { if (!isset($config['custom_logo_white_bg'])) {
config_update_value('custom_logo_white_bg', 'pandora_logo_head_white_bg.png'); config_update_value('custom_logo_white_bg', 'pandora_logo_head_white_bg.png');
} }
@ -2323,6 +2345,14 @@ function config_process_config()
config_update_value('custom_subtitle_header', __('the Flexible Monitoring System')); config_update_value('custom_subtitle_header', __('the Flexible Monitoring System'));
} }
if (!isset($config['meta_custom_title_header'])) {
config_update_value('meta_custom_title_header', __('PandoraFMS Metaconsole'));
}
if (!isset($config['meta_custom_subtitle_header'])) {
config_update_value('meta_custom_subtitle_header', __('Centralized operation console'));
}
if (!isset($config['custom_title1_login'])) { if (!isset($config['custom_title1_login'])) {
config_update_value('custom_title1_login', __('PANDORA FMS')); config_update_value('custom_title1_login', __('PANDORA FMS'));
} }
@ -2355,10 +2385,6 @@ function config_process_config()
config_update_value('meta_custom_support_url', 'https://support.pandorafms.com'); config_update_value('meta_custom_support_url', 'https://support.pandorafms.com');
} }
if (!isset($config['meta_custom_logo'])) {
config_update_value('meta_custom_logo', 'logo_pandora_metaconsola.png');
}
if (!isset($config['meta_custom_logo_white_bg'])) { if (!isset($config['meta_custom_logo_white_bg'])) {
config_update_value('pandora_logo_head_white_bg', 'pandora_logo_head_white_bg.png'); config_update_value('pandora_logo_head_white_bg', 'pandora_logo_head_white_bg.png');
} }
@ -3244,6 +3270,10 @@ function config_process_config()
} }
// Integria. // Integria.
if (!isset($config['integria_user_level_conf'])) {
config_update_value('integria_user_level_conf', 0);
}
if (!isset($config['integria_enabled'])) { if (!isset($config['integria_enabled'])) {
config_update_value('integria_enabled', 0); config_update_value('integria_enabled', 0);
} }

View File

@ -374,7 +374,7 @@ function db_get_value_filter($field, $table, $filter, $where_join='AND', $search
* *
* @param string SQL select statement to execute. * @param string SQL select statement to execute.
* *
* @return the first value of the first row of a table result from query. * @return mixed the first value of the first row of a table result from query.
*/ */
function db_get_value_sql($sql, $dbconnection=false) function db_get_value_sql($sql, $dbconnection=false)
{ {

View File

@ -3152,10 +3152,6 @@ function events_get_agent(
} }
} }
if (is_metaconsole() === true && empty($id_server) === false) {
$sql_where .= ' AND server_id = '.$id_server;
}
if ($show_summary_group) { if ($show_summary_group) {
return events_get_events_grouped( return events_get_events_grouped(
$sql_where, $sql_where,
@ -3169,7 +3165,7 @@ function events_get_agent(
} else { } else {
return events_get_events_no_grouped( return events_get_events_no_grouped(
$sql_where, $sql_where,
(is_metaconsole() === true && empty($id_server) === false) ? true : false, (is_metaconsole() === true && (int) $id_server === 0) ? true : false,
$history $history
); );
} }

View File

@ -2978,9 +2978,9 @@ function grafico_incidente_prioridad()
{ {
global $config; global $config;
$integria_ticket_count_by_priority_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['prioridad', 30], false, '', '|;|'); $integria_ticket_count_by_priority_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['prioridad', 30], false, '', '|;|');
$integria_priorities_map_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_priorities', '', false, 'json'); $integria_priorities_map_json = integria_api_call(null, null, null, null, 'get_incident_priorities', '', false, 'json');
$integria_ticket_count_by_priority = json_decode($integria_ticket_count_by_priority_json, true); $integria_ticket_count_by_priority = json_decode($integria_ticket_count_by_priority_json, true);
$integria_priorities_map = json_decode($integria_priorities_map_json, true); $integria_priorities_map = json_decode($integria_priorities_map_json, true);
@ -3023,9 +3023,9 @@ function graph_incidents_status()
{ {
global $config; global $config;
$integria_ticket_count_by_status_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['estado', 30], false, '', '|;|'); $integria_ticket_count_by_status_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['estado', 30], false, '', '|;|');
$integria_status_map_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents_status', '', false, 'json'); $integria_status_map_json = integria_api_call(null, null, null, null, 'get_incidents_status', '', false, 'json');
$integria_ticket_count_by_status = json_decode($integria_ticket_count_by_status_json, true); $integria_ticket_count_by_status = json_decode($integria_ticket_count_by_status_json, true);
$integria_status_map = json_decode($integria_status_map_json, true); $integria_status_map = json_decode($integria_status_map_json, true);
@ -3068,9 +3068,9 @@ function graphic_incident_group()
{ {
global $config; global $config;
$integria_ticket_count_by_group_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['id_grupo', 30], false, '', '|;|'); $integria_ticket_count_by_group_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['id_grupo', 30], false, '', '|;|');
$integria_group_map_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_groups', '', false, 'json'); $integria_group_map_json = integria_api_call(null, null, null, null, 'get_groups', '', false, 'json');
$integria_ticket_count_by_group = json_decode($integria_ticket_count_by_group_json, true); $integria_ticket_count_by_group = json_decode($integria_ticket_count_by_group_json, true);
$integria_group_map = json_decode($integria_group_map_json, true); $integria_group_map = json_decode($integria_group_map_json, true);
@ -3114,7 +3114,7 @@ function graphic_incident_user()
{ {
global $config; global $config;
$integria_ticket_count_by_user_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['id_usuario', 30], false, '', '|;|'); $integria_ticket_count_by_user_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['id_usuario', 30], false, '', '|;|');
$integria_ticket_count_by_user = json_decode($integria_ticket_count_by_user_json, true); $integria_ticket_count_by_user = json_decode($integria_ticket_count_by_user_json, true);

View File

@ -4306,10 +4306,14 @@ function html_print_sort_arrows($params, $order_tag, $up='up', $down='down')
/** /**
* Print an input hidden with a new csrf token generated * Print an input hidden with a new csrf token generated
*
* @param boolean $return If it is true return a string with the output instead to echo the output.
*
* @return void
*/ */
function html_print_csrf_hidden() function html_print_csrf_hidden(bool $return=false)
{ {
html_print_input_hidden('csrf_code', generate_csrf_code()); return html_print_input_hidden('csrf_code', generate_csrf_code(), $return);
} }

View File

@ -21,6 +21,7 @@ global $config;
require_once $config['homedir'].'/include/functions_ui.php'; require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_html.php'; require_once $config['homedir'].'/include/functions_html.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions.php'; require_once $config['homedir'].'/include/functions.php';
@ -78,22 +79,10 @@ function integriaims_tabs($active_tab, $view=false)
} }
$onheader = []; $onheader = [];
$onheader['view'] = $view_tab;
if (check_acl($config['id_user'], 0, 'IR') && $view) { $onheader['configure'] = $setup_tab;
$onheader['view'] = $view_tab; $onheader['list'] = $list_tab;
} $onheader['create'] = $create_tab;
if (check_acl($config['id_user'], 0, 'PM')) {
$onheader['configure'] = $setup_tab;
}
if (check_acl($config['id_user'], 0, 'IR')) {
$onheader['list'] = $list_tab;
}
if (check_acl($config['id_user'], 0, 'IW')) {
$onheader['create'] = $create_tab;
}
return $onheader; return $onheader;
} }
@ -137,7 +126,7 @@ function integriaims_get_details($details, $detail_index=false)
break; break;
} }
$api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], $operation); $api_call = integria_api_call(null, null, null, null, $operation);
$result = []; $result = [];
get_array_from_csv_data_pair($api_call, $result); get_array_from_csv_data_pair($api_call, $result);
@ -165,8 +154,42 @@ function integriaims_get_details($details, $detail_index=false)
* *
* @return boolean True if API request succeeded, false if API request failed. * @return boolean True if API request succeeded, false if API request failed.
*/ */
function integria_api_call($api_hostname, $user, $user_pass, $api_pass, $operation, $params='', $show_credentials_error_msg=false, $return_type='', $token='') function integria_api_call($api_hostname=null, $user=null, $user_pass=null, $api_pass=null, $operation, $params='', $show_credentials_error_msg=false, $return_type='', $token='', $user_level_conf=null)
{ {
global $config;
if ($user_level_conf === null) {
$user_level_conf = (bool) $config['integria_user_level_conf'];
}
$user_info = users_get_user_by_id($config['id_user']);
// API access data.
if ($api_hostname === null) {
$api_hostname = $config['integria_hostname'];
}
if ($api_pass === null) {
$api_pass = $config['integria_api_pass'];
}
// Integria user and password.
if ($user === null || $user_level_conf === true) {
$user = $config['integria_user'];
if ($user_level_conf === true) {
$user = $user_info['integria_user_level_user'];
}
}
if ($user_pass === null || $user_level_conf === true) {
$user_pass = $config['integria_pass'];
if ($user_level_conf === true) {
$user_pass = $user_info['integria_user_level_pass'];
}
}
if (is_array($params)) { if (is_array($params)) {
$params = implode($token, $params); $params = implode($token, $params);
} }
@ -352,10 +375,10 @@ function get_tickets_integriaims($tickets_filters)
// API call. // API call.
$result_api_call_list = integria_api_call( $result_api_call_list = integria_api_call(
$config['integria_hostname'], null,
$config['integria_user'], null,
$config['integria_pass'], null,
$config['integria_api_pass'], null,
'get_incidents', 'get_incidents',
[ [
$incident_text, $incident_text,

View File

@ -218,7 +218,16 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
$new_module = $module; $new_module = $module;
// Rewrite different values // Rewrite different values
$new_module['ip_target'] = agents_get_address($id_destiny_agent); if ($module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_CMD
|| $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_CMD_PROC
|| $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_CMD_STRING
|| $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_CMD_INC
) {
$new_module['ip_target'] = $module['ip_target'];
} else {
$new_module['ip_target'] = agents_get_address($id_destiny_agent);
}
$new_module['policy_linked'] = 0; $new_module['policy_linked'] = 0;
$new_module['id_policy_module'] = 0; $new_module['id_policy_module'] = 0;

View File

@ -120,7 +120,7 @@ function netflow_check_filter_group($id_sg)
$id_group = db_get_value('id_group', 'tnetflow_filter', 'id_sg', $id_sg); $id_group = db_get_value('id_group', 'tnetflow_filter', 'id_sg', $id_sg);
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
// Get group list that user has access. // Get group list that user has access.
$groups_user = users_get_groups($config['id_user'], 'IW', $own_info['is_admin'], true); $groups_user = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
$groups_id = []; $groups_id = [];
$has_permission = false; $has_permission = false;

View File

@ -1500,7 +1500,7 @@ function networkmap_delete_relations($id_map)
function get_networkmaps($id) function get_networkmaps($id)
{ {
$groups = array_keys(users_get_groups(null, 'IW')); $groups = array_keys(users_get_groups(null, 'MW'));
$filter = []; $filter = [];
$filter['id_group'] = $groups; $filter['id_group'] = $groups;

View File

@ -1844,6 +1844,7 @@ function reporting_event_report_group(
$content['name'] = __('Event Report Group'); $content['name'] = __('Event Report Group');
} }
$id_meta = 0;
if (is_metaconsole() === true && empty($content['server_name']) === false) { if (is_metaconsole() === true && empty($content['server_name']) === false) {
$id_meta = metaconsole_get_id_server($content['server_name']); $id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta); $server = metaconsole_get_connection_by_id($id_meta);
@ -1935,7 +1936,7 @@ function reporting_event_report_group(
true, true,
false, false,
false, false,
false, $id_meta,
$filter_event_filter_exclude $filter_event_filter_exclude
); );
@ -2183,10 +2184,6 @@ function reporting_event_report_module(
); );
} }
if (is_metaconsole()) {
metaconsole_restore_db();
}
$return['description'] = $content['description']; $return['description'] = $content['description'];
$return['show_extended_events'] = $content['show_extended_events']; $return['show_extended_events'] = $content['show_extended_events'];
$return['date'] = reporting_get_date_text($report, $content); $return['date'] = reporting_get_date_text($report, $content);
@ -2248,7 +2245,7 @@ function reporting_event_report_module(
$return['data'] = array_reverse($data); $return['data'] = array_reverse($data);
} }
if ($config['metaconsole']) { if (is_metaconsole() === true) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
@ -2899,6 +2896,7 @@ function reporting_exception(
// Metaconsole connection. // Metaconsole connection.
$server_name = $exc['server_name']; $server_name = $exc['server_name'];
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) { if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
metaconsole_restore_db();
$connection = metaconsole_get_connection($server_name); $connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) { if (metaconsole_load_external_db($connection) != NOERR) {
// ui_print_error_message ("Error connecting to ".$server_name); // ui_print_error_message ("Error connecting to ".$server_name);
@ -3427,10 +3425,6 @@ function reporting_event_report_agent(
); );
} }
if ($config['metaconsole']) {
metaconsole_restore_db();
}
$label = (isset($content['style']['label'])) ? $content['style']['label'] : ''; $label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
if ($label != '') { if ($label != '') {
$label = reporting_label_macro( $label = reporting_label_macro(
@ -3477,9 +3471,14 @@ function reporting_event_report_agent(
$filter_event_type, $filter_event_type,
$filter_event_status, $filter_event_status,
$filter_event_filter_search, $filter_event_filter_search,
$filter_event_filter_exclude $filter_event_filter_exclude,
$id_server
); );
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
reporting_set_conf_charts( reporting_set_conf_charts(
$width, $width,
$height, $height,
@ -9765,12 +9764,21 @@ function reporting_get_module_detailed_event(
* It construct a table object with all the grouped events happened in an agent * It construct a table object with all the grouped events happened in an agent
* during a period of time. * during a period of time.
* *
* @param mixed Agent id(s) to get the report from. * @param mixed $id_agents Agent id(s) to get the report from.
* @param int Period of time (in seconds) to get the report. * @param integer $period Period of time (in seconds) to get the report.
* @param int Beginning date (unixtime) of the report * @param integer $date Beginning date (unixtime) of the report.
* @param bool Flag to return or echo the report table (echo by default). * @param boolean $return Flag to return or echo the report table (echo by default).
* @param boolean $only_data Only data.
* @param boolean $history History.
* @param boolean $show_summary_group Show summary group.
* @param boolean $filter_event_severity Filter.
* @param boolean $filter_event_type Filter.
* @param boolean $filter_event_status Filter.
* @param boolean $filter_event_filter_search Filter.
* @param boolean $filter_event_filter_exclude Filter.
* @param integer $id_server Id server.
* *
* @return A table object (XHTML) * @return array table object (XHTML)
*/ */
function reporting_get_agents_detailed_event( function reporting_get_agents_detailed_event(
$id_agents, $id_agents,
@ -9784,7 +9792,8 @@ function reporting_get_agents_detailed_event(
$filter_event_type=false, $filter_event_type=false,
$filter_event_status=false, $filter_event_status=false,
$filter_event_filter_search=false, $filter_event_filter_search=false,
$filter_event_filter_exclude=false $filter_event_filter_exclude=false,
$id_server=0
) { ) {
global $config; global $config;
@ -9819,7 +9828,7 @@ function reporting_get_agents_detailed_event(
false, false,
false, false,
false, false,
false, $id_server,
$filter_event_filter_exclude $filter_event_filter_exclude
); );

View File

@ -27,6 +27,8 @@
*/ */
// Begin. // Begin.
global $config;
// Check to avoid error when load this library in error screen situations. // Check to avoid error when load this library in error screen situations.
if (isset($config['homedir'])) { if (isset($config['homedir'])) {
include_once $config['homedir'].'/include/functions_agents.php'; include_once $config['homedir'].'/include/functions_agents.php';
@ -4302,6 +4304,101 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
} }
/**
* Generates the Pandora 75x Standard views header.
* This function should be the standard for
* generating the headers of all PFMS views.
*
* @param string $title The title of this view.
* @param string $icon Icon for show.
* @param boolean $return If true, the string with the formed header is returned.
* @param string $help String for attach at end a link for help.
* @param boolean $godmode If false, it will created like operation mode.
* @param array $options Tabs allowed
* @param array $breadcrumbs Breadcrumbs with the walk.
*
* EXAMPLE:
* ```
* $buttons['option_1'] = [
* 'active' => false,
* 'text' => '<a href="'.$url.'">'.html_print_image(
* 'images/wand.png',
* true,
* [ 'title' => __('Option 1 for show'), 'class' => 'invert_filter' ]
* ).'</a>',
* ];
*
* ui_print_standard_header(
* __('Favorites'),
* 'images/op_reporting.png',
* false,
* '',
* true,
* $buttons,
* [
* [ 'link' => '', 'label' => __('Topology maps') ],
* [ 'link' => '', 'label' => __('Visual console') ],
* ]
* );
* ```
*
* @return string If apply
*/
function ui_print_standard_header(
string $title,
string $icon='',
bool $return=false,
string $help='',
bool $godmode=false,
array $options=[],
array $breadcrumbs=[]
) {
// For standard breadcrumbs.
ui_require_css_file('discovery');
// Create the breadcrumb.
$headerInformation = new HTML();
$headerInformation->setBreadcrum([]);
// Prepare the breadcrumbs.
$countBreadcrumbs = count($breadcrumbs);
$countUnitBreadcrumb = 0;
$applyBreadcrumbs = [];
foreach ($breadcrumbs as $unitBreadcrumb) {
// Count new breadcrumb.
$countUnitBreadcrumb++;
// Apply selected if is the last.
$unitBreadcrumb['selected'] = ($countBreadcrumbs === $countUnitBreadcrumb);
// Apply for another breadcrumb.
$applyBreadcrumbs[] = $unitBreadcrumb;
}
// Attach breadcrumbs.
$headerInformation->prepareBreadcrum(
$applyBreadcrumbs,
true
);
// Create the header.
$output = ui_print_page_header(
$title,
$icon,
true,
$help,
$godmode,
$options,
false,
'',
GENERIC_SIZE_TEXT,
'',
$headerInformation->printHeader(true)
);
if ($return !== true) {
echo $output;
} else {
return $output;
}
}
/** /**
* Return a standard page header (Pandora FMS 3.1 version) * Return a standard page header (Pandora FMS 3.1 version)
* *

View File

@ -755,43 +755,47 @@ function newsletter_wiz_modal(
); );
// Avoid to show default email. // Avoid to show default email.
if ($email == 'admin@example.com') { if ($email === 'admin@example.com') {
$email = ''; $email = '';
} }
$output .= '<div id="newsletter_wizard" title="'; $modalContent = html_print_div(
$output .= __('Do you want to be up to date?'); [
$output .= '" class="invisible">'; 'class' => 'register_update_manager',
$output .= '<div class="register_update_manager">'; 'content' => html_print_image(
$output .= html_print_image('images/pandora_circle_big.png', true); 'images/pandora_circle_big.png',
$output .= '</div>'; true
),
$output .= '<div class="newsletter_div">'; ],
$output .= __( true
'Subscribe to our newsletter',
$product_name
);
$output .= '</div>';
$output .= '<div class="license_text both">';
$output .= '<p>Stay up to date with updates, upgrades and promotions by subscribing to our newsletter.</p>';
$output .= '<p>';
$output .= __(
'By subscribing to the newsletter, you accept that your email will be transferred to a database owned by %s. These data will be used only to provide you with information about %s and will not be given to third parties. You can unsubscribe from this database at any time from the newsletter subscription options.',
$product_name,
$product_name
); );
$output .= '</p>'; $modalContent .= html_print_div(
[
'class' => 'newsletter_div',
'content' => __('Subscribe to our newsletter'),
],
true
);
$output .= '</div>'; $modalContent .= html_print_div(
// Show regiter to newsletter state. [
$show_newsletter = ($display_newsletter !== true) ? 'inline-block' : 'none'; 'class' => 'license_text both',
'content' => sprintf(
'<p>%s</p><p>%s</p>',
__('Stay up to date with updates, upgrades and promotions by subscribing to our newsletter.'),
__(
'By subscribing to the newsletter, you accept that your email will be transferred to a database owned by %s. These data will be used only to provide you with information about %s and will not be given to third parties. You can unsubscribe from this database at any time from the newsletter subscription options.',
$product_name,
$product_name
)
),
],
true
);
$output .= '<div class="mrgn_lft_4em">'; // Email Input case.
$output .= '<div id="box_newsletter">'; $emailInputCase = '<span id="label-email-newsletter">'.__('Email').' </span>'.html_print_input_text_extended(
$output .= '<span id="label-email-newsletter">'.__('Email').' </span>';
$output .= html_print_input_text_extended(
'email-newsletter', 'email-newsletter',
$email, $email,
'text-email-newsletter', 'text-email-newsletter',
@ -800,52 +804,110 @@ function newsletter_wiz_modal(
255, 255,
false, false,
'', '',
['style' => 'display:'.$show_newsletter.'; width: 200px;'], ['style' => 'display: inline-block; width: 200px;'],
true true
); );
$output .= '</div><br /><br />';
$output .= '<div class="submit_buttons_container">'; // Generate the submit buttons.
$output .= '<div class="left">'; // Cancel Button.
$output .= html_print_submit_button( $submitButtons = html_print_div(
__('Cancel'), [
'cancel_newsletter', 'class' => 'left',
false, 'content' => html_print_submit_button(
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel w100px"', __('Cancel'),
'cancel_newsletter',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel w100px"',
true
),
],
true true
); );
$output .= '</div>';
$output .= '<div class="right">';
$output .= html_print_submit_button(
__('OK!'),
'newsletter',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next w100px"',
true
);
$output .= '</div>';
$output .= '</div>';
$output .= '<div id="both"></div>'; // OK Button.
$output .= '<br/>'; $submitButtons .= html_print_div(
$output .= '</div>'; [
$output .= '</div>'; 'class' => 'right',
'content' => html_print_submit_button(
__('OK!'),
'newsletter',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next w100px"',
true
),
],
true
);
$submitButtonsCase = html_print_div(
[
'class' => 'submit_buttons_container',
'content' => $submitButtons,
],
true
);
$modalContent .= html_print_div(
[
'class' => 'mrgn_lft_4em',
'content' => html_print_div(
[
'id' => 'box_newsletter',
'content' => $emailInputCase.$submitButtonsCase.'<div id="both"></div><br />',
],
true
),
],
true
);
$output .= html_print_div(
[
'id' => 'newsletter_wizard',
'style' => 'display: none;',
'title' => __('Do you want to be up to date?'),
'content' => $modalContent,
],
true
);
// Verification modal. // Verification modal.
$output .= '<div id="news_ensure_cancel" title="Confirmation Required" class="invisible">'; $verificationContent = html_print_div(
$output .= '<div class="font_12_20">'; [
$output .= __('Are you sure you don\'t want to subscribe?'); 'class' => 'font_12_20',
$output .= '<p>'; 'content' => __('Are you sure you don\'t want to subscribe?').'<p>'.__('You will miss all news about amazing features and fixes!').'</p>',
$output .= __('You will miss all news about amazing features and fixes!'); ],
$output .= '</p>'; true
$output .= '</div>'; );
$output .= '</div>';
$output .= html_print_div(
[
'id' => 'news_ensure_cancel',
'style' => 'display: none;',
'title' => 'Confirmation Required',
'content' => $verificationContent,
],
true
);
// Results modal. // Results modal.
$output .= '<div id="news_result" title="Subscription process result" class="invisible">'; $resultsContent = html_print_div(
$output .= '<div id="news_result_content" class="font_12_20">'; [
$output .= '</div>'; 'id' => 'news_result_content',
$output .= '</div>'; 'class' => 'font_12_20',
],
true
);
$output .= html_print_div(
[
'id' => 'news_result',
'style' => 'display: none;',
'title' => 'Subscription process result',
'content' => $resultsContent,
],
true
);
ob_start(); ob_start();
?> ?>

View File

@ -235,9 +235,6 @@ function groups_combine_acl($acl_group_a, $acl_group_b)
} }
$acl_list = [ $acl_list = [
'incident_view' => 1,
'incident_edit' => 1,
'incident_management' => 1,
'agent_view' => 1, 'agent_view' => 1,
'agent_edit' => 1, 'agent_edit' => 1,
'agent_disable' => 1, 'agent_disable' => 1,

View File

@ -1151,7 +1151,9 @@ function dashboardLoadVC(settings) {
300 * 1000, 300 * 1000,
handleUpdate, handleUpdate,
beforeUpdate, beforeUpdate,
settings.size settings.size,
settings.id_user,
settings.hash
); );
} }

View File

@ -17,6 +17,9 @@
* @param {function | null} onUpdate Callback which will be execuded when the Visual Console. * @param {function | null} onUpdate Callback which will be execuded when the Visual Console.
* is updated. It will receive two arguments with the old and the new Visual Console's * is updated. It will receive two arguments with the old and the new Visual Console's
* data structure. * data structure.
* @param {string|null} id_user User id given for public access.
* @param {string|null} hash Authorization hash given for public access.
*
* @return {VisualConsole | null} The Visual Console instance or a null value. * @return {VisualConsole | null} The Visual Console instance or a null value.
*/ */
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
@ -28,7 +31,9 @@ function createVisualConsole(
updateInterval, updateInterval,
onUpdate, onUpdate,
beforeUpdate, beforeUpdate,
size size,
id_user,
hash
) { ) {
if (container == null || props == null || items == null) return null; if (container == null || props == null || items == null) return null;
if (baseUrl == null) baseUrl = ""; if (baseUrl == null) baseUrl = "";
@ -46,6 +51,8 @@ function createVisualConsole(
baseUrl, baseUrl,
visualConsoleId, visualConsoleId,
size, size,
id_user,
hash,
function(error, data) { function(error, data) {
if (error) { if (error) {
//Remove spinner change VC. //Remove spinner change VC.
@ -69,7 +76,7 @@ function createVisualConsole(
"[API]", "[API]",
error.message error.message
); );
done(); abortable.abort();
return; return;
} }
@ -651,6 +658,8 @@ function createVisualConsole(
* Fetch a Visual Console's structure and its items. * Fetch a Visual Console's structure and its items.
* @param {string} baseUrl Base URL to build the API path. * @param {string} baseUrl Base URL to build the API path.
* @param {number} vcId Identifier of the Visual Console. * @param {number} vcId Identifier of the Visual Console.
* @param {string|null} id_user User id given for public access.
* @param {string|null} hash Authorization hash given for public access.
* @param {function} callback Function to be executed on request success or fail. * @param {function} callback Function to be executed on request success or fail.
* On success, the function will receive an object with the next properties: * On success, the function will receive an object with the next properties:
* - `props`: object with the Visual Console's data structure. * - `props`: object with the Visual Console's data structure.
@ -658,7 +667,7 @@ function createVisualConsole(
* @return {Object} Cancellable. Object which include and .abort([statusText]) function. * @return {Object} Cancellable. Object which include and .abort([statusText]) function.
*/ */
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
function loadVisualConsoleData(baseUrl, vcId, size, callback) { function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
// var apiPath = baseUrl + "/include/rest-api"; // var apiPath = baseUrl + "/include/rest-api";
var apiPath = baseUrl + "/ajax.php"; var apiPath = baseUrl + "/ajax.php";
var vcJqXHR = null; var vcJqXHR = null;
@ -720,7 +729,9 @@ function loadVisualConsoleData(baseUrl, vcId, size, callback) {
{ {
page: "include/rest-api/index", page: "include/rest-api/index",
getVisualConsole: 1, getVisualConsole: 1,
visualConsoleId: vcId visualConsoleId: vcId,
id_user: typeof id_user == undefined ? id_user : null,
auth_hash: typeof hash == undefined ? hash : null
}, },
"json" "json"
) )
@ -735,7 +746,9 @@ function loadVisualConsoleData(baseUrl, vcId, size, callback) {
page: "include/rest-api/index", page: "include/rest-api/index",
getVisualConsoleItems: 1, getVisualConsoleItems: 1,
size: size, size: size,
visualConsoleId: vcId visualConsoleId: vcId,
id_user: typeof id_user == undefined ? id_user : null,
auth_hash: typeof hash == undefined ? hash : null
}, },
"json" "json"
) )

View File

@ -5,11 +5,12 @@ namespace PandoraFMS\Dashboard;
use PandoraFMS\View; use PandoraFMS\View;
use PandoraFMS\Dashboard\Cell; use PandoraFMS\Dashboard\Cell;
use PandoraFMS\PublicLogin;
/** /**
* Dashboard manager. * Dashboard manager.
*/ */
class Manager class Manager implements PublicLogin
{ {
/** /**

View File

@ -29,7 +29,7 @@
namespace PandoraFMS\Dashboard; namespace PandoraFMS\Dashboard;
// Load Visual Console. // Load Visual Console.
use Models\VisualConsole\Container as VisualConsole; use Models\VisualConsole\Container as VisualConsole;
use PandoraFMS\User;
/** /**
* Maps by users Widgets. * Maps by users Widgets.
*/ */
@ -498,6 +498,8 @@ class MapsMadeByUser extends Widget
'ratio' => $ratio_t, 'ratio' => $ratio_t,
'size' => $size, 'size' => $size,
'cellId' => $this->cellId, 'cellId' => $this->cellId,
'hash' => User::generatePublicHash(),
'id_user' => $config['id_user'],
] ]
); );

View File

@ -706,6 +706,13 @@ class Module extends Entity
$updates = $this->fields; $updates = $this->fields;
$updates['id_tipo_modulo'] = $this->moduleType()->id_tipo(); $updates['id_tipo_modulo'] = $this->moduleType()->id_tipo();
// In the case of the webserver modules, debug_content special characters must be handled.
if ($updates['id_tipo_modulo'] >= MODULE_TYPE_WEB_ANALYSIS
&& $updates['id_tipo_modulo'] <= MODULE_TYPE_WEB_CONTENT_STRING
) {
$updates['debug_content'] = io_safe_input($updates['debug_content']);
}
if ($this->fields['id_agente_modulo'] > 0) { if ($this->fields['id_agente_modulo'] > 0) {
// Update. // Update.
$rs = \db_process_sql_update( $rs = \db_process_sql_update(

View File

@ -0,0 +1,61 @@
<?php
/**
* Public access interface to provide access using hash and id_user.
*
* @category Interfaces
* @package Pandora FMS
* @subpackage Login
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
namespace PandoraFMS;
interface PublicLogin
{
/**
* Generates a hash to authenticate in public views.
*
* @param string|null $other_secret If you need to authenticate using a
* varable string, use this 'other_secret' to customize the hash.
*
* @return string Returns a hash with the authenticaction.
*/
public static function generatePublicHash(?string $other_secret=''):string;
/**
* Validates a hash to authenticate in public view.
*
* @param string $hash Hash to be checked.
* @param string $other_secret Any custom string needed for you.
*
* @return boolean Returns true if hash is valid.
*/
public static function validatePublicHash(
string $hash,
string $other_secret=''
):bool;
}

View File

@ -32,7 +32,7 @@ namespace PandoraFMS;
/** /**
* Object user. * Object user.
*/ */
class User class User implements PublicLogin
{ {
/** /**
@ -53,11 +53,11 @@ class User
/** /**
* Initializes a user object. * Initializes a user object.
* *
* @param array $data User information * @param array|null $data User information.
* - Username * - Username
* - PHP session ID. * - PHP session ID.
*/ */
public function __construct($data) public function __construct(?array $data)
{ {
global $config; global $config;
@ -88,17 +88,20 @@ class User
if (isset($data['id_usuario']) === true if (isset($data['id_usuario']) === true
&& isset($data['password']) === true && isset($data['password']) === true
) { ) {
$user_in_db = process_user_login($user, $password, true); $user_in_db = process_user_login(
$data['id_usuario'],
$data['password'],
true
);
if ($user_in_db !== false) { if ($user_in_db !== false) {
$config['id_usuario'] = $user_in_db; $config['id_usuario'] = $user_in_db;
$correctLogin = true;
// Originally at api.php. // Originally at api.php.
if (session_status() === PHP_SESSION_NONE) { if (session_status() === PHP_SESSION_NONE) {
session_start(); session_start();
} }
$_SESSION['id_usuario'] = $user; $_SESSION['id_usuario'] = $data['id_usuario'];
session_write_close(); session_write_close();
$this->idUser = $data['id_usuario']; $this->idUser = $data['id_usuario'];
@ -113,4 +116,81 @@ class User
} }
/**
* Generates a hash to authenticate in public views.
*
* @param string|null $other_secret If you need to authenticate using a
* varable string, use this 'other_secret' to customize the hash.
*
* @return string Returns a hash with the authenticaction.
*/
public static function generatePublicHash(?string $other_secret=''):string
{
global $config;
$str = $config['dbpass'];
$str .= $config['id_user'];
$str .= $other_secret;
return hash('sha256', $str);
}
/**
* Validates a hash to authenticate in public view.
*
* @param string $hash Hash to be checked.
* @param string $other_secret Any custom string needed for you.
*
* @return boolean Returns true if hash is valid.
*/
public static function validatePublicHash(
string $hash,
string $other_secret=''
):bool {
global $config;
if (isset($config['id_user']) === true) {
// Already logged in.
return true;
}
$userFromParams = false;
// Try to get id_user from parameters if it is missing.
if (isset($config['id_user']) === false) {
$userFromParams = true;
$config['id_user'] = get_parameter('id_user', false);
// It is impossible to authenticate without an id user.
if ($config['id_user'] === false) {
unset($config['id_user']);
return false;
}
} else {
$config['public_access'] = false;
}
// Build a hash to check.
$hashCheck = self::generatePublicHash($other_secret);
if ($hashCheck === $hash) {
// "Log" user in.
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
$_SESSION['id_usuario'] = $config['id_user'];
session_write_close();
$config['public_access'] = true;
$config['force_instant_logout'] = true;
return true;
}
// Remove id user from config array if authentication has failed.
if ($userFromParams === true) {
unset($config['id_user']);
}
return false;
}
} }

View File

@ -147,8 +147,8 @@ class WebSocketUser
/** /**
* Initializes a websocket user. * Initializes a websocket user.
* *
* @param string $id Id of the new user. * @param string $id Id of the new user.
* @param Socket $socket Socket where communication is stablished. * @param \Socket $socket Socket where communication is stablished.
*/ */
public function __construct($id, $socket) public function __construct($id, $socket)
{ {

View File

@ -1071,9 +1071,8 @@ class Item extends CachedModel
$mobile_navigation = false; $mobile_navigation = false;
if (isset($_SERVER['PHP_SELF']) === true if (strstr(($_SERVER['PHP_SELF'] ?? ''), 'mobile/') !== false
&& (strstr($_SERVER['PHP_SELF'], 'mobile/') !== false || strstr(($_SERVER['HTTP_REFERER'] ?? ''), 'mobile/') !== false
|| strstr($_SERVER['HTTP_REFERER'], 'mobile/') !== false)
) { ) {
$mobile_navigation = true; $mobile_navigation = true;
} }

View File

@ -26,6 +26,10 @@
justify-content: center; justify-content: center;
} }
#img-full-screen {
width: 12em;
}
#full_screen_refresh_box, #full_screen_refresh_box,
#slc-refresh-rate, #slc-refresh-rate,
#img-full-screen { #img-full-screen {
@ -45,6 +49,7 @@
.agent_alerts_header_pure { .agent_alerts_header_pure {
position: absolute; position: absolute;
z-index: 500;
} }
.agents_alerts_header form > ul > li { .agents_alerts_header form > ul > li {

View File

@ -2,6 +2,10 @@
display: inline-block; display: inline-block;
} }
#rules {
display: block;
}
li#li-buttons-alert-list > div { li#li-buttons-alert-list > div {
margin-left: 10px; margin-left: 10px;
} }
@ -132,11 +136,14 @@ div.target {
width: 100%; width: 100%;
} }
div.target.flex { div.target.flex {
display: block;
border: 2px dashed #ddd; border: 2px dashed #ddd;
margin-left: 0em; margin-left: 0em;
margin-top: 10px; margin-top: 10px;
padding: 1em; padding: 1em;
display: flex;
flex-direction: row;
flex-wrap: wrap;
height: fit-content;
} }
.fields, .fields,
@ -190,6 +197,8 @@ div#rules.show {
font-weight: 600; font-weight: 600;
background-color: #333; background-color: #333;
word-break: break-all; word-break: break-all;
height: fit-content;
min-height: 2.3em;
} }
.field.opacityElements { .field.opacityElements {
@ -215,6 +224,11 @@ div#rules.show {
background-color: #82b92e; background-color: #82b92e;
} }
.variable:empty::before {
content: "empty";
font-style: italic;
}
.modifier { .modifier {
background-color: #cba9d2; background-color: #cba9d2;
} }

View File

@ -1,5 +1,5 @@
div#page { div#page {
width: 90% !important; width: auto;
margin: 0 auto; margin: 0 auto;
} }
@ -22,3 +22,11 @@ div#page {
right: 50px; right: 50px;
top: 20px; top: 20px;
} }
.select-dashboard-width {
width: 110%;
}
#menu_tab li.nomn form#form-select-dashboard {
margin-top: 0px !important;
}

View File

@ -2163,6 +2163,11 @@ div.loading {
div.loading img { div.loading img {
float: right; float: right;
} }
textarea.resizev {
resize: vertical;
}
/* Tablesorter jQuery pager */ /* Tablesorter jQuery pager */
div.pager { div.pager {
margin-left: 10px; margin-left: 10px;
@ -4877,7 +4882,8 @@ input:checked + .p-slider:before {
.user_edit_first_row, .user_edit_first_row,
.user_edit_second_row, .user_edit_second_row,
.user_edit_third_row { .user_edit_third_row,
.user_edit_fourth_row {
margin-bottom: 20px; margin-bottom: 20px;
} }
@ -8505,3 +8511,12 @@ div.stat-win-spinner img {
width: 100px !important; width: 100px !important;
margin-left: 20px; margin-left: 20px;
} }
.btn_update_online_open {
float: right;
margin-bottom: 20px;
}
.align-left-important {
text-align: left !important;
}

View File

@ -1019,3 +1019,11 @@ li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab {
margin: 20px auto; margin: 20px auto;
border-radius: 3px; border-radius: 3px;
} }
table.alternate tr:nth-child(2n + 1) td {
background-color: #222;
}
table.alternate tr:nth-child(2n) td {
background-color: #111;
}

View File

@ -1277,6 +1277,7 @@ if ($config['pure'] == 0) {
// Container div. // Container div.
echo '</div>'; echo '</div>';
echo '<div id="both"></div>'; echo '<div id="both"></div>';
echo '</div>';
echo '<div id="foot">'; echo '<div id="foot">';
include 'general/footer.php'; include 'general/footer.php';

View File

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

View File

@ -188,12 +188,25 @@ if ($idAgent != 0) {
$print_agent = true; $print_agent = true;
if (!is_metaconsole()) { if (is_metaconsole() === false) {
ui_print_page_header( // Header.
ui_print_standard_header(
__('Alert detail'), __('Alert detail'),
'images/op_alerts.png', 'images/op_alerts.png',
false, false,
'' '',
false,
[],
[
[
'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('Views'),
],
]
); );
} else { } else {
ui_meta_print_header(__('Alerts view')); ui_meta_print_header(__('Alerts view'));

Some files were not shown because too many files have changed in this diff Show More