Merge remote-tracking branch 'origin/develop' into ent-9425-agrupar-eventos-por-id_extra

This commit is contained in:
Daniel Barbero 2022-10-14 08:11:51 +02:00
commit a21048c4c5
43 changed files with 429 additions and 464 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.765-221010 Version: 7.0NG.765-221014
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.765-221010" pandora_version="7.0NG.765-221014"
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.765'; use constant AGENT_VERSION => '7.0NG.765';
use constant AGENT_BUILD => '221010'; use constant AGENT_BUILD => '221014';
# 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;

View File

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

View File

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

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

View File

@ -0,0 +1,6 @@
START TRANSACTION;
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_mode` INT NOT NULL DEFAULT 2;
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_path` VARCHAR(1000) DEFAULT '';
COMMIT;

View File

@ -358,7 +358,7 @@ if (!is_user_admin($config['id_user'])) {
$filter['id_group'] = array_keys(users_get_groups(false, 'LM')); $filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
} }
$total_templates = alerts_get_alert_templates($filter, ['COUNT(*) AS total']); $total_templates = alerts_get_alert_templates($filter, ['COUNT(*) AS total'], true);
$total_templates = $total_templates[0]['total']; $total_templates = $total_templates[0]['total'];
$templates = alerts_get_alert_templates( $templates = alerts_get_alert_templates(

View File

@ -377,8 +377,8 @@ if ($save_event_filter) {
$values['custom_data'] = get_parameter('custom_data'); $values['custom_data'] = get_parameter('custom_data');
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type'); $values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
if (is_metaconsole()) { if (is_metaconsole() === true) {
$values['server_id'] = get_parameter('server_id'); $values['server_id'] = implode(',', get_parameter('server_id'));
} }
$exists = (bool) db_get_value_filter( $exists = (bool) db_get_value_filter(
@ -435,7 +435,7 @@ if ($update_event_filter) {
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type'); $values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$values['server_id'] = get_parameter('server_id'); $values['server_id'] = implode(',', get_parameter('server_id'));
} }
if (io_safe_output($values['tag_with']) == '["0"]') { if (io_safe_output($values['tag_with']) == '["0"]') {

View File

@ -44,7 +44,7 @@ class AuditLog extends HTML
* *
* @var array * @var array
*/ */
public $AJAXMethods = [ 'draw' ]; public $AJAXMethods = ['draw'];
/** /**
* Ajax page. * Ajax page.
@ -78,7 +78,6 @@ class AuditLog extends HTML
// Set the ajax controller. // Set the ajax controller.
$this->ajaxController = $ajaxController; $this->ajaxController = $ajaxController;
} }
@ -232,7 +231,6 @@ class AuditLog extends HTML
// Load own javascript file. // Load own javascript file.
echo $this->loadJS(); echo $this->loadJS();
} }
@ -368,39 +366,38 @@ class AuditLog extends HTML
// Javascript content. // Javascript content.
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function format ( d ) { function format(d) {
var output = ''; var output = '';
if (d.extendedInfo === '') { if (d.extendedInfo === '') {
output = "<?php echo __('There is no additional information to display'); ?>"; output = "<?php echo __('There is no additional information to display'); ?>";
} else { } else {
output = d.extendedInfo; output = d.extendedInfo;
}
return output;
} }
$(document).ready(function() { return output;
// Add event listener for opening and closing details }
$('#audit_logs tbody').on('click', 'td.show_extended_info', function () {
var tr = $(this).closest('tr'); $(document).ready(function() {
var table = <?php echo 'dt_'.$this->tableId; ?>; // Add event listener for opening and closing details
var row = table.row( tr ); $('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
var tr = $(this).closest('tr');
if ( row.child.isShown() ) { var table = $("#<?php echo $this->tableId; ?>").DataTable();
// This row is already open - close it var row = table.row(tr);
row.child.hide();
tr.removeClass('shown'); if (row.child.isShown()) {
} // This row is already open - close it
else { row.child.hide();
// Open this row tr.removeClass('shown');
row.child( format(row.data()) ).show(); } else {
tr.addClass('shown'); // Open this row
} row.child(format(row.data())).show();
} ); tr.addClass('shown');
} ); }
</script> });
});
</script>
<?php <?php
// EOF Javascript content. // EOF Javascript content.
return ob_get_clean(); return ob_get_clean();

View File

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

View File

@ -57,11 +57,17 @@ function mysql_connect_db(
$port = $config['dbport']; $port = $config['dbport'];
} }
if ($ssl === null && (bool) $config['dbssl'] === true) { if ($ssl === null
&& isset($config['dbssl']) === true
&& (bool) $config['dbssl'] === true
) {
$ssl = $config['dbsslcafile']; $ssl = $config['dbsslcafile'];
} }
if ($verify === null && (bool) $config['sslverifyservercert'] === true) { if ($verify === null
&& isset($config['sslverifyservercert']) === true
&& (bool) $config['sslverifyservercert'] === true
) {
$verify = 'verified'; $verify = 'verified';
} }

View File

@ -1007,6 +1007,30 @@ function get_parameter_post($name, $default='')
} }
/**
* Get header.
*
* @param string $key Key.
* @param string|null $default Default.
*
* @return string|null
*/
function get_header(string $key, ?string $default=null): ?string
{
static $headers;
if (!isset($headers)) {
$headers = getAllHeaders();
}
$adjust_key = ucwords(strtolower($key));
if (isset($headers[$adjust_key])) {
return $headers[$adjust_key];
}
return $default;
}
/** /**
* Get name of a priority value. * Get name of a priority value.
* *

View File

@ -795,7 +795,7 @@ function alerts_delete_alert_template($id_alert_template)
* *
* @return mixed Array with selected alert templates or false if something goes wrong. * @return mixed Array with selected alert templates or false if something goes wrong.
*/ */
function alerts_get_alert_templates($filter=false, $fields=false) function alerts_get_alert_templates($filter=false, $fields=false, $total=false)
{ {
global $config; global $config;
@ -811,32 +811,17 @@ function alerts_get_alert_templates($filter=false, $fields=false)
$templates_sql = @db_get_all_rows_filter('talert_templates', $filter, $fields, 'AND', false, true); $templates_sql = @db_get_all_rows_filter('talert_templates', $filter, $fields, 'AND', false, true);
switch ($config['dbtype']) { $limit_sql = '';
case 'mysql': if (isset($offset) && isset($limit) && $total === false) {
case 'postgresql': $limit_sql = " LIMIT $offset, $limit ";
$limit_sql = ''; } else {
if (isset($offset) && isset($limit)) { $limit_sql = '';
$limit_sql = " LIMIT $offset, $limit ";
} else {
$limit_sql = '';
}
$sql = sprintf('%s %s', $templates_sql, $limit_sql);
$alert_templates = db_get_all_rows_sql($sql);
break;
case 'oracle':
$set = [];
if (isset($offset) && isset($limit)) {
$set['limit'] = $limit;
$set['offset'] = $offset;
}
$alert_templates = oracle_recode_query($templates_sql, $set, 'AND', false);
break;
} }
$sql = sprintf('%s %s', $templates_sql, $limit_sql);
$alert_templates = db_get_all_rows_sql($sql);
return $alert_templates; return $alert_templates;
} }

View File

@ -1990,12 +1990,10 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$values = []; $values = [];
@ -2030,12 +2028,10 @@ function api_set_update_os($id_os, $thrash2, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$values = []; $values = [];
@ -2209,8 +2205,8 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
} }
} else { } else {
// Delete only if the centralised mode is disabled. // Delete only if the centralised mode is disabled.
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false && is_management_allowed($headers['idk']) === false) { if (is_management_allowed($idk) === false) {
returnError('centralized'); returnError('centralized');
exit; exit;
} }
@ -5079,12 +5075,10 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -5181,12 +5175,10 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -5456,12 +5448,10 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -5628,12 +5618,10 @@ function api_set_create_alert_template($name, $thrash1, $other, $thrash3)
{ {
global $config; global $config;
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($name == '') { if ($name == '') {
@ -5771,12 +5759,10 @@ function api_set_update_alert_template($id_template, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id_template == '') { if ($id_template == '') {
@ -5923,12 +5909,10 @@ function api_set_delete_alert_template($id_template, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id_template == '') { if ($id_template == '') {
@ -7117,12 +7101,10 @@ function api_set_tag($id, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$values = []; $values = [];
@ -7827,12 +7809,10 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -7947,12 +7927,10 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -8070,12 +8048,10 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -8177,12 +8153,10 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -8311,12 +8285,10 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -8607,12 +8579,10 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -8774,12 +8744,10 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -8939,12 +8907,10 @@ function api_set_remove_agent_from_policy_by_id($id, $thrash1, $other, $thrash2)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($other['data'][0] == '' || !$other['data'][0]) { if ($other['data'][0] == '' || !$other['data'][0]) {
@ -8980,12 +8946,10 @@ function api_set_remove_agent_from_policy_by_name($id, $thrash1, $other, $thrash
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($other['data'][0] == '' || !$other['data'][0]) { if ($other['data'][0] == '' || !$other['data'][0]) {
@ -9024,12 +8988,10 @@ function api_set_create_group($id, $thrash1, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$group_name = $id; $group_name = $id;
@ -9147,12 +9109,10 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $id_group) === false) { if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $id_group) === false) {
@ -9224,12 +9184,10 @@ function api_set_delete_group($id_group, $thrash2, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$group = db_get_row_filter('tgrupo', ['id_grupo' => $id_group]); $group = db_get_row_filter('tgrupo', ['id_grupo' => $id_group]);
@ -9549,12 +9507,10 @@ function api_set_new_user($id, $thrash2, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$values = []; $values = [];
@ -9607,12 +9563,10 @@ function api_set_update_user($id, $thrash2, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$fields_user = [ $fields_user = [
@ -9707,12 +9661,10 @@ function api_set_enable_disable_user($id, $thrash2, $other, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($id == '') { if ($id == '') {
@ -9986,12 +9938,10 @@ function api_set_new_alert_template($id, $id2, $other, $trash1)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($other['type'] == 'string') { if ($other['type'] == 'string') {
@ -10212,7 +10162,7 @@ function api_set_module_data($id, $thrash2, $other, $trash1)
$xmlTemplate, $xmlTemplate,
io_safe_output(get_os_name($agent['id_os'])), io_safe_output(get_os_name($agent['id_os'])),
io_safe_output($agent['os_version']), io_safe_output($agent['os_version']),
$agent['intervalo'], $agentModule['module_interval'],
io_safe_output($agent['agent_version']), io_safe_output($agent['agent_version']),
date('Y/m/d H:i:s', $time), date('Y/m/d H:i:s', $time),
io_safe_output($agent['nombre']), io_safe_output($agent['nombre']),
@ -10409,12 +10359,10 @@ function api_set_alert_actions($id, $id2, $other, $trash1)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($other['type'] == 'string') { if ($other['type'] == 'string') {
@ -10565,12 +10513,10 @@ function api_set_new_module_group($id, $thrash2, $other, $trash1)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if (!check_acl($config['id_user'], 0, 'PM')) { if (!check_acl($config['id_user'], 0, 'PM')) {
@ -10639,12 +10585,10 @@ function api_set_alert_commands($id, $thrash2, $other, $trash1)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$name = db_get_value('id', 'talert_commands', 'name', $id); $name = db_get_value('id', 'talert_commands', 'name', $id);
@ -11798,12 +11742,10 @@ function api_set_delete_user($id, $thrash1, $thrash2, $thrash3)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if (!delete_user($id)) { if (!delete_user($id)) {
@ -11841,12 +11783,10 @@ function api_set_add_user_profile($id, $thrash1, $other, $thrash2)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$group = (int) $other['data'][0]; $group = (int) $other['data'][0];
@ -11902,12 +11842,10 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$group = $other['data'][0]; $group = $other['data'][0];
@ -12017,12 +11955,10 @@ function api_set_create_user_profile_info($thrash1, $thrash2, $other, $returnTyp
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$values = [ $values = [
@ -12078,12 +12014,10 @@ function api_set_update_user_profile_info($id_profile, $thrash1, $other, $return
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$profile = db_get_row('tperfil', 'id_perfil', $id_profile); $profile = db_get_row('tperfil', 'id_perfil', $id_profile);
@ -12145,12 +12079,10 @@ function api_set_delete_user_profile_info($id_profile, $thrash1, $thrash2, $retu
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$profile = db_get_value('id_perfil', 'tperfil', 'id_perfil', $id_profile); $profile = db_get_value('id_perfil', 'tperfil', 'id_perfil', $id_profile);
@ -13037,12 +12969,10 @@ function api_set_create_tag($id, $trash1, $other, $returnType)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$data = []; $data = [];
@ -13368,12 +13298,6 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3)
{ {
global $config; global $config;
if (defined('METACONSOLE')) {
$meta = true;
} else {
$meta = $other['data'][1];
}
if (!check_acl($config['id_user'], 0, 'EW')) { if (!check_acl($config['id_user'], 0, 'EW')) {
returnError('forbidden', 'string'); returnError('forbidden', 'string');
return; return;
@ -13384,13 +13308,46 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3)
return; return;
} else if ($other['type'] == 'array') { } else if ($other['type'] == 'array') {
$comment = $other['data'][0]; $comment = $other['data'][0];
$history = $other['data'][2];
$status = events_comment( $node_int = 0;
$id, if (is_metaconsole() === true) {
$comment, if (isset($other['data'][1]) === true
'Added comment' && empty($other['data'][1]) === false
); ) {
$node_int = $other['data'][1];
}
}
try {
if (is_metaconsole() === true
&& (int) $node_int > 0
) {
$node = new Node($node_int);
$node->connect();
}
$status = events_comment(
$id,
$comment,
'Added comment'
);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $node_int > 0
) {
$node->disconnect();
}
$status = false;
} finally {
if (is_metaconsole() === true
&& $node_int > 0
) {
$node->disconnect();
}
}
if (is_error($status)) { if (is_error($status)) {
returnError( returnError(
'The event comment could not be added.' 'The event comment could not be added.'
@ -17130,12 +17087,10 @@ function api_set_delete_user_permission($thrash1, $thrash2, $other, $returnType)
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
if ($other['data'][0] != '') { if ($other['data'][0] != '') {
@ -17191,12 +17146,10 @@ function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $retur
return; return;
} }
$headers = getallheaders(); $idk = get_header('idk');
if (isset($headers['idk']) === false if (is_management_allowed($idk) === false) {
&& is_management_allowed($headers['idk']) === false
) {
returnError('centralized'); returnError('centralized');
return; exit;
} }
$sql = 'SELECT id_up $sql = 'SELECT id_up

View File

@ -1406,7 +1406,7 @@ function events_get_all(
// Pagination. // Pagination.
$pagination = ''; $pagination = '';
if (is_metaconsole() === true if (is_metaconsole() === true
&& empty($id_server) === true && (empty($id_server) === true || is_array($id_server) === true)
&& isset($filter['csv_all']) === false && isset($filter['csv_all']) === false
) { ) {
// TODO: XXX TIP. captura el error. // TODO: XXX TIP. captura el error.
@ -1691,7 +1691,9 @@ function events_get_all(
if ($count === true if ($count === true
&& (is_metaconsole() === false && (is_metaconsole() === false
|| (is_metaconsole() === true && empty($filter['server_id']) === false)) || (is_metaconsole() === true
&& empty($filter['server_id']) === false
&& is_array($filter['server_id']) === false))
) { ) {
$sql = 'SELECT count(*) as nitems FROM ('.$sql.') tt'; $sql = 'SELECT count(*) as nitems FROM ('.$sql.') tt';
} }
@ -1707,8 +1709,21 @@ function events_get_all(
$metaconsole_connections = array_flip($metaconsole_connections); $metaconsole_connections = array_flip($metaconsole_connections);
$metaconsole_connections['meta'] = 0; $metaconsole_connections['meta'] = 0;
} else { } else {
$only_id_server[$metaconsole_connections[$id_server]] = $id_server; if (is_array($id_server) === false) {
$metaconsole_connections = $only_id_server; $only_id_server[$metaconsole_connections[$id_server]] = $id_server;
$metaconsole_connections = $only_id_server;
} else {
$metaConnections = [];
foreach ($id_server as $idser) {
if ((int) $idser === 0) {
$metaConnections['meta'] = 0;
} else {
$metaConnections[$metaconsole_connections[$idser]] = $idser;
}
}
$metaconsole_connections = $metaConnections;
}
} }
$result_meta = Promise\wait( $result_meta = Promise\wait(
@ -1782,7 +1797,7 @@ function events_get_all(
} }
} }
if (empty($filter['server_id']) === true) { if ($count === false) {
if ($sort_field !== 'agent_name' if ($sort_field !== 'agent_name'
&& $sort_field !== 'server_name' && $sort_field !== 'server_name'
&& $sort_field !== 'timestamp' && $sort_field !== 'timestamp'

View File

@ -1664,44 +1664,31 @@ function html_print_select_multiple_modules_filtered(array $data):string
] ]
); );
// Show common modules. $commonModules = 0;
$selection = [ if (empty($data['mShowCommonModules']) === false) {
0 => __('Show common modules'), $commonModules = 1;
1 => __('Show all modules'),
];
if (true) {
$output .= html_print_input(
[
'label' => __('Only common modules'),
'type' => 'switch',
'value' => 'checked',
'id' => 'filtered-module-show-common-modules-'.$uniqId,
'return' => true,
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
]
);
} else {
$output .= html_print_input(
[
'label' => __('Show common modules'),
'type' => 'select',
'fields' => $selection,
'name' => 'filtered-module-show-common-modules-'.$uniqId,
'return' => true,
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
]
);
} }
$output .= html_print_input(
[
'label' => __('Only common modules'),
'type' => 'switch',
'checked' => $commonModules,
'value' => $commonModules,
'name' => 'filtered-module-show-common-modules-'.$uniqId,
'id' => 'filtered-module-show-common-modules-'.$uniqId,
'return' => true,
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
]
);
if (empty($data['mAgents']) === false if (empty($data['mAgents']) === false
&& empty($data['mModuleGroup'] === false) && empty($data['mModuleGroup'] === false)
) { ) {
$all_modules = get_modules_agents( $all_modules = get_modules_agents(
$data['mModuleGroup'], $data['mModuleGroup'],
explode(',', $data['mAgents']), explode(',', $data['mAgents']),
$data['mShowCommonModules'], !$commonModules,
false, false,
true true
); );
@ -1709,10 +1696,18 @@ function html_print_select_multiple_modules_filtered(array $data):string
$all_modules = []; $all_modules = [];
} }
$mModules = $data['mModules'];
if (is_array($data['mModules']) === false) { if (is_array($data['mModules']) === false) {
$result = explode(((is_metaconsole() === true) ? SEPARATOR_META_MODULE : ','), $data['mModules']); $mModules = explode(
} else { ',',
$result = $data['mModules']; $data['mModules']
);
}
$result = [];
// Clean double safe input.
foreach ($mModules as $name) {
$result[] = io_safe_output($name);
} }
$output .= html_print_input( $output .= html_print_input(
@ -4956,7 +4951,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$output = ''; $output = '';
if (($data['label'] ?? false) && $input_only === false) { if (($data['label'] ?? false) && $input_only === false) {
$output = '<'.$wrapper.' id="'.$wrapper.'-'.$data['name'].'" '; $output = '<'.$wrapper.' id="'.$wrapper.'-'.($data['name'] ?? '').'" ';
$output .= ' class="'.($data['input_class'] ?? '').'">'; $output .= ' class="'.($data['input_class'] ?? '').'">';
$output .= '<label '.$style.' class="'.($data['label_class'] ?? '').'">'; $output .= '<label '.$style.' class="'.($data['label_class'] ?? '').'">';
$output .= ($data['label'] ?? ''); $output .= ($data['label'] ?? '');
@ -4977,7 +4972,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
if (isset($data['wrapper']) === true) { if (isset($data['wrapper']) === true) {
$output = '<'.$data['wrapper'].' '.$wrapper_attributes.' id="wr_'.$data['name'].'" '; $output = '<'.$data['wrapper'].' '.$wrapper_attributes.' id="wr_'.$data['name'].'" ';
$output .= ' class="'.$data['input_class'].'">'; $output .= ' class="'.($data['input_class'] ?? '').'">';
} }
switch (($data['type'] ?? null)) { switch (($data['type'] ?? null)) {
@ -5097,7 +5092,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$output .= html_print_input_color( $output .= html_print_input_color(
$data['name'], $data['name'],
$data['value'], $data['value'],
$data['id'], ($data['id'] ?? ''),
((isset($data['class']) === true) ? $data['class'] : false), ((isset($data['class']) === true) ? $data['class'] : false),
((isset($data['return']) === true) ? $data['return'] : false) ((isset($data['return']) === true) ? $data['return'] : false)
); );

View File

@ -3656,7 +3656,7 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
$id_agents, $id_agents,
$selection, $selection,
false, false,
false, $useName,
true true
); );
@ -3684,8 +3684,8 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
if ($occurrences === $nodes_consulted) { if ($occurrences === $nodes_consulted) {
// Module already present in ALL nodes. // Module already present in ALL nodes.
$modules[] = [ $modules[] = [
'id_agente_modulo' => $module_name, 'id_agente_modulo' => io_safe_output($module_name),
'nombre' => $module_name, 'nombre' => io_safe_output($module_name),
]; ];
} }
} }
@ -3730,7 +3730,7 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
function ($carry, $item) use ($useName) { function ($carry, $item) use ($useName) {
// Only works in select mode. // Only works in select mode.
if ($useName === true) { if ($useName === true) {
$carry[io_safe_input($item['nombre'])] = $item['nombre']; $carry[$item['id_node'].'|'.$item['nombre']] = $item['nombre'];
} else { } else {
$carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre']; $carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre'];
} }
@ -3744,6 +3744,8 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
$id_module_group, $id_module_group,
$id_agents, $id_agents,
$selection, $selection,
false,
$useName,
false false
); );
} }

View File

@ -3788,7 +3788,6 @@ function visual_map_get_user_layouts(
unset($filter['can_manage_group_all']); unset($filter['can_manage_group_all']);
} }
$where = '';
if ($check_user_groups === true && !empty($groups)) { if ($check_user_groups === true && !empty($groups)) {
if (empty($where)) { if (empty($where)) {
$where = ''; $where = '';

View File

@ -338,22 +338,6 @@ class AgentModuleWidget extends Widget
) )
); );
if (is_metaconsole() === true) {
$values['mModules'] = implode(
SEPARATOR_META_MODULE,
array_reduce(
$values['mModules'],
function ($carry, $item) {
$d = explode('|', $item);
$carry[] = (isset($d[1]) === true) ? $d[1] : $item;
return $carry;
},
[]
)
);
}
return $values; return $values;
} }
@ -670,64 +654,34 @@ class AgentModuleWidget extends Widget
return $output; return $output;
} }
// Extract info all modules selected. $reduceAllModules = array_reduce(
$target_modules = $this->values['mModules']; $this->values['mModules'],
if (is_metaconsole() === true) { function ($carry, $item) {
$target_modules = explode( if ($item === null) {
SEPARATOR_META_MODULE, return $carry;
$this->values['mModules'] }
);
$all_modules = $target_modules; if (is_metaconsole() === true) {
} else { $item = explode('|', $item);
if (is_array($target_modules) === true $serverId = $item[0];
|| is_numeric($target_modules) === true $fullname = $item[1];
) { if ($this->values['mShowCommonModules'] !== 'on') {
$target_modules = array_reduce( $item = explode('&#x20;&raquo;&#x20;', $fullname);
$target_modules, $name = $item[1];
function ($carry, $item) { $carry['modules_selected'][$serverId][$name] = null;
$carry[] = io_safe_output($item); $carry['modules'][$name] = null;
} else {
return $carry; $carry['modules'][$fullname] = null;
} }
); } else {
$carry['modules'][$item] = null;
}
$all_modules = Module::search( return $carry;
['nombre' => $target_modules]
);
} else {
// From previous definitions.
$all_modules = Module::search(
['id_agente_modulo' => explode(',', $target_modules)]
);
} }
} );
if ($all_modules !== null) {
if (is_metaconsole() === true
&& $this->values['mShowCommonModules'] === '1'
) {
$reduceAllModules = [];
} else {
$reduceAllModules = array_reduce(
$all_modules,
function ($carry, $item) {
if ($item === null) {
return $carry;
}
if (is_object($item) === true) {
$carry[$item->name()] = null;
} else {
$carry[io_safe_output($item)] = null;
}
return $carry;
}
);
}
}
$allModules = $reduceAllModules['modules'];
$visualData = []; $visualData = [];
// Extract info agents selected. // Extract info agents selected.
$target_agents = explode(',', $this->values['mAgents']); $target_agents = explode(',', $this->values['mAgents']);
@ -754,54 +708,33 @@ class AgentModuleWidget extends Widget
$visualData[$agent_id]['agent_alias'] = $agent->alias(); $visualData[$agent_id]['agent_alias'] = $agent->alias();
$visualData[$agent_id]['modules'] = []; $visualData[$agent_id]['modules'] = [];
if (is_metaconsole() === true if (empty($allModules) === false) {
&& $this->values['mShowCommonModules'] === '1' if (is_metaconsole() === true && $this->values['mShowCommonModules'] !== 'on') {
) {
// MC should connect to nodes and retrieve information
// from targets.
$tmpModules = array_reduce(
$target_modules,
function ($carry, $item) {
// In this case, the modules come with '» ' chain.
$tmpCarry = explode('&raquo;&#x20;', $item);
$carry[trim($tmpCarry[1])] = null;
return $carry;
}
);
$modules = $agent->searchModules(
['nombre' => array_keys($tmpModules)]
);
foreach ($modules as $module) {
if ($module === null) {
$reduceAllModules[] = null;
} else {
$reduceAllModules[$module->name()] = null;
}
}
} else {
if (empty($reduceAllModules) === false) {
$modules = $agent->searchModules( $modules = $agent->searchModules(
['nombre' => array_keys($reduceAllModules)] ['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
);
} else {
$modules = $agent->searchModules(
['nombre' => array_keys($allModules)]
); );
} }
} }
$visualData[$agent_id]['modules'] = $reduceAllModules; $visualData[$agent_id]['modules'] = $allModules;
foreach ($modules as $module) { foreach ($modules as $module) {
if ($module === null) { if ($module === null) {
continue; continue;
} }
$key_name_module = $module->name();
if ($this->values['mTypeShow'] === '1') { if ($this->values['mTypeShow'] === '1') {
$mod = $module->toArray(); $mod = $module->toArray();
$mod['datos'] = $module->lastValue(); $mod['datos'] = $module->lastValue();
$module_last_value = modules_get_agentmodule_data_for_humans($mod); $module_last_value = modules_get_agentmodule_data_for_humans($mod);
$visualData[$agent_id]['modules'][$module->name()] = $module_last_value; $visualData[$agent_id]['modules'][$key_name_module] = $module_last_value;
} else { } else {
$visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado(); $visualData[$agent_id]['modules'][$key_name_module] = $module->getStatus()->estado();
} }
} }
@ -813,17 +746,9 @@ class AgentModuleWidget extends Widget
} }
} }
if (empty($reduceAllModules) === false) {
$allModules = array_keys($reduceAllModules);
}
if ($allModules === null) {
$allModules = [];
}
$output = $this->generateViewAgentModule( $output = $this->generateViewAgentModule(
$visualData, $visualData,
$allModules array_keys($allModules)
); );
return $output; return $output;

View File

@ -749,6 +749,10 @@ 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();
if (empty($updates['debug_content']) === false) {
$updates['debug_content'] = str_replace("'", '"', $updates['debug_content']);
}
// In the case of the webserver modules, debug_content special characters must be handled. // In the case of the webserver modules, debug_content special characters must be handled.
if ($updates['id_tipo_modulo'] >= MODULE_TYPE_WEB_ANALYSIS if ($updates['id_tipo_modulo'] >= MODULE_TYPE_WEB_ANALYSIS
&& $updates['id_tipo_modulo'] <= MODULE_TYPE_WEB_CONTENT_STRING && $updates['id_tipo_modulo'] <= MODULE_TYPE_WEB_CONTENT_STRING

View File

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

View File

@ -222,9 +222,16 @@ if (is_ajax()) {
$id_group, $id_group,
$id_agents, $id_agents,
$selection, $selection,
$select_mode $select_mode,
true
); );
echo json_encode($modules);
// Clean double safe input.
foreach ($modules as $id => $name) {
$result[$id] = io_safe_output($name);
}
echo json_encode($result);
return; return;
} }

View File

@ -218,9 +218,36 @@ $id_source_event = get_parameter(
$server_id = get_parameter( $server_id = get_parameter(
'filter[server_id]', 'filter[server_id]',
($filter['id_server_meta'] ?? 0) ($filter['id_server_meta'] ?? '')
); );
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
if (is_array($servers) === true) {
$servers = array_reduce(
$servers,
function ($carry, $item) {
$carry[$item['id']] = $item['server_name'];
return $carry;
}
);
} else {
$servers = [];
}
$servers[0] = __('Metaconsola');
if ($server_id === '') {
$server_id = array_keys($servers);
} else if (is_array($server_id) === false) {
if ((int) $server_id !== 0) {
$server_id = [$server_id];
} else {
$server_id = array_keys($servers);
}
}
}
$custom_data_filter_type = get_parameter( $custom_data_filter_type = get_parameter(
'filter[custom_data_filter_type]', 'filter[custom_data_filter_type]',
($filter['custom_data_filter_type'] ?? '') ($filter['custom_data_filter_type'] ?? '')
@ -231,7 +258,9 @@ $custom_data = get_parameter(
($filter['custom_data'] ?? '') ($filter['custom_data'] ?? '')
); );
if (is_metaconsole() === true) { if (is_metaconsole() === true
&& is_array($server_id) === false
) {
// Connect to node database. // Connect to node database.
$id_node = (int) $server_id; $id_node = (int) $server_id;
if ($id_node !== 0) { if ($id_node !== 0) {
@ -252,7 +281,9 @@ if (empty($text_module) === true && empty($id_agent_module) === false) {
$text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module)); $text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module));
} }
if (is_metaconsole() === true) { if (is_metaconsole() === true
&& is_array($server_id) === false
) {
// Return to metaconsole database. // Return to metaconsole database.
if ($id_node != 0) { if ($id_node != 0) {
metaconsole_restore_db(); metaconsole_restore_db();
@ -363,7 +394,8 @@ if (is_ajax() === true) {
$buffers = []; $buffers = [];
if (is_metaconsole() === false if (is_metaconsole() === false
|| (is_metaconsole() === true || (is_metaconsole() === true
&& empty($filter['server_id']) === false) && empty($filter['server_id']) === false
&& is_array($filter['server_id']) === false)
) { ) {
$count = events_get_all( $count = events_get_all(
'count', 'count',
@ -464,7 +496,7 @@ if (is_ajax() === true) {
$tmp->ack_utimestamp_raw = strtotime($tmp->ack_utimestamp); $tmp->ack_utimestamp_raw = strtotime($tmp->ack_utimestamp);
$tmp->ack_utimestamp = ui_print_timestamp( $tmp->ack_utimestamp = ui_print_timestamp(
$tmp->ack_utimestamp, (int) $tmp->ack_utimestamp,
true true
); );
$tmp->timestamp = ui_print_timestamp( $tmp->timestamp = ui_print_timestamp(
@ -1789,14 +1821,19 @@ $adv_inputs[] = $in;
// Mixed. Metaconsole => server, Console => module. // Mixed. Metaconsole => server, Console => module.
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$title = __('Server'); $title = __('Server');
$data = html_print_select_from_sql( $data = html_print_select(
'SELECT id, server_name FROM tmetaconsole_setup', $servers,
'server_id', 'server_id',
$server_id, $server_id,
'', '',
__('All'), '',
'0', 0,
true true,
true,
true,
'',
false,
'height: 60px;'
); );
} else { } else {
$title = __('Module search'); $title = __('Module search');
@ -2820,7 +2857,7 @@ $(document).ready( function() {
data: { data: {
page: 'include/ajax/events', page: 'include/ajax/events',
load_filter_modal: 1 load_filter_modal: 1
}, },
success: function (data){ success: function (data){
$('#load-modal-filter') $('#load-modal-filter')
.empty() .empty()

View File

@ -206,13 +206,19 @@ if ($access_console_node === true) {
} }
$layouts = visual_map_get_user_layouts($config['id_user'], false, false, $returnAllGroups, true); $layouts = visual_map_get_user_layouts($config['id_user'], false, false, $returnAllGroups, true);
$sub2 = []; $sub2 = [];
if ($layouts === false) { if ($layouts === false) {
$layouts = []; $layouts = [];
} else { } else {
$id = (int) get_parameter('id', -1); $id = (int) get_parameter('id', -1);
$delete_layout = (bool) get_parameter('delete_layout');
if ($delete_layout === true) {
$id_layout = (int) get_parameter('id_layout');
unset($layouts[$id_layout]);
}
$break_max_console = false; $break_max_console = false;
$max = $config['vc_menu_items']; $max = $config['vc_menu_items'];
$i = 0; $i = 0;

View File

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

View File

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

View File

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

View File

@ -2656,6 +2656,8 @@ CREATE TABLE IF NOT EXISTS `tmodule_inventory` (
`data_format` TEXT , `data_format` TEXT ,
`code` BLOB NOT NULL, `code` BLOB NOT NULL,
`block_mode` INT NOT NULL DEFAULT 0, `block_mode` INT NOT NULL DEFAULT 0,
`script_mode` INT NOT NULL DEFAULT 1,
`script_path` VARCHAR(1000) DEFAULT '',
PRIMARY KEY (`id_module_inventory`), PRIMARY KEY (`id_module_inventory`),
FOREIGN KEY (`id_os`) REFERENCES tconfig_os(`id_os`) FOREIGN KEY (`id_os`) REFERENCES tconfig_os(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.765-221010 Version: 7.0NG.765-221014
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.765-221010" pandora_version="7.0NG.765-221014"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.765 Build 221010"; my $version = "7.0NG.765 Build 221014";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -142,7 +142,7 @@ sub help_screen{
help_screen_line('--get_cluster_status', '<id_cluster>', 'Getting cluster status'); help_screen_line('--get_cluster_status', '<id_cluster>', 'Getting cluster status');
help_screen_line('--set_disabled_and_standby', '<id_agent> <id_node> <value>', 'Overwrite and disable and standby status'); help_screen_line('--set_disabled_and_standby', '<id_agent> <id_node> <value>', 'Overwrite and disable and standby status');
help_screen_line('--reset_agent_counts', '<id_agent>', 'Resets module counts and alert counts in the agents'); help_screen_line('--reset_agent_counts', '<id_agent>', 'Resets module counts and alert counts in the agents');
help_screen_line('--update_agent_custom_fields', '<id_agent> <type_field> <field_to_change> <new_value>', "Update an agent custom field. The fields can be \n\t the following: Serial number, Department ... and types can be 0 text and 1 combo "); help_screen_line('--agent_update_custom_fields', '<id_agent> <type_field> <field_to_change> <new_value>', "Update an agent custom field. The fields can be \n\t the following: Serial number, Department ... and types can be 0 text and 1 combo ");
print "\nMODULES:\n\n" unless $param ne ''; print "\nMODULES:\n\n" unless $param ne '';
help_screen_line('--create_data_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <definition_file> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions> <use_alias>]", 'Add data server module to agent'); help_screen_line('--create_data_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <definition_file> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions> <use_alias>]", 'Add data server module to agent');
@ -3135,7 +3135,7 @@ sub cli_user_update() {
############################################################################## ##############################################################################
# Update an agent customs field. # Update an agent customs field.
# Related option: --update_agent_custom_fields # Related option: --agent_update_custom_fields
############################################################################## ##############################################################################
sub cli_agent_update_custom_fields() { sub cli_agent_update_custom_fields() {
@ -3149,6 +3149,7 @@ sub cli_agent_update_custom_fields() {
if($agent_name eq '') { if($agent_name eq '') {
print_log "[ERROR] Agent '$id_agent' doesn't exist\n\n"; print_log "[ERROR] Agent '$id_agent' doesn't exist\n\n";
print "--agent_update_custom_fields, <id_agent> <type_field> <field_to_change> <new_value>, Updates an agent custom field. The fields can be \n\t the following: Serial number, Department ... and types can be 0 text and 1 combo )\n\n";
exit; exit;
} }
@ -3158,6 +3159,7 @@ sub cli_agent_update_custom_fields() {
if($custom_field eq '') { if($custom_field eq '') {
print_log "[ERROR] Field '$field' doesn't exist\n\n"; print_log "[ERROR] Field '$field' doesn't exist\n\n";
print "--agent_update_custom_fields, <id_agent> <type_field> <field_to_change> <new_value>, Updates an agent custom field. The fields can be \n\t the following: Serial number, Department ... and types can be 0 text and 1 combo )\n\n";
exit; exit;
} }
@ -3178,7 +3180,7 @@ sub cli_agent_update_custom_fields() {
print_log "\n[INFO] Updating field '$field' in agent with ID '$id_agent'\n\n"; print_log "\n[INFO] Updating field '$field' in agent with ID '$id_agent'\n\n";
my $result = pandora_update_agent_custom_field ($dbh, $new_value, $custom_field, $id_agent); my $result = pandora_agent_update_custom_field ($dbh, $new_value, $custom_field, $id_agent);
if($result == "0E0"){ if($result == "0E0"){
print_log "[ERROR] Error updating field '$field'\n\n"; print_log "[ERROR] Error updating field '$field'\n\n";