Daniel Cebrian 2023-07-28 13:54:51 +02:00
commit 022ccc6ace
26 changed files with 1174 additions and 19 deletions

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
COMMIT;

View File

@ -200,6 +200,14 @@ $text_agent_module = '';
$only_data = false;
$categories_security_hardening = [];
if (security_hardening_installed() === true) {
$categories_security_hardening = categories_of_cis();
foreach ($categories_security_hardening as $key => $cat) {
$categories_security_hardening[$key] = implode(' ', $cat);
}
}
// Users.
$id_users = [];
$users_groups = [];
@ -1019,6 +1027,16 @@ switch ($action) {
$idAgent = $item['id_agent'];
break;
case 'top_n_agents_sh':
$group = $item['id_group'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'vul_by_cat':
$group = $item['id_group'];
$cat_selected = $item['cat_security_hardening'];
break;
default:
// It's not possible.
break;
@ -3685,6 +3703,22 @@ $class = 'databox filters';
?>
</td>
</tr>
<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
if ($is_enterprise) {
?>
@ -6557,6 +6591,7 @@ function chooseType() {
$("#row_group_by").hide();
$("#row_type_show").hide();
$("#row_use_prefix_notation").hide();
$("#row_cat_security_hardening").hide();
// SLA list default state.
$("#sla_list").hide();
@ -7411,7 +7446,16 @@ function chooseType() {
case 'ncm':
$("#row_agent").show();
break;
case 'top_n_agents_sh':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'vul_by_cat':
$("#row_group").show();
$("#row_cat_security_hardening").show();
break;
}
switch (type) {

View File

@ -1987,6 +1987,18 @@ 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 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(
@ -2863,6 +2875,18 @@ 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 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/20/checkbox-on@svg</title>
<g id="Icons/Dark/20/checkbox-on" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle-2" stroke="#82b92e" stroke-width="2" x="1" y="1" width="18" height="18" rx="4"></rect>
<path d="M14.3713994,6.22237132 C14.8008905,5.87515972 15.4305323,5.94186038 15.7777439,6.37135141 C16.098247,6.76780467 16.0660673,7.33480068 15.7214138,7.69277628 L15.6287639,7.77769594 L8.20693177,13.7776959 C7.78987666,14.114854 7.18888164,14.0598005 6.83812914,13.672688 L6.76182606,13.5774872 L4.18365814,9.93238606 C3.86473931,9.48148781 3.97172977,8.85742777 4.42262802,8.53850895 C4.83884178,8.24412234 5.40260169,8.31264068 5.73770948,8.67956758 L5.81650513,8.77747883 L7.77861597,11.5510307 L14.3713994,6.22237132 Z" id="Path-10" fill="#82b92e" fill-rule="nonzero"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>Dark / 20 / delete-v2@svg</title>
<desc>Created with Sketch.</desc>
<g id="Dark-/-20-/-delete-v2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" transform="translate(10.000000, 10.000000) rotate(45.000000) translate(-10.000000, -10.000000) translate(4.000000, 4.000000)" fill="#e63c52">
<path d="M6,0 C6.51283584,0 6.93550716,0.38604019 6.99327227,0.883378875 L7,1 L7,5 L11,5 C11.5522847,5 12,5.44771525 12,6 C12,6.51283584 11.6139598,6.93550716 11.1166211,6.99327227 L11,7 L7,7 L7,11 C7,11.5522847 6.55228475,12 6,12 C5.48716416,12 5.06449284,11.6139598 5.00672773,11.1166211 L5,11 L5,7 L1,7 C0.44771525,7 0,6.55228475 0,6 C0,5.48716416 0.38604019,5.06449284 0.883378875,5.00672773 L1,5 L5,5 L5,1 C5,0.44771525 5.44771525,0 6,0 Z" id="Path-7"></path>
</g>
<path d="M10,0 C4.4771525,0 0,4.4771525 0,10 C0,15.5228475 4.4771525,20 10,20 C15.5228475,20 20,15.5228475 20,10 C20,4.4771525 15.5228475,0 10,0 Z M10,2 C14.418278,2 18,5.581722 18,10 C18,14.418278 14.418278,18 10,18 C5.581722,18 2,14.418278 2,10 C2,5.581722 5.581722,2 10,2 Z" id="Oval" fill="#e63c52"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Security scan@svg</title>
<g id="Security-scan" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M12,3 C13.6568542,3 15,4.34314575 15,6 L15,8 L13,8 L13,6 C13,5.44771525 12.5522847,5 12,5 L8,5 C7.44771525,5 7,5.44771525 7,6 L7,8 L5,8 L5,6 C5,4.34314575 6.34314575,3 8,3 L12,3 Z M4,0 C4.55228475,0 5,0.44771525 5,1 C5,1.51283584 4.61395981,1.93550716 4.11662113,1.99327227 L4,2 L2,2 L2,4.00298691 C2,4.51582275 1.61395981,4.93849407 1.11662113,4.99625918 L1,5.00298691 C0.487164161,5.00298691 0.0644928393,4.61694672 0.00672773133,4.11960803 L0,4.00298691 L0,1 C0,0.487164161 0.38604019,0.0644928393 0.883378875,0.00672773133 L1,0 L4,0 Z M19,0 L19.1166211,0.00672773133 C19.6139598,0.0644928393 20,0.487164161 20,1 L20,4.00298691 L19.9932723,4.11960803 C19.9355072,4.61694672 19.5128358,5.00298691 19,5.00298691 L18.8833789,4.99625918 C18.3860402,4.93849407 18,4.51582275 18,4.00298691 L18,2 L16,2 L15.8833789,1.99327227 C15.3860402,1.93550716 15,1.51283584 15,1 C15,0.44771525 15.4477153,0 16,0 L19,0 Z M1,15 L1.11662113,15.0067277 C1.61395981,15.0644928 2,15.4871642 2,16 L2,18.0029869 L4,18.0029869 L4.11662113,18.0097146 C4.61395981,18.0674797 5,18.4901511 5,19.0029869 C5,19.5552717 4.55228475,20.0029869 4,20.0029869 L1,20.0029869 L0.883378875,19.9962592 C0.38604019,19.9384941 0,19.5158227 0,19.0029869 L0,16 L0.00672773133,15.8833789 C0.0644928393,15.3860402 0.487164161,15 1,15 Z M19,15 C19.5128358,15 19.9355072,15.3860402 19.9932723,15.8833789 L20,16 L20,19.0029869 C20,19.5158227 19.6139598,19.9384941 19.1166211,19.9962592 L19,20.0029869 L16,20.0029869 C15.4477153,20.0029869 15,19.5552717 15,19.0029869 C15,18.4901511 15.3860402,18.0674797 15.8833789,18.0097146 L16,18.0029869 L18,18.0029869 L18,16 C18,15.4871642 18.3860402,15.0644928 18.8833789,15.0067277 L19,15 Z M15,12 L15,14 C15,15.1045695 14.1045695,16 13,16 L7,16 C5.8954305,16 5,15.1045695 5,14 L5,12 L15,12 Z M1,9 L19,9 C19.5522847,9 20,9.44771525 20,10 C20,10.5522847 19.5522847,11 19,11 L1,11 C0.44771525,11 6.76353751e-17,10.5522847 0,10 C-6.76353751e-17,9.44771525 0.44771525,9 1,9 Z" id="Path-54" fill="#3F3F3F"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -6202,6 +6202,57 @@ function html_print_input($data, $wrapper='div', $input_only=false)
<?php
break;
case 'datetime':
$date = (empty($data['value']) === true) ? '' : date('Y-m-d', $data['value']);
$time = (empty($data['value']) === true) ? '' : date('H:i:s', $data['value']);
ui_require_css_file('datepicker');
ui_include_time_picker();
ui_require_jquery_file(
'ui.datepicker-'.get_user_language(),
'include/javascript/i18n/'
);
$inputDate = html_print_input_text(
$data['name'].'_date',
$date,
'',
false,
10,
true,
false,
false,
'',
'',
'',
'off'
);
$inputTime = html_print_input_text(
$data['name'].'_time',
$time,
'',
false,
10,
true,
false,
false,
'',
'',
'',
'off'
);
$output .= html_print_div(
[
'content' => sprintf(
'<div class="datetime-adv-opt">%s<span>:</span>%s</div>',
$inputDate,
$inputTime
),
],
true
);
break;
default:
// Ignore.
break;

View File

@ -935,6 +935,20 @@ function reporting_make_reporting_data(
);
break;
case 'top_n_agents_sh':
$report['contents'][] = reporting_top_n_agents_sh(
$report,
$content
);
break;
case 'vul_by_cat':
$report['contents'][] = reporting_vul_by_categories(
$report,
$content
);
break;
default:
// Default.
break;

View File

@ -463,6 +463,14 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
case 'ncm':
reporting_html_ncm_config($table, $item);
break;
case 'top_n_agents_sh':
reporting_html_top_n_agents_sh($table, $item);
break;
case 'vul_by_cat':
reporting_vul_by_cat_graph($table, $item);
break;
}
if ($item['type'] == 'agent_module') {
@ -478,6 +486,32 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
}
function reporting_vul_by_cat_graph($table, $item)
{
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
}
function reporting_html_top_n_agents_sh($table, $item)
{
global $config;
$table->data[1][0] = '<b>'.__('Agent').'</b>';
$table->data[1][1] = '<b>'.__('Last audit scan').'</b>';
$table->data[1][2] = '<b>'.__('Score').'</b>';
$row = 2;
foreach ($item['data'] as $key => $agent) {
$table->data[$row][0] = $agent['alias'];
$table->data[$row][1] = date($config['date_format'], $agent['utimestamp']);
$table->data[$row][2] = $agent['datos'].' %';
$row++;
}
}
/**
* Function to print to HTML SLA report.
*

View File

@ -963,6 +963,18 @@ 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['vul_by_cat'] = [
'optgroup' => __('Security hardening'),
'name' => __('Vulnerabilities by category'),
];
}
return $types;
}

View File

@ -4054,7 +4054,7 @@ function ui_print_datatable(array $parameters)
'',
'',
$parameters['toggle_collapsed'],
false,
(isset($parameters['form']['return_filter']) === false) ? false : $parameters['form']['return_filter'],
'',
'no-border filter-datatable-submain',
'filter-datatable-main '.$parameters['filter_main_class']

View File

@ -486,6 +486,40 @@ function ring_graph(
}
/**
* Radar graph RADAR.
*
* @param array $chart_data Data.
* @param array $options Options.
*
* @return string Output html charts
*/
function radar_graph(
$chart_data,
$options
) {
$chart = get_build_setup_charts('RADAR', $options, $chart_data);
return $chart->render(true, true);
}
/**
* Line graph LINE.
*
* @param array $chart_data Data.
* @param array $options Options.
*
* @return string Output html charts
*/
function line_graph(
$chart_data,
$options
) {
$chart = get_build_setup_charts('LINE', $options, $chart_data);
return $chart->render(true, true);
}
function get_build_setup_charts($type, $options, $data)
{
global $config;
@ -505,6 +539,14 @@ function get_build_setup_charts($type, $options, $data)
$chart = $factory->create($factory::BAR);
break;
case 'RADAR':
$chart = $factory->create($factory::RADAR);
break;
case 'LINE':
$chart = $factory->create($factory::LINE);
break;
default:
// code...
break;
@ -649,6 +691,17 @@ function get_build_setup_charts($type, $options, $data)
}
$chart->options()->setMaintainAspectRatio($maintainAspectRatio);
if (isset($options['elements']) === true) {
if (isset($options['elements']['center']) === true) {
if (isset($options['elements']['center']['text']) === true) {
$chart->options()->getElements()->center()->setText($options['elements']['center']['text']);
}
if (isset($options['elements']['center']['color']) === true) {
$chart->options()->getElements()->center()->setColor($options['elements']['center']['color']);
}
}
}
// Set Responsive for responsive charts.
$responsive = true;
@ -942,19 +995,31 @@ function get_build_setup_charts($type, $options, $data)
) {
$scales = $chart->options()->getScales();
// Defaults scalesFont X.
$scalesXFonts = $scales->getX()->ticks()->getFonts();
$scalesXFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
$scalesXFonts->setStyle('normal');
$scalesXFonts->setWeight(600);
$scalesXFonts->setSize(((int) $config['font_size'] + 2));
if ($options['scales']['x'] !== false) {
// Defaults scalesFont X.
$scalesXFonts = $scales->getX()->ticks()->getFonts();
$scalesXFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
$scalesXFonts->setStyle('normal');
$scalesXFonts->setWeight(600);
$scalesXFonts->setSize(((int) $config['font_size'] + 2));
}
// Defaults scalesFont Y.
$scalesYFonts = $scales->getY()->ticks()->getFonts();
$scalesYFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
$scalesYFonts->setStyle('normal');
$scalesYFonts->setWeight(600);
$scalesYFonts->setSize(((int) $config['font_size'] + 2));
if ($options['scales']['y'] !== false) {
// Defaults scalesFont Y.
$scalesYFonts = $scales->getY()->ticks()->getFonts();
$scalesYFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
$scalesYFonts->setStyle('normal');
$scalesYFonts->setWeight(600);
$scalesYFonts->setSize(((int) $config['font_size'] + 2));
}
if ($options['scales']['r'] !== false) {
// Defaults scalesFont R.
$scalesRFonts = $scales->getR()->pointLabels()->getFonts();
$scalesRFonts->setStyle('normal');
$scalesRFonts->setWeight(600);
$scalesRFonts->setSize(((int) $config['font_size'] + 2));
}
if (isset($options['scales']['x']) === true
&& empty($options['scales']['x']) === false
@ -1045,6 +1110,50 @@ function get_build_setup_charts($type, $options, $data)
}
}
}
if (isset($options['scales']['r']) === true
&& empty($options['scales']['r']) === false
&& is_array($options['scales']['r']) === true
) {
if (isset($options['scales']['r']['pointLabels']) === true
&& empty($options['scales']['r']['pointLabels']) === false
&& is_array($options['scales']['r']['pointLabels']) === true
) {
if (isset($options['scales']['r']['pointLabels']['color']) === true) {
$scales->getR()->pointLabels()->setColor($options['scales']['r']['pointLabels']['color']);
}
if (isset($options['scales']['r']['grid']['display']) === true) {
$scales->getR()->grid()->setDrawOnChartArea($options['scales']['r']['grid']['display']);
}
if (isset($options['scales']['r']['grid']['color']) === true) {
$scales->getR()->grid()->setColor($options['scales']['r']['grid']['color']);
}
if (isset($options['scales']['r']['angleLines']['color']) === true) {
$scales->getR()->angleLines()->setColor($options['scales']['r']['angleLines']['color']);
}
if (isset($options['scales']['r']['pointLabels']['fonts']) === true
&& empty($options['scales']['r']['pointLabels']['fonts']) === false
&& is_array($options['scales']['r']['pointLabels']['fonts']) === true
) {
$scaleRpointLabelsFonts = $scales->getR()->pointLabels()->getFonts();
if (isset($options['scales']['r']['pointLabels']['fonts']['size']) === true) {
$scaleRpointLabelsFonts->setSize($options['scales']['r']['pointLabels']['fonts']['size']);
}
if (isset($options['scales']['r']['pointLabels']['fonts']['style']) === true) {
$scaleRpointLabelsFonts->setStyle($options['scales']['r']['pointLabels']['fonts']['style']);
}
if (isset($options['scales']['r']['pointLabels']['fonts']['weight']) === true) {
$scaleRpointLabelsFonts->setWeight($options['scales']['r']['pointLabels']['fonts']['weight']);
}
}
}
}
}
// Color.
@ -1102,12 +1211,45 @@ function get_build_setup_charts($type, $options, $data)
}
break;
case 'RADAR':
foreach ($data as $key => $dataset) {
$dataSet1 = $chart->createDataSet();
$dataSet1->setBackgroundColor($dataset['backgroundColor']);
$dataSet1->setBorderColor($dataset['borderColor']);
$dataSet1->setPointBackgroundColor($dataset['pointBackgroundColor']);
$dataSet1->setPointBorderColor($dataset['pointBorderColor']);
$dataSet1->setPointHoverBackgroundColor($dataset['pointHoverBackgroundColor']);
$dataSet1->setPointHoverBorderColor($dataset['pointHoverBorderColor']);
$dataSet1->data()->exchangeArray($dataset['data']);
$chart->addDataSet($dataSet1);
}
break;
case 'LINE':
$chart->labels()->exchangeArray($options['labels']);
foreach ($data as $key => $dataset) {
$dataSet1 = $chart->createDataSet();
$dataSet1->setLabel($dataset['label']);
$dataSet1->setBackgroundColor($dataset['backgroundColor']);
$dataSet1->setBorderColor($dataset['borderColor']);
$dataSet1->setPointBackgroundColor($dataset['pointBackgroundColor']);
$dataSet1->setPointBorderColor($dataset['pointBorderColor']);
$dataSet1->setPointHoverBackgroundColor($dataset['pointHoverBackgroundColor']);
$dataSet1->setPointHoverBorderColor($dataset['pointHoverBorderColor']);
$dataSet1->data()->exchangeArray($dataset['data']);
$chart->addDataSet($dataSet1);
}
break;
default:
// Not possible.
break;
}
$chart->addDataSet($setData);
if ($type !== 'RADAR' && $type !== 'LINE') {
$chart->addDataSet($setData);
}
return $chart;
}

