Merge remote-tracking branch 'origin/develop' into ent-11919-separar-los-spec-para-el7-el8-y-el9-del-agente-binario

This commit is contained in:
Enrique Martin 2023-09-21 13:19:04 +02:00
commit 02dcb740ec
44 changed files with 1003 additions and 123 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.773.3-230919 Version: 7.0NG.773.3-230921
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.773.3-230919" pandora_version="7.0NG.773.3-230921"
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

@ -1031,7 +1031,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.773.3'; use constant AGENT_VERSION => '7.0NG.773.3';
use constant AGENT_BUILD => '230919'; use constant AGENT_BUILD => '230921';
# 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

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 230919 %define release 230921
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 230919 %define release 230921
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 230919 %define release 230921
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.773.3" PI_VERSION="7.0NG.773.3"
PI_BUILD="230919" PI_BUILD="230921"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS" VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230919))" VALUE "ProductVersion", "(7.0NG.773.3(Build 230921))"
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.773.3-230919 Version: 7.0NG.773.3-230921
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.773.3-230919" pandora_version="7.0NG.773.3-230921"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -47,4 +47,23 @@ ADD COLUMN `time_end` VARCHAR(45) NULL AFTER `date_end`;
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.vmware'; UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.vmware';
-- Insert new Proxmox APP
SET @short_name = 'pandorafms.proxmox';
SET @name = 'Proxmox';
SET @section = 'app';
SET @description = 'Monitor Proxmox VMs, LXC, backups and nodes from a specific host';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_proxmox');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' -g '__taskGroup__' --host '_host_' --port '_port_' --user '_user_' --password '_password_' --vm '_scanVM_' --lxc '_scanLXC_' --backups '_scanBackups_' --nodes '_scanNodes_' --transfer_mode tentacle --tentacle_address '_tentacleIP_' --tentacle_port '_tentaclePort_' --as_discovery_plugin 1');
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
COMMIT; COMMIT;

View File

