Merge remote-tracking branch 'origin/develop' into ent-13668-release-777

This commit is contained in:
daniel 2024-05-21 08:23:51 +02:00
commit a5aecac20c
74 changed files with 1757 additions and 336 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.776-240515
Version: 7.0NG.776-240521
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.776-240515"
pandora_version="7.0NG.776-240521"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.776';
use constant AGENT_BUILD => '240515';
use constant AGENT_BUILD => '240521';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

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

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240515
%define release 240521
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.776
%define release 240515
%define release 240521
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.776"
PI_BUILD="240515"
PI_BUILD="240521"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{240515}
{240521}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.776 Build 240515")
#define PANDORA_VERSION ("7.0NG.776 Build 240521")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.776(Build 240515))"
VALUE "ProductVersion", "(7.0NG.776(Build 240521))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.776-240515
Version: 7.0NG.776-240521
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.776-240515"
pandora_version="7.0NG.776-240521"
package_pear=0
package_pandora=1

View File

@ -9,5 +9,5 @@ pandorafms.sap.deset=9bb72b7f7497a8b543f25cd71f96878f
pandorafms.gcp.ce=6743d39452f8e1ad85d0d56a30843973
pandorafms.aws.ec2=07416081f11d92a7d5d9441dabb5c5cb
pandorafms.aws.s3=eff053a212ea112e2a37efd9debbe6a0
pandorafms.aws.rds=47d7b02019329e1698f96db4959f9516
pandorafms.aws.rds=4627391054f118c65387280cb8c4e520
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3

View File