View File

@ -1280,6 +1280,11 @@ p.center {
margin-right: 10px;
}
.margin-lr-5 {
margin-left: 5px;
margin-right: 5px;
}
.img_help {
cursor: help;
margin: 0 5px;

View File

@ -0,0 +1,126 @@
.details_table b {
font-size: 12px;
}
.details_table {
width: 99% !important;
}
.dataTables_length {
margin: 10px 0px 20px 20px;
}
.dataTables_paginate.paging_simple_numbers {
margin: 10px 20px 20px 0px;
margin-right: 20px !important;
}
.row-graphs {
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: center;
}
.col-md-3 {
width: 30%;
margin: 10px;
}
.col-md-6 {
width: 35%;
margin: 10px;
}
.text-fail {
font-size: 18px;
color: #e63c52;
display: flex;
align-items: center;
font-weight: 800;
}
.text-passed {
font-size: 18px;
color: #82b92e;
display: flex;
align-items: center;
font-weight: 800;
}
.text-passed img {
margin: 0px 5px 0px 11px;
}
.text-fail img {
margin: 0px 5px 0px 11px;
}
.text-calendar {
margin-left: 20px;
display: flex;
font-size: 13px;
align-items: center;
}
.text-scored b {
margin-left: 5px;
font-size: 13px;
align-items: center;
}
.text-calendar b {
font-size: 13px;
}
.text-calendar img {
margin-right: 10px;
}
.issues-audit {
margin: 11px 12px 0px 18px;
}
.pdd_b_40px {
padding-bottom: 40px !important;
}
.custom-filter {
width: 95%;
margin: 21px auto;
}
.time-line {
max-height: 300px;
}
.summary_categories {
width: 80%;
margin: 20px;
}
#list_total_resume .sorting_asc {
background-image: none;
}
#form_list_resume {
display: flex;
align-items: flex-end;
}
#form_list_total_resume {
display: flex;
align-items: flex-end;
}
@media (max-width: 1500px) {
.col-md-3 {
width: 40%;
}
.col-md-6 {
width: 88%;
}
.issues-audit {
justify-content: center;
}
.time-line {
max-height: 230px;
}
}