@ -200,6 +200,16 @@ $text_agent_module = '';
$only_data = false; $only_data = false;
if (enterprise_installed() === true) {
$categories_security_hardening = categories_of_cis();
foreach ($categories_security_hardening as $key => $cat) {
$categories_security_hardening[$key] = implode(' ', $cat);
}
} else {
$categories_security_hardening = [];
}
// Users. // Users.
$id_users = []; $id_users = [];
$users_groups = []; $users_groups = [];
@ -1019,6 +1029,51 @@ switch ($action) {
$idAgent = $item['id_agent']; $idAgent = $item['id_agent'];
break; break;
case 'top_n_agents_sh':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'top_n_checks_failed':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'top_n_categories_checks':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'vul_by_cat':
$group = $item['id_group'];
$recursion = $item['recursion'];
$cat_selected = $item['cat_security_hardening'];
$ignore_skipped = $item['ignore_skipped'];
break;
case 'list_checks':
$group = $item['id_group'];
$recursion = $item['recursion'];
$cat_selected = $item['cat_security_hardening'];
$status_of_check = $item['status_of_check'];
$idAgent = $item['id_agent'];
break;
case 'scoring':
$group = $item['id_group'];
$recursion = $item['recursion'];
$period = $item['period'];
break;
case 'evolution':
$group = $item['id_group'];
$recursion = $item['recursion'];
$period = $item['period'];
break;
default: default:
// It's not possible. // It's not possible.
break; break;
@ -3757,6 +3812,64 @@ if (is_metaconsole() === true) {
?> ?>
</td> </td>
</tr> </tr>
<tr id="row_ignore_skipped" class="datos">
<td class="bolder">
<?php
echo __('Ignore skipped');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'ignore_skipped',
1,
($ignore_skipped !== null) ? $ignore_skipped : true,
);
?>
</td>
</tr>
<?php if (enterprise_installed() === true) : ?>
<tr id="row_cat_security_hardening" class="datos">
<td class="bolder">
<?php
echo __('Category');
?>
</td>
<td>
<?php
html_print_select(
$categories_security_hardening,
'cat_security_hardening',
$cat_selected,
);
?>
</td>
</tr>
<?php endif; ?>
<tr id="row_status_check" class="datos">
<td class="bolder">
<?php
echo __('Status of check');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'PASS' => __('Passed'),
'FAIL' => __('Failed'),
'INVALID' => __('Skipped'),
],
'status_of_check',
$status_of_check,
);
?>
</td>
</tr>
<?php <?php
if ($is_enterprise) { if ($is_enterprise) {
?> ?>
@ -5085,6 +5198,10 @@ echo "<div id='message_no_group' title='".__('Item Editor Information')."' clas
echo "<p class='center bolder'>".__('Please select a group.').'</p>'; echo "<p class='center bolder'>".__('Please select a group.').'</p>';
echo '</div>'; echo '</div>';
echo "<div id='message_no_max_item' title='".__('Max items')."' class='invisible'>";
echo "<p class='center bolder'>".__('Please insert max item number.').'</p>';
echo '</div>';
ui_require_javascript_file( ui_require_javascript_file(
'pandora_inventory', 'pandora_inventory',
ENTERPRISE_DIR.'/include/javascript/' ENTERPRISE_DIR.'/include/javascript/'
@ -5428,6 +5545,30 @@ $(document).ready (function () {
return false; return false;
} }
break; break;
case 'list_checks':
if ($("#text-agent").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'top_n_agents_sh':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_checks_failed':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_categories_checks':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
default: default:
break; break;
} }
@ -5498,13 +5639,14 @@ $(document).ready (function () {
}); });
$("#submit-edit_item").click(function () { $("#button-edit_item").click(function () {
var type = $('#type').val(); var type = $('#type').val();
if($('#text-name').val() == ''){ if($('#text-name').val() == ''){
dialog_message('#message_no_name'); dialog_message('#message_no_name');
return false; return false;
} }
switch (type){ switch (type){
case 'agent_module': case 'agent_module':
case 'agent_module_status': case 'agent_module_status':
@ -5557,6 +5699,30 @@ $(document).ready (function () {
return false; return false;
} }
break; break;
case 'list_checks':
if ($("#text-agent").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'top_n_agents_sh':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_checks_failed':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_categories_checks':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
default: default:
break; break;
@ -6630,6 +6796,9 @@ function chooseType() {
$("#row_group_by").hide(); $("#row_group_by").hide();
$("#row_type_show").hide(); $("#row_type_show").hide();
$("#row_use_prefix_notation").hide(); $("#row_use_prefix_notation").hide();
$("#row_cat_security_hardening").hide();
$("#row_ignore_skipped").hide();
$("#row_status_check").hide();
// SLA list default state. // SLA list default state.
$("#sla_list").hide(); $("#sla_list").hide();
@ -7485,6 +7654,43 @@ function chooseType() {
$("#row_agent").show(); $("#row_agent").show();
break; break;
case 'top_n_agents_sh':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'top_n_checks_failed':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'top_n_categories_checks':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'vul_by_cat':
$("#row_group").show();
$("#row_cat_security_hardening").show();
$("#row_ignore_skipped").show();
break;
case 'list_checks':
$("#row_group").show();
$("#row_agent").show();
$("#row_cat_security_hardening").show();
$("#row_status_check").show();
break;
case 'scoring':
$("#row_group").show();
$('#row_period').show();
break;
case 'evolution':
$("#row_group").show();
$('#row_period').show();
break;
} }
switch (type) { switch (type) {

View File

@ -1990,6 +1990,50 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'top_n_agents_sh':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_checks_failed':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_categories_checks':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['ignore_skipped'] = get_parameter('ignore_skipped');
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
case 'scoring':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'evolution':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
default: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter( $values['top_n'] = get_parameter(
@ -2019,6 +2063,7 @@ switch ($action) {
|| ($values['type'] == 'event_report_agent') || ($values['type'] == 'event_report_agent')
|| ($values['type'] == 'agent_configuration') || ($values['type'] == 'agent_configuration')
|| ($values['type'] == 'group_configuration') || ($values['type'] == 'group_configuration')
|| ($values['type'] == 'list_checks')
) { ) {
$values['id_agent_module'] = ''; $values['id_agent_module'] = '';
} else { } else {
@ -2866,6 +2911,50 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'top_n_agents_sh':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_checks_failed':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_categories_checks':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['ignore_skipped'] = get_parameter('ignore_skipped');
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
case 'scoring':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'evolution':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
default: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter( $values['top_n'] = get_parameter(

View File

@ -0,0 +1,45 @@
<?php
/**
* Ajax script for Inventory
*
* @category Inventory
* @package Pandora FMS
* @subpackage Enterprises
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
check_login();
if (is_ajax() === true) {
$id_agent = get_parameter('id_agent', '0');
$id_server = get_parameter('id_server', '0');
if (is_metaconsole() === true) {
$agent_modules = [];
$server_name = metaconsole_get_names(['id' => $id_server]);
if (is_array($server_name) === true && count($server_name) > 0) {
$agent_modules = inventory_get_agent_modules($id_agent, 'all', $id_server, reset($server_name));
}
} else {
$agent_modules = inventory_get_agent_modules($id_agent);
}
echo json_encode($agent_modules);
}

View File

@ -252,6 +252,18 @@ $hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
echo $chart->render(true); echo $chart->render(true);
break; break;
case 'line_graph':
$params['pdf'] = true;
$params['options']['width'] = '100%';
$params['options']['height'] = 200;
$chart = get_build_setup_charts(
'LINE',
$params['options'],
$params['chart_data']
);
echo $chart->render(true);
break;
case 'slicebar': case 'slicebar':
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET. // TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
$params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true); $params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true);

View File

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

View File

@ -2567,6 +2567,10 @@ function db_get_column_type(string $table, string $column='')
*/ */
function db_validate_sql(string $sql, $server=false) function db_validate_sql(string $sql, $server=false)
{ {
if ($server == 0) {
$server = false;
}
if ($server !== false && is_metaconsole() === true) { if ($server !== false && is_metaconsole() === true) {
$setup = metaconsole_get_connection($server); $setup = metaconsole_get_connection($server);
if (metaconsole_connect($setup) !== NOERR) { if (metaconsole_connect($setup) !== NOERR) {

View File

@ -940,6 +940,57 @@ function reporting_make_reporting_data(
); );
break; break;
case 'top_n_agents_sh':
$report['contents'][] = reporting_top_n_agents_sh(
$report,
$content
);
break;
case 'top_n_checks_failed':
$report['contents'][] = reporting_top_n_checks_failed(
$report,
$content
);
break;
case 'top_n_categories_checks':
$report['contents'][] = reporting_top_n_categories_checks(
$report,
$content
);
break;
case 'vul_by_cat':
$report['contents'][] = reporting_vul_by_categories(
$report,
$content,
$type
);
break;
case 'list_checks':
$report['contents'][] = reporting_list_checks(
$report,
$content
);
break;
case 'scoring':
$report['contents'][] = reporting_scoring(
$report,
$content
);
break;
case 'evolution':
$report['contents'][] = reporting_evolution_hardening(
$report,
$content,
$type
);
break;
default: default:
// Default. // Default.
break; break;

View File

@ -475,6 +475,34 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
case 'ncm': case 'ncm':
reporting_html_ncm_config($table, $item); reporting_html_ncm_config($table, $item);
break; break;
case 'top_n_agents_sh':
reporting_html_top_n_agents_sh($table, $item);
break;
case 'top_n_checks_failed':
reporting_html_top_n_checks_failed($table, $item);
break;
case 'top_n_categories_checks':
reporting_html_top_n_categories_checks($table, $item);
break;
case 'vul_by_cat':
reporting_vul_by_cat_graph($table, $item);
break;
case 'list_checks':
reporting_html_list_checks($table, $item);
break;
case 'scoring':
reporting_html_scoring($table, $item);
break;
case 'evolution':
reporting_evolution_graph($table, $item);
break;
} }
if ($item['type'] == 'agent_module') { if ($item['type'] == 'agent_module') {
@ -490,6 +518,280 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
} }
/**
* Function to print the security hardening evolution.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
*
* @return void
*/
function reporting_evolution_graph($table, $item)
{
$table->rowclass[0] = '';
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
}
/**
* Function to print the agents scoring.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_scoring($table, $item, $pdf=0)
{
global $config;
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->width = '99%';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Date').'</b>';
$table1->head[1] = '<b>'.__('Agent').'</b>';
$table1->head[2] = '<b>'.__('Score').'</b>';
$row = 1;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][1] = date($config['date_format'], $check['date']);
$table1->data[$row][2] = $check['agent'];
$table1->data[$row][3] = $check['scoring'].' %';
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML checks filtered by agent and category.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_list_checks($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 4;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Id').'</b>';
$table1->head[1] = '<b>'.__('Title').'</b>';
$table1->head[2] = '<b>'.__('Category').'</b>';
$table1->head[3] = '<b>'.__('Status').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][0] = $check['id'];
$table1->data[$row][1] = $check['title'];
$table1->data[$row][2] = $check['category'];
$table1->data[$row][3] = $check['status'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top checks failed by category
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_categories_checks($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Id').'</b>';
$table1->head[1] = '<b>'.__('Category').'</b>';
$table1->head[2] = '<b>'.__('Total Failed').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][0] = $check['id'];
$table1->data[$row][1] = $check['category'];
$table1->data[$row][2] = $check['total'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top checks failed.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_checks_failed($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->headstyle[1] = 'width: 10%; text-align: center;';
$table1->style[2] = 'text-align: center;';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Title').'</b>';
$table1->head[1] = '<b>'.__('Total Failed').'</b>';
$table1->head[2] = '<b>'.__('Description').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][1] = $check['title'];
$table1->data[$row][2] = $check['total'];
$table1->data[$row][3] = $check['description'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top categories in graph.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
*
* @return void
*/
function reporting_vul_by_cat_graph($table, $item)
{
$table->rowclass[0] = '';
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
}
/**
* Function to print HTML top n agents from security hardening.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_agents_sh($table, $item, $pdf=0)
{
global $config;
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->headstyle = [];
$table1->width = '99%';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Agent').'</b>';
$table1->head[1] = '<b>'.__('Last audit scan').'</b>';
$table1->head[2] = '<b>'.__('Score').'</b>';
$row = 2;
foreach ($item['data'] as $key => $agent) {
$table1->data[$row][0] = $agent['alias'];
$table1->data[$row][1] = date($config['date_format'], $agent['utimestamp']);
$table1->data[$row][2] = $agent['datos'].' %';
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table, true);
}
}
/** /**
* Function to print to HTML SLA report. * Function to print to HTML SLA report.
* *

View File

@ -963,6 +963,43 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Network configuration changes'), 'name' => __('Network configuration changes'),
]; ];
if (enterprise_installed() === true) {
$types['top_n_agents_sh'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N agents with the worst score'),
];
$types['top_n_checks_failed'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N most frequent failed checks'),
];
$types['top_n_categories_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N checks failed by category'),
];
$types['vul_by_cat'] = [
'optgroup' => __('Security hardening'),
'name' => __('Vulnerabilities by category'),
];
$types['list_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('List of checks'),
];
$types['scoring'] = [
'optgroup' => __('Security hardening'),
'name' => __('Scoring by date'),
];
$types['evolution'] = [
'optgroup' => __('Security hardening'),
'name' => __('Evolution'),
];
}
return $types; return $types;
} }

View File

@ -609,12 +609,20 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
$tag = 'span'; $tag = 'span';
} }
if (empty($option['style']) === true) { if (empty($option['class']) === false) {
$style = 'class="'.($option['class'] ?? 'nowrap').'"'; $class = 'class="nowrap '.$option['class'].'"';
} else { } else {
$style = 'style="'.$option['style'].'"'; $class = 'class="nowrap"';
} }
if (empty($option['style']) === false) {
$style = 'style="'.$option['style'].'"';
} else {
$style = 'style=""';
}
$style .= ' '.$class;
if (empty($option['prominent']) === false) { if (empty($option['prominent']) === false) {
$prominent = $option['prominent']; $prominent = $option['prominent'];
} else { } else {

View File

@ -515,6 +515,26 @@ function line_graph(
$chart_data, $chart_data,
$options $options
) { ) {
if (empty($chart_data) === true) {
if (isset($options['ttl']) === true
&& (int) $options['ttl'] === 2
) {
$options['base64'] = true;
}
return graph_nodata_image($options);
}
if (isset($options['ttl']) === true && (int) $options['ttl'] === 2) {
$params = [
'chart_data' => $chart_data,
'options' => $options,
'return_img_base_64' => true,
];
return generator_chart_to_pdf('line_graph', $params);
}
$chart = get_build_setup_charts('LINE', $options, $chart_data); $chart = get_build_setup_charts('LINE', $options, $chart_data);
return $chart->render(true, true); return $chart->render(true, true);
} }

View File

@ -256,7 +256,7 @@ class InventoryWidget extends Widget
'arguments' => [ 'arguments' => [
'name' => 'free_search', 'name' => 'free_search',
'type' => 'text', 'type' => 'text',
'class' => 'w100p', 'class' => 'w96p',
'input_class' => 'flex-row', 'input_class' => 'flex-row',
'value' => $values['freeSearch'], 'value' => $values['freeSearch'],
'return' => true, 'return' => true,
@ -612,7 +612,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable( $table = ui_print_datatable(
[ [
'id' => $id_table, 'id' => $id_table,
'class' => 'info_table w100p', 'class' => 'info_table w96p',
'style' => 'width: 100%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $columns, 'column_names' => $columns,
@ -642,8 +642,8 @@ class InventoryWidget extends Widget
true, true,
true, true,
'', '',
'white-box-content w100p', 'white-box-content w96p',
'box-shadow white_table_graph w100p', 'box-shadow white_table_graph w96p',
'images/arrow_down_green.png', 'images/arrow_down_green.png',
'images/arrow_right_green.png', 'images/arrow_right_green.png',
false, false,
@ -666,8 +666,8 @@ class InventoryWidget extends Widget
true, true,
true, true,
'', '',
'white-box-content w100p', 'white-box-content w96p',
'box-shadow white_table_graph w100p', 'box-shadow white_table_graph w96p',
); );
} }
@ -682,7 +682,10 @@ class InventoryWidget extends Widget
'', '',
'', '',
false, false,
false false,
'',
'white-box-content',
'box-flat white_table_graph w96p'
); );
} }
} else { } else {
@ -729,7 +732,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable( $table = ui_print_datatable(
[ [
'id' => $id_table, 'id' => $id_table,
'class' => 'info_table w100p', 'class' => 'info_table w96p',
'style' => 'width: 100%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $columns, 'column_names' => $columns,
@ -759,8 +762,8 @@ class InventoryWidget extends Widget
true, true,
true, true,
'', '',
'white-box-content w100p', 'white-box-content w96p',
'box-shadow white_table_graph w100p', 'box-shadow white_table_graph w96p',
'images/arrow_down_green.png', 'images/arrow_down_green.png',
'images/arrow_right_green.png', 'images/arrow_right_green.png',
false, false,
@ -782,8 +785,8 @@ class InventoryWidget extends Widget
true, true,
true, true,
'', '',
'white-box-content w100p', 'white-box-content w96p',
'box-shadow white_table_graph w100p', 'box-shadow white_table_graph w96p',
); );
} }
@ -895,7 +898,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable( $table = ui_print_datatable(
[ [
'id' => $id_table, 'id' => $id_table,
'class' => 'info_table w100p', 'class' => 'info_table w96p',
'style' => 'width: 100%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $columns, 'column_names' => $columns,
@ -925,8 +928,8 @@ class InventoryWidget extends Widget
true, true,
true, true,
'', '',
'white-box-content w100p', 'white-box-content w96p',
'box-shadow white_table_graph w100p', 'box-shadow white_table_graph w96p',
'images/arrow_down_green.png', 'images/arrow_down_green.png',
'images/arrow_right_green.png', 'images/arrow_right_green.png',
false, false,
@ -947,7 +950,10 @@ class InventoryWidget extends Widget
'', '',
'', '',
false, false,
false false,
'',
'white-box-content',
'box-flat white_table_graph w96p'
); );
} }
} else { } else {
@ -986,7 +992,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable( $table = ui_print_datatable(
[ [
'id' => $id_table, 'id' => $id_table,
'class' => 'info_table w100p', 'class' => 'info_table w96p',
'style' => 'width: 100%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $columns, 'column_names' => $columns,
@ -1022,7 +1028,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable( $table = ui_print_datatable(
[ [
'id' => $id_table, 'id' => $id_table,
'class' => 'info_table w100p', 'class' => 'info_table w96p',
'style' => 'width: 100%', 'style' => 'width: 100%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $columns, 'column_names' => $columns,
@ -1049,7 +1055,7 @@ class InventoryWidget extends Widget
$id_agente = $inventory_id_agent; $id_agente = $inventory_id_agent;
$agentes = []; $agentes = [];
$data = []; $data = [];
$class = 'info_table w100p'; $class = 'info_table w96p';
$style = 'width: 100%; font-size: 100px !important;'; $style = 'width: 100%; font-size: 100px !important;';
$ordering = true; $ordering = true;
$searching = false; $searching = false;

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'> <div style='padding-bottom: 50px'>
<?php <?php
$version = '7.0NG.773.3'; $version = '7.0NG.773.3';
$build = '230919'; $build = '230921';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -32,55 +32,65 @@ use PandoraFMS\Enterprise\Metaconsole\Node;
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_inventory.php'; require_once $config['homedir'].'/include/functions_inventory.php';
// Get different date to search the report.
$utimestamp = (int) get_parameter('date_end', 0);
$datetime_end = strtotime($utimestamp.' '.$time_end);
// Calculate new inteval for all reports. // Calculate new inteval for all reports.
$date_end = get_parameter('date_end', 0);
$time_end = get_parameter('time_end');
$datetime_end = strtotime($date_end.' '.$time_end);
$custom_date = get_parameter('custom_date', 0); $custom_date = get_parameter('custom_date', 0);
$date = get_parameter('date', SECONDS_1DAY); $range = get_parameter('utimestamp', SECONDS_1DAY);
$date_text = get_parameter('date_text', SECONDS_1DAY); $date_text = get_parameter('utimestamp_text', SECONDS_1DAY);
$date_init_less = (strtotime(date('Y-m-j')) - SECONDS_1DAY); $date_init_less = (strtotime(date('Y/m/d')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less)); $date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less)); $time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
$datetime_init = strtotime($date_init.' '.$time_init);
if ($custom_date === '1') { if ($custom_date === '1') {
if ($datetime_init >= $datetime_end) { if ($datetime_init >= $datetime_end) {
$datetime_init = $date_init_less; $datetime_init = $date_init_less;
} }
$date_init = date('Y/m/d H:i:s', $datetime_init);
$date_end = date('Y/m/d H:i:s', $datetime_end);
$period = ($datetime_end - $datetime_init); $period = ($datetime_end - $datetime_init);
} else if ($custom_date === '2') { } else if ($custom_date === '2') {
$date_units = get_parameter('date_units'); $date_units = get_parameter('utimestamp_units');
$utimestamp = date('Y/m/d H:i:s'); $date_end = date('Y/m/d H:i:s');
$date_start = date('Y/m/d H:i:s', (strtotime($utimestamp) - ($date_text * $date_units))); $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - ((int) $date_text * (int) $date_units)));
$period = (strtotime($utimestamp) - strtotime($date_start)); $period = (strtotime($date_end) - strtotime($date_init));
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) { } else if (in_array($range, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($date === 'this_week') { if ($range === 'this_week') {
$monday = date('Y/m/d', strtotime('last monday')); $monday = date('Y/m/d', strtotime('last monday'));
$sunday = date('Y/m/d', strtotime($monday.' +6 days')); $sunday = date('Y/m/d', strtotime($monday.' +6 days'));
$period = (strtotime($sunday) - strtotime($monday)); $period = (strtotime($sunday) - strtotime($monday));
$date_init = $monday; $date_init = $monday;
$utimestamp = $sunday; $date_end = $sunday;
} else if ($date === 'this_month') { } else if ($range === 'this_month') {
$utimestamp = date('Y/m/d', strtotime('last day of this month')); $date_end = date('Y/m/d', strtotime('last day of this month'));
$first_of_month = date('Y/m/d', strtotime('first day of this month')); $first_of_month = date('Y/m/d', strtotime('first day of this month'));
$period = (strtotime($utimestamp) - strtotime($first_of_month)); $date_init = $first_of_month;
} else if ($date === 'past_month') { $period = (strtotime($date_end) - strtotime($first_of_month));
$utimestamp = date('Y/m/d', strtotime('last day of previous month')); } else if ($range === 'past_month') {
$date_end = date('Y/m/d', strtotime('last day of previous month'));
$first_of_month = date('Y/m/d', strtotime('first day of previous month')); $first_of_month = date('Y/m/d', strtotime('first day of previous month'));
$period = (strtotime($utimestamp) - strtotime($first_of_month)); $date_init = $first_of_month;
} else if ($date === 'past_week') { $period = (strtotime($date_end) - strtotime($first_of_month));
$utimestamp = date('Y-m-d', strtotime('sunday', strtotime('last week'))); } else if ($range === 'past_week') {
$first_of_week = date('Y-m-d', strtotime('monday', strtotime('last week'))); $date_end = date('Y/m/d', strtotime('sunday', strtotime('last week')));
$period = (strtotime($utimestamp) - strtotime($first_of_week)); $first_of_week = date('Y/m/d', strtotime('monday', strtotime('last week')));
$date_init = $first_of_week;
$period = (strtotime($date_end) - strtotime($first_of_week));
} }
} else { } else {
$utimestamp = date('Y/m/d H:i:s'); $date_end = date('Y/m/d H:i:s');
$date_start = date('Y/m/d H:i:s', (strtotime($utimestamp) - $date)); $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range));
$period = (strtotime($utimestamp) - strtotime($date_start)); $period = (strtotime($date_end) - strtotime($date_init));
} }
$date_init = strtotime($date_init);
$utimestamp = strtotime($date_end);
if (is_ajax() === true) { if (is_ajax() === true) {
$get_csv_url = (bool) get_parameter('get_csv_url'); $get_csv_url = (bool) get_parameter('get_csv_url');
$get_data_basic_info = (bool) get_parameter('get_data_basic_info'); $get_data_basic_info = (bool) get_parameter('get_data_basic_info');
@ -383,7 +393,6 @@ $inventory_id_group = (int) get_parameter('id_group');
$inventory_search_string = (string) get_parameter('search_string'); $inventory_search_string = (string) get_parameter('search_string');
$order_by_agent = (bool) get_parameter('order_by_agent'); $order_by_agent = (bool) get_parameter('order_by_agent');
$export = (string) get_parameter('export'); $export = (string) get_parameter('export');
$utimestamp = (int) get_parameter('utimestamp');
$submit_filter = (bool) get_parameter('srcbutton'); $submit_filter = (bool) get_parameter('srcbutton');
$pagination_url_parameters = [ $pagination_url_parameters = [
@ -665,14 +674,13 @@ $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
$params['input_name'] = 'agent'; $params['input_name'] = 'agent';
$params['value'] = $inventory_agent; $params['value'] = $inventory_agent;
$params['selectbox_id'] = 'module_inventory_general_view';
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['javascript_function_action_after_select'] = 'this.form.submit';
$params['use_hidden_input_idagent'] = true; $params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent'; $params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $inventory_id_agent; $params['hidden_input_idagent_value'] = $inventory_id_agent;
$params['javascript_function_action_after_select'] = 'loadModulesFromAgent';
if ($is_metaconsole === true) { if ($is_metaconsole === true) {
$params['print_input_id_server'] = true; $params['print_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-autocomplete_id_server'; $params['input_id_server_id'] = 'hidden-autocomplete_id_server';
@ -734,10 +742,10 @@ if (is_metaconsole() === false) {
'utimestamp', 'utimestamp',
true, true,
get_parameter('utimestamp', SECONDS_1DAY), get_parameter('utimestamp', SECONDS_1DAY),
$date_init, date('Y/m/d', $date_init),
$time_init, date('H:i:s', $date_init),
date('Y/m/d'), date('Y/m/d', $utimestamp),
date('H:i:s'), date('H:i:s', $utimestamp),
$date_text $date_text
) )
); );
@ -1354,7 +1362,7 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
/* <![CDATA[ */ /* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {
<?php if (is_metaconsole() === true) : ?> <?php if (is_metaconsole() === true) : ?>
active_inventory_submit(); //active_inventory_submit();
<?php endif; ?> <?php endif; ?>
$("#id_group").click ( $("#id_group").click (
function () { function () {
@ -1432,5 +1440,38 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
closeText: '<?php echo __('Close'); ?>' closeText: '<?php echo __('Close'); ?>'
});*/ });*/
}); });
function loadModulesFromAgent(e){
const id_agent = $('#hidden-autocomplete_id_agent').val();
const text_agent = $('#text-agent').val();
let server = 0;
if($('#hidden-autocomplete_id_server').length > 0) {
server = $('#hidden-autocomplete_id_server').val();
}
if(text_agent === 'All') return;
jQuery.ajax ({
data: {
id_agent,
page: 'include/ajax/inventory.ajax',
id_server: server
},
type: "POST",
url: action="<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
dataType: "json",
success: function (data) {
if (data) {
console.log(data);
$("#module_inventory_general_view").empty();
$("#module_inventory_general_view").append ($("<option value=basic>Basic info</option>"));
$("#module_inventory_general_view").append ($("<option value=0>All</option>"));
jQuery.each (data, function (id, value) {
$("#module_inventory_general_view").append ($("<option value=" + id + ">" + value + "</option>"));
});
}
}
});
}
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -97,29 +97,12 @@ $filename = (string) get_parameter('filename');
$date_mode = get_parameter('date_mode', 'none'); $date_mode = get_parameter('date_mode', 'none');
$period = null; $date_init = get_parameter('date_init', '');
switch ($date_mode) { if (empty($date_init) === false) {
case 'none': $date_end = get_parameter('date_end', time());
case 'end_time': $period = ($date_end - $date_init);
// Get different date to search the report. $date = date('Y-m-d', $date_end);
$date = (string) get_parameter('date', date('Y-m-j')); $time = date('H:i:s', $date_end);
$time = (string) get_parameter('time', date('h:iA'));
break;
case 'init_and_end_time':
// Get different date to search the report.
$date = (string) get_parameter('date', date('Y-m-j'));
$time = (string) get_parameter('time', date('h:iA'));
// Calculations in order to modify init date of the report
$date_init_less = (strtotime(date('Y-m-j')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date('Y-m-j', $date_init_less));
$time_init = get_parameter('time_init', date('h:iA'));
$datetime_init = strtotime($date_init.' '.$time_init);
$period = (strtotime($date.' '.$time) - $datetime_init);
break;
} }

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 230919 %define release 230921
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd
@ -23,7 +23,7 @@ Group: Productivity/Networking/Web/Utilities
Packager: Sancho Lerena <slerena@artica.es> Packager: Sancho Lerena <slerena@artica.es>
Prefix: /var/www/html Prefix: /var/www/html
BuildRoot: %{_tmppath}/%{name} BuildRoot: %{_tmppath}/%{name}
BuildArch: noarch BuildArch: x86_64
AutoReq: 0 AutoReq: 0
Requires: %{httpd_name} >= 2.0.0 Requires: %{httpd_name} >= 2.0.0
Requires: php >= 8.0 Requires: php >= 8.0
@ -109,3 +109,5 @@ fi
%{prefix}/pandora_console %{prefix}/pandora_console
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console %config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console
%attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console %attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console
%defattr(0744,%{httpd_user},%{httpd_group},0755)
%{prefix}/pandora_console/attachment/discovery

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 230919 %define release 230921
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd
@ -23,7 +23,7 @@ Group: Productivity/Networking/Web/Utilities
Packager: Sancho Lerena <slerena@artica.es> Packager: Sancho Lerena <slerena@artica.es>
Prefix: /opt/rh/httpd24/root/var/www/html Prefix: /opt/rh/httpd24/root/var/www/html
BuildRoot: %{_tmppath}/%{name} BuildRoot: %{_tmppath}/%{name}
BuildArch: noarch BuildArch: x86_64
AutoReq: 0 AutoReq: 0
Requires: httpd24-httpd Requires: httpd24-httpd
Requires: httpd24-mod_php >= 7.2 Requires: httpd24-mod_php >= 7.2
@ -93,3 +93,5 @@ fi
%{prefix}/pandora_console %{prefix}/pandora_console
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console %config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console
%attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console %attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console
%defattr(0744,%{httpd_user},%{httpd_group},0755)
%{prefix}/pandora_console/attachment/discovery

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 230919 %define release 230921
%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

@ -1674,6 +1674,9 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`macros_definition` TEXT, `macros_definition` TEXT,
`render_definition` TEXT, `render_definition` TEXT,
`use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1, `use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1,
`cat_security_hardening` INT NOT NULL DEFAULT 0,
`ignore_skipped` INT NOT NULL DEFAULT 0,
`status_of_check` TINYTEXT,
PRIMARY KEY(`id_rc`), PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.773.3-230919 Version: 7.0NG.773.3-230921
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.773.3-230919" pandora_version="7.0NG.773.3-230921"
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.773.3"; my $pandora_version = "7.0NG.773.3";
my $pandora_build = "230919"; my $pandora_build = "230921";
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.773.3"; my $pandora_version = "7.0NG.773.3";
my $pandora_build = "230919"; my $pandora_build = "230921";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 230919 %define release 230921
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}
@ -18,7 +18,7 @@ Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es> Packager: Sancho Lerena <slerena@artica.es>
Prefix: %{_datadir} Prefix: %{_datadir}
BuildRoot: %{_tmppath}/%{name}-buildroot BuildRoot: %{_tmppath}/%{name}-buildroot
BuildArchitectures: noarch BuildArchitectures: x86_64
AutoReq: 0 AutoReq: 0
Provides: %{name}-%{version} Provides: %{name}-%{version}
Requires(pre): shadow-utils Requires(pre): shadow-utils
@ -59,6 +59,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/netflow
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/sflow mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/sflow
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/trans mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/trans
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/commands mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/commands
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf.d/ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf.d/
@ -68,6 +69,23 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/pandora/.ssh mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/pandora/.ssh
mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/ mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/
# Copy open discovery plugins to data_in
if [ -d "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery" ]; then
echo ">Installing the open discovery scripts to $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery..."
for disco_folder in $(ls "discovery/"); do
if [ -d "discovery/"$disco_folder ]; then
if [ -d "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder" ]; then
rm -Rf "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder"
fi
cp -Rf "discovery/"$disco_folder "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder"
chmod -R 770 "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder"
fi
done
else
echo ">ERROR: Failed to copy open discovery scripts to $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery - Folder not found"
fi
# All binaries go to %{_bindir} # All binaries go to %{_bindir}
cp -aRf bin/pandora_server $RPM_BUILD_ROOT%{_bindir}/ cp -aRf bin/pandora_server $RPM_BUILD_ROOT%{_bindir}/
cp -aRf bin/pandora_exec $RPM_BUILD_ROOT%{_bindir}/ cp -aRf bin/pandora_exec $RPM_BUILD_ROOT%{_bindir}/

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 230919 %define release 230921
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.773.3" PI_VERSION="7.0NG.773.3"
PI_BUILD="230919" PI_BUILD="230921"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
@ -341,6 +341,23 @@ install () {
chown apache:$GROUPNAME $DESTDIR$PANDORA_SPOOL/data_in/customer_key 2>/dev/null chown apache:$GROUPNAME $DESTDIR$PANDORA_SPOOL/data_in/customer_key 2>/dev/null
# Copy open discovery plugins to data_in
if [ -d "$DESTDIR$PANDORA_SPOOL/data_in/discovery" ]; then
echo ">Installing the open discovery scripts to $DESTDIR$PANDORA_SPOOL/data_in/discovery..."
for disco_folder in $(ls "discovery/"); do
if [ -d "discovery/"$disco_folder ]; then
if [ -d "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder" ]; then
rm -Rf "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder"
fi
cp -Rf "discovery/"$disco_folder "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder"
chmod -R 770 "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder"
fi
done
else
echo ">ERROR: Failed to copy open discovery scripts to $DESTDIR$PANDORA_SPOOL/data_in/discovery/discovery - Folder not found"
fi
echo "Creating setup directory in $PANDORA_CFG_DIR" echo "Creating setup directory in $PANDORA_CFG_DIR"
mkdir -p $DESTDIR$PANDORA_CFG_DIR 2> /dev/null mkdir -p $DESTDIR$PANDORA_CFG_DIR 2> /dev/null
if [ -f "$DESTDIR$PANDORA_CFG_FILE" ] if [ -f "$DESTDIR$PANDORA_CFG_FILE" ]

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.773.3 Build 230919"; my $version = "7.0NG.773.3 Build 230921";
# 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.773.3 Build 230919"; my $version = "7.0NG.773.3 Build 230921";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);

View File

@ -1095,7 +1095,7 @@ Protocol description and more info at: L<< https://pandorafms.com/manual/en/docu
=head1 COPYRIGHT =head1 COPYRIGHT
Copyright (c) 2005-2023 Pandora FMS. Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L
=cut =cut