Merge remote-tracking branch 'origin/develop' into fix/reverse-proxy

This commit is contained in:
fbsanchez 2018-11-23 14:35:32 +01:00
commit 507aaf1202
39 changed files with 352 additions and 261 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.729-181119
Version: 7.0NG.729-181121
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.729-181119"
pandora_version="7.0NG.729-181121"
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.729';
use constant AGENT_BUILD => '181119';
use constant AGENT_BUILD => '181121';
# 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.729
%define release 181119
%define release 181121
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.729"
PI_BUILD="181119"
PI_BUILD="181121"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{181119}
{181121}
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.729(Build 181119)")
#define PANDORA_VERSION ("7.0NG.729(Build 181121)")
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.729(Build 181119))"
VALUE "ProductVersion", "(7.0NG.729(Build 181121))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.729-181119
Version: 7.0NG.729-181121
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.729-181119"
pandora_version="7.0NG.729-181121"
package_pear=0
package_pandora=1

View File

@ -1,5 +1,7 @@
START TRANSACTION;
ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0';

View File

@ -1159,8 +1159,8 @@ ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "
-- Table `talert_commands`
-- ---------------------------------------------------------------------
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria IMS API path\",\"Integria IMS API pass\",\"Integria IMS user\",\"Integria IMS user pass\",\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Email copy\",\"Ticket owner\",\"Ticket description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria IMS Ticket';
UPDATE `talert_commands` SET `description` = 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:
_field1_ as destination email address, and
_field2_ as subject for message. 
_field3_ as text of message. 
_field4_ as content type (text/plain or html/text).', `fields_descriptions` = '[\"Destination address\",\"Subject\",\"Text\",\"Content Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1;
ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;

View File

@ -57,7 +57,7 @@ else {
$sec = 'galertas';
}
if ((!$copy_action) && (!$delete_action) && (!$update_action)) {
if ((!$copy_action) && (!$delete_action)) {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
@ -141,135 +141,8 @@ if ($copy_action) {
__('Could not be copied'));
}
if ($create_action) {
$name = (string) get_parameter ('name');
$id_alert_command = (int) get_parameter ('id_command');
$fields_descriptions = array();
$fields_values = array();
$info_fields = '';
$values = array();
for($i=1;$i<=$config['max_macro_fields'];$i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field'.$i.': ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
$info_fields .= ' Field'.$i.'Recovery: ' . $values['field'.$i.'_recovery'];
}
$values['id_group'] = (string) get_parameter ('group');
$values['action_threshold'] = (int) get_parameter ('action_threshold');
$name_check = db_get_value ('name', 'talert_actions', 'name', $name);
if ($name_check) {
$result = '';
}
else {
$result = alerts_create_alert_action ($name, $id_alert_command,
$values);
$info = '{"Name":"'.$name.'", "ID alert Command":"'.$id_alert_command.'", "Field information":"'.$info_fields.'", "Group":"'.$values['id_group'].'",
"Action threshold":"'.$values['action_threshold'].'"}';
}
if ($result) {
db_pandora_audit("Command management", "Create alert action #" . $result, false, false, $info);
}
else {
db_pandora_audit("Command management", "Fail try to create alert action", false, false);
}
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($name == "") {
$messageAction = __('No name specified');
}
if ($id_alert_command == "") {
$messageAction = __('No command specified');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
$messageAction);
}
if ($update_action) {
$id = (string) get_parameter ('id');
$al_action = alerts_get_alert_action ($id);
if ($al_action !== false) {
if ($al_action['id_group'] == 0) {
if (! check_acl ($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
}
else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
}
else {
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/gm_alerts.png", false, "alerts_config", true);
}
}
}
}
else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
}
else {
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/gm_alerts.png", false, "alerts_config", true);
}
}
$name = (string) get_parameter ('name');
$id_alert_command = (int) get_parameter ('id_command');
$group = get_parameter ('group');
$action_threshold = (int) get_parameter ('action_threshold');
$info_fields = '';
$values = array();
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field1: ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
$info_fields .= ' Field'.$i.'Recovery: ' . $values['field'.$i.'_recovery'];
}
$values['name'] = $name;
$values['id_alert_command'] = $id_alert_command;
$values['id_group'] = $group;
$values['action_threshold'] = $action_threshold;
if (!$name) {
$result = '';
}
else {
$result = alerts_update_alert_action ($id, $values);
}
if ($result) {
db_pandora_audit("Command management", "Update alert action #" . $id, false, false, json_encode($values));
}
else {
db_pandora_audit("Command management", "Fail try to update alert action #" . $id, false, false, json_encode($values));
}
ui_print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
if ($update_action || $create_action) {
alerts_ui_update_or_create_actions($update_action);
}
if ($delete_action) {
@ -363,9 +236,13 @@ $table->align[3] = 'left';
$filter = array();
if (!is_user_admin($config['id_user']))
$filter['id_group'] = array_keys(users_get_groups(false, "LM"));
$filter['talert_actions.id_group'] = array_keys(users_get_groups(false, "LM"));
$actions = db_get_all_rows_filter ('talert_actions', $filter);
$actions = db_get_all_rows_filter (
'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id',
$filter,
'talert_actions.* , talert_commands.id_group AS command_group'
);
if ($actions === false)
$actions = array ();
@ -384,6 +261,14 @@ foreach ($actions as $action) {
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.
$action['name'].'</a>';
$data[1] = ui_print_group_icon ($action["id_group"], true) .'&nbsp;';
if (!alerts_validate_command_to_action($action["id_group"], $action["command_group"])) {
$data[1].= html_print_image(
"images/error.png",
true,
// FIXME: Translation.
array("title" => __("The action and the command associated with it do not have the same group. Please contact an administrator to fix it.")
));
}
if (check_acl($config['id_user'], $action["id_group"], "LM")) {
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'"

View File

@ -38,6 +38,7 @@ $pure = (int)get_parameter('pure', 0);
$update_command = (bool) get_parameter ('update_command');
$create_command = (bool) get_parameter ('create_command');
$delete_command = (bool) get_parameter ('delete_command');
$copy_command = (bool) get_parameter ('copy_command');
if (is_ajax ()) {
$get_alert_command = (bool) get_parameter ('get_alert_command');
@ -57,36 +58,12 @@ if (is_ajax ()) {
if (isset($command['description'])) {
$command['description'] = io_safe_input(str_replace("\r\n","<br>", io_safe_output($command['description'])));
}
// Get the html rows of the fields form
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
// Descriptions are stored in json
$fields_descriptions = empty($command['fields_descriptions']) ?
'' : json_decode(io_safe_output($command['fields_descriptions']), true);
// Fields values are stored in json
$fields_values = empty($command['fields_values']) ?
'' : io_safe_output(json_decode($command['fields_values'], true));
break;
case "oracle":
// Descriptions are stored in json
$description_field = str_replace("\\\"","\"",$command['fields_descriptions']);
$description_field = str_replace("\\","",$description_field);
$fields_descriptions = empty($command['fields_descriptions']) ?
'' : json_decode(io_safe_output($description_field), true);
// Fields values are stored in json
$values_fields = str_replace("\\\"","\"",$command['fields_values']);
$values_fields = str_replace("\\","",$values_fields);
$fields_values = empty($command['fields_values']) ?
'' : io_safe_output(json_decode($values_fields, true));
break;
}
$fields_rows = array();
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -266,13 +243,11 @@ if (defined('METACONSOLE'))
else
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert commands'), "images/gm_alerts.png", false, "alerts_config", true);
if ($create_command) {
$name = (string) get_parameter ('name');
$command = (string) get_parameter ('command');
$description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group', 0);
$fields_descriptions = array();
$fields_values = array();
@ -287,6 +262,7 @@ if ($create_command) {
$values['fields_values'] = io_json_mb_encode($fields_values);
$values['fields_descriptions'] = io_json_mb_encode($fields_descriptions);
$values['description'] = $description;
$values['id_group'] = $id_group;
$name_check = db_get_value ('name', 'talert_commands', 'name', $name);
@ -349,8 +325,27 @@ if ($delete_command) {
ui_print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
}
if ($copy_command) {
$id = (int) get_parameter ('id');
// Get the info from the source command
$command_to_copy = db_get_row('talert_commands', 'id', $id);
if ($command_to_copy === false) {
ui_print_error_message(__("Command with id $id does not found."));
} else {
// Prepare to insert the copy with same values
unset ($command_to_copy['id']);
$command_to_copy['name'].= __(' (copy)');
$result = db_process_sql_insert('talert_commands', $command_to_copy);
// Print the result
ui_print_result_message ($result,
__('Successfully copied'),
__('Could not be copied')
);
}
}
$table->width = '100%';
@ -358,45 +353,54 @@ $table->class = 'databox data';
$table->data = array ();
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('ID');
$table->head[2] = __('Description');
$table->head[3] = __('Delete');
$table->head['name'] = __('Name');
$table->head['id'] = __('ID');
$table->head['group'] = __('Group');
$table->head['description'] = __('Description');
$table->head['action'] = __('Actions');
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->style['name'] = 'font-weight: bold';
$table->size = array ();
$table->size[3] = '40px';
$table->size['action'] = '40px';
$table->align = array ();
$table->align[3] = 'left';
$table->align['action'] = 'left';
$commands = db_get_all_rows_in_table ('talert_commands');
if ($commands === false)
$commands = array ();
$commands = db_get_all_rows_filter(
'talert_commands',
array('id_group' => array_keys(users_get_groups(false, "LM")))
);
if ($commands === false) $commands = array ();
foreach ($commands as $command) {
$data = array ();
$data[0] = '<span style="font-size: 7.5pt">';
$data['name'] = '<span style="font-size: 7.5pt">';
if (! $command['internal'])
$data[0] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&id='.$command['id'].'&pure='.$pure.'">'.
$data['name'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&id='.$command['id'].'&pure='.$pure.'">'.
$command['name'].'</a>';
else
$data[0] .= $command['name'];
$data[0] .= '</span>';
$data[1] = $command['id'];
$data[2] = str_replace("\r\n","<br>",
$data['name'] .= $command['name'];
$data['name'] .= '</span>';
$data['id'] = $command['id'];
$data['group'] = ui_print_group_icon ($command["id_group"], true);
$data['description'] = str_replace("\r\n","<br>",
io_safe_output($command['description']));
$data[3] = '';
$data['action'] = '';
if (! $command['internal']) {
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
$data['action'] = '<span style="display: inline-flex">';
$data['action'].= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/copy.png", true) . '</a>';
$data['action'].= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/cross.png", true) . '</a>';
$data['action'].= '</span>';
}
array_push ($table->data, $data);
}
if (isset($data)) {
if (count($table->data) > 0) {
html_print_table ($table);
}
else {

View File

@ -122,7 +122,6 @@ $table->colspan[0][1] = 2;
$table->data[1][0] = __('Group');
$groups = users_get_groups ();
$own_info = get_user_info ($config['id_user']);
// Only display group "All" if user is administrator or has "PM" privileges
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
@ -133,9 +132,17 @@ $table->data[1][1] = html_print_select_groups(false, "LW", $display_all_group, '
$table->colspan[1][1] = 2;
$table->data[2][0] = __('Command');
$table->data[2][1] = html_print_select_from_sql ('SELECT id, name
FROM talert_commands',
'id_command', $id_command, '', __('None'), 0, true);
$commands_sql = db_get_all_rows_filter(
'talert_commands',
array('id_group' => array_keys(users_get_groups(false, "LW"))),
array('id', 'name'),
'AND',
false,
true
);
$table->data[2][1] = html_print_select_from_sql ($commands_sql, 'id_command', $id_command,
'', __('None'), 0, true
);
$table->data[2][1] .= ' ';
if (check_acl ($config['id_user'], 0, "PM")) {
$table->data[2][1] .= html_print_image ('images/add.png', true);
@ -282,6 +289,19 @@ $(document).ready (function () {
var max_fields = parseInt('<?php echo $config["max_macro_fields"]; ?>');
// Change the selected group
$("#group option").each(function(index, value) {
var current_group = $(value).val();
if (data.id_group != 0 && current_group != 0 && current_group != data.id_group) {
$(value).hide();
} else {
$(value).show();
}
});
if (data.id_group != 0 && $("#group").val() != data.id_group) {
$("#group").val(0);
}
for (i = 1; i <= max_fields; i++) {
var old_value = '';
var old_recovery_value = '';

View File

@ -54,6 +54,7 @@ if ($update_command) {
$name = (string) get_parameter ('name');
$command = (string) get_parameter ('command');
$description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group', 0);
$fields_descriptions = array();
$fields_values = array();
@ -71,6 +72,7 @@ if ($update_command) {
$values['name'] = $name;
$values['command'] = $command;
$values['description'] = $description;
$values['id_group'] = $id_group;
//Check it the new name is used in the other command.
$id_check = db_get_value ('id', 'talert_commands', 'name', $name);
@ -100,12 +102,13 @@ $command = '';
$description = '';
$fields_descriptions = '';
$fields_values = '';
$id_group = 0;
if ($id) {
$alert = alerts_get_alert_command ($id);
$name = $alert['name'];
$command = $alert['command'];
$description = $alert['description'];
$id_group = $alert['id_group'];
$fields_descriptions = $alert['fields_descriptions'];
$fields_values = $alert['fields_values'];
}
@ -123,13 +126,7 @@ $table->width = '100%';
$table->class = 'databox filters';
if (defined('METACONSOLE')) {
if ($id) {
$table->head[0] = __('Update Command');
}
else {
$table->head[0] = __('Create Command');
}
$table->head[0] = ($id) ? __('Update Command') : __('Create Command');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
@ -142,18 +139,25 @@ $table->size = array ();
$table->size[0] = '20%';
$table->data = array ();
$table->colspan[0][1] = 3;
$table->data[0][0] = __('Name');
$table->data[0][2] = html_print_input_text ('name', $name, '', 35, 255, true);
$table->colspan['name'][1] = 3;
$table->data['name'][0] = __('Name');
$table->data['name'][2] = html_print_input_text ('name', $name, '', 35, 255, true);
$table->colspan[1][1] = 3;
$table->data[1][0] = __('Command');
$table->data[1][0] .= ui_print_help_icon ('alert_macros', true);
$table->data[1][1] = html_print_textarea ('command', 8, 30, $command, '', true);
$table->colspan['command'][1] = 3;
$table->data['command'][0] = __('Command');
$table->data['command'][0] .= ui_print_help_icon ('alert_macros', true);
$table->data['command'][1] = html_print_textarea ('command', 8, 30, $command, '', true);
$table->colspan['group'][1] = 3;
$table->data['group'][0] = __('Group');
$table->data['group'][1] = html_print_select_groups(false, "LM",
true, 'id_group', $id_group, false,
'', 0, true);
$table->colspan['description'][1] = 3;
$table->data['description'][0] = __('Description');
$table->data['description'][1] = html_print_textarea ('description', 10, 30, $description, '', true);
$table->colspan[2][1] = 3;
$table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea ('description', 10, 30, $description, '', true);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

View File

@ -155,16 +155,67 @@ if($build_table_custom_fields){
$count = db_get_sql($query_count);
//for link nodes.
$array_nodes = metaconsole_get_connections();
if(isset($array_nodes) && is_array($array_nodes)){
$hash_array_nodes = array();
foreach ($array_nodes as $key => $server) {
$pwd = $server['auth_token'];
$auth_serialized = json_decode($pwd,true);
if (is_array($auth_serialized)) {
$pwd = $auth_serialized['auth_token'];
$api_password = $auth_serialized['api_password'];
$console_user = $auth_serialized['console_user'];
$console_password = $auth_serialized['console_password'];
}
$user = $config['id_user'];
$user_rot13 = str_rot13($config['id_user']);
$hashdata = $user.$pwd;
$hashdata = md5($hashdata);
$url_hash = '&amp;' .
'loginhash=auto&amp;' .
'loginhash_data=' . $hashdata . '&amp;' .
'loginhash_user=' . $user_rot13;
$hash_array_nodes[$server['id']]['hashurl'] = $url_hash;
$hash_array_nodes[$server['id']]['server_url'] = $server['server_url'];
}
}
//prepare rows for table dinamic
$data = array();
foreach ($result as $values) {
$image_status = agents_get_image_status($values['status']);
//link nodes
$agent_link = '<a href="'.
$hash_array_nodes[$values['id_tmetaconsole_setup']]['server_url'] . '/' .
'index.php?' .
'sec=estado&amp;' .
'sec2=operation/agentes/ver_agente&amp;' .
'id_agente='. $values['id_tagente'] .
$hash_array_nodes[$values['id_tmetaconsole_setup']]['hashurl'] . '">'
;
$agent_alias = ui_print_truncate_text($values['alias'],
'agent_small', false, true, false, '[&hellip;]',
'font-size:7.5pt;'
);
if (can_user_access_node ()) {
$agent = $agent_link . '<b>' . $agent_alias . '</b></a>';
}
else {
$agent = $agent_alias;
}
$data[] = array(
"ref" => $referencia,
"data_custom_field" => $values['name_custom_fields'],
"server" => $values['server_name'],
"agent" => $values['alias'],
"agent" => $agent,
"IP" => $values['direccion'],
"status" => "<div id='reload_status_agent_" . $values['id_tmetaconsole_setup'] . "_" . $values['id_tagente'] ."'>" . $image_status . "</div>",
"id_agent" => $values['id_tagente'],

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC181119';
$build_version = 'PC181121';
$pandora_version = 'v7.0NG.729';
// Do not overwrite default timezone set if defined.
@ -171,19 +171,21 @@ require_once ($ownDir. 'functions_config.php');
date_default_timezone_set("Europe/Madrid");
//////////////////////////////////////
//// PLEASE DO NOT CHANGE ORDER //////
//////////////////////////////////////
require_once ($config["homedir"].'/include/load_session.php');
if (session_id() == '') session_start();
config_process_config();
config_prepare_session();
require_once ($config["homedir"].'/include/load_session.php');
if(session_id() == '') {
$resultado = session_start();
}
// Set a the system timezone default
if ((!isset($config["timezone"])) OR ($config["timezone"] == "")) {
$config["timezone"] = "Europe/Berlin";
}
////////////////////////////////////////
date_default_timezone_set($config["timezone"]);

View File

@ -922,7 +922,7 @@ function agents_get_group_agents (
}
if (isset($search['id_os'])) {
$filter[] = "id_os = ". $search['id_os'];
$filter['id_os'] = $search['id_os'];
}
if (isset($search['status'])) {

View File

@ -2268,5 +2268,121 @@ function alerts_normalize_actions_escalation($escalation) {
return $escalation;
}
/**
* Check if a command can be added to an action.
*
* @param int Action group id
* @param int Command group id
*
* @return False if command group and alert group are distint of 0 and they are not equal
*/
function alerts_validate_command_to_action($action_group, $command_group) {
// If action group or command group is All, all commands can be applicated.
if ($action_group == 0 || $command_group == 0) return true;
return $action_group == $command_group;
}
/**
* Print the UI update actions
*
* @param bool Update or create
*/
function alerts_ui_update_or_create_actions($update = true) {
global $config;
$id = (string) get_parameter ('id');
// Check ACL of existing aler action
if($update) {
$al_action = alerts_get_alert_action ($id);
if ($al_action !== false) {
if ($al_action['id_group'] == 0) {
if (! check_acl ($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
}
}
}
}
$name = (string) get_parameter ('name');
$id_alert_command = (int) get_parameter ('id_command');
$group = get_parameter ('group');
$action_threshold = (int) get_parameter ('action_threshold');
// Validate some values
if (!$id_alert_command) {
ui_print_error_message(__('No command specified'));
return;
}
if (!$name) {
ui_print_error_message(__('No name specified'));
return;
}
$comamnd_group = db_get_value('id_group', 'talert_commands', 'id', $id_alert_command);
if(!alerts_validate_command_to_action($group, $comamnd_group)) {
ui_print_error_message(__("Alert and command group does not match"));
return;
}
// Fill fields info
$info_fields = '';
$values = array();
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field'.$i.': ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
$info_fields .= ' Field'.$i.'Recovery: ' . $values['field'.$i.'_recovery'];
}
$values['id_group'] = $group;
$values['action_threshold'] = $action_threshold;
if ($update) {
$values['name'] = $name;
$values['id_alert_command'] = $id_alert_command;
$result = (!$name) ? '' : alerts_update_alert_action ($id, $values);
} else {
$name_check = db_get_value ('name', 'talert_actions', 'name', $name);
if ($name_check) {
$result = '';
}
else {
$result = alerts_create_alert_action ($name, $id_alert_command,
$values);
$values = array(
"Name" => $name,
"ID alert Command" => $id_alert_command,
"Field information" => $info_fields,
"Group" => $values['id_group'],
"Action threshold" => $values['action_threshold']
);
}
}
if ($result) {
db_pandora_audit(
"Command management",
$update ? "Update alert action #" . $id : "Create alert action #" . $result,
false,
false,
json_encode($values)
);
}
else {
db_pandora_audit(
"Command management",
$update ? "Fail try to update alert action #" . $id : "Fail try to create alert action",
false,
false,
$update ? json_encode($values) : ''
);
}
ui_print_result_message ($result,
$update ? __('Successfully updated') : __('Successfully created'),
$update ? __('Could not be updated') : __('Could not be created')
);
}
?>

View File

@ -2023,6 +2023,12 @@ function config_process_config () {
config_update_value('ehorus_req_timeout', 5);
}
if (is_metaconsole()) {
if (!isset($config["metaconsole_deploy_collection"])) {
config_update_value('metaconsole_deploy_collection', 0);
}
}
/* Finally, check if any value was overwritten in a form */
config_update_config();
}
@ -2323,11 +2329,7 @@ function config_prepare_session() {
else
$sessionCookieExpireTime *= 60;
@ini_set('session.gc_maxlifetime', $sessionCookieExpireTime);
@session_set_cookie_params ($sessionCookieExpireTime);
// Reset the expiration time upon page load //session_name() is default name of session PHPSESSID
if (isset($_COOKIE[session_name()]))
setcookie(session_name(), $_COOKIE[session_name()], time() + $sessionCookieExpireTime, "/");

View File

@ -742,7 +742,7 @@ function filemanager_file_explorer($real_directory, $relative_directory,
$data[4] .= '<span style="display: flex">';
$typefile = array_pop(explode(".",$fileinfo['name']));
if (is_writable ($fileinfo['realpath']) &&
(! is_dir ($fileinfo['realpath']) || count (scandir ($fileinfo['realpath'])) < 3)) {
(! is_dir ($fileinfo['realpath']) || count (scandir ($fileinfo['realpath'])) < 3) && (!$readOnly)) {
$data[4] .= '<form method="post" action="' . $url . '" style="">';
$data[4] .= '<input type="image" src="images/cross.png" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_input_hidden ('filename', $fileinfo['realpath'], true);

View File

@ -77,6 +77,6 @@ function pandora_session_gc ($max_lifetime = 300) {
return $retval;
}
$result_handler = @session_set_save_handler ('pandora_session_open', 'pandora_session_close', 'pandora_session_read', 'pandora_session_write', 'pandora_session_destroy', 'pandora_session_gc');
$result_handler = session_set_save_handler ('pandora_session_open', 'pandora_session_close', 'pandora_session_read', 'pandora_session_write', 'pandora_session_destroy', 'pandora_session_gc');
?>

View File

@ -105,10 +105,9 @@ if ((! file_exists ("include/config.php")) || (! is_readable ("include/config.ph
exit;
}
// Real start
if(session_id() == '') {
session_start ();
}
//////////////////////////////////////
//// PLEASE DO NOT CHANGE ORDER //////
//////////////////////////////////////
require_once ("include/config.php");
require_once ("include/functions_config.php");
@ -126,6 +125,7 @@ if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) {
if (file_exists (ENTERPRISE_DIR . "/include/functions_login.php")) {
include_once (ENTERPRISE_DIR . "/include/functions_login.php");
}
////////////////////////////////////////
if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
$query = '';
@ -564,6 +564,7 @@ if (! isset ($config['id_user'])) {
if($home_page == 'Visual console') unset($query_params_redirect["sec2"]);
$redirect_url = '?1=1';
foreach ($query_params_redirect as $key => $value) {
if ($key == "login") continue;
$redirect_url .= '&'.safe_url_extraclean($key).'='.safe_url_extraclean($value);
}
header("Location: ".$config['homeurl']."index.php".$redirect_url);
@ -810,8 +811,11 @@ if (isset ($_GET["bye"])) {
$iduser = $_SESSION["id_usuario"];
db_logoff ($iduser, $_SERVER['REMOTE_ADDR']);
// Unregister Session (compatible with 5.2 and 6.x, old code was deprecated
unset($_SESSION['id_usuario']);
unset($iduser);
$_SESSION = array();
session_destroy();
header_remove("Set-Cookie");
setcookie(session_name(), $_COOKIE[session_name()], time() - 4800, "/");
if ($config['auth'] == 'saml') {
require_once($config['saml_path'] . 'simplesamlphp/lib/_autoload.php');
$as = new SimpleSAML_Auth_Simple('PandoraFMS');

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.729
%define release 181119
%define release 181121
# 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.729
%define release 181119
%define release 181121
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -369,6 +369,7 @@ CREATE TABLE IF NOT EXISTS `talert_commands` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`command` text,
`id_group` mediumint(8) unsigned NULL default 0,
`description` text,
`internal` tinyint(1) default 0,
`fields_descriptions` TEXT,

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.729-181119
Version: 7.0NG.729-181121
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.729-181119"
pandora_version="7.0NG.729-181121"
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.729";
my $pandora_build = "181119";
my $pandora_build = "181121";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

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.729";
my $pandora_build = "181119";
my $pandora_build = "181121";
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.729
%define release 181119
%define release 181121
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.729"
PI_BUILD="181119"
PI_BUILD="181121"
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.729 PS181119";
my $version = "7.0NG.729 PS181121";
# 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.729 PS181119";
my $version = "7.0NG.729 PS181121";
# save program name for logging
my $progname = basename($0);