View File

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

View File

@ -42,6 +42,7 @@ ui_require_javascript_file('openlayers.pandora');
ui_require_css_file('agent_view');
enterprise_include_once('operation/agentes/ver_agente.php');
enterprise_include_once('include/functions_security_hardening.php');
check_login();
if (is_ajax()) {
@ -1744,6 +1745,20 @@ $external_tools['text'] = html_print_menu_button(
$external_tools['active'] = ($tab === 'external_tools');
if (enterprise_installed() === true && security_hardening_installed() === true) {
// External Tools tab.
$security_hardening['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=security_hardening&id_agente='.$id_agente,
'image' => 'images/security_scan@svg.svg',
'title' => __('Security hardening'),
],
true
);
$security_hardening['active'] = ($tab === 'security_hardening');
}
$onheader = [
'manage' => ($managetab ?? null),
'main' => ($maintab ?? null),
@ -1761,6 +1776,7 @@ $onheader = [
'sap_view' => ($saptab ?? null),
'ncm_view' => ($ncm_tab ?? null),
'external_tools' => ($external_tools ?? null),
'security_hardening' => ($security_hardening ?? null),
'incident' => ($incidenttab ?? null),
'omnishell' => ($omnishellTab ?? null),
];
@ -1941,6 +1957,10 @@ switch ($tab) {
$tab_name = __('External Tools');
break;
case 'security_hardening':
$tab_name = __('Security hardening');
break;
default:
$tab_name = '';
$help_header = '';
@ -2086,6 +2106,10 @@ switch ($tab) {
include 'external_tools.php';
break;
case 'security_hardening':
enterprise_include('operation/agentes/security_hardening.php');
break;
case 'extension':
$found = false;
foreach ($config['extensions'] as $extension) {

View File

@ -1656,6 +1656,7 @@ 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,
PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE

View File

@ -8,6 +8,7 @@ use Artica\PHPChartJS\Options\Elements\Arc;
use Artica\PHPChartJS\Options\Elements\Line;
use Artica\PHPChartJS\Options\Elements\Point;
use Artica\PHPChartJS\Options\Elements\Rectangle;
use Artica\PHPChartJS\Options\Elements\Center;
use JsonSerializable;
/**
@ -39,6 +40,11 @@ class Elements implements ArraySerializableInterface, JsonSerializable
*/
private $arc;
/**
* @var Center
*/
private $center;
/**
* @return Rectangle
*/
@ -119,6 +125,26 @@ class Elements implements ArraySerializableInterface, JsonSerializable
return $this->arc;
}
/**
* @return Center
*/
public function center()
{
if (is_null($this->center)) {
$this->center = new Center();
}
return $this->center;
}
/**
* @return Center
*/
public function getCenter()
{
return $this->center;
}
/**
* @return array
*/

View File

@ -0,0 +1,85 @@
<?php
namespace Artica\PHPChartJS\Options\Elements;
use Artica\PHPChartJS\ArraySerializableInterface;
use Artica\PHPChartJS\Delegate\ArraySerializable;
use JsonSerializable;
/**
* Class Center
* @package Artica\PHPChartJS\Options\Elements
*/
class Center implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
* Text center graph.
* @var string
*/
private $text;
/**
* Color text.
* @default '#000'
* @var string
*/
private $color;
/**
* Get text center graph.
*
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* Set text center graph.
*
* @param string $text Text center graph.
*
* @return self
*/
public function setText(string $text)
{
$this->text = $text;
return $this;
}
/**
* Get color text.
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set color text.
*
* @param string $color Color text.
*
* @return self
*/
public function setColor(string $color)
{
$this->color = $color;
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return $this->getArrayCopy();
}
}

View File

@ -4,7 +4,9 @@ namespace Artica\PHPChartJS\Options;
use Artica\PHPChartJS\ArraySerializableInterface;
use Artica\PHPChartJS\Delegate\ArraySerializable;
use Artica\PHPChartJS\Options\Scales\AngleLines;
use Artica\PHPChartJS\Options\Scales\GridLines;
use Artica\PHPChartJS\Options\Scales\PointLabels;
use Artica\PHPChartJS\Options\Scales\ScaleLabel;
use Artica\PHPChartJS\Options\Scales\Ticks;
use JsonSerializable;
@ -128,6 +130,13 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
*/
protected $grid;
/**
* AngleLines
*
* @var AngleLines
*/
protected $angleLines;
/**
* @var ScaleLabel
*/
@ -138,6 +147,11 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
*/
protected $ticks;
/**
* @var PointLabels
*/
protected $pointLabels;
/**
* @return string
*/
@ -158,7 +172,7 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
return $this;
}
/**
* @return string
*/
@ -579,6 +593,26 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
return $this->grid;
}
/**
* @return AngleLines
*/
public function getAngleLines()
{
return $this->angleLines;
}
/**
* @return AngleLines
*/
public function angleLines()
{
if (is_null($this->angleLines)) {
$this->angleLines = new AngleLines();
}
return $this->angleLines;
}
/**
* @return ScaleLabel
*/
@ -619,6 +653,31 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable
return $this->ticks;
}
/**
*
* @return PointLabels
*/
public function getPointLabels()
{
return $this->pointLabels;
}
/**
*
* @param PointLabels $pointLabels
*
* @return self
*/
public function pointLabels()
{
if (is_null($this->pointLabels)) {
$this->pointLabels = new PointLabels();
}
return $this->pointLabels;
}
/**
* @return array
*/

View File

@ -8,6 +8,8 @@ use Artica\PHPChartJS\Options\Scales\XAxis;
use Artica\PHPChartJS\Options\Scales\XAxisCollection;
use Artica\PHPChartJS\Options\Scales\YAxis;
use Artica\PHPChartJS\Options\Scales\YAxisCollection;
use Artica\PHPChartJS\Options\Scales\RAxis;
use Artica\PHPChartJS\Options\Scales\RAxisCollection;
use JsonSerializable;
/**
@ -28,6 +30,11 @@ class Scales implements ArraySerializableInterface, JsonSerializable
*/
private $y;
/**
* @var RAxisCollection
*/
private $r;
/**
* @return XAxis
*/
@ -44,6 +51,14 @@ class Scales implements ArraySerializableInterface, JsonSerializable
return new YAxis();
}
/**
* @return RAxis
*/
public function createR()
{
return new RAxis();
}
/**
* @return XAxis
*/
@ -68,6 +83,18 @@ class Scales implements ArraySerializableInterface, JsonSerializable
return $this->y;
}
/**
* @return RAxis
*/
public function getR()
{
if (is_null($this->r)) {
$this->r = new RAxis();
}
return $this->r;
}
/**
* @return array
*/

View File

@ -0,0 +1,135 @@
<?php
namespace Artica\PHPChartJS\Options\Scales;
use Artica\PHPChartJS\ArraySerializableInterface;
use Artica\PHPChartJS\Delegate\ArraySerializable;
use Artica\PHPChartJS\Delegate\NumberUtils;
use Artica\PHPChartJS\Delegate\StringUtils;
use JsonSerializable;
/**
* Class AngleLines
*
* @package Artica\PHPChartJS\Options\Scales
*/
class AngleLines implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
use StringUtils;
use NumberUtils;
/**
* @var bool
*/
private $display;
/**
* @var string|string[]
*/
private $color;
/**
* @var float[]|null
*/
private $borderDash;
/**
* @var float
*/
private $borderDashOffset;
/**
* @return bool
*/
public function isDisplay()
{
return $this->display;
}
/**
* @param bool $display
*
* @return $this
*/
public function setDisplay($display)
{
$this->display = $display;
return $this;
}
/**
* @return string|string[]
*/
public function getColor()
{
return $this->color;
}
/**
* @param string|string[] $color
*
* @return $this
*/
public function setColor($color)
{
if (is_array($color)) {
$this->color = $this->recursiveToString($color);
} else {
$this->color = is_null($color) ? null : strval($color);
}
return $this;
}
/**
* @return float[]|null
*/
public function getBorderDash()
{
return $this->borderDash;
}
/**
* @param float[] $borderDash
*
* @return $this
*/
public function setBorderDash($borderDash)
{
if (is_array($borderDash)) {
$this->borderDash = $this->recursiveToFloat($borderDash);
}
return $this;
}
/**
* @return float
*/
public function getBorderDashOffset()
{
return $this->borderDashOffset;
}
/**
* @param float $borderDashOffset
*
* @return $this
*/
public function setBorderDashOffset($borderDashOffset)
{
$this->borderDashOffset = floatval($borderDashOffset);
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return $this->getArrayCopy();
}
}