@ -126,7 +126,8 @@ UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FRO
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
-- Update version for plugin mysql
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.mysql';
-- Update version for plugin rds
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.aws.rds';
SET @widget_id = NULL;
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = 'GisMap';
@ -177,4 +178,4 @@ ALTER TABLE `tuser_task_scheduled` ADD COLUMN `id_report` INT NULL AFTER `id_use
ALTER TABLE `tuser_task_scheduled` ADD COLUMN `name` VARCHAR(255) NULL AFTER `id_user_task`;
COMMIT;
COMMIT;

View File

@ -7771,5 +7771,13 @@ UPDATE `tdiscovery_apps` SET `version` = '1.5' WHERE `short_name` = 'pandorafms.
DELETE FROM tevent_response WHERE name = 'Create incident from event';
UPDATE tconfig_os SET `name` = 'Web Server' WHERE `id_os` = 12;
UPDATE `tncm_script` SET `content` ='set cli pager off \n
capture:show system info | match app-version:\n
sleep:1
exit \n'
WHERE `content`='set cli pager off \n
capture:show system info | match app-version:\n
sleep:1 
expect:app-version:\s*
exit \n';
UPDATE `tncm_script` SET `content` ='expect:root@%
cli\n
expect:root>
capture:show version|match Junos:\n
quit\n
expect:root@%
exit\n'
WHERE `content`= 'expect:root@%
cli\n
expect:root>
capture:show version|match Junos:\n
capture: \n
quit\n
expect:root@%
exit\n';
UPDATE `tncm_script` SET `content` ='expect:root@%
cli\n
expect:root>
capture:show version|match Junos:\n
quit\n
expect:root@%
exit\n'
WHERE `content`='expect:root@%
cli\n
expect:root>
capture:show version|match Junos:\n
capture: \n
quit\n
expect:root@%
exit\n';
COMMIT;

View File

@ -712,6 +712,29 @@ if ($login_screen === 'disabled_access_node') {
echo '</div>';
}
if (empty($process_error_message) === true
&& isset($config['pending_sync_process_message']) === true
&& $login_screen === 'login'
) {
echo '<div id="pending_sync_process" title="'.__('Centralized user in metaconsole').'">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
echo html_print_image('images/icono_logo_pandora.png', true, ['alt' => __('Pending synchronization process'), 'border' => 0]);
echo '</div>';
echo '<div class="content_message_alert">';
echo '<div class="text_message_alert">';
echo '<h1>'.__('Access granted').'</h1>';
echo '<p>'.$config['pending_sync_process_message'].'</p>';
echo '</div>';
echo '<br>';
echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-sync-process', false, ['class' => 'mini float-right']);
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
switch ($login_screen) {
case 'error_dbconfig':
case 'error_authconfig':
@ -966,6 +989,24 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
$("#login_failed" ).dialog('close');
$("#login_correct_pass").dialog('close');
});
if ($('#pending_sync_process').length > 0) {
$('#pending_sync_process').dialog({
resizable: true,
draggable: true,
modal: true,
height: 230,
width: 530,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
$('#button-hide-sync-process').click(function() {
$('#pending_sync_process').dialog('close')
})
});
$('#nick').focus();
break;

View File

@ -143,7 +143,7 @@ $form_filter .= '<td class="w33p">'.html_print_label_input_block(
).'</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Priority'),
__('Severity'),
html_print_select(
get_priorities(),
'priority',

View File

@ -127,7 +127,7 @@ $table_details->data[] = $data;
$priorities = get_priorities();
$data[0] = __('Priority');
$data[0] = __('Severity');
$data[1] = '<span title="'.$priorities[$template['priority']].'" class="'.get_priority_class($template['priority']).' span_priority">&nbsp</span>'.$priorities[$template['priority']];
$table_details->data[] = $data;

View File

@ -1235,9 +1235,9 @@ if ($step == 2) {
);
$table->data[2][0] = html_print_label_input_block(
__('Priority'),
__('Severity'),
html_print_select(
get_priorities(),
get_priorities(false, true),
'priority',
$priority,
'',

View File

@ -121,6 +121,11 @@ foreach ($rows as $row) {
$settings->{$row['key']} = $row['value'];
}
if ($settings->customer_key === 'PANDORA-ENTERPRISE-FREE') {
$license['limit'] = 50;
$license['license_mode'] = 'FREE';
}
?>
<script type="text/javascript">
var texts = {

View File

@ -1614,9 +1614,9 @@ if ($create_alert || $update_alert) {
echo '</td>';
echo '<td class="w50p">';
echo html_print_label_input_block(
__('Priority'),
__('Severity'),
html_print_select(
get_priorities(),
get_priorities(false, true),
'priority',
$priority,
'',
@ -1776,7 +1776,7 @@ if ($create_alert || $update_alert) {
);
$table_filter->data[0][2] = html_print_label_input_block(
__('Priority'),
__('Severity'),
html_print_select(
get_priorities(),
'priority_filter',

View File

@ -65,7 +65,7 @@ if (isset($config['lts_updates']) === false) {
}
if (empty($license) === true) {
$license = 'PANDORA-FREE';
$license = 'PANDORA-ENTERPRISE-FREE';
}
$mode_str = '';
@ -81,7 +81,7 @@ if ($mode === Manager::MODE_ONLINE) {
enterprise_include_once('/include/functions_license.php');
$license_data = enterprise_hook('license_get_info');
if ($license_data !== ENTERPRISE_NOT_HOOK) {
if ($license_data !== ENTERPRISE_NOT_HOOK && $license !== 'PANDORA-ENTERPRISE-FREE') {
$days_to_expiry = ((strtotime($license_data['expiry_date']) - time()) / (60 * 60 * 24));
if ((int) $license_data['limit_mode'] === 0) {
@ -91,7 +91,7 @@ if ($license_data !== ENTERPRISE_NOT_HOOK) {
$limit = db_get_value('count(*)', 'tagente_modulo', 'disabled', 0);
}
if ($limit > $license_data['limit']) {
if ($limit > ($license_data['limit'] * 1.1)) {
ui_print_warning_message(
__(
'You cannot use update manager %s. You are exceding monitoring limits by %s elements. Please update your license or disable enterprise section by moving enterprise directory to another location and try again.',
@ -112,20 +112,6 @@ if ($license_data !== ENTERPRISE_NOT_HOOK) {
);
return;
}
if (rtrim($license_data['licensed_to']) === Manager::PANDORA_TRIAL_ISSUER) {
$product_name = get_product_name();
ui_print_info_message(
__(
'You cannot use update manager %s. This license is a trial license to test all %s features. Please update your license to unlock all %s features.',
$mode_str,
$product_name,
$product_name
)
);
return;
}
} else {
$license_data = [];
$license_data['count_enabled'] = db_get_value(

View File

@ -134,8 +134,8 @@ if ($stop_lts_modal === '0') {
}],
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
$("div.ui-dialog-buttonset").addClass('flex-rr-sb-important');
$("div.ui-dialog-buttonset").append(`
$(".ui-dialog-buttonpane").children(":first").addClass('flex-rr-sb-important');
$(".ui-dialog-buttonpane").children(":first").append(`
<div class="welcome-wizard-buttons">
<label class="flex-row-center">
<input type="checkbox" id="checkbox-no_show_more" class="welcome-wizard-do-not-show"/>

View File

@ -1926,6 +1926,9 @@ class DiscoveryTaskList extends HTML
// License precheck.
$license = enterprise_hook('license_get_info');
if (empty($license) === false && license_enterprise_free() === true) {
$license['limit'] = 50;
}
if (is_array($license) === true
&& $n_agents > ($license['limit'] - $license['count_enabled'])

View File

@ -1175,6 +1175,10 @@ class HostDevices extends Wizard
// License precheck.
$license = enterprise_hook('license_get_info');
if (empty($license) === false && license_enterprise_free() === true) {
$license['limit'] = 50;
}
$n_agents = 0;
foreach (explode(',', $this->task['subnet']) as $net) {
$mask = explode('/', $net, 2)[1];

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 478 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 558 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 350 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1.0 MiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 49 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 111 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 525 KiB

View File

@ -103,7 +103,7 @@ $playAsteroids = (bool) get_parameter('playAsteroids', false);
if ($get_comments === true) {
global $config;
$event = json_decode(io_safe_output(base64_decode(get_parameter('event', ''))), true);
$event = json_decode(base64_decode(get_parameter('event', '')), true);
$filter = json_decode(io_safe_output(base64_decode(get_parameter('filter', ''))), true);
$default_hour = (int) $filter['event_view_hr'];
@ -1205,13 +1205,8 @@ if ($get_response === true) {
if (empty($event_id) === false) {
try {
$target_metaconsole = '';
if (is_metaconsole() === true
&& $server_id > 0
) {
$target_metaconsole = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id']));
if (is_metaconsole() === true && $server_id > 0) {
$node = new Node($server_id);
$node->connect();
}
$event_response['target'] = events_get_response_target(
@ -1220,28 +1215,13 @@ if ($get_response === true) {
$response_parameters,
$server_id,
($server_id !== 0) ? $node->server_name() : 'Metaconsole',
$target_metaconsole
);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
return;
} finally {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
}
}
echo json_encode($event_response);
return;
}
@ -1313,23 +1293,29 @@ if ($get_response_massive === true) {
if ($get_row_response_action === true) {
$response_id = get_parameter('response_id');
$response = json_decode(
io_safe_output(
get_parameter('response', '')
),
$server_id = get_parameter('server_id');
$event_id = get_parameter('event_id');
$response_parameters = (array) json_decode(
io_safe_output(get_parameter('response_parameters', '')),
true
);
$end = (bool) get_parameter('end', false);
$index = $response['event_id'];
$event_response = db_get_row(
'tevent_response',
'id',
$response_id
);
$index = $event_id;
if (is_metaconsole() === true) {
$index .= '-'.$response['server_id'];
$index .= '-'.$server_id;
}
echo get_row_response_action(
$response,
$response_id,
$end,
$event_response,
$event_id,
$server_id,
$response_parameters,
$index
);
@ -1344,34 +1330,31 @@ if ($perform_event_response === true) {
return;
}
$target = get_parameter('target', '');
$response_id = get_parameter('response_id');
$response_id = (int) get_parameter('response_id', 0);
$event_id = (int) get_parameter('event_id');
$server_id = (int) get_parameter('server_id', 0);
$response = json_decode(
io_safe_output(
get_parameter('response', '')
),
$response_parameters = (array) json_decode(
io_safe_output(get_parameter('response_parameters', '')),
true
);
$event_response = $response;
$event_response = db_get_row(
'tevent_response',
'id',
$response_id
);
if (empty($event_response) === true) {
echo __('No data');
return;
}
$command = $event_response['target'];
// Prevent OS command injection.
$prev_command = get_events_get_response_target($event_id, $event_response, $server_id);
if ($command !== $prev_command) {
echo __('unauthorized');
return;
}
$command_timeout = ($event_response !== false) ? $event_response['command_timeout'] : 90;
$command = get_events_get_response_target(
$event_id,
$event_response,
$server_id,
$response_parameters
);
$command_timeout = (empty($event_response['command_timeout']) === false) ? $event_response['command_timeout'] : 90;
if (enterprise_installed() === true) {
if ($event_response !== false
&& (int) $event_response['server_to_exec'] !== 0
@ -1470,21 +1453,33 @@ if ($dialogue_event_response) {
return;
}
$event_id = get_parameter('event_id');
$response_id = get_parameter('response_id');
$command = get_parameter('target');
$event_response = json_decode(
io_safe_output(
get_parameter('response', '')
),
$event_id = (int) get_parameter('event_id', 0);
$response_id = (int) get_parameter('response_id', 0);
$server_id = (int) get_parameter('server_id', 0);
$response_parameters = (array) json_decode(
io_safe_output(get_parameter('response_parameters', '')),
true
);
$event_response = db_get_row(
'tevent_response',
'id',
$response_id
);
$command = get_events_get_response_target(
$event_id,
$event_response,
$server_id,
$response_parameters
);
switch ($event_response['type']) {
case 'command':
echo get_row_response_action(
$event_response,
$response_id
$event_id,
$server_id,
$response_parameters
);
break;
@ -1550,7 +1545,7 @@ if ($add_comment === true) {
if ($change_status === true) {
$event_ids = get_parameter('event_ids');
$new_status = get_parameter('new_status');
$group_rep = (int) get_parameter('group_rep', 0);
$filter = get_parameter('filter', []);
$server_id = 0;
if (is_metaconsole() === true) {
$server_id = (int) get_parameter('server_id');
@ -1564,19 +1559,11 @@ if ($change_status === true) {
$node->connect();
}
if ($group_rep !== 3) {
$return = events_change_status(
explode(',', $event_ids),
$new_status
);
} else {
// Update all elements with same extraid.
$return = events_update_status(
$event_ids,
(int) $new_status,
['group_rep' => $group_rep]
);
}
$return = events_update_status(
$event_ids,
(int) $new_status,
$filter
);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
@ -1962,7 +1949,7 @@ if ($get_extended_event) {
metaconsole_restore_db();
}
$general = events_page_general($event);
$general = events_page_general($event, $filter);
$comments = '<div id="extended_event_comments_page" class="extended_event_pages"></div>';

View File

@ -83,7 +83,7 @@ $apiPassword = io_output_password(
$apiTokenValid = false;
// Try getting bearer token from header.
// TODO. Getting token from url will be removed.
$apiToken = (string) getBearerToken();
$apiToken = (string) io_safe_input(getBearerToken());
if (empty($apiToken) === true) {
// Legacy user/pass token.
// TODO. Revome in future.

View File

@ -72,6 +72,7 @@ if (isset($config) === false) {
}
require_once $config['homedir'].'/include/functions_profile.php';
require_once $config['homedir'].'/include/functions_token.php';
enterprise_include('include/auth/mysql.php');
$config['user_can_update_info'] = true;
@ -220,14 +221,31 @@ function process_user_login_remote($login, $pass, $api=false)
{
global $config, $mysql_cache;
$create_by_remote_api = false;
if (is_metaconsole() === false && is_management_allowed() === false) {
$create_by_remote_api = true;
}
// Remote authentication.
switch ($config['auth']) {
// LDAP.
case 'ldap':
$sr = ldap_process_user_login($login, $pass);
// Try with secondary server if not login.
if ($sr === false && (bool) $config['secondary_ldap_enabled'] === true) {
$sr = ldap_process_user_login($login, $pass, true);
if ($create_by_remote_api === true) {
$sr = ldap_process_user_login_by_api($login, $pass);
if ($sr !== false && isset($sr['uid']) === true && is_array($sr['uid']) === true) {
$already_user = db_get_value('id_user', 'tusuario', 'id_user', $sr['uid'][0]);
// If the node is centralized, LDAP login is delegated to the metaconsole via the API.
// Since the user is not yet on the nodes, they are asked to try again in a few minutes.
if ($already_user === false && is_metaconsole() === false) {
$config['pending_sync_process_message'] = __('Successful login, please wait a few minutes for the metaconsole to synchronize with the nodes and then log in again with the same credentials.');
}
}
} else {
$sr = ldap_process_user_login($login, $pass);
// Try with secondary server if not login.
if ($sr === false && (bool) $config['secondary_ldap_enabled'] === true) {
$sr = ldap_process_user_login($login, $pass, true);
}
}
if (!$sr) {
@ -237,10 +255,22 @@ function process_user_login_remote($login, $pass, $api=false)
// Active Directory.
case 'ad':
$sr = enterprise_hook('ad_process_user_login', [$login, $pass]);
// Try with secondary server.
if ($sr === false && (bool) $config['secondary_active_directory'] === true) {
$sr = enterprise_hook('ad_process_user_login', [$login, $pass, true]);
if ($create_by_remote_api === true) {
$sr = ldap_process_user_login_by_api($login, $pass);
if ($sr !== false && isset($sr['uid']) === true && is_array($sr['uid']) === true) {
$already_user = db_get_value('id_user', 'tusuario', 'id_user', $sr['uid'][0]);
// If the node is centralized, AD login is delegated to the metaconsole via the API.
// Since the user is not yet on the nodes, they are asked to try again in a few minutes.
if ($already_user === false && is_metaconsole() === false) {
$config['pending_sync_process_message'] = __('Successful login, please wait a few minutes for the metaconsole to synchronize with the nodes and then log in again with the same credentials.');
}
}
} else {
$sr = enterprise_hook('ad_process_user_login', [$login, $pass]);
// Try with secondary server.
if ($sr === false && (bool) $config['secondary_active_directory'] === true) {
$sr = enterprise_hook('ad_process_user_login', [$login, $pass, true]);
}
}
if ($sr === false) {
@ -278,7 +308,7 @@ function process_user_login_remote($login, $pass, $api=false)
if (($config['auth'] === 'ad')) {
// Check if autocreate remote users is active.
if ($config['autocreate_remote_users'] == 1) {
if ($create_by_remote_api === false && $config['autocreate_remote_users'] == 1) {
if ($config['ad_save_password']) {
$update_credentials = change_local_user_pass_ldap($login, $pass);
} else {
@ -286,7 +316,7 @@ function process_user_login_remote($login, $pass, $api=false)
}
}
if (isset($config['ad_advanced_config']) && $config['ad_advanced_config']) {
if ($create_by_remote_api === false && isset($config['ad_advanced_config']) && $config['ad_advanced_config']) {
$return = enterprise_hook(
'prepare_permissions_groups_of_user_ad',
[
@ -305,7 +335,7 @@ function process_user_login_remote($login, $pass, $api=false)
}
} else if ($config['auth'] === 'ldap') {
// Check if autocreate remote users is active.
if ($config['autocreate_remote_users'] == 1) {
if ($create_by_remote_api === false && $config['autocreate_remote_users'] == 1) {
if ($config['ldap_save_password']) {
$update_credentials = change_local_user_pass_ldap($login, $pass);
} else {
@ -347,11 +377,6 @@ function process_user_login_remote($login, $pass, $api=false)
&& (isset($config['ad_advanced_config'])
&& $config['ad_advanced_config'])
) {
if (is_management_allowed() === false) {
$config['auth_error'] = __('Please, login into metaconsole first');
return false;
}
$user_info = [
'fullname' => db_escape_string_sql($login),
'comments' => 'Imported from '.$config['auth'],
@ -361,27 +386,24 @@ function process_user_login_remote($login, $pass, $api=false)
$user_info['metaconsole_access_node'] = $config['ad_adv_user_node'];
}
// Create the user.
if (enterprise_hook(
'prepare_permissions_groups_of_user_ad',
[
$login,
$pass,
$user_info,
false,
defined('METACONSOLE') && is_centralized() === false,
]
) === false
) {
$config['auth_error'] = __('User not found in database or incorrect password');
return false;
if ($create_by_remote_api === false) {
// Create the user.
if (enterprise_hook(
'prepare_permissions_groups_of_user_ad',
[
$login,
$pass,
$user_info,
false,
defined('METACONSOLE') && is_centralized() === false,
]
) === false
) {
$config['auth_error'] = __('User not found in database or incorrect password');
return false;
}
}
} else if ($config['auth'] === 'ldap') {
if (is_management_allowed() === false) {
$config['auth_error'] = __('Please, login into metaconsole first');
return false;
}
if (is_metaconsole() === true) {
$user_info['metaconsole_access_node'] = $config['ldap_adv_user_node'];
}
@ -397,15 +419,16 @@ function process_user_login_remote($login, $pass, $api=false)
} else {
$user_info['fullname'] = db_escape_string_sql(io_safe_input($sr['cn'][0]));
$user_info['email'] = io_safe_input($sr['mail'][0]);
// Create the user.
$create_user = create_user_and_permisions_ldap(
$login,
$pass,
$user_info,
$permissions,
is_metaconsole() && is_centralized() === false
);
if ($create_by_remote_api === false) {
// Create the user.
$create_user = create_user_and_permisions_ldap(
$login,
$pass,
$user_info,
$permissions,
is_metaconsole() && is_centralized() === false
);
}
}
} else {
$user_info = [
@ -416,24 +439,26 @@ function process_user_login_remote($login, $pass, $api=false)
$user_info['metaconsole_access_node'] = $config['ad_adv_user_node'];
}
if (is_management_allowed() === false) {
if ($create_by_remote_api === false && is_management_allowed() === false) {
$config['auth_error'] = __('Please, login into metaconsole first');
return false;
}
// Create the user in the local database.
if (create_user($login, $pass, $user_info) === false) {
if ($create_by_remote_api === false && create_user($login, $pass, $user_info) === false) {
$config['auth_error'] = __('User not found in database or incorrect password');
return false;
}
profile_create_user_profile(
$login,
$config['default_remote_profile'],
$config['default_remote_group'],
false,
$config['default_assign_tags']
);
if ($create_by_remote_api === false) {
profile_create_user_profile(
$login,
$config['default_remote_profile'],
$config['default_remote_group'],
false,
$config['default_assign_tags']
);
}
}
return $login;
@ -984,6 +1009,7 @@ function ldap_process_user_login($login, $password, $secondary_server=false)
if ($memberof['count'] == 0 && !isset($memberof[0]['memberof'])) {
@ldap_close($ds);
$config['auth_error'] = 'User not found in database or incorrect password';
return false;
} else {
$memberof = $memberof[0];
@ -1640,5 +1666,79 @@ function local_ldap_search(
}
/**
* Performs the LDAP login process by delegating it to the metaconsole via the API.
* It will return the user's ID and email if successful in LDAP format. USE ONLY ON NODE.
*
* @param string $user User to login.
* @param string $pass Password of user.
*
* @return false|array
*/
function ldap_process_user_login_by_api($user, $pass)
{
global $config;
if (is_metaconsole() === true) {
return false;
}
metaconsole_load_external_db(
[
'dbhost' => $config['replication_dbhost'],
'dbuser' => $config['replication_dbuser'],
'dbpass' => io_output_password($config['replication_dbpass']),
'dbname' => $config['replication_dbname'],
]
);
$serverUniqueIdentifier = db_get_value('value', 'tconfig', 'token', 'server_unique_identifier');
$apiPassword = db_get_value('value', 'tconfig', 'token', 'api_password');
$token = generate_token_for_system($serverUniqueIdentifier, $apiPassword);
metaconsole_restore_db();
$url = $config['metaconsole_base_url'];
$url .= (substr($config['metaconsole_base_url'], -1) === '/') ? '' : '/';
$curl = curl_init();
curl_setopt_array(
$curl,
[
CURLOPT_URL => $url.'api/v2/user/'.urlencode($user).'/login?password='.urlencode($pass),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Authorization: Bearer '.$token,
],
CURLOPT_RETURNTRANSFER => true,
]
);
$response = json_decode(curl_exec($curl), true);
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($code === 200) {
if (isset($response['idUser']) === true) {
$ldap_format = [
'mail' => [$response['email']],
'uid' => [$response['idUser']],
];
return $ldap_format;
} else {
return false;
}
} else {
if (isset($response['error']) === true) {
$config['auth_error'] = $response['error'];
} else {
$config['auth_error'] = __('Unexpected error');
}
return false;
}
}
// Reference the global use authorization error to last auth error.
$config['auth_error'] = &$mysql_cache['auth_error'];

View File

@ -1081,6 +1081,25 @@ class ConsoleSupervisor
{
global $config;
if (license_enterprise_free() === true) {
if (isset($config['limit_exceeded']) === true && (int) $config['limit_exceeded'] === 1) {
update_config_token('limit_exceeded', 0);
$message = __('When the limit is exceeded the system automatically deactivates the latest agents and modules exceeding license.');
$this->notify(
[
'type' => 'NOTIF.LICENSE.LIMITED',
'title' => __('You have exceeded the limit of the free version'),
'message' => $message,
'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
]
);
}
return true;
}
$license = enterprise_hook('license_get_info');
if ($license === ENTERPRISE_NOT_HOOK) {
return false;

View File

@ -22,7 +22,7 @@ use DI\ContainerBuilder;
/*
* Pandora build version and version
*/
$build_version = 'PC240515';
$build_version = 'PC240521';
$pandora_version = 'v7.0NG.776';
// Do not overwrite default timezone set if defined.

View File

@ -1404,7 +1404,7 @@ function get_event_types($id_type=false)
*
* @return array An array with all the priorities.
*/
function get_priorities($priority_param=false)
function get_priorities($priority_param=false, $creation=false)
{
global $config;
@ -1416,9 +1416,12 @@ function get_priorities($priority_param=false)
$priorities[EVENT_CRIT_WARNING] = __('Warning');
$priorities[EVENT_CRIT_MAJOR] = __('Major');
$priorities[EVENT_CRIT_CRITICAL] = __('Critical');
$priorities[EVENT_CRIT_WARNING_OR_CRITICAL] = __('Warning').'/'.__('Critical');
$priorities[EVENT_CRIT_NOT_NORMAL] = __('Not normal');
$priorities[EVENT_CRIT_OR_NORMAL] = __('Critical').'/'.__('Normal');
if ($creation === false) {
$priorities[EVENT_CRIT_WARNING_OR_CRITICAL] = __('Warning').'/'.__('Critical');
$priorities[EVENT_CRIT_OR_NORMAL] = __('Critical').'/'.__('Normal');
}
foreach ($priorities as $key => $priority) {
$priorities[$key] = ui_print_truncate_text($priority, GENERIC_SIZE_TEXT, false, true, false);
@ -1679,6 +1682,24 @@ function license_free()
}
/**
* Check if the license is PANDORA-ENTERPRISE-FREE.
*
* @return boolean.
*/
function license_enterprise_free()
{
$return = true;
$pandora_license = db_get_value('value', 'tupdate_settings', '`key`', 'customer_key');
if ($pandora_license !== 'PANDORA-ENTERPRISE-FREE') {
$return = false;
}
return $return;
}
/**
* TODO: Document enterprise functions
*/

View File

@ -435,7 +435,11 @@ function api_get_license($trash1, $trash2, $trash3, $returnType='json')
if ($license === ENTERPRISE_NOT_HOOK) {
// Not an enterprise environment?
if (license_free()) {
$license = 'PANDORA_FREE';
$license = 'PANDORA-FREE';
}
if (license_enterprise_free() === true) {
$license = 'PANDORA-ENTERPRISE-FREE';
}
returnData(
@ -494,6 +498,10 @@ function api_get_license_remaining(
return;
}
if (license_enterprise_free() === true) {
$license['limit'] = 50;
}
returnData(
$returnType,
[
@ -13150,9 +13158,16 @@ function api_set_create_event($id, $trash1, $other, $returnType)
if ($other['data'][18] != '') {
$values['id_extra'] = $other['data'][18];
$id_extra_db_len = strlen(io_safe_input(io_safe_output($values['id_extra'])));
if($id_extra_db_len > 255){
returnError('The id_extra field after insertion will exceed the allowed length (255), current length (' . $id_extra_db_len . ')' );
return;
}
$sql_validation = 'SELECT id_evento,estado,ack_utimestamp,id_usuario,event_custom_id
FROM tevento
WHERE estado IN (0,2) AND id_extra ="'.$other['data'][18].'";';
WHERE estado IN (0,2) AND id_extra ="'.$values['id_extra'].'";';
$validation = db_get_all_rows_sql($sql_validation);

View File

@ -513,6 +513,10 @@ function config_update_config()
if (config_update_value('ipam_ocuppied_warning_treshold', get_parameter('ipam_ocuppied_warning_treshold'), true) === false) {
$error_update[] = __('Ipam Ocuppied Manager Warning');
}
if (config_update_value('metaconsole_base_url', get_parameter('metaconsole_base_url'), true) === false) {
$error_update[] = __('Metaconsole base url');
}
}
break;

View File

@ -585,25 +585,30 @@ function events_update_status($id_evento, $status, $filter=null)
if ((int) $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) {
$sql = sprintf(
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
ON tu.id_extra = tf.id_extra
'SELECT te.id_evento FROM tevento te INNER JOIN ( %s ) tf
ON te.id_extra = tf.id_extra
AND tf.max_id_evento = %d',
$sql,
$id_evento
);
} else {
$sql = sprintf(
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
ON tu.estado = tf.estado
AND tu.evento = tf.evento
AND tu.id_agente = tf.id_agente
AND tu.id_agentmodule = tf.id_agentmodule
'SELECT te.id_evento FROM tevento te INNER JOIN ( %s ) tf
ON te.estado = tf.estado
AND te.evento = tf.evento
AND te.id_agente = tf.id_agente
AND te.id_agentmodule = tf.id_agentmodule
AND tf.max_id_evento = %d',
$sql,
$id_evento
);
}
$filter_date = get_filter_date($filter);
if (is_array($filter_date) === true && count($filter_date) > 0) {
$sql .= implode(' ', $filter_date);
}
$target_ids = db_get_all_rows_sql($sql);
// Try to avoid deadlock while updating full set.
@ -631,7 +636,10 @@ function events_update_status($id_evento, $status, $filter=null)
break;
}
$result = db_process_sql($update_sql);
$result = false;
if (empty($update_sql) === false) {
$result = db_process_sql($update_sql);
}
if ($result !== false) {
switch ($status) {
@ -3827,8 +3835,7 @@ function events_get_response_target(
array $event_response,
?array $response_parameters=null,
?int $server_id=0,
?string $server_name='',
?string $target_metaconsole=''
?string $server_name=''
) {
global $config;
@ -3842,9 +3849,6 @@ function events_get_response_target(
$event = db_get_row('tevento', 'id_evento', $event_id);
$target = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id']));
if (empty($target) === true && $target_metaconsole !== '') {
$target = io_safe_output($target_metaconsole);
}
// Replace parameters response.
if (isset($response_parameters) === true
@ -4978,7 +4982,7 @@ function events_display_instructions($event_type='', $inst=[], $italic=true, $ev
*
* @return string HTML.
*/
function events_page_general($event)
function events_page_general($event, $filter=[])
{
global $img_sev;
global $config;
@ -5081,14 +5085,23 @@ function events_page_general($event)
$data = [];
$data[0] = __('Repeated');
if ($group_rep != 0) {
if ($event['event_rep'] <= 1) {
$data[1] = '<i>'.__('No').'</i>';
} else {
$data[1] = sprintf('%d Times', $event['event_rep']);
// Ticket 13013 This was done on purpose.
if ((int) $event['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) {
$counter_extra_id = event_get_counter_extraId($event, $filter);
if (empty($counter_extra_id) === false && $counter_extra_id > 1) {
$data[1] = sprintf('%d Times', $counter_extra_id);
}
} else {
$data[1] = '<i>'.__('No').'</i>';
if ($group_rep != 0) {
if ($event['event_rep'] <= 1) {
$data[1] = '<i>'.__('No').'</i>';
} else {
$data[1] = sprintf('%d Times', $event['event_rep']);
}
} else {
$data[1] = '<i>'.__('No').'</i>';
}
}
$table_general->data[] = $data;
@ -5994,9 +6007,10 @@ function events_get_criticity_class($criticity)
*/
function get_row_response_action(
array $event_response,
?int $response_id,
$end=false,
$index=null
?int $id_event,
?int $server_id,
?array $response_parameters=[],
?string $index=null
) {
$output = '<div class="container-massive-events-response-cell">';
$display_command = (bool) $event_response['display_command'];
@ -6005,7 +6019,7 @@ function get_row_response_action(
// String command.
$output .= '<div class="container-massive-events-response-command">';
$output .= '<b>';
$output .= __('Event # %d', $event_response['event_id']);
$output .= __('Event # %d', $id_event);
if (empty($command_str) === false) {
$output .= ' ';
$output .= __('Executing command').': ';
@ -6028,11 +6042,18 @@ function get_row_response_action(
// Butom.
$output .= '<div id="re_exec_command'.$index.'" style="display:none" class="container-massive-events-response-execute">';
$info = [
'response_id' => $event_response['id'],
'server_id' => $server_id,
'event_id' => $id_event,
'response_parameters' => $response_parameters,
];
$output .= html_print_button(
__('Execute again'),
'btn_str',
false,
'perform_response("'.base64_encode(json_encode($event_response)).'",'.$response_id.',"'.trim($index).'")',
'perform_response("'.base64_encode(json_encode($info)).'","'.trim($index).'")',
[
'icon' => 'next',
'mode' => 'mini secondary',
@ -6063,13 +6084,8 @@ function get_events_get_response_target(
$response_parameters=[]
) {
try {
$target_metaconsole = '';
if (is_metaconsole() === true
&& $server_id > 0
) {
$target_metaconsole = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id']));
if (is_metaconsole() === true && $server_id > 0) {
$node = new Node($server_id);
$node->connect();
}
return events_get_response_target(
@ -6077,24 +6093,10 @@ function get_events_get_response_target(
$event_response,
$response_parameters,
$server_id,
($server_id !== 0) ? $node->server_name() : 'Metaconsole',
$target_metaconsole
($server_id !== 0) ? $node->server_name() : 'Metaconsole'
);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
return '';
} finally {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
}
}

View File

@ -900,6 +900,7 @@ if (is_ajax()) {
global $config;
global $pandora_version;
global $build_version;
$license = db_get_value_sql('SELECT `value` FROM tupdate_settings WHERE `key` LIKE "customer_key"');
$product_name = io_safe_output(get_product_name());
$license_expiry_date = substr($config['license_expiry_date'], 0, 4).'/'.substr($config['license_expiry_date'], 4, 2).'/'.substr($config['license_expiry_date'], 6, 2);
$license_expired = false;
@ -908,6 +909,11 @@ if (is_ajax()) {
$license_expired = true;
}
$text = (enterprise_installed()) ? 'Enterprise' : 'Community';
if ($license === 'PANDORA-ENTERPRISE-FREE') {
$text = 'FREE';
}
include_once $config['homedir'].'/include/class/Diagnostics.class.php';
$d = new Diagnostics;
$db_health = json_decode($d->getDatabaseHealthStatus());
@ -970,16 +976,18 @@ if (is_ajax()) {
</th>
<th style="width: 60%; text-align: left; border: 0px;">
<h1>'.$product_name.'</h1>
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'</span></p>
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.$text.'</span></p>
<p><span>'.__('Current package').'</span> '.$config['current_package'].'</p>
<p><span>'.__('MR version').'</span> MR'.$config['MR'].'</p>
<p><span>Build</span>'.$build_version.'</p>';
if (enterprise_installed() === true) {
if (enterprise_installed() === true && $license !== 'PANDORA-ENTERPRISE-FREE') {
$dialog .= '<p><span>'.__('Support expires').'</span>'.$license_expiry_date.'</p>';
}
if ($license_expired === false) {
$dialog .= '<p>'.__('This system has official support, warranty and official updates.').'</p>';
} else if ($license === 'PANDORA-ENTERPRISE-FREE') {
$dialog .= '<p><span>'.__('This system has no active support contract.').'</span></p>';
} else if (enterprise_installed() === true) {
$dialog .= '<p><span>'.__('This system has no active support contract, and has no support, upgrades or warranty.').'</span></p>';
$dialog .= '<p><b><a href="https://pandorafms.com/contact/" target="_blank">'.__('Contact Pandora FMS for expand your support contract.').'</a></b></p>';
@ -1280,6 +1288,7 @@ if (is_ajax()) {
global $config;
global $pandora_version;
global $build_version;
$license = db_get_value_sql('SELECT `value` FROM tupdate_settings WHERE `key` LIKE "customer_key"');
$product_name = io_safe_output(get_product_name());
$license_expiry_date = substr($config['license_expiry_date'], 0, 4).'/'.substr($config['license_expiry_date'], 4, 2).'/'.substr($config['license_expiry_date'], 6, 2);
$license_expired = false;
@ -1288,6 +1297,11 @@ if (is_ajax()) {
$license_expired = true;
}
$text = (enterprise_installed()) ? 'Enterprise' : 'Community';
if ($license === 'PANDORA-ENTERPRISE-FREE') {
$text = 'FREE';
}
$lts_name = '';
if (empty($config['lts_name']) === false) {
$lts_name = ' <i>'.$config['lts_name'].'</i>';
@ -1313,15 +1327,17 @@ if (is_ajax()) {
</th>
<th style="width: 60%; text-align: left; border: 0px;">
<h1>'.$product_name.'</h1>
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'</span></p>
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.$text.'</span></p>
<p><span>'.__('MR version').'</span> MR'.$config['MR'].'</p>
<p><span>Build</span>'.$build_version.'</p>';
if (enterprise_installed() === true) {
if (enterprise_installed() === true && $license !== 'PANDORA-ENTERPRISE-FREE') {
$dialog .= '<p><span>'.__('Support expires').'</span>'.$license_expiry_date.'</p>';
}
if ($license_expired === false) {
$dialog .= '<p>'.__('This system has official support, warranty and official updates.').'</p>';
} else if ($license === 'PANDORA-ENTERPRISE-FREE') {
$dialog .= '<p><span>'.__('This system has no active support contract.').'</span></p>';
} else if (enterprise_installed() === true) {
$dialog .= '<p><span>'.__('This system has no active support contract, and has no support, upgrades or warranty.').'</span></p>';
$dialog .= '<p><b><a href="https://pandorafms.com/contact/" target="_blank">'.__('Contact Pandora FMS for expand your support contract.').'</a></b></p>';

View File

@ -804,8 +804,9 @@ function netflow_get_stats(
return json_decode($data, true);
}
$aggregate = escapeshellarg($aggregate.'/bytes');
// Get the command to call nfdump.
$options = "-o csv -q -n $max -s $aggregate/bytes -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
$options = "-o csv -q -n $max -s $aggregate -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
$command = netflow_get_command($options, $filter, $start_date_fixed, $end_date_fixed);
// Execute nfdump.
exec($command, $string);
@ -1147,6 +1148,7 @@ function netflow_get_command($options, $filter, $date_init=0, $date_end=0)
// Filter options.
$command .= ' '.netflow_get_filter_arguments($filter);
return $command;
}
@ -2186,9 +2188,9 @@ function netflow_get_top_data(
// Get the command to call nfdump.
$options = sprintf(
'-q -o csv -n %s -s %s/bytes -t %s-%s',
'-q -o csv -n %s -s %s -t %s-%s',
$max,
$aggregate,
escapeshellarg($aggregate.'/bytes'),
date($nfdump_date_format, $start_date),
date($nfdump_date_format, $end_date)
);

View File

@ -4540,6 +4540,17 @@ function reporting_exception(
} else {
$return['chart']['hbar'] .= '</div>';
}
} else {
// Get only table data.
foreach ($items as $key => $item) {
$data = [];
$data['agent'] = $item['agent'];
$data['module'] = $item['module'];
$data['operation'] = __($item['operation']);
$data['value'] = $item['value'];
$data['formated_value'] = format_for_graph($item['value'], 2).' '.$item['unit'];
$return['data'][] = $data;
}
}
if ($content['show_resume'] && $i > 0) {

View File

@ -155,3 +155,23 @@ function delete_user_token(int $idToken): bool
return $result;
}
/**
* Generate token for use ONLY in pandora.
*
* @param string $serverUniqueIdentifier Value server_unique_identifier from tconfig.
* @param string $apiPassword Value api_password from tconfig.
*
* @return string
*/
function generate_token_for_system(string $serverUniqueIdentifier='', string $apiPassword=''):string
{
if (empty($serverUniqueIdentifier) === true
|| empty($apiPassword) === true
) {
return '';
}
return md5($serverUniqueIdentifier).md5($apiPassword);
}

View File

@ -176,6 +176,8 @@ $(document).ready(function() {
if (typeof hide_counter == "undefined") hide_counter = 0;
if (typeof remaining == "undefined") remaining = 30;
let height = 300;
if (typeof invalid_license != "undefined") height = 350;
@ -194,8 +196,6 @@ $(document).ready(function() {
},
open: function() {
if (hide_counter != 1) {
var remaining = 30;
// Timeout counter.
var count = function() {
if (remaining > 0) {
@ -246,6 +246,66 @@ $(document).ready(function() {
});
}
if ($("#register_dialog_message").length) {
function validateEmail(email) {
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
$("#register_dialog_message").dialog({
dialogClass: "no-close",
closeOnEscape: false,
resizable: false,
draggable: true,
modal: true,
height: "auto",
width: 800,
overlay: {
opacity: 0.5,
background: "black"
}
});
$("#button-register_buttom").click(function() {
if (validateEmail($("#text-license_email").val())) {
$.ajax({
method: "POST",
url: $("#hidden-test").val(),
dataType: "json",
data: {
page: "enterprise/load_enterprise",
register_email: 1,
email: $("#text-license_email").val()
},
success: function(data) {
if (data.error != null) {
$("#register_dialog_result").addClass("error");
$("#register_dialog_result_content").html("Unsuccessful register. "+ data.error);
} else {
$("#register_dialog_result_content").html("Successfully registered with UID: " + data.result);
}
$("#register_dialog_result").dialog({
buttons: [
{
text: "OK",
class: "submit-next",
click: function() {
$(this).dialog("close");
$("#register_dialog_message").dialog("close");
location.reload();
}
}
]
});
}
});
} else {
$("#text-license_email").css("border", "1px solid red");
}
});
}
if ($("#msg_change_password").length) {
$("#msg_change_password").dialog({
resizable: false,

View File

@ -143,7 +143,14 @@ function execute_response(event_id, server_id) {
if (response["type"] == "url" && response["new_window"] == 1) {
window.open(response["target"], "_blank");
} else {
show_response_dialog(response_id, response);
var data = {};
data.response_id = response_id;
data.server_id = server_id;
data.event_id = event_id;
data.response_parameters = response_parameters;
data.modal_width = response["modal_width"];
data.modal_height = response["modal_height"];
show_response_dialog(data);
}
}
});
@ -173,12 +180,10 @@ function execute_response_massive(events, response_id, response_parameters) {
// Convert to array.
var array_data = Object.entries(data.event_response_targets);
var total_count = array_data.length;
// Each input checkeds.
array_data.forEach(function(element, index) {
var id = element[0];
var target = element[1].target;
var meta = $("#hidden-meta").val();
var event_id = id;
var server_id = 0;
@ -188,25 +193,22 @@ function execute_response_massive(events, response_id, response_parameters) {
server_id = split_id[1];
}
var end = 0;
if (total_count - 1 === index) {
end = 1;
}
var response = data.event_response;
response["event_id"] = event_id;
response["server_id"] = server_id;
response["target"] = target;
if (response["type"] == "url" && response["new_window"] == 1) {
window.open(response["target"], "_blank");
if (
data.event_response["type"] == "url" &&
data.event_response["new_window"] == 1
) {
window.open(data.event_response["target"], "_blank");
} else {
var params = [];
params.push({ name: "page", value: "include/ajax/events" });
params.push({ name: "get_row_response_action", value: 1 });
params.push({ name: "response_id", value: response_id });
params.push({ name: "server_id", value: response.server_id });
params.push({ name: "end", value: end });
params.push({ name: "response", value: JSON.stringify(response) });
params.push({ name: "server_id", value: server_id });
params.push({ name: "event_id", value: event_id });
params.push({
name: "response_parameters",
value: response_parameters
});
jQuery.ajax({
data: params,
@ -215,20 +217,17 @@ function execute_response_massive(events, response_id, response_parameters) {
dataType: "html",
success: function(data) {
$(".container-massive-events-response").append(data);
response["event_id"] = event_id;
response["server_id"] = server_id;
response["target"] = target;
var indexstr = event_id;
if (meta != 0) {
indexstr += "-" + server_id;
}
perform_response(
btoa(JSON.stringify(response)),
response_id,
indexstr
);
var info = {};
info.response_id = response_id;
info.server_id = server_id;
info.event_id = event_id;
info.response_parameters = JSON.parse(response_parameters);
perform_response(btoa(JSON.stringify(info)), indexstr);
}
});
}
@ -238,15 +237,17 @@ function execute_response_massive(events, response_id, response_parameters) {
}
//Show the modal window of an event response
function show_response_dialog(response_id, response) {
function show_response_dialog(info) {
var params = [];
params.push({ name: "page", value: "include/ajax/events" });
params.push({ name: "dialogue_event_response", value: 1 });
params.push({ name: "event_id", value: response.event_id });
params.push({ name: "target", value: response.target });
params.push({ name: "response_id", value: response_id });
params.push({ name: "server_id", value: response.server_id });
params.push({ name: "response", value: JSON.stringify(response) });
params.push({ name: "event_id", value: info.event_id });
params.push({ name: "response_id", value: info.response_id });
params.push({ name: "server_id", value: info.server_id });
params.push({
name: "response_parameters",
value: JSON.stringify(info.response_parameters)
});
var view = ``;
@ -272,10 +273,10 @@ function show_response_dialog(response_id, response) {
draggable: true,
modal: false,
open: function() {
perform_response(btoa(JSON.stringify(response)), response_id, "");
perform_response(btoa(JSON.stringify(info)));
},
width: response["modal_width"],
height: response["modal_height"],
width: info.modal_width,
height: info.modal_height,
buttons: []
})
.show();
@ -284,26 +285,22 @@ function show_response_dialog(response_id, response) {
}
// Perform a response and put the output into a div
function perform_response(response, response_id, index = "") {
function perform_response(info, index = "") {
info = JSON.parse(atob(info));
$("#re_exec_command" + index).hide();
$("#response_loading_command" + index).show();
$("#response_out" + index).html("");
try {
response = JSON.parse(atob(response));
} catch (e) {
console.error(e);
return;
}
var params = [];
params.push({ name: "page", value: "include/ajax/events" });
params.push({ name: "perform_event_response", value: 1 });
params.push({ name: "target", value: response["target"] });
params.push({ name: "response_id", value: response_id });
params.push({ name: "event_id", value: response["event_id"] });
params.push({ name: "server_id", value: response["server_id"] });
params.push({ name: "response", value: JSON.stringify(response) });
params.push({ name: "response_id", value: info.response_id });
params.push({ name: "event_id", value: info.event_id });
params.push({ name: "server_id", value: info.server_id });
params.push({
name: "response_parameters",
value: JSON.stringify(info.response_parameters)
});
jQuery.ajax({
data: params,
@ -323,6 +320,12 @@ function perform_response(response, response_id, index = "") {
// Change the status of an event to new, in process or validated.
function event_change_status(event_ids, server_id, group_rep) {
var inputs = $("#events_form :input");
var values = {};
inputs.each(function() {
values[this.name] = $(this).val();
});
var new_status = $("#estado").val();
$("#button-status_button").attr("disabled", "disabled");
@ -335,7 +338,8 @@ function event_change_status(event_ids, server_id, group_rep) {
event_ids: event_ids,
new_status: new_status,
server_id: server_id,
group_rep: group_rep
group_rep: group_rep,
filter: values
},
type: "POST",
url: getUrlAjax(),

View File

@ -2,7 +2,6 @@
namespace PandoraFMS\Modules\Shared\Middlewares;
use PandoraFMS\Modules\Shared\Services\Config;
use PandoraFMS\Modules\Authentication\Services\GetUserTokenService;
use PandoraFMS\Modules\Authentication\Services\UpdateTokenService;
use PandoraFMS\Modules\Authentication\Services\ValidateServerIdentifierTokenService;
@ -20,14 +19,20 @@ final class UserTokenMiddleware
private readonly ValidateUserTokenService $validateUserTokenService,
private readonly GetUserTokenService $getUserTokenService,
private readonly UpdateTokenService $updateTokenService,
private readonly Timestamp $timestamp,
private readonly Config $config
private readonly Timestamp $timestamp
) {
}
public function check(Request $request): bool
{
global $config;
// DO NOT REMOVE THIS LINE.
// In case a JSON error occurs outside of the API, it will be reset to handle
// formatting errors in the parameters.
json_encode([]);
$authorization = ($request->getHeader('Authorization')[0] ?? '');
$token = null;
@ -50,7 +55,7 @@ final class UserTokenMiddleware
$validToken = $this->validateUserTokenService->__invoke($uuid, $strToken);
$token = $this->getUserTokenService->__invoke($uuid);
if ($token !== null && $validToken) {
$this->config->set('id_user', $token->getIdUser());
$config['id_user'] = $token->getIdUser();
$oldToken = clone $token;
$token->setLastUsage($this->timestamp->getMysqlCurrentTimestamp(0));
$this->updateTokenService->__invoke($token, $oldToken);
@ -70,10 +75,10 @@ final class UserTokenMiddleware
if ($validTokenUiniqueServerIdentifier === true) {
$_SESSION['id_usuario'] = 'admin';
$this->config->set('id_user', 'admin');
$config['id_user'] = 'admin';
} else {
$_SESSION['id_usuario'] = $token->getIdUser();
$this->config->set('id_user', $token->getIdUser());
$config['id_user'] = $token->getIdUser();
}
if (session_status() === PHP_SESSION_ACTIVE) {

View File

@ -0,0 +1,130 @@
/**
*
* Name: Pandora RC styles
*
* @category Stylesheet
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
div#main {
margin-bottom: 25px;
}
.rc-ad-view-main {
width: 100%;
/* height: calc(100vh - 158px); */
box-sizing: border-box;
padding: 63px 125px;
border: 1px solid var(--border-color-4);
border-radius: 25px;
background-color: var(--secondary-color);
background-image: url(../../images/ehorus/ad/background.svg);
background-repeat: no-repeat;
background-size: contain;
background-position-x: center;
}
.rc-ad-view-first-row {
width: 100%;
height: 255px;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
gap: 60px;
}
.rc-ad-view-first-row > div {
width: 450px;
height: 100%;
color: var(--text-color-2);
font-family: "lato-bold";
font-size: 40px;
line-height: 48px;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: space-between;
}
.rc-ad-view-first-row > div * {
background-color: var(--pandora-rc-color);
width: 221px;
height: 42px;
border: 0;
border-radius: 8px;
font-family: "lato-bold";
font-size: 15px;
line-height: 20px;
text-align: center;
cursor: pointer;
}
.rc-ad-view-first-row > div button:hover {
opacity: 0.9;
}
.rc-ad-view-first-row > img {
width: calc(100% - 480px);
max-height: 255px;
}
.rc-ad-view-main > p {
margin-top: 60px;
color: var(--text-color-3);
font-size: 18px;
line-height: 22px;
}
.rc-ad-view-second-row {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: flex-start;
gap: 20px;
}
.rc-ad-view-second-row > div {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
align-items: center;
border: 1px solid var(--border-color-4);
border-radius: 10px;
padding: 20px;
width: calc((100% - 100px) / 5);
}
.rc-ad-view-second-row > div > img {
max-width: 100%;
}
.rc-ad-view-second-row > div > span {
margin-top: 20px;
color: var(--text-color-2);
font-family: "lato-bold";
font-size: 20px;
line-height: 24px;
text-align: center;
}

View File

@ -31,6 +31,7 @@
--primary-color: #14524f;
--primary-color-hover: #318280;
--secondary-color: #ffffff;
--pandora-rc-color: #34cc9d;
--text-color: #333;
--text-color-2: #161628;
@ -9785,6 +9786,12 @@ div.stat-win-spinner img {
min-height: 350px !important;
}
p.license_p {
font-size: 12pt;
margin-left: 50px;
text-align: left;
}
.select2-container--default
.select2-selection--multiple
.select2-selection__rendered {

View File

@ -2154,3 +2154,14 @@ select option:checked {
.content-widget .flot-base {
background-color: unset;
}
div.rc-ad-view-main {
background-image: url(../../images/ehorus/ad/background-dark.svg);
background-size: cover;
border: 0;
}
div.rc-ad-view-second-row > div {
border: 0;
background-color: #525282;
}

View File

@ -578,6 +578,15 @@ if (isset($config['id_user']) === false) {
exit('</html>');
}
if (isset($config['pending_sync_process_message']) === true) {
include_once 'general/login_page.php';
while (ob_get_length() > 0) {
ob_end_flush();
}
exit('</html>');
}
// Login ok and password has not expired.
$process_login = true;

View File

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

View File

@ -16,7 +16,10 @@
// Load global vars
global $config;
ui_require_css_file('pandora-rc', 'include/styles/');
if (!$config['ehorus_enabled']) {
echo rc_ad_view();
return;
}
@ -214,6 +217,58 @@ $query_data = [
$query = http_build_query($query_data);
$client_url = $config['homeurl'].'operation/agentes/ehorus_client.php?'.$query;
function rc_ad_view()
{
$title = __('Forget about distances').':';
$title2 = __('operate up to 5 devices for free, as if they were at your side!');
$onclick = 'onclick="window.location.href=\'index.php?sec=gsetup&sec2=godmode/setup/setup&section=pandorarc\'"';
$output = '
<div class="rc-ad-view-main">
<div class="rc-ad-view-first-row">
<div>
'.$title.'<br>'.$title2.'
<button '.$onclick.'>'.__('Enable Pandora RC for free').'</button>
</div>
'.html_print_image('images/ehorus/ad/sample.svg', true).'
</div>
<p>'.__('Pandora RC is not currently enabled, heres what your missing out').':</p>
<div class="rc-ad-view-second-row">
<div>
'.html_print_image('images/ehorus/ad/desktop.svg', true).'
<span>'.__('Remote access to the servers Desktop').'.</span>
</div>
<div>
'.html_print_image('images/ehorus/ad/cli.svg', true).'
<span>'.__('Run commands directly with native CLI').'.</span>
</div>
<div>
'.html_print_image('images/ehorus/ad/files.svg', true).'
<span>'.__('Upload and manage your files').'.</span>
</div>
<div>
'.html_print_image('images/ehorus/ad/multiplatform.svg', true).'
<span>'.__('Compatible with all major OS platforms').'.</span>
</div>
<div>
'.html_print_image('images/ehorus/ad/process-services.svg', true).'
<span>'.__('Manage all your processes and services').'.</span>
</div>
</div>
</div>
';
return $output;
}
?>
<script type="text/javascript">

View File

@ -1812,6 +1812,17 @@ if (enterprise_installed() === true && (bool) $config['log_collector'] === true)
}
// EHorus tab.
$tab_url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=ehorus&id_agente='.$id_agente;
$ehorus_tab['text'] = '<a href="'.$tab_url.'" class="ehorus_tab">'.html_print_image(
'images/RC.png',
true,
[
'title' => __('Pandora RC'),
'class' => 'invert_filter',
]
).'</a>';
$ehorus_tab['active'] = $tab == 'ehorus';
if ((bool) $config['ehorus_enabled'] === true && empty($config['ehorus_custom_field'] === false)
&& (check_acl_one_of_groups(
$config['id_user'],
@ -1824,16 +1835,8 @@ if ((bool) $config['ehorus_enabled'] === true && empty($config['ehorus_custom_fi
// If ehorus user configuration is enabled, and userr acces level is disabled do not show eHorus tab.
} else {
$ehorus_agent_id = agents_get_agent_custom_field($id_agente, $config['ehorus_custom_field']);
if (empty($ehorus_agent_id) === false) {
$tab_url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=ehorus&id_agente='.$id_agente;
$ehorus_tab['text'] = '<a href="'.$tab_url.'" class="ehorus_tab">'.html_print_image(
'images/RC.png',
true,
[
'title' => __('Pandora RC'),
'class' => 'invert_filter',
]
).'</a>';
$menu_tab_url = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=ehorus&id_agente='.$id_agente.'">'.__('Pandora RC').'</a>';
array_push($menu_tabs, $menu_tab_url);
@ -1895,8 +1898,6 @@ if ((bool) $config['ehorus_enabled'] === true && empty($config['ehorus_custom_fi
$ehorus_tab['sub_menu'] .= '</li>';
$ehorus_tab['sub_menu'] .= '</a>';
$ehorus_tab['sub_menu'] .= '</ul>';
$ehorus_tab['active'] = $tab == 'ehorus';
}
}
}

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.776
%define release 240515
%define release 240521
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.776
%define release 240515
%define release 240521
# User and Group under which Apache is running
%define httpd_name httpd

View File

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

View File

@ -1219,7 +1219,7 @@ INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://pandoraf
INSERT INTO `tevent_response` VALUES (1,'Ping&#x20;to&#x20;host','Ping&#x20;to&#x20;the&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_agent_address_','command',0,620,500,0,'',0,90,0),(5,'Restart&#x20;agent','Restart&#x20;the&#x20;agent&#x20;with&#x20;using&#x20;UDP&#x20;protocol.&#x0d;&#x0a;&#x0d;&#x0a;To&#x20;use&#x20;this&#x20;response&#x20;is&#x20;necessary&#x20;to&#x20;have&#x20;installed&#x20;Pandora&#x20;FMS&#x20;server&#x20;and&#x20;console&#x20;in&#x20;the&#x20;same&#x20;machine.','/usr/share/pandora_server/util/udp_client.pl&#x20;_agent_address_&#x20;41122&#x20;&quot;REFRESH&#x20;AGENT&quot;','command',0,620,500,0,'',0,90,0),(6,'Ping&#x20;to&#x20;module&#x20;agent&#x20;host','Ping&#x20;to&#x20;the&#x20;module&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_module_address_','command',0,620,500,0,'',0,90,0),(7,'Create&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;event','Create&#x20;a&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;an&#x20;event','index.php?sec=manageTickets&amp;sec2=operation/ITSM/itsm&amp;operation=edit&amp;from_event=_event_id_','url',0,0,0,1,'',0,90,1);
INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');
INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-ENTERPRISE-FREE'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');
--
-- Dumping data for table `tcollection`
@ -2545,12 +2545,12 @@ INSERT INTO `tncm_template` VALUES
(8,'Mikrotik-Generic','[\"3\"]','[\"8\"]');
INSERT INTO `tncm_script` VALUES
(1,0,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;exit'),
(2,1,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;capture:show&#x20;running-config&#x0d;&#x0a;exit&#x0d;&#x0a;'),
(3,2,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;config&#x20;terminal&#x0d;&#x0a;_applyconfigbackup_&#x0d;&#x0a;exit&#x0d;&#x0a;'),
(4,3,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;capture:show&#x20;version&#x20;|&#x20;i&#x20;IOS&#x20;Software&#x0d;&#x0a;exit&#x0d;&#x0a;'),
(5,5,'enable&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#x0d;&#x0a;term&#x20;length&#x20;0&#x0d;&#x0a;config&#x20;term&#x0d;&#x0a;end&#x0d;&#x0a;end&#x0d;&#x0a;exit&#x0d;&#x0a;'),
(6,4,'copy&#x20;tftp&#x20;flash&#x0d;&#x0a;expect:&#92;]&#92;?&#x0d;&#x0a;_TFTP_SERVER_IP_&#x0d;&#x0a;expect:&#92;]&#92;?&#x0d;&#x0a;_SOURCE_FILE_NAME_&#x0d;&#x0a;expect:&#92;]&#92;?&#x0d;&#x0a;firmware.bin&#x0d;&#x0a;show&#x20;flash&#x0d;&#x0a;reload&#x0d;&#x0a;expect:confirm&#x0d;&#x0a;y&#x0d;&#x0a;config&#x20;terminal&#x0d;&#x0a;boot&#x20;system&#x20;firmware.bin'),
(1,0,'enable&#92;n&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#92;n&#x0d;&#x0a;exit&#92;n'),
(2,1,'enable&#92;n&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#92;n&#x0d;&#x0a;term&#x20;length&#x20;0&#92;n&#x0d;&#x0a;capture:show&#x20;running-config&#92;n&#x0d;&#x0a;exit&#92;n'),
(3,2,'enable&#92;n&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#92;n&#x0d;&#x0a;term&#x20;length&#x20;0&#92;n&#x0d;&#x0a;config&#x20;terminal&#92;n&#x0d;&#x0a;_applyconfigbackup_&#92;n&#x0d;&#x0a;exit&#92;n'),
(4,3,'enable&#92;n&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#92;n&#x0d;&#x0a;term&#x20;length&#x20;0&#92;n&#x0d;&#x0a;capture:show&#x20;version&#x20;|&#x20;i&#x20;IOS&#x20;Software&#92;n&#x0d;&#x0a;exit&#92;n'),
(5,5,'enable&#92;n&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#92;n&#x0d;&#x0a;term&#x20;length&#x20;0&#92;n&#x0d;&#x0a;config&#x20;term&#92;n&#x0d;&#x0a;end&#92;n&#x0d;&#x0a;end&#92;n&#x0d;&#x0a;exit&#92;n'),
(6,4,'copy&#x20;tftp&#x20;flash&#92;n&#x0d;&#x0a;expect:&#92;]&#92;?&#x0d;&#x0a;_TFTP_SERVER_IP_&#92;n&#x0d;&#x0a;expect:&#92;]&#92;?&#x0d;&#x0a;_SOURCE_FILE_NAME_&#92;n&#x0d;&#x0a;expect:&#92;]&#92;?&#x0d;&#x0a;firmware.bin&#92;n&#x0d;&#x0a;show&#x20;flash&#92;n&#x0d;&#x0a;reload&#92;n&#x0d;&#x0a;expect:confirm&#x0d;&#x0a;y&#92;n&#x0d;&#x0a;config&#x20;terminal&#92;n&#x0d;&#x0a;boot&#x20;system&#x20;firmware.bin&#92;n'),
(7,0,'enable&#92;n&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#92;n&#x0d;&#x0a;exit&#92;n'),
(8,1,'enable&#92;n&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#92;n&#x0d;&#x0a;term&#x20;length&#x20;0&#92;n&#x0d;&#x0a;capture:show&#x20;running-config&#92;n&#x0d;&#x0a;exit&#92;n'),
(9,2,'enable&#92;n&#x0d;&#x0a;expect:Password:&#92;s*&#x0d;&#x0a;_enablepass_&#92;n&#x0d;&#x0a;term&#x20;length&#x20;0&#92;n&#x0d;&#x0a;config&#x20;terminal&#92;n&#x0d;&#x0a;_applyconfigbackup_&#92;n&#x0d;&#x0a;exit&#92;n'),
@ -2561,14 +2561,14 @@ INSERT INTO `tncm_script` VALUES
(14,0,'expect:root@%&#x0d;&#x0a;cli&#92;n&#x0d;&#x0a;exit&#92;n'),
(15,1,'expect:root@%&#x0d;&#x0a;cli&#92;n&#x0d;&#x0a;expect:root&gt;&#x0d;&#x0a;capture:show&#x20;configuration&#x20;|&#x20;no-more&#92;n&#x0d;&#x0a;capture:&#92;n&#x0d;&#x0a;quit&#92;n&#x0d;&#x0a;expect:root@%&#x0d;&#x0a;exit&#92;n'),
(16,2,'expect:root@%&#x0d;&#x0a;cli&#92;n&#x0d;&#x0a;expect:root&gt;&#x0d;&#x0a;configure&#92;n&#x0d;&#x0a;load&#x20;override&#x20;terminal&#92;n&#x0d;&#x0a;_applyconfigbackup_&#92;n&#x0d;&#x0a;commit&#92;n&#x0d;&#x0a;exit&#92;n'),
(17,3,'expect:root@%&#x0d;&#x0a;cli&#92;n&#x0d;&#x0a;expect:root&gt;&#x0d;&#x0a;capture:show&#x20;version|match&#x20;Junos:&#92;n&#x0d;&#x0a;capture:&#x20;&#92;n&#x0d;&#x0a;quit&#92;n&#x0d;&#x0a;expect:root@%&#x0d;&#x0a;exit&#92;n'),
(17,3,'expect:root@%&#x0d;&#x0a;cli&#92;n&#x0d;&#x0a;expect:root&gt;&#x0d;&#x0a;capture:show&#x20;version|match&#x20;Junos:&#92;n&#x0d;&#x0a;quit&#92;n&#x0d;&#x0a;expect:root@%&#x0d;&#x0a;exit&#92;n'),
(18,4,'expect:root@%&#x0d;&#x0a;cli&#92;n&#x0d;&#x0a;expect:root&gt;&#x0d;&#x0a;save&#x20;software&#x20;from&#x20;tftp&#x20;_TFTP_SERVER_IP_&#x20;_FIRMWARE_NAME_&#x20;to&#x20;flash&#92;n&#x0d;&#x0a;reset&#92;n&#x0d;&#x0a;exit&#92;n'),
(19,5,''),
(20,7,'expect:root@%&#x0d;&#x0a;cli&#92;n&#x0d;&#x0a;expect:root&gt;&#x0d;&#x0a;capture:show&#x20;version|match&#x20;Junos:&#92;n&#x0d;&#x0a;capture:&#x20;&#92;n&#x0d;&#x0a;quit&#92;n&#x0d;&#x0a;expect:root@%&#x0d;&#x0a;exit&#92;n'),
(20,7,'expect:root@%&#x0d;&#x0a;cli&#92;n&#x0d;&#x0a;expect:root&gt;&#x0d;&#x0a;capture:show&#x20;version|match&#x20;Junos:&#92;n&#x0d;&#x0a;quit&#92;n&#x0d;&#x0a;expect:root@%&#x0d;&#x0a;exit&#92;n'),
(21,0,'sleep:1&#x0d;&#x0a;exit&#92;n'),
(22,1,'set&#x20;cli&#x20;pager&#x20;off&#x20;&#92;n&#x0d;&#x0a;capture:show&#x20;config&#x20;running&#92;n&#x0d;&#x0a;exit&#92;n'),
(23,2,'set&#x20;cli&#x20;terminal&#x20;width&#x20;500&#92;n&#x0d;&#x0a;set&#x20;cli&#x20;scripting-mode&#x20;on&#92;n&#x0d;&#x0a;configure&#92;n&#x0d;&#x0a;_applyconfigbackup_&#92;n&#x0d;&#x0a;commit&#92;n'),
(24,3,'set&#x20;cli&#x20;pager&#x20;off&#x20;&#92;n&#x0d;&#x0a;capture:show&#x20;system&#x20;info&#x20;|&#x20;match&#x20;app-version:&#92;n&#x0d;&#x0a;sleep:1&#x20;&#x0d;&#x0a;expect:app-version:&#92;s*&#x0d;&#x0a;exit&#x20;&#92;n'),
(24,3,'set&#x20;cli&#x20;pager&#x20;off&#x20;&#92;n&#x0d;&#x0a;capture:show&#x20;system&#x20;info&#x20;|&#x20;match&#x20;app-version:&#92;n&#x0d;&#x0a;sleep:1&#x0d;&#x0a;exit&#x20;&#92;n'),
(25,4,'tftp&#x20;import&#x20;software&#x20;from&#x20;_TFTP_SERVER_IP_&#x20;file&#x20;_FIRMWARE_NAME_&#92;n&#x0d;&#x0a;request&#x20;system&#x20;software&#x20;install&#x20;version&#92;n&#x0d;&#x0a;reboot&#92;n&#x0d;&#x0a;exit&#92;n'),
(26,5,''),
(27,7,'set&#x20;cli&#x20;pager&#x20;off&#x20;&#92;n&#x0d;&#x0a;capture:show&#x20;system&#x20;info&#x20;|&#x20;match&#x20;app-version:&#92;n&#x0d;&#x0a;sleep:1&#x20;&#x0d;&#x0a;expect:app-version:&#92;s*&#x0d;&#x0a;exit&#x20;&#92;n'),
@ -2986,7 +2986,7 @@ SET @short_name = 'pandorafms.aws.rds';
SET @name = 'Amazon&#x20;RDS';
SET @section = 'cloud';
SET @description = 'Monitor&#x20;AWS&#x20;RDS&#x20;instances';
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;

View File

@ -654,6 +654,17 @@ class Client
}
/**
* Return license.
*
* @return string|null
*/
public function getLicense()
{
return $this->license;
}
/**
* Executes a curl request.
*

View File

@ -292,21 +292,23 @@ class Manager
*/
public function register()
{
View::render(
'register',
[
'version' => $this->umc->getVersion(),
'mr' => $this->umc->getMR(),
'error' => $this->umc->getLastError(),
'asset' => function ($rp) {
echo $this->getUrl($rp);
},
'authCode' => $this->authCode,
'ajax' => $this->ajaxUrl,
'ajaxPage' => $this->ajaxPage,
'mode' => self::MODE_REGISTER,
]
);
if ($this->umc->getLicense() !== 'PANDORA-ENTERPRISE-FREE') {
View::render(
'register',
[
'version' => $this->umc->getVersion(),
'mr' => $this->umc->getMR(),
'error' => $this->umc->getLastError(),
'asset' => function ($rp) {
echo $this->getUrl($rp);
},
'authCode' => $this->authCode,
'ajax' => $this->ajaxUrl,
'ajaxPage' => $this->ajaxPage,
'mode' => self::MODE_REGISTER,
]
);
}
}

View File

@ -451,6 +451,10 @@ span.warning {
align-items: center;
justify-content: space-between;
}
.ui-dialog-content.ui-widget-content#register_dialog_message {
display: inherit;
}
/*.ui-dialog-content.ui-widget-content p {
font-size: 10pt;
word-break: keep-all;

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.776-240515
Version: 7.0NG.776-240521
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.776-240515"
pandora_version="7.0NG.776-240521"
package_cpan=0
package_pandora=1

View File

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

View File

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

View File

@ -7,7 +7,7 @@
%define debug_package %{nil}
%define name pandorafms_server
%define version 7.0NG.776
%define release 240515
%define release 240521
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

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

View File

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.776 Build 240515";
my $version = "7.0NG.776 Build 240521";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.776 Build 240515";
my $version = "7.0NG.776 Build 240521";
# save program name for logging
my $progname = basename($0);
@ -1227,6 +1227,18 @@ sub param_error ($$) {
exit 1;
}
###############################################################################
# Print a 'length' error and exit the program.
# Param 0: field name
# Param 1: field max size
# Param 2: field current size
###############################################################################
sub length_error ($$$) {
print (STDERR "[ERROR] Error: The $_[0] after insertion will exceed the allowed length ($_[1]), current length ($_[2]).\n\n");
logger( $conf, "($progname) [ERROR] Error: The $_[0] after insertion will exceed the allowed length ($_[1]), current length ($_[2]).", 10);
exit 1;
}
###############################################################################
# Print a 'does not exist' error and exit the program.
###############################################################################
@ -1287,6 +1299,20 @@ sub param_check ($$;$) {
}
}
###############################################################################
# Check the length and call the error if exeeds the allowed.
# Param 0: field name
# Param 1: field content
# Param 2: field max size
###############################################################################
sub length_check ($$$) {
my $field_length = length(safe_input($_[0]));
if($field_length > $_[2]) {
length_error($_[1],$_[2],$field_length);
}
}
##############################################################################
# Print a help line.
##############################################################################
@ -4473,6 +4499,10 @@ sub cli_create_event() {
$event_status = 0 unless defined($event_status);
$severity = 0 unless defined($severity);
if (defined($id_extra) && $id_extra ne '') {
length_check($id_extra, 'id_extra', 255);
}
my $id_user;
if (!defined($user_name) || $user_name eq '') {