Merge remote-tracking branch 'origin/develop' into ent-12829-Cambiar-filtro-Regex-search-para-que-busque-en-la-query
This commit is contained in:
commit
1991b74b9b
|
@ -467,7 +467,7 @@ fi
|
|||
|
||||
# Script banner at start
|
||||
echo " "
|
||||
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
|
||||
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2024 PandoraFMS"
|
||||
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
|
||||
echo " "
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.775-240214
|
||||
Version: 7.0NG.775-240220
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.775-240214"
|
||||
pandora_version="7.0NG.775-240220"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1039,7 +1039,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.775';
|
||||
use constant AGENT_BUILD => '240214';
|
||||
use constant AGENT_BUILD => '240220';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.775"
|
||||
PI_BUILD="240214"
|
||||
PI_BUILD="240220"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -579,7 +579,7 @@ fi
|
|||
|
||||
# Script banner at start
|
||||
echo " "
|
||||
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
|
||||
echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2024 PandoraFMS"
|
||||
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
|
||||
echo " "
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{240214}
|
||||
{240220}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.775 Build 240214")
|
||||
#define PANDORA_VERSION ("7.0NG.775 Build 240220")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.775(Build 240214))"
|
||||
VALUE "ProductVersion", "(7.0NG.775(Build 240220))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.775-240214
|
||||
Version: 7.0NG.775-240220
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.775-240214"
|
||||
pandora_version="7.0NG.775-240220"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -394,7 +394,7 @@ function quickShellSettings()
|
|||
__('Address'),
|
||||
html_print_input_text(
|
||||
'gotty_addr',
|
||||
$config['gotty_addr'],
|
||||
($config['gotty_addr'] ?? ''),
|
||||
'',
|
||||
30,
|
||||
100,
|
||||
|
@ -443,9 +443,8 @@ function quickShellSettings()
|
|||
html_print_checkbox_switch(
|
||||
'gotty_ssh_use_ssl',
|
||||
1,
|
||||
$config['gotty_ssh_use_ssl'],
|
||||
true,
|
||||
$disable_agentaccess
|
||||
($config['gotty_ssh_use_ssl'] ?? false),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -497,7 +496,7 @@ function quickShellSettings()
|
|||
html_print_checkbox_switch(
|
||||
'gotty_telnet_use_ssl',
|
||||
1,
|
||||
$config['gotty_telnet_use_ssl'],
|
||||
($config['gotty_telnet_use_ssl'] ?? false),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b
|
||||
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
||||
pandorafms.mysql=ca7dd8b80a1a03a25eb0fb077818ad63
|
||||
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
||||
pandorafms.oracle=abdfd7280f76276f696115cabdac731e
|
||||
pandorafms.db2=122f2abff0ec1d668c35ee0911483021
|
||||
|
|
|
@ -58,9 +58,43 @@ UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FRO
|
|||
|
||||
-- Update version for plugin oracle
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
|
||||
-- Update version for plugin mysql
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.mysql';
|
||||
|
||||
|
||||
SET @widget_id = NULL;
|
||||
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = 'GisMap';
|
||||
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,'GisMap','GisMap','Gis map','','GisMap.php');
|
||||
|
||||
SET @class_name = 'ITSMIncidences';
|
||||
SET @unique_name = 'ITSMIncidences';
|
||||
SET @description = 'Pandora ITSM tickets';
|
||||
SET @page = 'ITSMIncidences.php';
|
||||
SET @widget_id = NULL;
|
||||
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
||||
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
||||
|
||||
-- Create SNMPv3 credentials for recon tasks and update them
|
||||
SET @creds_name = 'Recon-SNMP-creds-';
|
||||
INSERT IGNORE INTO `tcredential_store` (`identifier`, `id_group`, `product`, `extra_1`)
|
||||
SELECT
|
||||
CONCAT(@creds_name,`id_rt`) AS `identifier`,
|
||||
`id_group`,
|
||||
'SNMP' AS `product`,
|
||||
CONCAT(
|
||||
'{',
|
||||
'"community":"',`snmp_community`,'",',
|
||||
'"version":"',`snmp_version`,'",',
|
||||
'"securityLevelV3":"',`snmp_security_level`,'",',
|
||||
'"authUserV3":"',`snmp_auth_user`,'",',
|
||||
'"authMethodV3":"',`snmp_auth_method`,'",',
|
||||
'"authPassV3":"',`snmp_auth_pass`,'",',
|
||||
'"privacyMethodV3":"',`snmp_privacy_method`,'",',
|
||||
'"privacyPassV3":"',`snmp_privacy_pass`,'"',
|
||||
'}'
|
||||
) AS `extra1`
|
||||
FROM `trecon_task` WHERE `snmp_version` = 3 AND `snmp_enabled` = 1
|
||||
;
|
||||
UPDATE `trecon_task` SET `auth_strings` = IF(`auth_strings` = '',CONCAT(@creds_name,`id_rt`),CONCAT(@creds_name,`id_rt`,',',`auth_strings`)) WHERE `snmp_version` = 3 AND `snmp_enabled` = 1;
|
||||
|
||||
COMMIT;
|
|
@ -54,7 +54,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||
// ======= Servers List ===============================================
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
$servers['all'] = (int) count((servers_get_info() ?? []));
|
||||
if ($servers['all'] != 0) {
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
|
|
|
@ -357,7 +357,18 @@ if ($new_agent === false) {
|
|||
$tableAgent->data['caption_name'][0] = __('Agent name');
|
||||
$tableAgent->rowclass['name'] = 'w540px';
|
||||
$tableAgent->cellstyle['name'][0] = 'width: 100%;';
|
||||
$tableAgent->data['name'][0] = html_print_input_text('agente', $nombre_agente, '', 76, 100, true, false, false, '', 'w100p');
|
||||
$tableAgent->data['name'][0] = html_print_input_text(
|
||||
'agente',
|
||||
$nombre_agente,
|
||||
'',
|
||||
76,
|
||||
100,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
'w100p'
|
||||
);
|
||||
$tableAgent->data['name'][0] .= html_print_div(
|
||||
[
|
||||
'class' => 'moduleIdBox',
|
||||
|
@ -365,6 +376,29 @@ if ($new_agent === false) {
|
|||
],
|
||||
true
|
||||
);
|
||||
|
||||
// Other than Linux, Solaris, AIX, BSD, HPUX, MacOs, and Windows.
|
||||
if ($id_os !== LINUX && $id_os !== SOLARIS && $id_os !== AIX
|
||||
&& $id_os !== BSD && $id_os !== HPUX && $id_os !== MACOS
|
||||
&& $id_os !== WINDOWS
|
||||
) {
|
||||
$tableAgent->data['name'][0] .= html_print_anchor(
|
||||
[
|
||||
'content' => html_print_image(
|
||||
'images/edit.svg',
|
||||
true,
|
||||
[
|
||||
'border' => 0,
|
||||
'title' => __('Edit agent name'),
|
||||
'class' => 'main_menu_icon invert_filter after_input_icon forced_title clickable',
|
||||
'onclick' => 'editAgent()',
|
||||
]
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Agent options for QR code.
|
||||
$agent_options_update = 'agent_options_update';
|
||||
}
|
||||
|
@ -1491,7 +1525,6 @@ ui_require_jquery_file('bgiframe');
|
|||
128
|
||||
);
|
||||
}
|
||||
$("#text-agente").prop('readonly', true);
|
||||
|
||||
|
||||
$("#text-direccion").on('change',function(e){
|
||||
|
@ -1538,6 +1571,39 @@ ui_require_jquery_file('bgiframe');
|
|||
}
|
||||
}
|
||||
|
||||
function editAgent() {
|
||||
$(`#text-agente`).attr(`readonly`, false);
|
||||
const title = '<?php echo __('Warning'); ?>';
|
||||
const text = '<?php echo __('Change the internal name of the agent may cause duplicity and malfunction'); ?>';
|
||||
const id = uniqId();
|
||||
$("body").append('<div title="' + title + '" id="' + id + '"></div>');
|
||||
$("#" + id).empty();
|
||||
$("#" + id).append(text);
|
||||
$("#" + id).dialog({
|
||||
height: 150,
|
||||
width: 528,
|
||||
opacity: 1,
|
||||
modal: true,
|
||||
position: {
|
||||
my: "center",
|
||||
at: "center",
|
||||
of: window,
|
||||
collision: "fit"
|
||||
},
|
||||
title: title,
|
||||
closeOnEscape: true,
|
||||
buttons: [{
|
||||
text: "OK",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}],
|
||||
open: function(event, ui) {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
},
|
||||
}).show();
|
||||
}
|
||||
|
||||
|
||||
function check_unique_ip() {
|
||||
const direccion = $('#text-direccion').val();
|
||||
|
|
|
@ -949,6 +949,13 @@ if ($update_agent) {
|
|||
$mssg_warning = 0;
|
||||
$id_agente = (int) get_parameter_post('id_agente');
|
||||
$nombre_agente = str_replace('`', '‘', (string) get_parameter_post('agente', ''));
|
||||
$repeated_name = db_get_row_sql(
|
||||
sprintf(
|
||||
'SELECT nombre FROM tagente WHERE id_agente <> %s AND nombre like "%s"',
|
||||
$id_agente,
|
||||
$nombre_agente
|
||||
)
|
||||
);
|
||||
$alias_safe_output = strip_tags(io_safe_output(get_parameter('alias', '')));
|
||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||
|
@ -1077,14 +1084,17 @@ if ($update_agent) {
|
|||
}
|
||||
}
|
||||
|
||||
// Verify if there is another agent with the same name but different ID.
|
||||
if (empty($repeated_name) === false) {
|
||||
ui_print_error_message(__('Agent with repeated name'));
|
||||
}
|
||||
|
||||
if ($mssg_warning) {
|
||||
ui_print_warning_message(__('The ip or dns name entered cannot be resolved'));
|
||||
}
|
||||
|
||||
// Verify if there is another agent with the same name but different ID.
|
||||
if ($alias == '') {
|
||||
ui_print_error_message(__('No agent alias specified'));
|
||||
// If there is an agent with the same name, but a different ID.
|
||||
}
|
||||
|
||||
$old_group = agents_get_agent_group($id_agente);
|
||||
|
@ -1139,13 +1149,16 @@ if ($update_agent) {
|
|||
'ignore_unknown' => $ignore_unknown,
|
||||
];
|
||||
|
||||
if (empty($repeated_name) === true) {
|
||||
$values['nombre'] = $nombre_agente;
|
||||
}
|
||||
|
||||
if ($config['metaconsole_agent_cache'] == 1) {
|
||||
$values['update_module_count'] = 1;
|
||||
// Force an update of the agent cache.
|
||||
}
|
||||
|
||||
$result = db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]);
|
||||
|
||||
$result = (bool) db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]);
|
||||
if ($result === false && $update_custom_result == false) {
|
||||
ui_print_error_message(
|
||||
__('There was a problem updating the agent')
|
||||
|
|
|
@ -697,7 +697,7 @@ if ($agents !== false) {
|
|||
$tableAgents->head = [];
|
||||
$tableAgents->data = [];
|
||||
// Header.
|
||||
$tableAgents->head[0] = '<span>'.__('Agent name').'</span>';
|
||||
$tableAgents->head[0] = '<span>'.__('Agent alias').'</span>';
|
||||
$tableAgents->head[0] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown);
|
||||
$tableAgents->head[1] = '<span title=\''.__('Remote agent configuration').'\'>'.__('R').'</span>';
|
||||
$tableAgents->head[1] .= ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown);
|
||||
|
|
|
@ -5941,6 +5941,7 @@ ui_require_javascript_file('pandora');
|
|||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
const ACTION = '<?php echo $actionParameter; ?>';
|
||||
$(document).ready (function () {
|
||||
chooseType();
|
||||
chooseSQLquery();
|
||||
|
@ -7601,6 +7602,12 @@ function chooseType() {
|
|||
$("#row_ncm_group").hide();
|
||||
$("#row_ncm_agent").hide();
|
||||
|
||||
if (ACTION !== 'update') {
|
||||
// Set default period value, this value will be change for each report.
|
||||
period_set_value($("#hidden-period").attr('class'), 300);
|
||||
$("#row_period").find('select').val('300').trigger('change');
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case 'event_report_group':
|
||||
$("#row_description").show();
|
||||
|
@ -7763,8 +7770,10 @@ function chooseType() {
|
|||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
period_set_value($("#hidden-period").attr('class'), 3600);
|
||||
$("#row_period").find('select').val('3600').trigger('change');
|
||||
if (ACTION !== 'update') {
|
||||
period_set_value($("#hidden-period").attr('class'), 3600);
|
||||
$("#row_period").find('select').val('3600').trigger('change');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'SLA_monthly':
|
||||
|
|
|
@ -450,6 +450,35 @@ class HostDevices extends Wizard
|
|||
|
||||
if (isset($this->task['id_rt']) === false) {
|
||||
// Create.
|
||||
$default_templates = [
|
||||
io_safe_input('Linux System'),
|
||||
io_safe_input('Windows System'),
|
||||
io_safe_input('Windows Hardware'),
|
||||
io_safe_input('Network Management'),
|
||||
];
|
||||
|
||||
$default_templates_ids = db_get_all_rows_sql(
|
||||
'SELECT id_np
|
||||
FROM tnetwork_profile
|
||||
WHERE name IN ('.implode(
|
||||
',',
|
||||
array_map(
|
||||
function ($template) {
|
||||
return "'".$template."'";
|
||||
},
|
||||
$default_templates
|
||||
)
|
||||
).')
|
||||
ORDER BY name'
|
||||
);
|
||||
|
||||
if ($default_templates_ids !== false) {
|
||||
$this->task['id_network_profile'] = implode(
|
||||
',',
|
||||
array_column($default_templates_ids, 'id_np'),
|
||||
);
|
||||
}
|
||||
|
||||
$this->task['id_rt'] = db_process_sql_insert(
|
||||
'trecon_task',
|
||||
$this->task
|
||||
|
@ -1100,12 +1129,9 @@ class HostDevices extends Wizard
|
|||
'arguments' => [
|
||||
'name' => 'id_network_profile[]',
|
||||
'type' => 'select_from_sql',
|
||||
'sql' => 'SELECT tn.id_np, tn.name
|
||||
FROM tnetwork_profile tn
|
||||
LEFT JOIN `tnetwork_profile_pen` tp
|
||||
ON tp.id_np = tn.id_np
|
||||
WHERE tp.id_np IS NULL
|
||||
ORDER BY tn.name',
|
||||
'sql' => 'SELECT id_np, name
|
||||
FROM tnetwork_profile
|
||||
ORDER BY name',
|
||||
'return' => true,
|
||||
'selected' => explode(
|
||||
',',
|
||||
|
@ -1273,114 +1299,86 @@ class HostDevices extends Wizard
|
|||
],
|
||||
];
|
||||
|
||||
// SNMP Options pack v3.
|
||||
$form['inputs'][] = [
|
||||
'hidden' => 1,
|
||||
'block_id' => 'snmp_options_v3',
|
||||
'class' => 'indented',
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => '<b>'.__('Context').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_context',
|
||||
'type' => 'text',
|
||||
'value' => $this->task['snmp_community'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
$show_snmp_auth = false;
|
||||
if (isset($this->task['snmp_enabled']) && $this->task['snmp_enabled'] > 0
|
||||
&& isset($this->task['snmp_version']) && $this->task['snmp_version'] == 3
|
||||
) {
|
||||
$show_snmp_auth = true;
|
||||
}
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Auth user').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_auth_user',
|
||||
'type' => 'text',
|
||||
'value' => $this->task['snmp_auth_user'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Security level').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_security_level',
|
||||
'type' => 'select',
|
||||
'fields' => [
|
||||
'noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'),
|
||||
'authPriv' => __('Auth and privacy method'),
|
||||
],
|
||||
'selected' => $this->task['snmp_security_level'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Auth method').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_auth_method',
|
||||
'type' => 'select',
|
||||
'fields' => [
|
||||
'MD5' => __('MD5'),
|
||||
'SHA' => __('SHA'),
|
||||
],
|
||||
'selected' => $this->task['snmp_auth_method'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Auth password').'</b>'.ui_print_help_tip(
|
||||
__(
|
||||
'The pass length must be eight character minimum.'
|
||||
),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'name' => 'snmp_auth_pass',
|
||||
'type' => 'password',
|
||||
'value' => $this->task['snmp_auth_pass'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Privacy method').'</b>',
|
||||
'arguments' => [
|
||||
'name' => 'snmp_privacy_method',
|
||||
'type' => 'select',
|
||||
'fields' => [
|
||||
'DES' => __('DES'),
|
||||
'AES' => __('AES'),
|
||||
],
|
||||
'selected' => $this->task['snmp_privacy_method'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '<b>'.__('Privacy pass').'</b>'.ui_print_help_tip(
|
||||
__(
|
||||
'The pass length must be eight character minimum.'
|
||||
),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'name' => 'snmp_privacy_pass',
|
||||
'type' => 'password',
|
||||
'value' => $this->task['snmp_privacy_pass'],
|
||||
'size' => 15,
|
||||
'return' => true,
|
||||
|
||||
],
|
||||
],
|
||||
include_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||
$all_snmp_keys = CredentialStore::getAll(
|
||||
[
|
||||
'cs.*',
|
||||
'tg.nombre as `group`',
|
||||
],
|
||||
];
|
||||
['product' => 'SNMP']
|
||||
);
|
||||
|
||||
if (is_array($all_snmp_keys) === true) {
|
||||
// Improve usage and decode output.
|
||||
$snmp_available_keys = array_reduce(
|
||||
$all_snmp_keys,
|
||||
function ($carry, $item) {
|
||||
$item['extra_1'] = io_output_password($item['extra_1']);
|
||||
|
||||
$extra1 = json_decode($item['extra_1'], true);
|
||||
if ($extra1 !== null && $extra1['version'] == 3) {
|
||||
$carry[$item['identifier']] = $item['identifier'];
|
||||
}
|
||||
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'UM')) {
|
||||
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
|
||||
'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox'
|
||||
).'" >';
|
||||
$link_to_cs .= __('No credentials available').', ';
|
||||
$link_to_cs .= strtolower(__('Manage credentials')).'</a>';
|
||||
} else {
|
||||
$link_to_cs = __('No credentials available');
|
||||
}
|
||||
|
||||
if (count($snmp_available_keys) > 0) {
|
||||
$form['inputs'][] = [
|
||||
'block_id' => 'auth_block_snmp',
|
||||
'class' => 'indented',
|
||||
'hidden' => !$show_snmp_auth,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Credentials to try with'),
|
||||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'name' => 'auth_strings[]',
|
||||
'fields' => $snmp_available_keys,
|
||||
'selected' => explode(
|
||||
',',
|
||||
$this->task['auth_strings']
|
||||
),
|
||||
|
||||
'multiple' => true,
|
||||
'class' => 'select_multiple',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
} else {
|
||||
$form['inputs'][] = [
|
||||
'block_id' => 'auth_block_snmp',
|
||||
'class' => 'indented',
|
||||
'hidden' => !$show_snmp_auth,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Credentials to try with'),
|
||||
'extra' => $link_to_cs,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
// Input: Enforce os detection.
|
||||
$form['inputs'][] = [
|
||||
|
@ -1453,14 +1451,12 @@ class HostDevices extends Wizard
|
|||
|
||||
// AUTH CONFIGURATION.
|
||||
$show_auth = false;
|
||||
if ((isset($this->task['wmi_enabled']) && $this->task['wmi_enabled'] > 0)
|
||||
|| (isset($this->task['rcmd_enabled']) && $this->task['rcmd_enabled'] > 0)
|
||||
) {
|
||||
if (isset($this->task['wmi_enabled']) && $this->task['wmi_enabled'] > 0) {
|
||||
$show_auth = true;
|
||||
}
|
||||
|
||||
include_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||
$available_keys = CredentialStore::getKeys('WMI');
|
||||
$wmi_available_keys = CredentialStore::getKeys('WMI');
|
||||
if (check_acl($config['id_user'], 0, 'UM')) {
|
||||
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
|
||||
'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox'
|
||||
|
@ -1471,9 +1467,9 @@ class HostDevices extends Wizard
|
|||
$link_to_cs = __('No credentials available');
|
||||
}
|
||||
|
||||
if (count($available_keys) > 0) {
|
||||
if (count($wmi_available_keys) > 0) {
|
||||
$form['inputs'][] = [
|
||||
'block_id' => 'auth_block',
|
||||
'block_id' => 'auth_block_wmi',
|
||||
'class' => 'indented',
|
||||
'hidden' => !$show_auth,
|
||||
'block_content' => [
|
||||
|
@ -1482,7 +1478,7 @@ class HostDevices extends Wizard
|
|||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'name' => 'auth_strings[]',
|
||||
'fields' => CredentialStore::getKeys('WMI'),
|
||||
'fields' => $wmi_available_keys,
|
||||
'selected' => explode(
|
||||
',',
|
||||
$this->task['auth_strings']
|
||||
|
@ -1496,12 +1492,12 @@ class HostDevices extends Wizard
|
|||
];
|
||||
} else {
|
||||
$form['inputs'][] = [
|
||||
'block_id' => 'auth_block',
|
||||
'block_id' => 'auth_block_wmi',
|
||||
'class' => 'indented',
|
||||
'hidden' => !$show_auth,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Credentials'),
|
||||
'label' => __('Credentials to try with'),
|
||||
'extra' => $link_to_cs,
|
||||
],
|
||||
],
|
||||
|
@ -1520,11 +1516,11 @@ class HostDevices extends Wizard
|
|||
function SNMPExtraShow(target) {
|
||||
$("#snmp_options_basic").hide();
|
||||
$("#snmp_options_skip_non_enabled_ifs").hide();
|
||||
$("#snmp_options_v3").hide();
|
||||
$("#auth_block_snmp").hide();
|
||||
if (document.getElementsByName("snmp_enabled")[0].checked) {
|
||||
$("#snmp_extra").show();
|
||||
if (target == 3) {
|
||||
$("#snmp_options_v3").show();
|
||||
$("#auth_block_snmp").show();
|
||||
} else {
|
||||
$("#snmp_options_basic").show();
|
||||
$("#snmp_options_skip_non_enabled_ifs").show();
|
||||
|
@ -1554,7 +1550,7 @@ class HostDevices extends Wizard
|
|||
$("#snmp_extra").hide();
|
||||
$("#snmp_options_basic").hide();
|
||||
$("#snmp_options_skip_non_enabled_ifs").hide();
|
||||
$("#snmp_options_v3").hide();
|
||||
$("#auth_block_snmp").hide();
|
||||
|
||||
// Disable snmp dependant checks
|
||||
if (document.getElementsByName("parent_recursion")[0].checked)
|
||||
|
@ -1572,13 +1568,17 @@ class HostDevices extends Wizard
|
|||
}
|
||||
|
||||
function toggleAuth() {
|
||||
if (document.getElementsByName("wmi_enabled")[0].checked
|
||||
|| (typeof document.getElementsByName("rcmd_enabled")[0] != "undefined"
|
||||
&& document.getElementsByName("rcmd_enabled")[0].checked)
|
||||
) {
|
||||
$("#auth_block").show();
|
||||
if (document.getElementsByName("wmi_enabled")[0].checked) {
|
||||
$("#auth_block_wmi").show();
|
||||
} else {
|
||||
$("#auth_block").hide();
|
||||
$("#auth_block_wmi").hide();
|
||||
}
|
||||
|
||||
if (typeof document.getElementsByName("rcmd_enabled")[0] != "undefined"
|
||||
&& document.getElementsByName("rcmd_enabled")[0].checked) {
|
||||
$("#auth_block_rcmd").show();
|
||||
} else {
|
||||
$("#auth_block_rcmd").hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2049,7 +2049,9 @@ if ($get_extended_event) {
|
|||
|
||||
$js .= '});';
|
||||
|
||||
$js .= '$("#link_comments").click(get_table_events_tabs(\''.base64_encode(json_encode($event)).'\',\''.base64_encode(json_encode($filter)).'\'));';
|
||||
$js .= '$("#link_comments").on("click", () => {
|
||||
get_table_events_tabs(\''.base64_encode(json_encode($event)).'\',\''.base64_encode(json_encode($filter)).'\')
|
||||
});';
|
||||
|
||||
if (events_has_extended_info($event['id_evento']) === true) {
|
||||
$js .= '
|
||||
|
|
|
@ -129,7 +129,12 @@ if ($check_connectivity) {
|
|||
|
||||
if ($create_net_scan) {
|
||||
$ip_target = get_parameter('ip_target', '192.168.10.0/24');
|
||||
$id_net_scan = create_net_scan($ip_target);
|
||||
$snmp_version = get_parameter('snmp_version', '1');
|
||||
$snmp_communities = get_parameter('snmp_communities', 'public');
|
||||
$wmi_credentials = get_parameter('wmi_credentials', []);
|
||||
$rcmd_credentials = get_parameter('rcmd_credentials', []);
|
||||
|
||||
$id_net_scan = create_net_scan($ip_target, $snmp_version, $snmp_communities, $wmi_credentials, $rcmd_credentials);
|
||||
if ($id_net_scan > 0) {
|
||||
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
|
||||
ui_print_success_message(__('Basic net created and scan in progress. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_recon_server.'&force='.$id_net_scan).'>Click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
|
||||
|
|
|
@ -172,12 +172,12 @@ function process_user_login_local($login, $pass, $api=false, $passAlreadyEncrypt
|
|||
$credentials_check = $pass === $row['password'];
|
||||
} else {
|
||||
// Perform password check whether it is MD5-hashed (old hashing) or Bcrypt-hashed.
|
||||
if (strlen($row['password']) === 32) {
|
||||
if (strlen(($row['password'] ?? '')) === 32) {
|
||||
// MD5.
|
||||
$credentials_check = $row !== false && $row['password'] !== md5('') && $row['password'] == md5($pass);
|
||||
} else {
|
||||
// Bcrypt.
|
||||
$credentials_check = password_verify($pass, $row['password']);
|
||||
$credentials_check = password_verify($pass, ($row['password'] ?? ''));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1510,17 +1510,42 @@ class ConsoleSupervisor
|
|||
{
|
||||
global $config;
|
||||
|
||||
$types_sql = sprintf(
|
||||
' AND (
|
||||
`server_type` != %d AND
|
||||
`server_type` != %d
|
||||
)',
|
||||
SERVER_TYPE_AUTOPROVISION,
|
||||
SERVER_TYPE_MIGRATION
|
||||
);
|
||||
if (is_metaconsole() === true && isset($config['ndbh']) === false) {
|
||||
$types_sql = sprintf(
|
||||
' AND (
|
||||
`server_type` = %d OR
|
||||
`server_type` = %d OR
|
||||
`server_type` = %d OR
|
||||
`server_type` = %d
|
||||
)',
|
||||
SERVER_TYPE_AUTOPROVISION,
|
||||
SERVER_TYPE_EVENT,
|
||||
SERVER_TYPE_MIGRATION,
|
||||
SERVER_TYPE_PREDICTION
|
||||
);
|
||||
}
|
||||
|
||||
$servers = db_get_all_rows_sql(
|
||||
'SELECT
|
||||
id_server,
|
||||
name,
|
||||
server_type,
|
||||
server_keepalive,
|
||||
status,
|
||||
unix_timestamp() - unix_timestamp(keepalive) as downtime
|
||||
FROM tserver
|
||||
WHERE
|
||||
unix_timestamp() - unix_timestamp(keepalive) > server_keepalive'
|
||||
sprintf(
|
||||
'SELECT id_server,
|
||||
`name`,
|
||||
server_type,
|
||||
server_keepalive,
|
||||
`status`,
|
||||
unix_timestamp() - unix_timestamp(keepalive) as downtime
|
||||
FROM tserver
|
||||
WHERE unix_timestamp() - unix_timestamp(keepalive) > server_keepalive
|
||||
%s',
|
||||
$types_sql
|
||||
)
|
||||
);
|
||||
|
||||
if ($servers === false) {
|
||||
|
|
|
@ -759,21 +759,21 @@ class Prd
|
|||
'conditional_refs' => [
|
||||
[
|
||||
'when' => ['type' => 'netflow_area'],
|
||||
'ref' => $this->tnetflowFilter,
|
||||
'ref' => $this->tnetflowFilter,
|
||||
],
|
||||
[
|
||||
'when' => ['type' => 'netflow_data'],
|
||||
'ref' => $this->tnetflowFilter,
|
||||
'ref' => $this->tnetflowFilter,
|
||||
],
|
||||
[
|
||||
'when' => ['type' => 'netflow_summary'],
|
||||
'ref' => $this->tnetflowFilter,
|
||||
'ref' => $this->tnetflowFilter,
|
||||
],
|
||||
[
|
||||
'when' => ['type' => 'netflow_top_N'],
|
||||
'ref' => $this->tnetflowFilter,
|
||||
]
|
||||
]
|
||||
'ref' => $this->tnetflowFilter,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'treport_content_item' => [
|
||||
|
@ -790,11 +790,11 @@ class Prd
|
|||
'when' => ['type' => 'SLA_services'],
|
||||
],
|
||||
],
|
||||
'ref' => $this->tservice,
|
||||
]
|
||||
'ref' => $this->tservice,
|
||||
],
|
||||
],
|
||||
'ref' => $this->tagenteModulo
|
||||
]
|
||||
'ref' => $this->tagenteModulo,
|
||||
],
|
||||
],
|
||||
'tpolicies' => [
|
||||
'id_group' => ['ref' => $this->tgrupo],
|
||||
|
@ -952,12 +952,14 @@ class Prd
|
|||
'id_agent' => ['ref' => $this->tagente],
|
||||
],
|
||||
],
|
||||
'treport_content' => [
|
||||
'treport_content' => [
|
||||
'external_source' => [
|
||||
'module' => ['ref' => $this->tagenteModulo + ['array' => true, 'values_as_keys' => true]],
|
||||
'id_agents' => ['ref' => $this->tagente + ['array' => true]],
|
||||
'templates' => ['ref' => $this->talertTemplates + ['array' => true]],
|
||||
'actions' => ['ref' => $this->talertActions + ['array' => true]],
|
||||
'module' => [
|
||||
'ref' => ($this->tagenteModulo + ['array' => true, 'values_as_keys' => true]),
|
||||
],
|
||||
'id_agents' => ['ref' => ($this->tagente + ['array' => true])],
|
||||
'templates' => ['ref' => ($this->talertTemplates + ['array' => true])],
|
||||
'actions' => ['ref' => ($this->talertActions + ['array' => true])],
|
||||
],
|
||||
],
|
||||
'twidget_dashboard' => [
|
||||
|
@ -1956,6 +1958,7 @@ class Prd
|
|||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function that checks if a value is a base64.
|
||||
*
|
||||
|
@ -1967,11 +1970,12 @@ class Prd
|
|||
{
|
||||
// Check if the string is valid base64 by decoding it
|
||||
$decoded = base64_decode($string, true);
|
||||
|
||||
|
||||
// Check if decoding was successful and if the decoded string matches the original
|
||||
return ($decoded !== false && base64_encode($decoded) === $string);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function that checks if a value is a json.
|
||||
*
|
||||
|
@ -2175,6 +2179,7 @@ class Prd
|
|||
} else {
|
||||
$value_arr = json_decode($value, true);
|
||||
}
|
||||
|
||||
if (is_array($value_arr)) {
|
||||
$ref_arr = [];
|
||||
foreach ($value_arr as $val) {
|
||||
|
@ -2226,6 +2231,7 @@ class Prd
|
|||
} else {
|
||||
$value_arr = json_decode($value, true);
|
||||
}
|
||||
|
||||
if (is_array($value_arr)) {
|
||||
$ref_arr = [];
|
||||
foreach ($value_arr as $val) {
|
||||
|
@ -2270,6 +2276,7 @@ class Prd
|
|||
if (is_array($ref_val) === true) {
|
||||
$ref_val = json_encode($ref_val);
|
||||
}
|
||||
|
||||
$ref_arr[] = $ref_val;
|
||||
}
|
||||
|
||||
|
@ -2303,6 +2310,7 @@ class Prd
|
|||
} else {
|
||||
$value_arr = json_decode($value, true);
|
||||
}
|
||||
|
||||
if (is_array($value_arr)) {
|
||||
$ref_arr = [];
|
||||
foreach ($value_arr as $val) {
|
||||
|
@ -2354,6 +2362,7 @@ class Prd
|
|||
} else {
|
||||
$value_arr = json_decode($value, true);
|
||||
}
|
||||
|
||||
if (is_array($value_arr)) {
|
||||
$ref_arr = [];
|
||||
foreach ($value_arr as $val) {
|
||||
|
@ -2398,6 +2407,7 @@ class Prd
|
|||
if (is_array($ref_val) === true) {
|
||||
$ref_val = json_encode($ref_val);
|
||||
}
|
||||
|
||||
$ref_arr[] = $ref_val;
|
||||
}
|
||||
|
||||
|
@ -2449,6 +2459,7 @@ class Prd
|
|||
} else {
|
||||
$value_arr = json_decode($value, true);
|
||||
}
|
||||
|
||||
if (is_array($value_arr)) {
|
||||
$ref_arr = [];
|
||||
foreach ($value_arr as $val) {
|
||||
|
@ -2536,6 +2547,7 @@ class Prd
|
|||
} else {
|
||||
$value_arr = json_decode($value, true);
|
||||
}
|
||||
|
||||
if (is_array($value_arr)) {
|
||||
$ref_arr = [];
|
||||
foreach ($value_arr as $val) {
|
||||
|
@ -2719,6 +2731,7 @@ class Prd
|
|||
$value = base64_decode($value);
|
||||
$isBase64 = true;
|
||||
}
|
||||
|
||||
// The column is inside column refs.
|
||||
$this->getReferenceFromValue(
|
||||
$element['table'],
|
||||
|
@ -2740,6 +2753,7 @@ class Prd
|
|||
$json_value = base64_decode($json_value);
|
||||
$isBase64 = true;
|
||||
}
|
||||
|
||||
$this->getReferenceFromValue(
|
||||
$element['table'],
|
||||
$column,
|
||||
|
@ -2751,8 +2765,10 @@ class Prd
|
|||
if (is_array($json_value) === true) {
|
||||
$json_value = json_encode($json_value);
|
||||
}
|
||||
|
||||
$json_value = base64_encode($json_value);
|
||||
}
|
||||
|
||||
$this->updateJsonArrayValue($array_value, $json_key, $json_value);
|
||||
}
|
||||
}
|
||||
|
@ -2908,6 +2924,7 @@ class Prd
|
|||
$value = base64_decode($value);
|
||||
$isBase64 = true;
|
||||
}
|
||||
|
||||
$create_item = $this->getValueFromReference(
|
||||
$table,
|
||||
$column,
|
||||
|
@ -2934,6 +2951,7 @@ class Prd
|
|||
$json_value = base64_decode($json_value);
|
||||
$isBase64 = true;
|
||||
}
|
||||
|
||||
if ($this->getValueFromReference(
|
||||
$table,
|
||||
$column,
|
||||
|
@ -2945,8 +2963,10 @@ class Prd
|
|||
if (is_array($json_value) === true) {
|
||||
$json_value = json_encode($json_value);
|
||||
}
|
||||
|
||||
$json_value = base64_encode($json_value);
|
||||
}
|
||||
|
||||
$this->updateJsonArrayValue($array_value, $json_key, $json_value);
|
||||
} else {
|
||||
$create_item = false;
|
||||
|
@ -2958,7 +2978,7 @@ class Prd
|
|||
$value = json_encode($array_value);
|
||||
}
|
||||
|
||||
if($create_item === false){
|
||||
if ($create_item === false) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3519,7 +3539,7 @@ class Prd
|
|||
/**
|
||||
* Function to create item in database.
|
||||
*
|
||||
* @param string $table Table.
|
||||
* @param string $table Table.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
|
@ -848,13 +848,22 @@ class WelcomeWindow extends Wizard
|
|||
</div>
|
||||
<div id="dialog_basic_net" class="invisible">
|
||||
<?php
|
||||
$serverIP = $_SERVER['SERVER_ADDR'];
|
||||
$ipParts = explode('.', $serverIP);
|
||||
if (count($ipParts) === 4) {
|
||||
$ipParts[3] = '0/24';
|
||||
$network = implode('.', $ipParts);
|
||||
} else {
|
||||
$network = '192.168.10.0/24';
|
||||
}
|
||||
|
||||
echo html_print_input_hidden('create_net_scan', 1);
|
||||
echo html_print_label_input_block(
|
||||
__('Ip target'),
|
||||
html_print_input_text(
|
||||
'ip_target_discovery',
|
||||
'192.168.10.0/24',
|
||||
'192.168.10.0/24',
|
||||
$network,
|
||||
$network,
|
||||
false,
|
||||
18,
|
||||
true,
|
||||
|
@ -874,8 +883,320 @@ class WelcomeWindow extends Wizard
|
|||
)
|
||||
);
|
||||
|
||||
echo html_print_div(
|
||||
[
|
||||
'class' => '',
|
||||
'content' => '<br>To detect and find systems on your network we will need access credentials. The SNMP community for network devices, and at least one set of credentials for Linux and Windows environments (they do not need to be super administrators, but they do need to be able to connect remotely). Without the credentials, we will only be able to detect if the devices are connected to the network.<br><br>',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
// SNMP Communities
|
||||
echo html_print_label_input_block(
|
||||
__('SNMP communities to try with').ui_print_help_tip(
|
||||
__(
|
||||
'You can specify several values, separated by commas, for example: public,mysecret,1234'
|
||||
),
|
||||
true
|
||||
),
|
||||
html_print_input(
|
||||
[
|
||||
'name' => 'community',
|
||||
'type' => 'text',
|
||||
'value' => 'public',
|
||||
'size' => 25,
|
||||
'return' => true,
|
||||
],
|
||||
'div',
|
||||
true
|
||||
),
|
||||
['div_id' => 'snmp-communities-div']
|
||||
);
|
||||
ui_require_jquery_file('tag-editor.min', 'include/javascript/', true);
|
||||
ui_require_jquery_file('caret.min', 'include/javascript/', true);
|
||||
ui_require_css_file('jquery.tag-editor', 'include/styles/', true);
|
||||
|
||||
echo '<br>';
|
||||
|
||||
$spacing = '';
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$spacing .= ' ';
|
||||
}
|
||||
|
||||
// WMI Credentials
|
||||
echo '<fieldset style="padding: 10px; padding-top: 0px">';
|
||||
echo '<legend>'.__('WMI credentials').'</legend>';
|
||||
echo html_print_div(
|
||||
[
|
||||
'id' => 'wmi-creds',
|
||||
'content' => '',
|
||||
],
|
||||
true
|
||||
);
|
||||
echo html_print_div(
|
||||
[
|
||||
'id' => 'wmi-cred-form',
|
||||
'hidden' => true,
|
||||
'style' => 'margin: 10px; display: flex; align-items: center;',
|
||||
'content' => html_print_div(
|
||||
[
|
||||
'id' => 'wmi-cred-user-div',
|
||||
'style' => 'width: 260px;',
|
||||
'content' => html_print_label_input_block(
|
||||
__('User').' ',
|
||||
html_print_input_text(
|
||||
'wmi-cred-user',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
50,
|
||||
// Max length
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'w100p',
|
||||
'',
|
||||
'off',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'Username'
|
||||
),
|
||||
['div_style' => 'display: flex; align-items: center;']
|
||||
),
|
||||
],
|
||||
true
|
||||
).html_print_div(
|
||||
[
|
||||
'id' => 'wmi-cred-pass-div',
|
||||
'style' => 'width: 260px;',
|
||||
'content' => html_print_label_input_block(
|
||||
$spacing.__('Password').' ',
|
||||
html_print_input_password(
|
||||
'wmi-cred-pass',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
50,
|
||||
// Max length
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'w100p',
|
||||
'off',
|
||||
false,
|
||||
''
|
||||
),
|
||||
['div_style' => 'display: flex; align-items: center;']
|
||||
),
|
||||
],
|
||||
true
|
||||
).html_print_div(
|
||||
[
|
||||
'id' => 'wmi-cred-namespace-div',
|
||||
'style' => 'width: 260px;',
|
||||
'content' => html_print_label_input_block(
|
||||
$spacing.__('Namespace').' ',
|
||||
html_print_input_text(
|
||||
'wmi-cred-namespace',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
50,
|
||||
// Max length
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'w100p',
|
||||
'',
|
||||
'off',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'Namespace'
|
||||
),
|
||||
['div_style' => 'display: flex; align-items: center;']
|
||||
),
|
||||
],
|
||||
true
|
||||
).'<a onClick="delete_discovery_credential(this);">'.html_print_image(
|
||||
'images/delete.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'style' => 'cursor: pointer;',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
],
|
||||
true
|
||||
);
|
||||
echo '<div style="height: 10px;"></div>';
|
||||
echo html_print_button(
|
||||
__('Add'),
|
||||
'add-wmi-cred',
|
||||
false,
|
||||
'add_discovery_credential("wmi-cred-form","wmi-creds");',
|
||||
[
|
||||
'icon' => 'plus',
|
||||
'mode' => 'secondary',
|
||||
'class' => 'mini',
|
||||
],
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
);
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<br>';
|
||||
|
||||
// RCM Credentials
|
||||
echo '<fieldset style="padding: 10px; padding-top: 0px">';
|
||||
echo '<legend>'.__('Remote commands credentials').'</legend>';
|
||||
echo html_print_div(
|
||||
[
|
||||
'id' => 'rcmd-creds',
|
||||
'content' => '',
|
||||
],
|
||||
true
|
||||
);
|
||||
echo html_print_div(
|
||||
[
|
||||
'id' => 'rcmd-cred-form',
|
||||
'hidden' => true,
|
||||
'style' => 'margin: 10px; display: flex; align-items: center;',
|
||||
'content' => html_print_div(
|
||||
[
|
||||
'id' => 'rcmd-cred-user-div',
|
||||
'style' => 'width: 260px;',
|
||||
'content' => html_print_label_input_block(
|
||||
__('User').' ',
|
||||
html_print_input_text(
|
||||
'rcmd-cred-user',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
50,
|
||||
// Max length
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'w100p',
|
||||
'',
|
||||
'off',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'Username'
|
||||
),
|
||||
['div_style' => 'display: flex; align-items: center;']
|
||||
),
|
||||
],
|
||||
true
|
||||
).html_print_div(
|
||||
[
|
||||
'id' => 'rcmd-cred-pass-div',
|
||||
'style' => 'width: 260px;',
|
||||
'content' => html_print_label_input_block(
|
||||
$spacing.__('Password').' ',
|
||||
html_print_input_password(
|
||||
'rcmd-cred-pass',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
50,
|
||||
// Max length
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'w100p',
|
||||
'off',
|
||||
false,
|
||||
''
|
||||
),
|
||||
['div_style' => 'display: flex; align-items: center;']
|
||||
),
|
||||
],
|
||||
true
|
||||
).'<a onClick="delete_discovery_credential(this);">'.html_print_image(
|
||||
'images/delete.svg',
|
||||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'style' => 'cursor: pointer;',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
],
|
||||
true
|
||||
);
|
||||
echo '<div style="height: 10px;"></div>';
|
||||
echo html_print_button(
|
||||
__('Add'),
|
||||
'add-rcmd-cred',
|
||||
false,
|
||||
'add_discovery_credential("rcmd-cred-form","rcmd-creds");',
|
||||
[
|
||||
'icon' => 'plus',
|
||||
'mode' => 'secondary',
|
||||
'class' => 'mini',
|
||||
],
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
);
|
||||
echo '</fieldset>';
|
||||
|
||||
echo html_print_submit_button(__('Create'), 'basic_net', false, ['icon' => 'next', 'style' => 'margin-top:15px; float:right;']);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#snmp-communities-div .tag-editor').remove();
|
||||
$('#text-community').tagEditor({
|
||||
forceLowercase: false
|
||||
});
|
||||
});
|
||||
|
||||
var credentialCounters = {};
|
||||
|
||||
function add_discovery_credential(sourceFormId, targetDivId) {
|
||||
// Increment the counter for this type of credential
|
||||
credentialCounters[targetDivId] = (credentialCounters[targetDivId] || 0) + 1;
|
||||
|
||||
// Clone the source form
|
||||
var newCredential = $("#" + sourceFormId).clone();
|
||||
|
||||
// Generate a unique ID for the new credential
|
||||
var uniqueId = targetDivId + "-" + credentialCounters[targetDivId];
|
||||
|
||||
// Set a new ID for the cloned form
|
||||
newCredential.attr("id", uniqueId);
|
||||
|
||||
// Append the cloned form to the target div
|
||||
$("#" + targetDivId).append(newCredential);
|
||||
|
||||
// Ensure the cloned div is visible
|
||||
newCredential.show().css("display", "flex");
|
||||
}
|
||||
|
||||
function delete_discovery_credential(clickedElement) {
|
||||
$(clickedElement).parent().remove();
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<div id="dialog_alert_mail" class="invisible">
|
||||
<?php
|
||||
|
@ -1308,8 +1629,8 @@ class WelcomeWindow extends Wizard
|
|||
draggable: true,
|
||||
modal: true,
|
||||
close: false,
|
||||
height: 200,
|
||||
width: 480,
|
||||
height: 590,
|
||||
width: 925,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
|
@ -1407,6 +1728,35 @@ class WelcomeWindow extends Wizard
|
|||
});
|
||||
|
||||
$('#button-basic_net').click(function(){
|
||||
var wmi_credentials = [];
|
||||
$("#wmi-creds [id^='wmi-creds-']").each(function() {
|
||||
var credentialId = $(this).attr("id");
|
||||
var credentialValues = {
|
||||
user: $(this).find('[name="wmi-cred-user"]').val(),
|
||||
pass: $(this).find('[name="wmi-cred-pass"]').val(),
|
||||
namespace: $(this).find('[name="wmi-cred-namespace"]').val()
|
||||
};
|
||||
|
||||
wmi_credentials.push({
|
||||
id: credentialId,
|
||||
credential: credentialValues
|
||||
});
|
||||
});
|
||||
|
||||
var rcmd_credentials = [];
|
||||
$("#rcmd-creds [id^='rcmd-creds-']").each(function() {
|
||||
var credentialId = $(this).attr("id");
|
||||
var credentialValues = {
|
||||
user: $(this).find('[name="rcmd-cred-user"]').val(),
|
||||
pass: $(this).find('[name="rcmd-cred-pass"]').val()
|
||||
};
|
||||
|
||||
rcmd_credentials.push({
|
||||
id: credentialId,
|
||||
credential: credentialValues
|
||||
});
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
type: "POST",
|
||||
|
@ -1414,6 +1764,10 @@ class WelcomeWindow extends Wizard
|
|||
data: {
|
||||
create_net_scan: 1,
|
||||
ip_target: $('#text-ip_target_discovery').val(),
|
||||
snmp_version: 1,
|
||||
snmp_communities: $('#text-community').val(),
|
||||
wmi_credentials: wmi_credentials,
|
||||
rcmd_credentials: rcmd_credentials
|
||||
},
|
||||
success: function(data) {
|
||||
if (data !== 0) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC240214';
|
||||
$build_version = 'PC240220';
|
||||
$pandora_version = 'v7.0NG.775';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -910,3 +910,13 @@ define('DEMO_PLUGIN', 9);
|
|||
|
||||
// Export resources.
|
||||
define('LINE_BREAK', "\n");
|
||||
|
||||
// OS.
|
||||
define('LINUX', '1');
|
||||
define('SOLARIS', '2');
|
||||
define('AIX', '3');
|
||||
define('BSD', '4');
|
||||
define('HPUX', '5');
|
||||
define('CISCO', '7');
|
||||
define('MACOS', '8');
|
||||
define('WINDOWS', '9');
|
||||
|
|
|
@ -504,7 +504,7 @@ function cron_task_start_gotty(bool $restart_mode=true)
|
|||
}
|
||||
}
|
||||
|
||||
if ($start_proc === true) {
|
||||
if ($start_proc === true && file_exists('/usr/bin/pandora_gotty') === true) {
|
||||
$logFilePath = $config['homedir'].'/log/gotty_cron_tmp.log';
|
||||
shell_exec('touch '.$logFilePath);
|
||||
|
||||
|
@ -527,7 +527,7 @@ function cron_task_start_gotty(bool $restart_mode=true)
|
|||
while ((time() - $startTime) < $maxWaitTime) {
|
||||
if ($start_proc === true) {
|
||||
// Read command output.
|
||||
$log_content = file_get_contents($logFilePath);
|
||||
$log_content = @file_get_contents($logFilePath);
|
||||
}
|
||||
|
||||
if ($start_proc === true
|
||||
|
|
|
@ -1179,18 +1179,27 @@ function events_get_all(
|
|||
|
||||
if ((bool) $filter['regex'] === true) {
|
||||
$comp_pattern = 'REGEXP "%s"';
|
||||
$search_term = $filter['search'];
|
||||
$search_column_pattern = '%s';
|
||||
} else {
|
||||
$comp_pattern = 'LIKE lower("%%%s%%")';
|
||||
|
||||
// Disregard repeated whitespaces in search (customer requirement).
|
||||
// Apply in both column stored value and search term.
|
||||
$search_term = preg_replace('/( )+/', ' ', $filter['search']);
|
||||
$search_column_pattern = 'REGEXP_REPLACE(%s, "( \\s*)+", " ")';
|
||||
}
|
||||
|
||||
$comp_string = sprintf($comp_pattern, $filter['search']);
|
||||
$comp_string = sprintf($comp_pattern, $search_term);
|
||||
|
||||
$sql_search = ' AND (';
|
||||
foreach ($array_search as $key => $field) {
|
||||
$col_string = sprintf($search_column_pattern, $field);
|
||||
|
||||
$sql_search .= sprintf(
|
||||
'%s %s %s %s',
|
||||
($key === 0) ? '' : $nexo,
|
||||
$field,
|
||||
$col_string,
|
||||
$not_search,
|
||||
$comp_string
|
||||
);
|
||||
|
|
|
@ -12546,7 +12546,7 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru
|
|||
$table_ind = html_get_predefined_table();
|
||||
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
$servers['all'] = (int) count((servers_get_info() ?? []));
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
if ($servers['all'] == 0) {
|
||||
|
@ -12607,7 +12607,7 @@ function reporting_get_stats_indicators_mobile($data, $width=280, $height=20, $h
|
|||
$table_ind = html_get_predefined_table();
|
||||
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
$servers['all'] = (int) count((servers_get_info() ?? []));
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
if ($servers['all'] == 0) {
|
||||
|
@ -16206,7 +16206,8 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
|
|||
// Si viene de no iniciado busco el primer dato del modulo y si es de histórico.
|
||||
$first_utimestamp = false;
|
||||
$search_historydb = false;
|
||||
$extract_first_data = modules_get_first_date($content['id_agent_module'], 0);
|
||||
// Limitamos el primer dato al rango de tiempo seleccionado por el usuario.
|
||||
$extract_first_data = modules_get_first_date($content['id_agent_module'], $date_start);
|
||||
if (empty($extract_first_data) === false) {
|
||||
$first_utimestamp = $extract_first_data['first_utimestamp'];
|
||||
$search_historydb = (isset($extract_first_data['search_historydb']) === true) ? $extract_first_data['search_historydb'] : false;
|
||||
|
@ -16311,7 +16312,8 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
|
|||
$return['data_ok'] = $check_ok;
|
||||
$return['data_total'] = $check_total;
|
||||
if ($check_total > 0) {
|
||||
$return['percent_ok'] = (($time_ok * 100) / $content['period']);
|
||||
$percent_ok = (($time_ok * 100) / $content['period']);
|
||||
$return['percent_ok'] = ($percent_ok > 100) ? 100 : $percent_ok;
|
||||
} else {
|
||||
$return['percent_ok'] = 0;
|
||||
}
|
||||
|
|
|
@ -615,7 +615,7 @@ function servers_get_rate($avg_interval, $num_modules)
|
|||
* This function will get all the server information in an array
|
||||
* or a specific server.
|
||||
*
|
||||
* @param integer $id_server An optional integer or array of integers
|
||||
* @param integer|array $id_server An optional integer or array of integers
|
||||
* to select specific servers.
|
||||
*
|
||||
* @return mixed False in case the server doesn't exist or an array with info.
|
||||
|
@ -624,28 +624,63 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (is_array($id_server)) {
|
||||
$select_id = ' WHERE id_server IN ('.implode(',', $id_server).')';
|
||||
$select_id = '';
|
||||
if (is_array($id_server) === true) {
|
||||
$select_id = ' AND id_server IN ('.implode(',', $id_server).')';
|
||||
} else if ($id_server > 0) {
|
||||
$select_id = ' WHERE id_server IN ('.(int) $id_server.')';
|
||||
} else {
|
||||
$select_id = '';
|
||||
$select_id = ' AND id_server IN ('.(int) $id_server.')';
|
||||
}
|
||||
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM tserver '.$select_id.'
|
||||
ORDER BY server_type';
|
||||
$types_sql = sprintf(
|
||||
' AND (
|
||||
`server_type` != %d AND
|
||||
`server_type` != %d
|
||||
)',
|
||||
SERVER_TYPE_AUTOPROVISION,
|
||||
SERVER_TYPE_MIGRATION
|
||||
);
|
||||
if (is_metaconsole() === true && isset($config['ndbh']) === false) {
|
||||
$types_sql = sprintf(
|
||||
' AND (
|
||||
`server_type` = %d OR
|
||||
`server_type` = %d OR
|
||||
`server_type` = %d OR
|
||||
`server_type` = %d
|
||||
)',
|
||||
SERVER_TYPE_AUTOPROVISION,
|
||||
SERVER_TYPE_EVENT,
|
||||
SERVER_TYPE_MIGRATION,
|
||||
SERVER_TYPE_PREDICTION
|
||||
);
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tserver
|
||||
WHERE 1=1
|
||||
%s
|
||||
%s
|
||||
ORDER BY server_type',
|
||||
$select_id,
|
||||
$types_sql
|
||||
);
|
||||
|
||||
if ($sql_limit !== -1) {
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM tserver '.$select_id.'
|
||||
ORDER BY server_type'.$sql_limit;
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tserver
|
||||
WHERE 1=1
|
||||
%s
|
||||
%s
|
||||
ORDER BY server_type
|
||||
%s',
|
||||
$select_id,
|
||||
$types_sql,
|
||||
$sql_limit
|
||||
);
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
$time = get_system_time();
|
||||
|
||||
if (empty($result)) {
|
||||
return false;
|
||||
|
@ -1445,6 +1480,12 @@ function servers_get_server_string_name(int $server)
|
|||
case SERVER_TYPE_NCM:
|
||||
return __('NCM server');
|
||||
|
||||
case SERVER_TYPE_AUTOPROVISION:
|
||||
return __('Autoprovision server');
|
||||
|
||||
case SERVER_TYPE_MIGRATION:
|
||||
return __('Migration server');
|
||||
|
||||
default:
|
||||
return __('N/A');
|
||||
}
|
||||
|
|
|
@ -472,14 +472,124 @@ function create_module_packet_lost($id_agent, $id_group, $ip_target)
|
|||
/**
|
||||
* Create module packet lost and return module id.
|
||||
*
|
||||
* @param string $ip_target Ip and red mask.
|
||||
* @param string $ip_target Ip and red mask.
|
||||
* @param string $snmp_communities SNMP Communities to use in recon task.
|
||||
* @param array $wmi_credentials WMI Credentials to use in recon task.
|
||||
* @param array $rcmd_credentials RCMD Credentials to use in recon task.
|
||||
*
|
||||
* @return interger Module id.
|
||||
*/
|
||||
function create_net_scan($ip_target)
|
||||
function create_net_scan($ip_target, $snmp_version, $snmp_communities, $wmi_credentials, $rcmd_credentials)
|
||||
{
|
||||
global $config;
|
||||
include_once $config['homedir'].'/godmode/wizards/HostDevices.class.php';
|
||||
include_once $config['homedir'].'/include/functions_groups.php';
|
||||
|
||||
$group_name = 'AutoDiscovery';
|
||||
$id_group = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($group_name));
|
||||
if (!($id_group > 0)) {
|
||||
$id_group = groups_create_group(
|
||||
io_safe_input($group_name),
|
||||
[
|
||||
'icon' => 'applications.png',
|
||||
'description' => '',
|
||||
'contact' => '',
|
||||
'other' => '',
|
||||
]
|
||||
);
|
||||
|
||||
if (!($id_group > 0)) {
|
||||
$id_group = 10;
|
||||
}
|
||||
}
|
||||
|
||||
$auth_strings = [];
|
||||
|
||||
$default_templates = [
|
||||
io_safe_input('Linux System'),
|
||||
io_safe_input('Windows System'),
|
||||
io_safe_input('Windows Hardware'),
|
||||
io_safe_input('Network Management'),
|
||||
];
|
||||
|
||||
$default_templates_ids = db_get_all_rows_sql(
|
||||
'SELECT id_np
|
||||
FROM tnetwork_profile
|
||||
WHERE name IN ('.implode(
|
||||
',',
|
||||
array_map(
|
||||
function ($template) {
|
||||
return "'".$template."'";
|
||||
},
|
||||
$default_templates
|
||||
)
|
||||
).')
|
||||
ORDER BY name'
|
||||
);
|
||||
|
||||
$id_base = 'autoDiscovery-WMI-';
|
||||
$id = 0;
|
||||
foreach ($wmi_credentials as $wmi) {
|
||||
$id++;
|
||||
$identifier = $id_base.$id;
|
||||
while (db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT COUNT(*) AS count FROM tcredential_store WHERE identifier = "%s"',
|
||||
$identifier
|
||||
)
|
||||
) > 0) {
|
||||
$id++;
|
||||
$identifier = $id_base.$id;
|
||||
}
|
||||
|
||||
$storeKey = db_process_sql_insert(
|
||||
'tcredential_store',
|
||||
[
|
||||
'identifier' => $identifier,
|
||||
'id_group' => $id_group,
|
||||
'product' => 'WMI',
|
||||
'username' => $wmi['credential']['user'],
|
||||
'password' => $wmi['credential']['pass'],
|
||||
'extra_1' => $wmi['credential']['namespace'],
|
||||
]
|
||||
);
|
||||
|
||||
if ($storeKey !== false) {
|
||||
$auth_strings[] = $identifier;
|
||||
}
|
||||
}
|
||||
|
||||
$id_base = 'autoDiscovery-RCMD-';
|
||||
$id = 0;
|
||||
foreach ($rcmd_credentials as $rcmd) {
|
||||
$id++;
|
||||
$identifier = $id_base.$id;
|
||||
while (db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT COUNT(*) AS count FROM tcredential_store WHERE identifier = "%s"',
|
||||
$identifier
|
||||
)
|
||||
) > 0) {
|
||||
$id++;
|
||||
$identifier = $id_base.$id;
|
||||
}
|
||||
|
||||
$storeKey = db_process_sql_insert(
|
||||
'tcredential_store',
|
||||
[
|
||||
'identifier' => $identifier,
|
||||
'id_group' => $id_group,
|
||||
'product' => 'CUSTOM',
|
||||
'username' => $rcmd['credential']['user'],
|
||||
'password' => $rcmd['credential']['pass'],
|
||||
]
|
||||
);
|
||||
|
||||
if ($storeKey !== false) {
|
||||
$auth_strings[] = $identifier;
|
||||
}
|
||||
}
|
||||
|
||||
$HostDevices = new HostDevices(1);
|
||||
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
|
||||
|
||||
|
@ -493,7 +603,7 @@ function create_net_scan($ip_target)
|
|||
'taskname' => __('Basic network'),
|
||||
'id_recon_server' => $id_recon_server,
|
||||
'network' => $ip_target,
|
||||
'id_group' => '8',
|
||||
'id_group' => $id_group,
|
||||
'comment' => __('Created on welcome'),
|
||||
];
|
||||
$task_created = $HostDevices->parseNetScan();
|
||||
|
@ -504,13 +614,13 @@ function create_net_scan($ip_target)
|
|||
'page' => '2',
|
||||
'recon_ports' => '',
|
||||
'auto_monitor' => 'on',
|
||||
'id_network_profile' => ['0' => '2'],
|
||||
'id_network_profile' => array_column($default_templates_ids, 'id_np'),
|
||||
'review_results' => 'on',
|
||||
'review_limited' => '0',
|
||||
'snmp_enabled' => 'on',
|
||||
'snmp_version' => '1',
|
||||
'snmp_version' => $snmp_version,
|
||||
'snmp_skip_non_enabled_ifs' => 'on',
|
||||
'community' => '',
|
||||
'community' => $snmp_communities,
|
||||
'snmp_context' => '',
|
||||
'snmp_auth_user' => '',
|
||||
'snmp_security_level' => 'authNoPriv',
|
||||
|
@ -523,6 +633,9 @@ function create_net_scan($ip_target)
|
|||
'parent_detection' => 'on',
|
||||
'parent_recursion' => 'on',
|
||||
'vlan_enabled' => 'on',
|
||||
'wmi_enabled' => 'on',
|
||||
'rcmd_enabled' => 'on',
|
||||
'auth_strings' => $auth_strings,
|
||||
];
|
||||
|
||||
$task_final_created = $HostDevicesFinal->parseNetScan();
|
||||
|
|
|
@ -253,30 +253,35 @@ function createDroppableZones(
|
|||
)
|
||||
);
|
||||
|
||||
// Create remove button.
|
||||
if (
|
||||
graphDiv
|
||||
.children()
|
||||
.children()
|
||||
.hasClass("parent_graph") === true
|
||||
$("#hidden-section").val() ===
|
||||
"operation/reporting/graph_analytics"
|
||||
) {
|
||||
graphDiv
|
||||
.children()
|
||||
.children()
|
||||
.children(":first-child")
|
||||
.prepend(
|
||||
$(
|
||||
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
graphDiv
|
||||
.children()
|
||||
.append(
|
||||
$(
|
||||
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
|
||||
)
|
||||
);
|
||||
// Create remove button.
|
||||
if (
|
||||
graphDiv
|
||||
.children()
|
||||
.children()
|
||||
.hasClass("parent_graph") === true
|
||||
) {
|
||||
graphDiv
|
||||
.children()
|
||||
.children()
|
||||
.children(":first-child")
|
||||
.prepend(
|
||||
$(
|
||||
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
graphDiv
|
||||
.children()
|
||||
.append(
|
||||
$(
|
||||
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -753,7 +758,7 @@ $("#button-share-modal").click(function(e) {
|
|||
|
||||
window.open(
|
||||
configHomeurl +
|
||||
"/operation/reporting/graph_analytics_public.php?" +
|
||||
"operation/reporting/graph_analytics_public.php?" +
|
||||
queryParams
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1266,17 +1266,19 @@ class Manager implements PublicLogin
|
|||
}
|
||||
|
||||
if (empty($cells) === false) {
|
||||
$result = array_values(array_reduce(
|
||||
$cells,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['order']]['id'] = $item['id'];
|
||||
$carry[$item['order']]['position'] = $item['position'];
|
||||
$carry[$item['order']]['widgetId'] = $item['id_widget'];
|
||||
$result = array_values(
|
||||
array_reduce(
|
||||
$cells,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['order']]['id'] = $item['id'];
|
||||
$carry[$item['order']]['position'] = $item['position'];
|
||||
$carry[$item['order']]['widgetId'] = $item['id_widget'];
|
||||
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
));
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
echo json_encode($result);
|
||||
|
|
|
@ -108,9 +108,7 @@
|
|||
cursor: default;
|
||||
font-size: 14px;
|
||||
}
|
||||
.ui-front {
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.ui-menu {
|
||||
list-style: none;
|
||||
padding: 1px;
|
||||
|
|
|
@ -1945,7 +1945,7 @@ div.title_line {
|
|||
#menu_tab_frame_view_bc {
|
||||
position: sticky;
|
||||
top: 61px;
|
||||
z-index: 2;
|
||||
z-index: 3;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
|
@ -13517,6 +13517,10 @@ tr.shown td.details-control {
|
|||
-webkit-mask: url(../../images/minimizar.svg) no-repeat right / contain;
|
||||
}
|
||||
|
||||
#modules-toggle > .modules > .white-box-content div {
|
||||
z-index: 1 !important;
|
||||
}
|
||||
|
||||
/* Import/export */
|
||||
.div-import-export {
|
||||
display: flex;
|
||||
|
@ -13584,3 +13588,7 @@ button.disabled {
|
|||
background: #c0ccdc !important;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.ui-draggable-handle {
|
||||
z-index: 2 !important;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.775';
|
||||
$build = '240214';
|
||||
$build = '240220';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
|
|
@ -811,6 +811,7 @@ ui_print_standard_header(
|
|||
$tab_new,
|
||||
$tab_pause_realtime,
|
||||
$tab_start_realtime,
|
||||
html_print_input_hidden('section', get_parameter('sec2'), true),
|
||||
],
|
||||
[
|
||||
[
|
||||
|
@ -885,7 +886,7 @@ $left_content .= '
|
|||
'modules-toggle',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'modules',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph',
|
||||
'images/arrow@svg.svg',
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%define debug_package %{nil}
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -239,7 +239,7 @@ help () {
|
|||
|
||||
# Script banner at start
|
||||
echo " "
|
||||
echo "Pandora FMS Console Installer $PI_VERSION $PI_BUILD (c) 2008-2015 ArticaST"
|
||||
echo "Pandora FMS Console Installer $PI_VERSION $PI_BUILD (c) 2008-2024 PandoraFMS"
|
||||
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
|
||||
echo " "
|
||||
|
||||
|
|
|
@ -2833,7 +2833,8 @@ INSERT INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`
|
|||
(45,'WuxStatsWidget','wux_transaction_stats','WUX transaction stats','','wux_transaction_stats.php'),
|
||||
(46,'SecurityHardening','security_hardening','Security Hardening','','security_hardening.php'),
|
||||
(47,'ServiceLevelWidget','service_level','Service Level','','service_level.php'),
|
||||
(48,'GisMap','GisMap','Gis map','','GisMap.php');
|
||||
(48,'GisMap','GisMap','Gis map','','GisMap.php'),
|
||||
(49,'ITSMIncidences','ITSMIncidences','Pandora ITSM tickets','','ITSMIncidences.php');
|
||||
|
||||
INSERT INTO `tmap` (`id`,`id_group`,`id_user`,`type`,`subtype`,`name`,`description`,`height`,`width`,`center_x`,`center_y`,`background`,`background_options`,`source_period`,`source`,`source_data`,`generation_method`,`generated`,`filter`,`id_group_map`,`refresh_time`) VALUES (1,'0','admin',0,0,'Sample dynamic map','This is a sample dynamic map.',900,900,0,0,'',0,60,0,'0',6,0,'{\"dont_show_subgroups\":0,\"node_radius\":40,\"x_offs\":\"0\",\"y_offs\":\"0\",\"z_dash\":\"1\",\"node_sep\":\"0.25\",\"rank_sep\":\"0.5\",\"mindist\":\"1\",\"kval\":\"0.3\"}',0,300);
|
||||
INSERT INTO `treport` (`id_report`,`id_user`,`name`,`description`,`private`,`id_group`,`custom_logo`,`header`,`first_page`,`footer`,`custom_font`,`id_template`,`id_group_edit`,`metaconsole`,`non_interactive`,`hidden`,`orientation`,`cover_page_render`,`index_render`) VALUES (1,'admin','Sample report #1','This is a sample report, just to show you some general report items.',0,0,NULL,NULL,'<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><img src="http://localhost/pandora_console//images/pandora_report_logo.png" alt="" width="800" /></p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p>
<p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>',NULL,'Lato-Regular.ttf',0,0,0,0,0,'vertical',1,1);
|
||||
|
@ -2884,7 +2885,7 @@ SET @short_name = 'pandorafms.mysql';
|
|||
SET @name = 'MySQL';
|
||||
SET @section = 'app';
|
||||
SET @description = 'Monitor MySQL databases';
|
||||
SET @version = '1.0';
|
||||
SET @version = '1.1';
|
||||
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;
|
||||
|
||||
|
|
|
@ -132,6 +132,15 @@ $product_name = get_product_name(); ?>
|
|||
<script type="text/javascript">
|
||||
var clientMode = '<?php echo $mode; ?>';
|
||||
var ajaxPage = '<?php echo $ajaxPage; ?>';
|
||||
|
||||
function notDefaultEmails(email) {
|
||||
if (email.toLowerCase() === 'pandora@pandorafms.com' || email.toLowerCase() === 'admin@example.com') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#registration_wizard").dialog({
|
||||
resizable: true,
|
||||
|
@ -188,7 +197,7 @@ $("#submit-cancel_registration").click(function(e) {
|
|||
});
|
||||
|
||||
$("#submit-register").click(function() {
|
||||
if (validateEmail($('#registration-email').val())) {
|
||||
if (validateEmail($('#registration-email').val()) && notDefaultEmails($('#registration-email').val())) {
|
||||
// All fields are required.
|
||||
ajax({
|
||||
url: "<?php echo $ajax; ?>",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Artica\PHPChartJS;
|
||||
|
||||
use Halfpastfour\Collection\CollectionInterface;
|
||||
use Artica\PHPChartJS\Collection\CollectionInterface;
|
||||
|
||||
/**
|
||||
* Interface ChartInterface
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
|
||||
namespace Artica\PHPChartJS\Collection;
|
||||
|
||||
use Artica\PHPChartJS\Collection\Collection;
|
||||
|
||||
/**
|
||||
* Class ArrayAccess
|
||||
* @package Artica\PHPChartJS\Collection\Collection
|
||||
*/
|
||||
class ArrayAccess extends Collection implements ArrayAccessInterface
|
||||
{
|
||||
/**
|
||||
* Check if the given offset exists in the set of data.
|
||||
*
|
||||
* @param mixed $offset The offset to check.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists( $offset )
|
||||
{
|
||||
// Can not retrieve a key based on a value other than a string, integer or boolean
|
||||
if( !is_string( $offset ) && !is_int( $offset ) && !is_bool( $offset ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return array_key_exists( $offset, $this->data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from the given offset.
|
||||
*
|
||||
* @param mixed $offset The offset to get the value from.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet( $offset )
|
||||
{
|
||||
if( $this->offsetExists( $offset ) ) {
|
||||
return $this->data[ $offset ];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value at the given offset.
|
||||
*
|
||||
* @param mixed $offset The offset to set the value at.
|
||||
* @param mixed $value The value to set.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function offsetSet( $offset, $value )
|
||||
{
|
||||
$this->data[ $offset ] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset a value at the given offset. Does nothing if the offset is not found.
|
||||
*
|
||||
* @param mixed $offset The offset to unset the value from.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function offsetUnset( $offset )
|
||||
{
|
||||
if( $this->offsetExists( $offset ) ) {
|
||||
unset( $this->data[ $offset ] );
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a callback to use for sorting the data.
|
||||
*
|
||||
* @param \Closure $callback The callback to be used.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function usort( \Closure $callback )
|
||||
{
|
||||
usort( $this->data, $callback );
|
||||
reset( $this->data );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the data by key.
|
||||
*
|
||||
* @param int $sortFlags Optional flags to provide to ksort.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function ksort( $sortFlags = null )
|
||||
{
|
||||
ksort( $this->data, $sortFlags );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the rows of data the collection contains.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count( $this->data );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator( $this );
|
||||
}
|
||||
}
|
42
pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccessInterface.php
vendored
Normal file
42
pandora_console/vendor/artica/phpchartjs/src/Collection/ArrayAccessInterface.php
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace Artica\PHPChartJS\Collection;
|
||||
|
||||
/**
|
||||
* Interface ArrayAccessInterface
|
||||
* @package Artica\PHPChartJS\Collection\Collection
|
||||
*/
|
||||
interface ArrayAccessInterface
|
||||
{
|
||||
/**
|
||||
* Should set the data for the collection and return the previous set of data.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function exchangeArray( array $data );
|
||||
|
||||
/**
|
||||
* Should perform the php function usort on the dataset.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function usort( \Closure $callback );
|
||||
|
||||
/**
|
||||
* Should perform the php function ksort on the dataset.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function ksort();
|
||||
|
||||
/**
|
||||
* Count the rows of data the collection contains.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count();
|
||||
}
|
17
pandora_console/vendor/artica/phpchartjs/src/Collection/ArraySerializableInterface.php
vendored
Normal file
17
pandora_console/vendor/artica/phpchartjs/src/Collection/ArraySerializableInterface.php
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Artica\PHPChartJS\Collection;
|
||||
|
||||
/**
|
||||
* Interface ArraySerializableInterface
|
||||
* @package Artica\PHPChartJS\Collection
|
||||
*/
|
||||
interface ArraySerializableInterface
|
||||
{
|
||||
/**
|
||||
* Should return an array containing all values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getArrayCopy();
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
|
||||
namespace Artica\PHPChartJS\Collection;
|
||||
|
||||
/**
|
||||
* Class Collection
|
||||
* @package Artica\PHPChartJS\Collection
|
||||
*/
|
||||
abstract class Collection implements CollectionInterface, ArraySerializableInterface
|
||||
{
|
||||
/**
|
||||
* The internal set of data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [];
|
||||
|
||||
/**
|
||||
* Collection constructor.
|
||||
*
|
||||
* @param array|null $data
|
||||
*/
|
||||
public function __construct( array $data = null )
|
||||
{
|
||||
if( !is_null( $data ) ) {
|
||||
$this->data = $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a value to the beginning of the set of data. This will change existing keys.
|
||||
*
|
||||
* @param mixed $value The value to prepend.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function prepend( $value )
|
||||
{
|
||||
array_unshift( $this->data, $value );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a value to the end of the set of data.
|
||||
*
|
||||
* @param mixed $value The value to append.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function append( $value )
|
||||
{
|
||||
array_push( $this->data, $value );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shift an element off of the left of the collection.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function trimLeft()
|
||||
{
|
||||
return array_shift( $this->data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop an element off of the right of the collection.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function trimRight()
|
||||
{
|
||||
return array_pop( $this->data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Should return an array containing all values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getArrayCopy()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should set the data for the collection and return the previous set of data.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function exchangeArray( array $data )
|
||||
{
|
||||
// Gather return data
|
||||
$returnArray = $this->getArrayCopy();
|
||||
// Set the new data
|
||||
$this->data = $data;
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get (and create if not exists) an iterator.
|
||||
*
|
||||
* @return \ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator( $this->data );
|
||||
}
|
||||
}
|
23
pandora_console/vendor/artica/phpchartjs/src/Collection/CollectionInterface.php
vendored
Normal file
23
pandora_console/vendor/artica/phpchartjs/src/Collection/CollectionInterface.php
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Artica\PHPChartJS\Collection;
|
||||
|
||||
/**
|
||||
* Interface CollectionInterface
|
||||
*/
|
||||
interface CollectionInterface
|
||||
{
|
||||
/**
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function append( $value );
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function prepend( $value );
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Artica\PHPChartJS\Collection;
|
||||
|
||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\Delegate;
|
||||
use JsonSerializable as JsonSerializableInterface;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Artica\PHPChartJS;
|
||||
|
||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Artica\PHPChartJS;
|
||||
|
||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Artica\PHPChartJS\Options\Scales;
|
||||
|
||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||
use JsonSerializable;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Artica\PHPChartJS\Options\Scales;
|
||||
|
||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||
use JsonSerializable;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Artica\PHPChartJS\Options\Scales;
|
||||
|
||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||
use JsonSerializable;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Artica\PHPChartJS;
|
||||
|
||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Test;
|
||||
|
||||
use Halfpastfour\Collection\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\Collection\ArrayAccess;
|
||||
use Artica\PHPChartJS\ArraySerializableInterface;
|
||||
use Artica\PHPChartJS\Chart\Bar;
|
||||
use Artica\PHPChartJS\ChartInterface;
|
||||
|
|
|
@ -0,0 +1,400 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
EXCHANGE MAIL PLUGIN
|
||||
|
||||
Author: Alejandro Sanchez Carrion
|
||||
Copyright: Copyright 2024, PandoraFMS
|
||||
Maintainer: Operations Department
|
||||
Status: Production
|
||||
Version: 1.0
|
||||
"""
|
||||
|
||||
from exchangelib import Credentials,Configuration, Account, DELEGATE, OAUTH2, IMPERSONATION,Message, Mailbox
|
||||
from exchangelib import OAuth2Credentials
|
||||
from exchangelib.version import Version, EXCHANGE_O365
|
||||
from exchangelib.protocol import BaseProtocol, NoVerifyHTTPAdapter
|
||||
|
||||
BaseProtocol.HTTP_ADAPTER_CLS = NoVerifyHTTPAdapter
|
||||
|
||||
import urllib3
|
||||
urllib3.disable_warnings()
|
||||
|
||||
import pandoraPlugintools as ppt
|
||||
|
||||
import argparse,sys,re,json,os,traceback
|
||||
from datetime import datetime,timedelta,timezone
|
||||
|
||||
|
||||
|
||||
__author__ = "Alejandro Sánchez Carrion"
|
||||
__copyright__ = "Copyright 2022, PandoraFMS"
|
||||
__maintainer__ = "Operations department"
|
||||
__status__ = "Production"
|
||||
__version__= '1.0'
|
||||
|
||||
info = f"""
|
||||
Pandora FMS Exchange Mail
|
||||
Version = 1.0
|
||||
Description = This plugin can search for matches in your mail and find the number of matches, as well as list them.
|
||||
|
||||
Manual execution
|
||||
|
||||
./exchange_mail \
|
||||
--auth <oauth> \
|
||||
--server <server> \
|
||||
--smtp_address <smtp_address> \
|
||||
--client_id <client_id> \
|
||||
--tenant_id <tenant_id> \
|
||||
--secret <secret> \
|
||||
[--user <user>] \
|
||||
[--password <password>] \
|
||||
[--subject <subject>] \
|
||||
[--sender <sender>] \
|
||||
[--date_start <date_start>] \
|
||||
[--date_end <date_end>] \
|
||||
[--mail_list <mail_list>] \
|
||||
[--module_prefix <module_prefix>] \
|
||||
[--agent_prefix <agent_prefix>] \
|
||||
[--group <group>] \
|
||||
[--interval <interval>] \
|
||||
[--temporal <temporal>] \
|
||||
[--data_dir <data_dir>] \
|
||||
[--transfer_mode <transfer_mode>] \
|
||||
[--tentacle_client <tentacle_client>] \
|
||||
[--tentacle_opts <tentacle_opts>] \
|
||||
[--tentacle_port <tentacle_port>] \
|
||||
[--tentacle_address <tentacle_address>] \
|
||||
[--log_file <log_file>]
|
||||
|
||||
|
||||
there are three parameters with which to filter the mails
|
||||
|
||||
subject
|
||||
email
|
||||
date
|
||||
|
||||
You can use only one and filter from that or use the following combinations:
|
||||
|
||||
subject
|
||||
subject + sender
|
||||
subject + sender + date
|
||||
"""
|
||||
|
||||
parser = argparse.ArgumentParser(description= info, formatter_class=argparse.RawTextHelpFormatter)
|
||||
|
||||
parser.add_argument('--server' , help="Server name" , default = "outlook.office365.com" , type=str)
|
||||
parser.add_argument('--smtp_address' , help="SMTP address" , required = True , type=str)
|
||||
|
||||
parser.add_argument('--user' , help="User name" , default="" , type=str)
|
||||
parser.add_argument('--password' , help="Password" , default="" , type=str)
|
||||
|
||||
parser.add_argument('--client_id' , help="Client_id" , default="" , type=str)
|
||||
parser.add_argument('--tenant_id' , help="Tenant_id" , default="" , type=str)
|
||||
parser.add_argument('--secret' , help="Secret" , default="" , type=str)
|
||||
|
||||
|
||||
parser.add_argument('--subject' , help="Select match in subjects" , default=None , type=str)
|
||||
parser.add_argument('--sender' , help="Select coincidences from email" , default=None , type=str)
|
||||
parser.add_argument('--date_start' , help="Search for matches from a certain date,Each date must be separated by a hyphen and in quotation marks, with the following format: 'year-month-day-hour-minute'. example: '2021-1-12-0-0'", default=None, type=str)
|
||||
parser.add_argument('--date_end' , help="Search for matches from a certain date,Each date must be separated by a hyphen and in quotation marks, with the following format: 'year-month-day-hour-minute'. example: '2021-6-12-0-0'", default=None, type=str)
|
||||
parser.add_argument('--mail_list' , help='List mail coincidences' , default=0 ,type=int )
|
||||
|
||||
parser.add_argument('--module_prefix' , help='Prefix for the modules. Example : meraki.' , default="" , type=str )
|
||||
parser.add_argument('--agent_prefix' , help='Prefix for the agents. Example : meraki.' , default="" , type=str )
|
||||
|
||||
parser.add_argument('--group' , help='PandoraFMS destination group (default exchange)' , default='' , type=str )
|
||||
parser.add_argument('--interval' , help='Agent monitoring interval' , default=300 , type=int )
|
||||
parser.add_argument('--temporal' , help='PandoraFMS temporal dir' , default='/tmp' , type=str )
|
||||
parser.add_argument('--data_dir' , help='PandoraFMS data dir ' , default='/var/spool/pandora/data_in/' , type=str )
|
||||
parser.add_argument('--transfer_mode' , help='Data transfer mode, local or tentacle' , default="tentacle" , type=str )
|
||||
parser.add_argument('--tentacle_client' , help='Tentacle client path, by default tentacle_client' , default="tentacle_client" , type=str )
|
||||
parser.add_argument('--tentacle_opts' , help='Additional tentacle options' , default="" , type=str )
|
||||
parser.add_argument('--tentacle_port' , help='Tentacle port' , default=41121 , type=int )
|
||||
parser.add_argument('--tentacle_address' , help='Tentacle adress' , default="127.0.0.1" , type=str )
|
||||
|
||||
parser.add_argument('--log_file' , help='Log file path' , default='/tmp/exchangemail_logfile.txt' , type=str )
|
||||
|
||||
parser.add_argument('--auth', choices=['basic', 'oauth'], help='Auth type', required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
###############
|
||||
## VARIABLES ##
|
||||
###############
|
||||
|
||||
server = args.server
|
||||
smtp_address = args.smtp_address
|
||||
|
||||
user = args.user
|
||||
password = args.password
|
||||
|
||||
client_id = args.client_id
|
||||
tenant_id = args.tenant_id
|
||||
secret = args.secret
|
||||
|
||||
subject = args.subject
|
||||
sender = args.sender
|
||||
date_start = args.date_start
|
||||
date_end = args.date_end
|
||||
mail_list = args.mail_list
|
||||
|
||||
module_prefix = args.module_prefix
|
||||
agent_prefix = args.agent_prefix
|
||||
|
||||
temporal = args.temporal
|
||||
group = args.group
|
||||
interval = args.interval
|
||||
data_dir = args.data_dir
|
||||
transfer_mode = args.transfer_mode
|
||||
|
||||
tentacle_address = args.tentacle_address
|
||||
tentacle_port = args.tentacle_port
|
||||
tentacle_client = args.tentacle_client
|
||||
tentacle_opts = args.tentacle_opts
|
||||
|
||||
log_file = args.log_file
|
||||
|
||||
###############
|
||||
## FUNCTIONS ##
|
||||
###############
|
||||
|
||||
def Oauth_session(credentials):
|
||||
"""
|
||||
Creates an OAuth session with an Exchange server using the provided credentials.
|
||||
|
||||
Args:
|
||||
credentials (Credentials): Credentials object containing information for OAuth authentication.
|
||||
|
||||
Returns:
|
||||
Account: An Account object representing the OAuth session with the Exchange server.
|
||||
"""
|
||||
try:
|
||||
config = Configuration(server=server,credentials=credentials, auth_type=OAUTH2,version=Version(build=EXCHANGE_O365),)
|
||||
account = Account(
|
||||
smtp_address,
|
||||
credentials=credentials,
|
||||
config=config,
|
||||
autodiscover=False,
|
||||
access_type=IMPERSONATION)
|
||||
return account
|
||||
except Exception as e:
|
||||
print(0)
|
||||
write_to_log(f"{type(e).__name__}: {e}", log_file)
|
||||
sys.exit()
|
||||
|
||||
def basic_session(credentials):
|
||||
"""
|
||||
Creates a basic session with an Exchange server using the provided credentials.
|
||||
|
||||
Args:
|
||||
credentials (Credentials): Credentials object containing information for authentication.
|
||||
|
||||
Returns:
|
||||
Account: An Account object representing the basic session with the Exchange server.
|
||||
"""
|
||||
try:
|
||||
config = Configuration(server=server, credentials=credentials)
|
||||
|
||||
account = Account(
|
||||
primary_smtp_address=args.smtp_address,
|
||||
autodiscover=False,
|
||||
config=config,
|
||||
access_type=DELEGATE
|
||||
)
|
||||
return account
|
||||
except Exception as e:
|
||||
print(0)
|
||||
write_to_log(f"{type(e).__name__}: {e}", log_file)
|
||||
sys.exit()
|
||||
|
||||
def create_module(name, module_type, description, value, unit=""):
|
||||
"""
|
||||
Creates a generic module based on a template.
|
||||
|
||||
Args:
|
||||
module_prefix (str): The prefix for the module name.
|
||||
name_suffix (str): The suffix to be appended to the module name.
|
||||
module_type (str): The type of the module.
|
||||
description (str): The description of the module.
|
||||
value: The value of the module.
|
||||
unit (str, optional): The unit of measurement for the module. Defaults to "".
|
||||
|
||||
Returns:
|
||||
dict: A dictionary representing the generic module.
|
||||
"""
|
||||
return {
|
||||
"name": f'{module_prefix}{name}',
|
||||
"type": module_type,
|
||||
"desc": description,
|
||||
"value": value,
|
||||
"unit": unit
|
||||
}
|
||||
|
||||
def create_agent(count,list_mail = None):
|
||||
|
||||
"""
|
||||
Creates an agent with specified parameters and transfers it to a target address.
|
||||
|
||||
Args:
|
||||
count (int): Number of mails matching the filter used in the run.
|
||||
list_mail (str, optional): List of mails matching the filter used in the run. Default is None.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
|
||||
modules = []
|
||||
|
||||
modules.append(create_module(f"{module_prefix}.Coincidences_count", "generic_data", "Number of mails matching the filter used in the run", count))
|
||||
|
||||
if list_mail is not None :
|
||||
|
||||
modules.append(create_module(f"{module_prefix}.Coincidences_list", "generic_data_string", "List of mails matching the filter used in the run", list_mail))
|
||||
|
||||
agent = {
|
||||
"agent_name" : ppt.generate_md5(agent_prefix + smtp_address),
|
||||
"agent_alias" : agent_prefix + smtp_address,
|
||||
"parent_agent_name" : "",
|
||||
"description" : "",
|
||||
"version" : "",
|
||||
"os_name" : "",
|
||||
"os_version" : "",
|
||||
"timestamp" : now(),
|
||||
"address" : server,
|
||||
"group" : group,
|
||||
"interval" : interval,
|
||||
"agent_mode" : "1"
|
||||
}
|
||||
|
||||
xml_content = ppt.print_agent(agent, modules)
|
||||
xml_file = ppt.write_xml(xml_content, agent["agent_name"])
|
||||
ppt.transfer_xml(
|
||||
xml_file,
|
||||
transfer_mode=transfer_mode,
|
||||
tentacle_ip=tentacle_address,
|
||||
tentacle_port=tentacle_port
|
||||
)
|
||||
write_to_log("Agent: " + agent_prefix + smtp_address + " getting mail data.", log_file)
|
||||
|
||||
def parse_result(list_email,sep="")-> list:
|
||||
|
||||
"""
|
||||
Parses a list of email elements and converts them into a list of dictionaries.
|
||||
|
||||
Args:
|
||||
list_email (list): List of email elements to be parsed.
|
||||
sep (str): Separator to join elements into a string. Default is an empty string.
|
||||
|
||||
Returns:
|
||||
list: A list of dictionaries, where each dictionary has a single key "value" containing the joined string.
|
||||
"""
|
||||
|
||||
result=[]
|
||||
|
||||
for line in list_email:
|
||||
str_line=sep.join(str(elem) for elem in line)
|
||||
str_dict={"value":str_line}
|
||||
result.append(str_dict)
|
||||
|
||||
return result
|
||||
|
||||
def now(
|
||||
utimestamp: bool = False
|
||||
):
|
||||
"""
|
||||
Get the current time in the specified format or as a Unix timestamp.
|
||||
|
||||
Args:
|
||||
utimestamp (bool): Set to True to get the Unix timestamp (epoch time).
|
||||
print_flag (bool): Set to True to print the time to standard output.
|
||||
|
||||
Returns:
|
||||
str: The current time in the desired format or as a Unix timestamp.
|
||||
"""
|
||||
|
||||
today = datetime.today()
|
||||
|
||||
if utimestamp:
|
||||
time = datetime.timestamp(today)
|
||||
else:
|
||||
time = today.strftime('%Y/%m/%d %H:%M:%S')
|
||||
|
||||
return time
|
||||
|
||||
def write_to_log(variable_content, log_file_path):
|
||||
"""
|
||||
Writes the content of a variable to a log file with timestamp.
|
||||
|
||||
Args:
|
||||
variable_content: Content of the variable to be logged.
|
||||
log_file_path (str): Path to the log file.
|
||||
"""
|
||||
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
log_entry = f"{timestamp} - {variable_content}\n"
|
||||
|
||||
try:
|
||||
with open(log_file_path, 'a') as log_file:
|
||||
log_file.write(log_entry)
|
||||
except IOError as e:
|
||||
print(f"Error writing to log file: {e}")
|
||||
|
||||
if args.auth == 'basic':
|
||||
credentials = Credentials(username=user, password=password)
|
||||
account = basic_session(credentials)
|
||||
elif args.auth == 'oauth':
|
||||
credentials = OAuth2Credentials(client_id=client_id, client_secret=secret, tenant_id=tenant_id)
|
||||
account = Oauth_session(credentials)
|
||||
else:
|
||||
print(0)
|
||||
write_to_log(f"{type(e).__name__}: {e}", log_file)
|
||||
sys.exit()
|
||||
|
||||
try:
|
||||
## Only one parameter
|
||||
if subject and sender==None and date_start==None and date_end == None:
|
||||
filtered_items = account.inbox.filter(subject__contains=args.subject)
|
||||
if subject==None and sender and date_start==None and date_end == None:
|
||||
filtered_items = account.inbox.filter(sender__icontains=sender)
|
||||
if subject==None and sender==None and date_start and date_end :
|
||||
|
||||
date_start=date_start.split("-")
|
||||
date_end=date_end.split("-")
|
||||
filtered_items = account.inbox.filter(datetime_received__range=(datetime(int(date_start[0].strip()), int(date_start[1].strip()), int(date_start[2].strip()), int(date_start[3].strip()), int(date_start[4].strip())).replace(tzinfo=timezone.utc),datetime(int(date_end[0].strip()), int(date_end[1].strip()), int(date_end[2].strip()), int(date_end[3].strip()), int(date_end[4].strip())).replace(tzinfo=timezone.utc)))
|
||||
|
||||
## Subject + sender
|
||||
if subject and sender and date_start==None and date_end==None :
|
||||
filtered_items = account.inbox.filter(sender__icontains=sender,subject__contains=subject)
|
||||
|
||||
## All parameters
|
||||
if subject and sender and date_start and date_end :
|
||||
date_start=date_start.split("-")
|
||||
date_end=date_end.split("-")
|
||||
filtered_items = account.inbox.filter(datetime_received__range=(datetime(int(date_start[0].strip()), int(date_start[1].strip()), int(date_start[2].strip()), int(date_start[3].strip()), int(date_start[4].strip())).replace(tzinfo=timezone.utc),datetime(int(date_end[0].strip()), int(date_end[1].strip()), int(date_end[2].strip()), int(date_end[3].strip()), int(date_end[4].strip())).replace(tzinfo=timezone.utc)),sender__icontains=args.sender,subject__contains=args.subject)
|
||||
|
||||
# List Number email coincidences
|
||||
list_mail=[]
|
||||
# Count number messages coincidences
|
||||
count=0
|
||||
|
||||
for item in filtered_items:
|
||||
|
||||
count=count+1
|
||||
|
||||
if mail_list != 0:
|
||||
list_mail.append("("+str(item.datetime_received) + ") - "+str(item.subject)+" - "+str(item.sender))
|
||||
|
||||
#print(item.subject, item.sender, item.datetime_received)
|
||||
|
||||
if mail_list!= 0:
|
||||
list_mail = parse_result(list_mail)
|
||||
create_agent(count,list_mail)
|
||||
else:
|
||||
create_agent(count)
|
||||
except Exception as e:
|
||||
print(0)
|
||||
write_to_log(f"{type(e).__name__}: {e}", log_file)
|
||||
sys.exit()
|
||||
|
||||
print(1)
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.775-240214
|
||||
Version: 7.0NG.775-240220
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.775-240214"
|
||||
pandora_version="7.0NG.775-240220"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.775";
|
||||
my $pandora_build = "240214";
|
||||
my $pandora_build = "240220";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -2428,7 +2428,7 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
|||
}
|
||||
|
||||
# Active ff interval
|
||||
if ($module->{'module_ff_interval'} != 0) {
|
||||
if ($module->{'module_ff_interval'} != 0 && $min_ff_event > 0 && $last_known_status != $status) {
|
||||
$current_interval = $module->{'module_ff_interval'};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -477,7 +477,7 @@ sub exec_recon_app ($$$) {
|
|||
|
||||
# No output message.
|
||||
if (!defined($output_json)) {
|
||||
push(@summary, "The execution returned no output.");
|
||||
push(@summary, "The execution returned no output. Is the server out of memory?");
|
||||
next;
|
||||
}
|
||||
|
||||
|
@ -1118,6 +1118,30 @@ sub PandoraFMS::Recon::Base::create_interface_modules($$) {
|
|||
return unless ($self->is_snmp_discovered($device));
|
||||
my $community = $self->get_community($device);
|
||||
|
||||
my $snmp3_creds = undef;
|
||||
if(defined($self->{'snmp3_auth_key'}{$device})) {
|
||||
$snmp3_creds = $self->snmp3_credentials($self->{'snmp3_auth_key'}{$device});
|
||||
}
|
||||
my $snmp3_params = {
|
||||
'custom_string_1' => '',
|
||||
'custom_string_2' => '',
|
||||
'custom_string_3' => '',
|
||||
'plugin_parameter' => '',
|
||||
'plugin_user' => '',
|
||||
'plugin_pass' => ''
|
||||
};
|
||||
if(defined($snmp3_creds)) {
|
||||
$community = $snmp3_creds->{'community'};
|
||||
$snmp3_params = {
|
||||
'custom_string_1' => $snmp3_creds->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $snmp3_creds->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $snmp3_creds->{'snmp_security_level'},
|
||||
'plugin_parameter' => $snmp3_creds->{'snmp_auth_method'},
|
||||
'plugin_user' => $snmp3_creds->{'snmp_auth_user'},
|
||||
'plugin_pass' => $snmp3_creds->{'snmp_auth_pass'}
|
||||
};
|
||||
}
|
||||
|
||||
my @output = $self->snmp_get_value_array($device, $PandoraFMS::Recon::Base::IFINDEX);
|
||||
foreach my $if_index (@output) {
|
||||
next unless ($if_index =~ /^[0-9]+$/);
|
||||
|
@ -1153,12 +1177,12 @@ sub PandoraFMS::Recon::Base::create_interface_modules($$) {
|
|||
),
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => $self->{'task_data'}{'snmp_version'},
|
||||
'custom_string_1' => $self->{'task_data'}{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'task_data'}{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'task_data'}{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'task_data'}{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'task_data'}{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'task_data'}{'snmp_auth_pass'},
|
||||
'custom_string_1' => $snmp3_params->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $snmp3_params->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $snmp3_params->{'snmp_security_level'},
|
||||
'plugin_parameter' => $snmp3_params->{'snmp_auth_method'},
|
||||
'plugin_user' => $snmp3_params->{'snmp_auth_user'},
|
||||
'plugin_pass' => $snmp3_params->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOPERSTATUS.$if_index",
|
||||
'unit' => ''
|
||||
|
@ -1183,12 +1207,12 @@ sub PandoraFMS::Recon::Base::create_interface_modules($$) {
|
|||
),
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => $self->{'task_data'}{'snmp_version'},
|
||||
'custom_string_1' => $self->{'task_data'}{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'task_data'}{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'task_data'}{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'task_data'}{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'task_data'}{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'task_data'}{'snmp_auth_pass'},
|
||||
'custom_string_1' => $snmp3_params->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $snmp3_params->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $snmp3_params->{'snmp_security_level'},
|
||||
'plugin_parameter' => $snmp3_params->{'snmp_auth_method'},
|
||||
'plugin_user' => $snmp3_params->{'snmp_auth_user'},
|
||||
'plugin_pass' => $snmp3_params->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFHCINOCTECTS.$if_index",
|
||||
'unit' => safe_input('bytes/s')
|
||||
|
@ -1210,12 +1234,12 @@ sub PandoraFMS::Recon::Base::create_interface_modules($$) {
|
|||
),
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => $self->{'task_data'}{'snmp_version'},
|
||||
'custom_string_1' => $self->{'task_data'}{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'task_data'}{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'task_data'}{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'task_data'}{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'task_data'}{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'task_data'}{'snmp_auth_pass'},
|
||||
'custom_string_1' => $snmp3_params->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $snmp3_params->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $snmp3_params->{'snmp_security_level'},
|
||||
'plugin_parameter' => $snmp3_params->{'snmp_auth_method'},
|
||||
'plugin_user' => $snmp3_params->{'snmp_auth_user'},
|
||||
'plugin_pass' => $snmp3_params->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFINOCTECTS.$if_index",
|
||||
'unit' => safe_input('bytes/s')
|
||||
|
@ -1241,12 +1265,12 @@ sub PandoraFMS::Recon::Base::create_interface_modules($$) {
|
|||
),
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => $self->{'task_data'}{'snmp_version'},
|
||||
'custom_string_1' => $self->{'task_data'}{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'task_data'}{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'task_data'}{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'task_data'}{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'task_data'}{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'task_data'}{'snmp_auth_pass'},
|
||||
'custom_string_1' => $snmp3_params->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $snmp3_params->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $snmp3_params->{'snmp_security_level'},
|
||||
'plugin_parameter' => $snmp3_params->{'snmp_auth_method'},
|
||||
'plugin_user' => $snmp3_params->{'snmp_auth_user'},
|
||||
'plugin_pass' => $snmp3_params->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFHCOUTOCTECTS.$if_index",
|
||||
'unit' => safe_input('bytes/s')
|
||||
|
@ -1268,12 +1292,12 @@ sub PandoraFMS::Recon::Base::create_interface_modules($$) {
|
|||
),
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => $self->{'task_data'}{'snmp_version'},
|
||||
'custom_string_1' => $self->{'task_data'}{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'task_data'}{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'task_data'}{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'task_data'}{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'task_data'}{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'task_data'}{'snmp_auth_pass'},
|
||||
'custom_string_1' => $snmp3_params->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $snmp3_params->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $snmp3_params->{'snmp_security_level'},
|
||||
'plugin_parameter' => $snmp3_params->{'snmp_auth_method'},
|
||||
'plugin_user' => $snmp3_params->{'snmp_auth_user'},
|
||||
'plugin_pass' => $snmp3_params->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOUTOCTECTS.$if_index",
|
||||
'unit' => safe_input('bytes/s')
|
||||
|
@ -1305,19 +1329,19 @@ sub PandoraFMS::Recon::Base::create_interface_modules($$) {
|
|||
# Interface index filter.
|
||||
$macros->{'5'}->{'value'} = $if_index;
|
||||
# SecurityName.
|
||||
$macros->{'6'}->{'value'} = $self->{'task_data'}->{'snmp_auth_user'};
|
||||
$macros->{'6'}->{'value'} = $snmp3_params->{'snmp_auth_user'};
|
||||
# SecurityContext.
|
||||
$macros->{'7'}->{'value'} = $community;
|
||||
# SecurityLevel.
|
||||
$macros->{'8'}->{'value'} = $self->{'task_data'}->{'snmp_security_level'};
|
||||
$macros->{'8'}->{'value'} = $snmp3_params->{'snmp_security_level'};
|
||||
# AuthProtocol.
|
||||
$macros->{'9'}->{'value'} = $self->{'task_data'}->{'snmp_auth_method'};
|
||||
$macros->{'9'}->{'value'} = $snmp3_params->{'snmp_auth_method'};
|
||||
# AuthKey.
|
||||
$macros->{'10'}->{'value'} = $self->{'task_data'}->{'snmp_auth_pass'};
|
||||
$macros->{'10'}->{'value'} = $snmp3_params->{'snmp_auth_pass'};
|
||||
# PrivProtocol.
|
||||
$macros->{'11'}->{'value'} = $self->{'task_data'}->{'snmp_privacy_method'};
|
||||
$macros->{'11'}->{'value'} = $snmp3_params->{'snmp_privacy_method'};
|
||||
# PrivKey.
|
||||
$macros->{'12'}->{'value'} = $self->{'task_data'}->{'snmp_privacy_pass'};
|
||||
$macros->{'12'}->{'value'} = $snmp3_params->{'snmp_privacy_pass'};
|
||||
# Hash identifier.
|
||||
$macros->{'13'}->{'value'} = PandoraFMS::Tools::generate_agent_name_hash($if_name, $device);
|
||||
# Get input usage.
|
||||
|
@ -1429,6 +1453,7 @@ sub PandoraFMS::Recon::Base::create_wmi_modules {
|
|||
{
|
||||
'ip_target' => $target,
|
||||
'snmp_oid' => "SELECT LoadPercentage FROM Win32_Processor WHERE DeviceId=\'$cpu\'",
|
||||
'tcp_send' => $creds->{'extra_1'},
|
||||
'plugin_user' => $creds->{'username'},
|
||||
'plugin_pass' => $creds->{'password'},
|
||||
'tcp_port' => 1,
|
||||
|
@ -1449,6 +1474,7 @@ sub PandoraFMS::Recon::Base::create_wmi_modules {
|
|||
{
|
||||
'ip_target' => $target,
|
||||
'snmp_oid' => "SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem",
|
||||
'tcp_send' => $creds->{'extra_1'},
|
||||
'plugin_user' => $creds->{'username'},
|
||||
'plugin_pass' => $creds->{'password'},
|
||||
'tcp_port' => 0,
|
||||
|
@ -1469,6 +1495,7 @@ sub PandoraFMS::Recon::Base::create_wmi_modules {
|
|||
{
|
||||
'ip_target' => $target,
|
||||
'snmp_oid' => "SELECT FreeSpace FROM Win32_LogicalDisk WHERE DeviceID='$unit'",
|
||||
'tcp_send' => $creds->{'extra_1'},
|
||||
'plugin_user' => $creds->{'username'},
|
||||
'plugin_pass' => $creds->{'password'},
|
||||
'tcp_port' => 1,
|
||||
|
@ -1510,14 +1537,7 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) {
|
|||
# 1. Retrieve template info.
|
||||
my $template = get_nc_profile_advanced($self->{'dbh'}, $t_id);
|
||||
|
||||
# 2. Verify Private Enterprise Number matches (PEN)
|
||||
if (defined($template->{'pen'})) {
|
||||
my @pens = split(',', $template->{'pen'});
|
||||
|
||||
next unless (is_in_array(\@pens, $self->get_pen($device)));
|
||||
}
|
||||
|
||||
# 3. Retrieve module list from target template.
|
||||
# 2. Retrieve module list from target template.
|
||||
my @np_components = get_db_rows(
|
||||
$self->{'dbh'},
|
||||
'SELECT * FROM tnetwork_profile_component WHERE id_np = ?',
|
||||
|
@ -1525,7 +1545,7 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) {
|
|||
);
|
||||
|
||||
foreach my $np_component (@np_components) {
|
||||
# 4. Register each module (candidate). 'add_module' will test them.
|
||||
# 3. Register each module (candidate). 'add_module' will test them.
|
||||
my $component = get_db_single_row(
|
||||
$self->{'dbh'},
|
||||
'SELECT * FROM tnetwork_component WHERE id_nc = ?',
|
||||
|
@ -1543,18 +1563,45 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) {
|
|||
}
|
||||
|
||||
$component->{'name'} = safe_output($component->{'name'});
|
||||
if ($component->{'type'} >= 15 && $component->{'type'} <= 18) {
|
||||
$component->{'snmp_community'} = safe_output($self->get_community($device));
|
||||
# SNMP Modules
|
||||
if ($self->is_snmp_discovered($device) && $component->{'type'} >= 15 && $component->{'type'} <= 18) {
|
||||
my $snmp3_creds = undef;
|
||||
my $community = safe_output($self->get_community($device));
|
||||
if(defined($self->{'snmp3_auth_key'}{$device})) {
|
||||
$snmp3_creds = $self->snmp3_credentials($self->{'snmp3_auth_key'}{$device});
|
||||
}
|
||||
my $snmp3_params = {
|
||||
'custom_string_1' => '',
|
||||
'custom_string_2' => '',
|
||||
'custom_string_3' => '',
|
||||
'plugin_parameter' => '',
|
||||
'plugin_user' => '',
|
||||
'plugin_pass' => ''
|
||||
};
|
||||
if(defined($snmp3_creds)) {
|
||||
$community = $snmp3_creds->{'community'};
|
||||
$snmp3_params = {
|
||||
'custom_string_1' => $snmp3_creds->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $snmp3_creds->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $snmp3_creds->{'snmp_security_level'},
|
||||
'plugin_parameter' => $snmp3_creds->{'snmp_auth_method'},
|
||||
'plugin_user' => $snmp3_creds->{'snmp_auth_user'},
|
||||
'plugin_pass' => $snmp3_creds->{'snmp_auth_pass'}
|
||||
};
|
||||
}
|
||||
|
||||
$component->{'snmp_community'} = $community;
|
||||
$component->{'tcp_send'} = $self->{'snmp_version'};
|
||||
$component->{'custom_string_1'} = $self->{'snmp_privacy_method'};
|
||||
$component->{'custom_string_2'} = $self->{'snmp_privacy_pass'};
|
||||
$component->{'custom_string_3'} = $self->{'snmp_security_level'};
|
||||
$component->{'plugin_parameter'} = $self->{'snmp_auth_method'};
|
||||
$component->{'plugin_user'} = $self->{'snmp_auth_user'};
|
||||
$component->{'plugin_pass'} = $self->{'snmp_auth_pass'};
|
||||
$component->{'custom_string_1'} = $snmp3_params->{'snmp_privacy_method'};
|
||||
$component->{'custom_string_2'} = $snmp3_params->{'snmp_privacy_pass'};
|
||||
$component->{'custom_string_3'} = $snmp3_params->{'snmp_security_level'};
|
||||
$component->{'plugin_parameter'} = $snmp3_params->{'snmp_auth_method'};
|
||||
$component->{'plugin_user'} = $snmp3_params->{'snmp_auth_user'};
|
||||
$component->{'plugin_pass'} = $snmp3_params->{'snmp_auth_pass'};
|
||||
}
|
||||
|
||||
if ($component->{'type'} >= 34 && $component->{'type'} <= 37) {
|
||||
# RCMD Modules
|
||||
if ($self->rcmd_responds($device) && $component->{'type'} >= 34 && $component->{'type'} <= 37) {
|
||||
# Update module credentials.
|
||||
$component->{'custom_string_1'} = $self->rcmd_credentials_key($device);
|
||||
$component->{'custom_string_2'} = pandora_get_os_by_id(
|
||||
|
@ -1563,9 +1610,18 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) {
|
|||
);
|
||||
}
|
||||
|
||||
# WMI Modules
|
||||
if ($self->wmi_responds($device) && $component->{'id_modulo'} == 6) {
|
||||
my $key = $self->wmi_credentials_key($device);
|
||||
my $creds = $self->call('get_credentials', $key);
|
||||
$component->{'tcp_send'} = $creds->{'extra_1'};
|
||||
$component->{'plugin_user'} = $creds->{'username'};
|
||||
$component->{'plugin_pass'} = $creds->{'password'};
|
||||
}
|
||||
|
||||
$component->{'__module_component'} = 1;
|
||||
|
||||
# 3. Try to register module into monitoring list.
|
||||
# 4. Try to register module into monitoring list.
|
||||
$self->call('add_module', $device, $component);
|
||||
}
|
||||
}
|
||||
|
@ -1576,13 +1632,23 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) {
|
|||
# Retrieve a key from credential store.
|
||||
################################################################################
|
||||
sub PandoraFMS::Recon::Base::get_credentials {
|
||||
my ($self, $key_index) = @_;
|
||||
my ($self, $key_index, $product) = @_;
|
||||
|
||||
return credential_store_get_key(
|
||||
my $cred = credential_store_get_key(
|
||||
$self->{'pa_config'},
|
||||
$self->{'dbh'},
|
||||
$key_index
|
||||
);
|
||||
|
||||
if(defined($product)) {
|
||||
if($product eq $cred->{'product'}) {
|
||||
return $cred;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
return $cred;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.775";
|
||||
my $pandora_build = "240214";
|
||||
my $pandora_build = "240220";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -1352,10 +1352,9 @@ sub snmp_responds_v122c($$) {
|
|||
sub snmp_responds_v3($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
my $command = $self->snmp_get_command($device, ".0");
|
||||
`$command`;
|
||||
$self->snmp3_credentials_calculation($device);
|
||||
|
||||
if ($? == 0) {
|
||||
if ($self->snmp3_credentials_calculation($device)) {
|
||||
$self->mark_discovered($device);
|
||||
return 1;
|
||||
}
|
||||
|
@ -1363,6 +1362,81 @@ sub snmp_responds_v3($$) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Get SNMP3 credentials info in HASH
|
||||
################################################################################
|
||||
sub snmp3_credentials {
|
||||
my ($self, $key) = @_;
|
||||
|
||||
my $cred = $self->call('get_credentials', $key, 'SNMP');
|
||||
return undef if !defined($cred);
|
||||
return undef if ref($cred) ne 'HASH';
|
||||
|
||||
my $extra1 = {};
|
||||
eval {
|
||||
local $SIG{__DIE__};
|
||||
$extra1 = p_decode_json($self->{'pa_config'}, $cred->{'extra_1'});
|
||||
};
|
||||
if ($@) {
|
||||
$self->call('message', "[".$key."] Credentials ERROR JSON: $@", 10);
|
||||
return undef;
|
||||
}
|
||||
|
||||
return undef if $extra1->{'version'} ne '3';
|
||||
|
||||
return {
|
||||
'snmp_security_level' => $extra1->{'securityLevelV3'},
|
||||
'snmp_privacy_method' => $extra1->{'privacyMethodV3'},
|
||||
'snmp_privacy_pass' => $extra1->{'privacyPassV3'},
|
||||
'snmp_auth_method' => $extra1->{'authMethodV3'},
|
||||
'snmp_auth_user' => $extra1->{'authUserV3'},
|
||||
'snmp_auth_pass' => $extra1->{'authPassV3'},
|
||||
'community' => $extra1->{'community'}
|
||||
};
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Calculate WMI credentials for target, 1 if calculated, undef if cannot
|
||||
# connect to target. Credentials could be empty (-N)
|
||||
################################################################################
|
||||
sub snmp3_credentials_calculation {
|
||||
my ($self, $target) = @_;
|
||||
|
||||
# Test all credentials selected.
|
||||
foreach my $key_index (@{$self->{'auth_strings_array'}}) {
|
||||
my $cred = snmp3_credentials($key_index);
|
||||
next if !defined($cred);
|
||||
next if ref($cred) ne 'HASH';
|
||||
|
||||
my $auth = '';
|
||||
if ($cred->{'community'}) { # Context
|
||||
$auth .= " -N \'$cred->{'community'}\' ";
|
||||
}
|
||||
$auth .= " -l$cred->{'snmp_security_level'} ";
|
||||
if ($cred->{'snmp_security_level'} ne "noAuthNoPriv") {
|
||||
$auth .= " -u$cred->{'snmp_auth_user'} -a $cred->{'snmp_auth_method'} -A \'$cred->{'snmp_auth_pass'}\' ";
|
||||
}
|
||||
if ($cred->{'snmp_security_level'} eq "authPriv") {
|
||||
$auth .= " -x$cred->{'snmp_privacy_method'} -X \'$cred->{'snmp_privacy_pass'}\' ";
|
||||
}
|
||||
|
||||
$self->{'snmp3_auth'}{$target} = $auth;
|
||||
$self->{'snmp3_auth_key'}{$target} = $key_index;
|
||||
|
||||
my $command = $self->snmp_get_command($target, ".0");
|
||||
`$command`;
|
||||
|
||||
if ($? == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
delete($self->{'snmp3_auth'}{$target});
|
||||
delete($self->{'snmp3_auth_key'}{$target});
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Parse the local ARP cache.
|
||||
################################################################################
|
||||
|
@ -2198,16 +2272,7 @@ sub snmp_get_command {
|
|||
|
||||
my $command = "snmpwalk -M$DEVNULL -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v$self->{'snmp_version'} -On -Oe ";
|
||||
if ($self->{'snmp_version'} eq "3") {
|
||||
if ($self->{'community'}) { # Context
|
||||
$command .= " -N \'$self->{'community'}\' ";
|
||||
}
|
||||
$command .= " -l$self->{'snmp_security_level'} ";
|
||||
if ($self->{'snmp_security_level'} ne "noAuthNoPriv") {
|
||||
$command .= " -u$self->{'snmp_auth_user'} -a $self->{'snmp_auth_method'} -A \'$self->{'snmp_auth_pass'}\' ";
|
||||
}
|
||||
if ($self->{'snmp_security_level'} eq "authPriv") {
|
||||
$command .= " -x$self->{'snmp_privacy_method'} -X \'$self->{'snmp_privacy_pass'}\' ";
|
||||
}
|
||||
$command .= " $self->{'snmp3_auth'}{$device} ";
|
||||
} else {
|
||||
$command .= " -c\'$community\'$vlan ";
|
||||
}
|
||||
|
@ -2353,7 +2418,8 @@ sub wmi_credentials_calculation {
|
|||
|
||||
# Test all credentials selected.
|
||||
foreach my $key_index (@{$self->{'auth_strings_array'}}) {
|
||||
my $cred = $self->call('get_credentials', $key_index);
|
||||
my $cred = $self->call('get_credentials', $key_index, 'WMI');
|
||||
next if !defined($cred);
|
||||
next if ref($cred) ne 'HASH';
|
||||
|
||||
my $auth = $cred->{'username'}.'%'.$cred->{'password'};
|
||||
|
@ -2431,7 +2497,8 @@ sub rcmd_credentials_calculation {
|
|||
|
||||
# Test all credentials selected.
|
||||
foreach my $key_index (@{$self->{'auth_strings_array'}}) {
|
||||
my $cred = $self->call('get_credentials', $key_index);
|
||||
my $cred = $self->call('get_credentials', $key_index, 'CUSTOM');
|
||||
next if !defined($cred);
|
||||
next if ref($cred) ne 'HASH';
|
||||
$rcmd->clean_ssh_lib();
|
||||
|
||||
|
|
|
@ -716,19 +716,23 @@ sub credential_store_get_key($$$) {
|
|||
my $sql = 'SELECT * FROM tcredential_store WHERE identifier = ?';
|
||||
my $key = PandoraFMS::DB::get_db_single_row($dbh, $sql, $identifier);
|
||||
|
||||
return {
|
||||
'username' => PandoraFMS::Core::pandora_output_password(
|
||||
$pa_config,
|
||||
$key->{'username'}
|
||||
),
|
||||
'password' => PandoraFMS::Core::pandora_output_password(
|
||||
$pa_config,
|
||||
$key->{'password'}
|
||||
),
|
||||
'extra_1' => $key->{'extra_1'},
|
||||
'extra_2' => $key->{'extra_2'},
|
||||
};
|
||||
if(defined($key)) {
|
||||
return {
|
||||
'product' => $key->{'product'},
|
||||
'username' => PandoraFMS::Core::pandora_output_password(
|
||||
$pa_config,
|
||||
$key->{'username'}
|
||||
),
|
||||
'password' => PandoraFMS::Core::pandora_output_password(
|
||||
$pa_config,
|
||||
$key->{'password'}
|
||||
),
|
||||
'extra_1' => $key->{'extra_1'},
|
||||
'extra_2' => $key->{'extra_2'},
|
||||
};
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
%define debug_package %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.775
|
||||
%define release 240214
|
||||
%define release 240220
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.775"
|
||||
PI_BUILD="240214"
|
||||
PI_BUILD="240220"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -38,7 +38,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.775 Build 240214";
|
||||
my $version = "7.0NG.775 Build 240220";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -58,6 +58,9 @@ my $Restart = 0;
|
|||
# Controlled exit
|
||||
my $Running = 0;
|
||||
|
||||
# License
|
||||
my $License;
|
||||
|
||||
########################################################################
|
||||
# Print the given message with a preceding timestamp.
|
||||
########################################################################
|
||||
|
@ -359,6 +362,27 @@ sub ha_update_server($$) {
|
|||
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Restart pandora server on demand.
|
||||
###############################################################################
|
||||
sub ha_restart_server($$) {
|
||||
my ($config, $dbh) = @_;
|
||||
my $OSNAME = $^O;
|
||||
|
||||
my $current_license;
|
||||
if (!defined($License)) {
|
||||
$License = get_db_value($dbh, 'SELECT `value` FROM `tupdate_settings` WHERE `key` = "customer_key"');
|
||||
$current_license = $License;
|
||||
} else {
|
||||
$current_license = get_db_value($dbh, 'SELECT `value` FROM `tupdate_settings` WHERE `key` = "customer_key"');
|
||||
}
|
||||
|
||||
if($License ne $current_license) {
|
||||
ha_restart_pandora($config);
|
||||
$License = $current_license;
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Dump the list of known databases to disk.
|
||||
################################################################################
|
||||
|
@ -691,6 +715,9 @@ sub ha_main_pandora($) {
|
|||
# Check if there are updates pending.
|
||||
ha_update_server($conf, $dbh);
|
||||
|
||||
# Check restart server on demand.
|
||||
ha_restart_server($conf, $dbh);
|
||||
|
||||
# Keep pandora running
|
||||
ha_keep_pandora_running($conf, $dbh);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.775 Build 240214";
|
||||
my $version = "7.0NG.775 Build 240220";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue