Merge remote-tracking branch 'origin/develop' into ent-3013-ipam-modo-configuracion-de-vlan

Former-commit-id: f89cf021526d5e7f9fcaad080d0f8721c20c82cb
This commit is contained in:
daniel 2019-01-21 09:22:42 +01:00
commit dc24599f18
29 changed files with 378 additions and 144 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.730-190117
Version: 7.0NG.730-190121
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.730"
PI_BUILD="190117"
PI_BUILD="190121"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{190117}
{190121}
ViewReadme
{Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.730-190117
Version: 7.0NG.730-190121
Architecture: all
Priority: optional
Section: admin

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC190117';
$build_version = 'PC190121';
$pandora_version = 'v7.0NG.730';
// Do not overwrite default timezone set if defined.

View File

@ -11934,6 +11934,231 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
return false;
}
function api_get_user_info($thrash1, $thrash2, $other, $returnType) {
$separator = ';';
$other = json_decode(base64_decode($other['data']),true);
$sql = 'select * from tusuario where id_user = "'.$other[0]['id_user'].'" and password = "'.$other[0]['password'].'"';
$user_info = db_get_all_rows_sql($sql);
if (count($user_info) > 0 and $user_info !== false) {
$data = array('type' => 'array', 'data' => $user_info);
returnData($returnType, $data, $separator);
}
else {
return 0;
}
}
/*
This function receives different parameters to process one of these actions the logging process in our application from the records in the audit of pandora fms, to avoid concurrent access of administrator users, and optionally to prohibit access to non-administrator users:
Parameter 0
The User ID that attempts the action is used to check the status of the application for access.
Parameter 1
Login, logout, exclude, browse.
These requests receive a response that we can treat as we consider, this function only sends answers, does not perform any action in your application, you must customize them.
Login action: free (register our access), taken, denied (if you are not an administrator user and parameter four is set to 1, register the expulsion).
Browse action: It has the same answers as login, but does not register anything in the audit.
Logout action: It records the deslogeo but does not send a response.
All other actions do not return a response,
Parameter 2
IP address of the application is also used to check the status of the application for access.
Parameter 3
Name of the application, it is also used to check the status of the application for access.
Parameter 4
If you mark 1 you will avoid the access to the non-administrators users, returning the response `denied' and registering that expulsion in the audit of pandora fms.
*/
function api_set_access_process($thrash1, $thrash2, $other, $returnType) {
if (defined ('METACONSOLE')) {
return;
}
$other['data'] = explode('|',$other['data']);
$sql = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario != "'.$other['data'][0].'" order by utimestamp DESC limit 1';
$audit_concurrence = db_get_all_rows_sql($sql);
$sql_user = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario = "'.$other['data'][0].'" order by utimestamp DESC limit 1';
$audit_concurrence_user = db_get_all_rows_sql($sql_user);
$sql2 = 'select id_usuario,utimestamp,accion from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logoff%" and id_usuario = "'.$audit_concurrence[0]['id_usuario'].'" order by utimestamp DESC limit 1';
$audit_concurrence_2 = db_get_all_rows_sql($sql2);
//The user trying to log in is an administrator
if(users_is_admin($other['data'][0])){
//The admin user is trying to login
if($other['data'][1] == 'login'){
// Check if there is an administrator user logged in prior to our last login
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
// Check if the administrator user logged in later to us has unlogged and left the node free
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
// The administrator user logged in later has not yet unlogged
returnData('string', array('type' => 'string', 'data' => 'taken'));
}
else{
// The administrator user logged in later has already unlogged
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
else{
// There is no administrator user who has logged in since then to log us in.
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
elseif ($other['data'][1] == 'logout') {
// The administrator user wants to log out
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
}
elseif ($other['data'][1] == 'exclude') {
// The administrator user has ejected another administrator user who was logged in
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2] , $audit_concurrence[0]['id_usuario']);
}
//The admin user is trying to browse
elseif ($other['data'][1] == 'browse') {
// Check if there is an administrator user logged in prior to our last login
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
// Check if the administrator user logged in later to us has unlogged and left the node free
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
// The administrator user logged in later has not yet unlogged
returnData('string', array('type' => 'string', 'data' => $audit_concurrence[0]['id_usuario']));
}
else{
// The administrator user logged in later has already unlogged
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
else{
// There is no administrator user who has logged in since then to log us in.
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
elseif ($other['data'][1] == 'cancelled'){
//The administrator user tries to log in having another administrator logged in, but instead of expelling him he cancels his log in.
db_pandora_audit($other['data'][3].' cancelled access', 'Cancelled access in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'cancelled'));
}
}
else{
if($other['data'][4] == 1){
//The user trying to log in is not an administrator and is not allowed no admin access
db_pandora_audit($other['data'][3].' denied access', 'Denied access to non-admin user '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'denied'));
}
else{
//The user trying to log in is not an administrator and is allowed no admin access
if($other['data'][1] == 'login'){
//The user trying to login is not admin, can enter without concurrent use filter
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'free'));
}
elseif ($other['data'][1] == 'logout') {
//The user trying to logoff is not admin
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
}
elseif ($other['data'][1] == 'browse'){
//The user trying to browse in an app page is not admin, can enter without concurrent use filter
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
}
}
function api_get_traps($thrash1, $thrash2, $other, $returnType) {
if (defined ('METACONSOLE')) {
return;
}
$other['data'] = explode('|',$other['data']);
$other['data'][1] = date("Y-m-d H:i:s",$other['data'][1]);
$sql = 'SELECT * from ttrap where timestamp >= "'.$other['data'][1].'"';
// $sql = 'SELECT * from ttrap where source = "'.$other['data'][0].'" and timestamp >= "'.$other['data'][1].'"';
if($other['data'][4]){
$other['data'][4] = date("Y-m-d H:i:s",$other['data'][4]);
$sql .= ' and timestamp <= "'.$other['data'][4].'"';
}
if($other['data'][2]){
$sql .= ' limit '.$other['data'][2];
}
if($other['data'][3]){
$sql .= ' offset '.$other['data'][3];
}
if($other['data'][5]){
$sql .= ' and status = 0';
}
if(sizeof($other['data']) == 0){
$sql = 'SELECT * from ttrap';
}
$traps = db_get_all_rows_sql($sql);
if($other['data'][6]){
foreach ($traps as $key => $value) {
if(!strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'false'){
unset($traps[$key]);
}
if(strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'true'){
unset($traps[$key]);
}
}
}
$traps_json = json_encode($traps);
if (count($traps) > 0 and $traps !== false) {
returnData('string', array('type' => 'string', 'data' => $traps_json));
}
else {
return 0;
}
}
function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
@ -11959,7 +12184,7 @@ function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
}
}
function api_set_delete_traps ($id, $thrash2, $other, $thrash3) {
function api_set_delete_traps ($id, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
@ -11983,7 +12208,9 @@ function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
}
}
function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3) {
function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
@ -12001,9 +12228,9 @@ function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
else {
returnError('error_group_name', 'No groups retrieved.');
}
}
}
function api_get_timezone($thrash1, $thrash2, $other, $thrash3) {
function api_get_timezone($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
@ -12023,9 +12250,9 @@ function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
else {
returnError('error_timezone', 'No timezone retrieved.');
}
}
}
function api_get_language($thrash1, $thrash2, $other, $thrash3) {
function api_get_language($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
@ -12045,9 +12272,9 @@ function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
else {
returnError('error_language', 'No language retrieved.');
}
}
}
function api_get_session_timeout($thrash1, $thrash2, $other, $thrash3) {
function api_get_session_timeout($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
@ -12067,9 +12294,6 @@ function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
else {
returnError('error_session_timeout', 'No session timeout retrieved.');
}
}
}
?>