View File

@ -0,0 +1,263 @@
<?php
namespace Artica\PHPChartJS\Options\Scales;
use Artica\PHPChartJS\ArraySerializableInterface;
use Artica\PHPChartJS\Delegate\ArraySerializable;
use JsonSerializable;
use Artica\PHPChartJS\Options\Fonts;
/**
* Class Pointlabels
*
* @package Artica\PHPChartJS\Options\Scales
*/
class Pointlabels implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
* @var string
*/
private $backdropColor;
/**
* @var int
*/
private $backdropPadding;
/**
* @var int
*/
private $borderRadius;
/**
* @var string
*/
private $display;
/**
* @var string
*/
private $color;
/**
* @var Fonts
*/
private $font;
/**
* @var int
*/
private $padding;
/**
* @var bool
*/
private $centerPointLabels;
/**
* Get the value of backdropColor
*
* @return string
*/
public function getBackdropColor()
{
return $this->backdropColor;
}
/**
* Set the value of backdropColor
*
* @param string $backdropColor
*
* @return self
*/
public function setBackdropColor(string $backdropColor)
{
$this->backdropColor = $backdropColor;
return $this;
}
/**
* Get the value of backdropPadding
*
* @return int
*/
public function getBackdropPadding()
{
return $this->backdropPadding;
}
/**
* Set the value of backdropPadding
*
* @param int $backdropPadding
*
* @return self
*/
public function setBackdropPadding(int $backdropPadding)
{
$this->backdropPadding = $backdropPadding;
return $this;
}
/**
* Get the value of borderRadius
*
* @return int
*/
public function getBorderRadius()
{
return $this->borderRadius;
}
/**
* Set the value of borderRadius
*
* @param int $borderRadius
*
* @return self
*/
public function setBorderRadius(int $borderRadius)
{
$this->borderRadius = $borderRadius;
return $this;
}
/**
* Get the value of display
*
* @return string
*/
public function getDisplay()
{
return $this->display;
}
/**
* Set the value of display
*
* @param string $display
*
* @return self
*/
public function setDisplay(string $display)
{
$this->display = $display;
return $this;
}
/**
* Get the value of color
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set the value of color
*
* @param string $color
*
* @return self
*/
public function setColor(string $color)
{
$this->color = $color;
return $this;
}
/**
* Get the value of font
*
* @return string
*/
public function getFonts()
{
if (isset($this->font) === false) {
$this->font = new Fonts();
}
return $this->font;
}
/**
* Set the value of font
*
* @param string $font
*
* @return self
*/
public function setFonts(string $font)
{
$this->font = $font;
return $this;
}
/**
* Get the value of padding
*
* @return int
*/
public function getPadding()
{
return $this->padding;
}
/**
* Set the value of padding
*
* @param int $padding
*
* @return self
*/
public function setPadding(int $padding)
{
$this->padding = $padding;
return $this;
}
/**
* Get the value of centerPointLabels
*
* @return bool
*/
public function getCenterPointLabels()
{
return $this->centerPointLabels;
}
/**
* Set the value of centerPointLabels
*
* @param bool $centerPointLabels
*
* @return self
*/
public function setCenterPointLabels(bool $centerPointLabels)
{
$this->centerPointLabels = $centerPointLabels;
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return $this->getArrayCopy();
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Artica\PHPChartJS\Options\Scales;
use Artica\PHPChartJS\Options\Scale;
/**
* Class RAxis
*
* @package Artica\PHPChartJS\Options\Scales
*/
class RAxis extends Scale
{
}

View File

@ -0,0 +1,37 @@
<?php
namespace Artica\PHPChartJS\Options\Scales;
use Halfpastfour\Collection\Collection\ArrayAccess;
use Artica\PHPChartJS\ArraySerializableInterface;
use JsonSerializable;
/**
* Class RAxisCollection
*
* @package Artica\PHPChartJS\Collection
*/
class RAxisCollection extends ArrayAccess implements ArraySerializableInterface, JsonSerializable
{
/**
* @return array
*/
public function getArrayCopy()
{
$rows = [];
foreach ($this->data as $row) {
/** @var RAxis $row */
$rows[] = $row->getArrayCopy();
}
return $rows;
}
/**
* @return array
*/
public function jsonSerialize()
{
return $this->getArrayCopy();
}
}

View File

@ -2,7 +2,7 @@
################################################################################
#
# Copyright (c) 2007-2008 Ramon Novoa <rnovoa@artica.es>
# Copyright (c) 2007-2023 Pandora FMS.
# Copyright (c) 2007-2008 Artica Soluciones Tecnologicas S.L.
#
# 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