Merge branch 'ent-11807-security-hardening-console-informes' into 'develop'

Ent 11807 Security hardening: Console - Informes

See merge request artica/pandorafms!6292
This commit is contained in:
Rafael Ameijeiras 2023-09-20 07:59:02 +00:00
commit 65b4bba0c6
12 changed files with 745 additions and 38 deletions

View File

@ -62,4 +62,8 @@ INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES
-- 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;

View File

@ -200,6 +200,16 @@ $text_agent_module = '';
$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.
$id_users = [];
$users_groups = [];
@ -1019,6 +1029,51 @@ switch ($action) {
$idAgent = $item['id_agent'];
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:
// It's not possible.
break;
@ -3757,6 +3812,64 @@ if (is_metaconsole() === true) {
?>
</td>
</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
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 '</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(
'pandora_inventory',
ENTERPRISE_DIR.'/include/javascript/'
@ -5418,7 +5535,7 @@ $(document).ready (function () {
return false;
}
break;
case 'permissions_report':
case 'permissions_report':
if ($("#checkbox-select_by_group").prop("checked") && $("select#users_groups>option:selected").val() == undefined) {
dialog_message('#message_no_group');
return false;
@ -5428,6 +5545,30 @@ $(document).ready (function () {
return false;
}
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:
break;
}
@ -5498,13 +5639,14 @@ $(document).ready (function () {
});
$("#submit-edit_item").click(function () {
$("#button-edit_item").click(function () {
var type = $('#type').val();
if($('#text-name').val() == ''){
dialog_message('#message_no_name');
return false;
}
switch (type){
case 'agent_module':
case 'agent_module_status':
@ -5557,6 +5699,30 @@ $(document).ready (function () {
return false;
}
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:
break;
@ -6630,6 +6796,9 @@ function chooseType() {
$("#row_group_by").hide();
$("#row_type_show").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").hide();
@ -7484,7 +7653,44 @@ function chooseType() {
case 'ncm':
$("#row_agent").show();
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) {

View File

@ -1990,6 +1990,50 @@ switch ($action) {
$good_format = true;
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:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(
@ -2019,6 +2063,7 @@ switch ($action) {
|| ($values['type'] == 'event_report_agent')
|| ($values['type'] == 'agent_configuration')
|| ($values['type'] == 'group_configuration')
|| ($values['type'] == 'list_checks')
) {
$values['id_agent_module'] = '';
} else {
@ -2866,6 +2911,50 @@ switch ($action) {
$good_format = true;
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:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(

View File

@ -252,6 +252,18 @@ $hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
echo $chart->render(true);
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':
// 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);

View File

@ -335,66 +335,66 @@ class Diagnostics extends Wizard
$result = '';
if ($agentIdMasterServer !== 0) {
$agentMonitoring = [
'chartAgentsUnknown' => [
'chartAgentsUnknown' => [
'title' => __(
'Graph of the Agents Unknown module.'
),
'nameModule' => 'Agents_Unknown',
'idAgent' => $agentIdMasterServer,
],
'chartDatabaseMain' => [
'chartDatabaseMain' => [
'title' => __(
'Graph of the Database Maintenance module.'
),
'nameModule' => 'Database&#x20;Maintenance',
'idAgent' => $agentIdMasterServer,
],
'chartFreeDiskSpoolDir' => [
'chartFreeDiskSpoolDir' => [
'title' => __(
'Graph of the Free Disk Spool Dir module.'
),
'nameModule' => 'FreeDisk_SpoolDir',
'idAgent' => $agentIdMasterServer,
],
'chartFreeRAM' => [
'chartFreeRAM' => [
'title' => __('Graph of the Free RAM module.'),
'nameModule' => 'Free_RAM',
'idAgent' => $agentIdMasterServer,
],
'chartQueuedModules' => [
'chartQueuedModules' => [
'title' => __(
'Graph of the Queued Modules module.'
),
'nameModule' => 'Queued_Modules',
'idAgent' => $agentIdMasterServer,
],
'chartQueuedAlerts' => [
'chartQueuedAlerts' => [
'title' => __(
'Graph of the Queued Alerts total.'
),
'nameModule' => 'Queued_Alerts',
'idAgent' => $agentIdMasterServer,
],
'chartAlertServerStatus' => [
'chartAlertServerStatus' => [
'title' => __(
'Graph of the Alert Server Status.'
),
'nameModule' => 'Alert_Server_Status',
'idAgent' => $agentIdMasterServer,
],
'chartStatus' => [
'chartStatus' => [
'title' => __('Graph of the Status module.'),
'nameModule' => 'Status',
'idAgent' => $agentIdMasterServer,
],
'chartSystemLoadAVG' => [
'chartSystemLoadAVG' => [
'title' => __(
'Graph of the System Load AVG module.'
),
'nameModule' => 'System_Load_AVG',
'idAgent' => $agentIdMasterServer,
],
'chartExecutionTime' => [
'chartExecutionTime' => [
'title' => __(
'Graph of the Execution Time module.'
),

View File

@ -940,6 +940,57 @@ function reporting_make_reporting_data(
);
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.
break;

View File

@ -475,6 +475,34 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
case 'ncm':
reporting_html_ncm_config($table, $item);
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') {
@ -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.
*

View File

@ -963,6 +963,43 @@ function reports_get_report_types($template=false, $not_editor=false)
'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;
}

View File

@ -515,6 +515,26 @@ function line_graph(
$chart_data,
$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);
return $chart->render(true, true);
}

View File

@ -97,29 +97,12 @@ $filename = (string) get_parameter('filename');
$date_mode = get_parameter('date_mode', 'none');
$period = null;
switch ($date_mode) {
case 'none':
case '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'));
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;
$date_init = get_parameter('date_init', '');
if (empty($date_init) === false) {
$date_end = get_parameter('date_end', time());
$period = ($date_end - $date_init);
$date = date('Y-m-d', $date_end);
$time = date('H:i:s', $date_end);
}

View File

@ -1674,6 +1674,9 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`macros_definition` TEXT,
`render_definition` TEXT,
`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`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE

View File

@ -2,7 +2,7 @@
################################################################################
#
# Copyright (c) 2007-2008 Ramon Novoa <rnovoa@artica.es>
# Copyright (c) 2007-2023 Pandora FMS.
# Copyright (c) 2007-2023 Pandora FMS.
#
# tentacle_client.pl Tentacle Client. See https://pandorafms.com/docs/ for
# protocol description.
@ -1095,7 +1095,7 @@ Protocol description and more info at: L<< https://pandorafms.com/manual/en/docu
=head1 COPYRIGHT
Copyright (c) 2005-2023 Pandora FMS.
Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L
=cut