View File

@ -375,8 +375,8 @@ function __ ($string /*, variable arguments */) {
global $config;
static $extensions_cache = array();
if( !isset($config["id_user"]) && count($extensions_cache) > 0 ) {
if (array_key_exists($config["id_user"], $extensions_cache)) {
if( isset($config["id_user"]) ) {
if ( count($extensions_cache) > 0 && array_key_exists($config["id_user"], $extensions_cache)) {
$extensions = $extensions_cache[$config["id_user"]];
}
else {
@ -385,8 +385,9 @@ function __ ($string /*, variable arguments */) {
}
}
else{
$extension =null;
$extensions=null;
}
if (empty($extensions))
$extensions = array();

View File

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

View File

@ -297,7 +297,7 @@ class Events {
$id_event = $system->getRequest('id_event', 0);
if (events_change_status($id_event, EVENT_VALIDATE)) {
if (events_change_status($id_event, EVENT_VALIDATE,$system->getConfig('metaconsole'))) {
echo json_encode(array('correct' => 1));
}
else {
@ -379,11 +379,20 @@ class Events {
$this->default_filters['severity'] = false;
}
$this->filter = $system->getRequest('filter', __('Preset Filters'));
if (($this->filter === __("Preset Filters")) || ($this->filter == 0)) {
$this->filter = 0;
if ($system->getRequest('filter', __('Preset Filters')) === __("Preset Filters")) {
//Set filter as default user event filter (only first time)
$this->filter = db_get_value('default_event_filter', 'tusuario', 'id_user', $system->getConfig('id_user'));
//Use user set default filter if admin set default filter is "none"
if ($this->filter == 0){
$this->filter = db_get_value('id_filter', 'tusuario', 'id_user', $system->getConfig('id_user'));
}
}
else {
$this->filter = $system->getRequest('filter', __('Preset Filters'));
}
if ($this->filter != 0) {
$this->default = false;
}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.730-190117
Version: 7.0NG.730-190121
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -396,7 +396,7 @@ sub process_xml_data ($$$$$) {
# If it exists add the value to the agent
if (defined ($custom_field_info)) {
my $cf_value = get_tag_value ($custom_field, 'value', '');
my $cf_value = safe_input(get_tag_value ($custom_field, 'value', ''));
my $field_agent;
@ -482,7 +482,7 @@ sub process_xml_data ($$$$$) {
my $custom_field_data = get_db_single_row($dbh, 'SELECT * FROM tagent_custom_data WHERE id_field = ? AND id_agent = ?',
$custom_field_info->{"id_field"}, $agent->{"id_agente"});
my $cf_value = get_tag_value ($custom_field, 'value', '');
my $cf_value = safe_input(get_tag_value ($custom_field, 'value', ''));
#If not defined we must create if defined just updated
if(!defined($custom_field_data)) {
@ -497,7 +497,7 @@ sub process_xml_data ($$$$$) {
} else {
db_update ($dbh, "UPDATE tagent_custom_data SET description = ? WHERE id_field = ? AND id_agent = ?",
$cf_value ,$custom_field_info->{"id_field"}, $agent->{'id_agente'});
$cf_value, $custom_field_info->{"id_field"}, $agent->{'id_agente'});
}
}
else {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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