Merge remote-tracking branch 'origin/develop' into ent-5524-backups-de-la-base-de-datos-desde-la-consola

This commit is contained in:
marcos 2020-05-18 10:28:32 +02:00
commit fc5c5fd60d
46 changed files with 611 additions and 236 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.745-200512 Version: 7.0NG.745-200518
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.745 %define version 7.0NG.745
%define release 200512 %define release 200518
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.745 %define version 7.0NG.745
%define release 200512 %define release 200518
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.745" PI_VERSION="7.0NG.745"
PI_BUILD="200512" PI_BUILD="200518"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{200512} {200518}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.745(Build 200512))" VALUE "ProductVersion", "(7.0NG.745(Build 200518))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.745-200512 Version: 7.0NG.745-200518
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE trecon_task add column `rcmd_enabled` TINYINT(1) UNSIGNED DEFAULT 0 AFTER `wmi_enabled`;
COMMIT;

View File

@ -1674,6 +1674,7 @@ ALTER TABLE trecon_task ADD `alias_as_name` int(2) unsigned default '0';
ALTER TABLE trecon_task ADD `snmp_enabled` int(2) unsigned default '0'; ALTER TABLE trecon_task ADD `snmp_enabled` int(2) unsigned default '0';
ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0'; ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0';
ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0'; ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
ALTER TABLE trecon_task ADD `rcmd_enabled` tinyint(1) unsigned DEFAULT '0';
ALTER TABLE trecon_task ADD `auth_strings` text; ALTER TABLE trecon_task ADD `auth_strings` text;
ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0'; ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0';
ALTER TABLE trecon_task ADD `summary` text; ALTER TABLE trecon_task ADD `summary` text;

View File

@ -138,6 +138,9 @@ font-size:10pt;
echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.'); echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.');
echo '<br/> <br/>'; echo '<br/> <br/>';
echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name()); echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name());
if ($config['logged'] == false) {
session_destroy();
}
?> ?>
</div> </div>

View File

@ -538,7 +538,14 @@ class DiscoveryTaskList extends HTML
} }
$can_be_reviewed = false; $can_be_reviewed = false;
if ($task['review_mode'] == DISCOVERY_STANDARD) { if (empty($task['summary']) === false
&& $task['summary'] == 'cancelled'
) {
$data[5] = __('Cancelled').ui_print_help_tip(
__('Server has been restarted while executing this task, please retry.'),
true
);
} else if ($task['review_mode'] == DISCOVERY_STANDARD) {
if ($task['status'] <= 0 if ($task['status'] <= 0
&& empty($task['summary']) === false && empty($task['summary']) === false
) { ) {

View File

@ -482,6 +482,7 @@ class HostDevices extends Wizard
$review_results = get_parameter_switch('review_results'); $review_results = get_parameter_switch('review_results');
$review_limited = (bool) get_parameter('review_limited', 0); $review_limited = (bool) get_parameter('review_limited', 0);
$auto_monitor = get_parameter_switch('auto_monitor'); $auto_monitor = get_parameter_switch('auto_monitor');
$recon_ports = get_parameter('recon_ports', null);
$autoconf_enabled = get_parameter_switch( $autoconf_enabled = get_parameter_switch(
'autoconfiguration_enabled' 'autoconfiguration_enabled'
); );
@ -491,6 +492,7 @@ class HostDevices extends Wizard
$parent_recursion = get_parameter_switch('parent_recursion'); $parent_recursion = get_parameter_switch('parent_recursion');
$vlan_enabled = get_parameter_switch('vlan_enabled'); $vlan_enabled = get_parameter_switch('vlan_enabled');
$wmi_enabled = get_parameter_switch('wmi_enabled'); $wmi_enabled = get_parameter_switch('wmi_enabled');
$rcmd_enabled = get_parameter_switch('rcmd_enabled');
$resolve_names = get_parameter_switch('resolve_names'); $resolve_names = get_parameter_switch('resolve_names');
$snmp_version = get_parameter('snmp_version', null); $snmp_version = get_parameter('snmp_version', null);
$community = get_parameter('community', null); $community = get_parameter('community', null);
@ -532,12 +534,14 @@ class HostDevices extends Wizard
} }
$this->task['auto_monitor'] = $auto_monitor; $this->task['auto_monitor'] = $auto_monitor;
$this->task['recon_ports'] = $recon_ports;
$this->task['snmp_enabled'] = $snmp_enabled; $this->task['snmp_enabled'] = $snmp_enabled;
$this->task['os_detect'] = $os_detect; $this->task['os_detect'] = $os_detect;
$this->task['parent_detection'] = $parent_detection; $this->task['parent_detection'] = $parent_detection;
$this->task['parent_recursion'] = $parent_recursion; $this->task['parent_recursion'] = $parent_recursion;
$this->task['vlan_enabled'] = $vlan_enabled; $this->task['vlan_enabled'] = $vlan_enabled;
$this->task['wmi_enabled'] = $wmi_enabled; $this->task['wmi_enabled'] = $wmi_enabled;
$this->task['rcmd_enabled'] = $rcmd_enabled;
$this->task['resolve_names'] = $resolve_names; $this->task['resolve_names'] = $resolve_names;
$this->task['snmp_version'] = $snmp_version; $this->task['snmp_version'] = $snmp_version;
$this->task['snmp_auth_user'] = $snmp_auth_user; $this->task['snmp_auth_user'] = $snmp_auth_user;
@ -1036,6 +1040,21 @@ class HostDevices extends Wizard
], ],
]; ];
$form['inputs'][] = [
'label' => __('Filter by opened ports').ui_print_help_tip(
__(
'Targets will be scanned if at least one of defined ports (comma separated) is open.'
),
true
),
'arguments' => [
'name' => 'recon_ports',
'type' => 'text',
'return' => true,
'value' => $this->task['recon_ports'],
],
];
$form['inputs'][] = [ $form['inputs'][] = [
'label' => __('Auto discover known hardware').ui_print_help_tip( 'label' => __('Auto discover known hardware').ui_print_help_tip(
__( __(

View File

@ -752,25 +752,41 @@ class ConsoleSupervisor
// Expiry. // Expiry.
if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) { if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) {
if ($config['license_mode'] == 1) {
$title = __('License is about to expire');
$msg = 'Your license will expire in %d days. Please, contact our sales department.';
} else {
$title = __('Support is about to expire');
$msg = 'Your support license will expire in %d days. Please, contact our sales department.';
}
// Warn user if license is going to expire in 15 days or less. // Warn user if license is going to expire in 15 days or less.
$this->notify( $this->notify(
[ [
'type' => 'NOTIF.LICENSE.EXPIRATION', 'type' => 'NOTIF.LICENSE.EXPIRATION',
'title' => __('License is about to expire'), 'title' => $title,
'message' => __( 'message' => __(
'Your license will expire in %d days. Please, contact our sales department.', $msg,
$days_to_expiry $days_to_expiry
), ),
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'), 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
] ]
); );
} else if ($days_to_expiry < 0) { } else if ($days_to_expiry < 0) {
if ($config['license_mode'] == 1) {
$title = __('Expired license');
$msg = __('Your license has expired. Please, contact our sales department.');
} else {
$title = __('Support expired');
$msg = __('This license is outside of support. Please, contact our sales department.');
}
// Warn user, license has expired. // Warn user, license has expired.
$this->notify( $this->notify(
[ [
'type' => 'NOTIF.LICENSE.EXPIRATION', 'type' => 'NOTIF.LICENSE.EXPIRATION',
'title' => __('Expired license'), 'title' => $title,
'message' => __('Your license has expired. Please, contact our sales department.'), 'message' => $msg,
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'), 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
] ]
); );

View File

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

View File

@ -3947,7 +3947,7 @@ function get_copyright_notice()
{ {
$stored_name = enterprise_hook('enterprise_get_copyright_notice'); $stored_name = enterprise_hook('enterprise_get_copyright_notice');
if (empty($stored_name) || $stored_name == ENTERPRISE_NOT_HOOK) { if (empty($stored_name) || $stored_name == ENTERPRISE_NOT_HOOK) {
return 'Ártica ST'; return 'PandoraFMS.com';
} }
return $stored_name; return $stored_name;

View File

@ -14294,7 +14294,7 @@ function api_get_agents_id_name_by_cluster_name($cluster_name, $trash1, $trash2,
* @param $trash2 * @param $trash2
* @param string $returnType * @param string $returnType
* Example: * Example:
* api.php?op=get&op2=agents_id_name_by_alias&return_type=json&apipass=1234&user=admin&pass=pandora&id=pandrora&id2=strict * api.php?op=get&op2=agents_id_name_by_alias&return_type=json&apipass=1234&user=admin&pass=pandora&id=pandorafms&id2=strict
*/ */
function api_get_agents_id_name_by_alias($alias, $strict, $trash2, $returnType) function api_get_agents_id_name_by_alias($alias, $strict, $trash2, $returnType)
{ {
@ -14307,9 +14307,9 @@ function api_get_agents_id_name_by_alias($alias, $strict, $trash2, $returnType)
} }
if (is_metaconsole()) { if (is_metaconsole()) {
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente, id_tagente,id_tmetaconsole_setup as 'id_server', server_name FROM tmetaconsole_agent WHERE $where_clause"); $all_agents = db_get_all_rows_sql("SELECT alias, nombre, id_agente, id_tagente,id_tmetaconsole_setup as 'id_server', server_name FROM tmetaconsole_agent WHERE $where_clause");
} else { } else {
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente from tagente WHERE $where_clause"); $all_agents = db_get_all_rows_sql("SELECT alias, nombre, id_agente from tagente WHERE $where_clause");
} }
if ($all_agents !== false) { if ($all_agents !== false) {
@ -15990,3 +15990,34 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access='A
return false; return false;
} }
/**
* Function for get event id and node id, then we get in return the Metaconsole event ID.
*
* @param [string] $server_id id server (Node)
* @param [string] $console_event_id console Id node event in tmetaconsole_event
* @param [string] $trash2 don't use
* @param [string] $returnType
*
* Example
* api.php?op=get&op2=event_mcid&return_type=json&id=0&id2=0&apipass=1234&user=admin&pass=pandora
*
* @return void
*/
function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType)
{
global $config;
if (is_metaconsole()) {
$mc_event_id = db_get_all_rows_sql("SELECT id_evento FROM tmetaconsole_event WHERE id_source_event = $console_event_id AND server_id = $server_id ");
if ($mc_event_id !== false) {
returnData($returnType, ['type' => 'string', 'data' => $mc_event_id]);
} else {
returnError('id_not_found', 'string');
}
} else {
returnError('forbidden', 'string');
return;
}
}

View File

@ -2088,10 +2088,10 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='') function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='', $disable=false)
{ {
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' class="'.$class.'">'; $disabled = ($disable) ? 'disabled' : '';
// $output .= io_safe_input ($value); $output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' class="'.$class.'" '.$disabled.'>';
$output .= ($value); $output .= ($value);
$output .= '</textarea>'; $output .= '</textarea>';

View File

@ -5634,7 +5634,7 @@ function ui_get_snapshot_link($params, $only_params=false)
$params = array_merge($default_params, $params); $params = array_merge($default_params, $params);
// First parameter of js winopeng_var. // First parameter of js winopeng_var.
$page = $config['homeurl_static'].'/operation/agentes/snapshot_view.php'; $page = $config['homeurl'].'/operation/agentes/snapshot_view.php';
$url = $page.'?id='.$params['id_module'].'&label='.rawurlencode(urlencode(io_safe_output($params['module_name']))).'&id_node='.$params['id_node']; $url = $page.'?id='.$params['id_module'].'&label='.rawurlencode(urlencode(io_safe_output($params['module_name']))).'&id_node='.$params['id_node'];

View File

@ -1181,8 +1181,16 @@ function add_agent_node(agents) {
$("#agent_name").val(""); $("#agent_name").val("");
$("#dialog_node_add").dialog("close"); $("#dialog_node_add").dialog("close");
const new_id =
Math.max.apply(
Math,
graph.nodes.map(function(o) {
return o.id;
})
) + 1;
var temp_node = {}; var temp_node = {};
temp_node["id"] = graph.nodes.length; temp_node["id"] = new_id;
temp_node["id_db"] = data["id_node"]; temp_node["id_db"] = data["id_node"];
temp_node["id_agent"] = data["id_agent"]; temp_node["id_agent"] = data["id_agent"];
temp_node["id_module"] = ""; temp_node["id_module"] = "";
@ -2423,7 +2431,13 @@ function refresh_holding_area() {
jQuery.each(holding_area.nodes, function(i, node) { jQuery.each(holding_area.nodes, function(i, node) {
var temp_node = {}; var temp_node = {};
temp_node["id"] = graph.nodes.length; temp_node["id"] =
Math.max.apply(
Math,
graph.nodes.map(function(o) {
return o.id;
})
) + 1;
holding_area.nodes[i]["id"] = temp_node["id"]; holding_area.nodes[i]["id"] = temp_node["id"];
temp_node["id_db"] = node["id_db"]; temp_node["id_db"] = node["id_db"];
@ -2711,6 +2725,20 @@ function set_parent(parent_data) {
url: "ajax.php", url: "ajax.php",
success: function(data) { success: function(data) {
if (data["correct"]) { if (data["correct"]) {
var child_index = -1;
var parent_index = -1;
// Get indexes of child and parent nodes.
$.each(graph.nodes, function(i, d) {
if (child_data.id == d.id) {
child_index = i;
}
if (parent_data.id == d.id) {
parent_index = i;
}
});
//Add the relationship and paint //Add the relationship and paint
item = {}; item = {};
item["arrow_start"] = ""; item["arrow_start"] = "";
@ -2723,11 +2751,11 @@ function set_parent(parent_data) {
item["id_module_end"] = 0; item["id_module_end"] = 0;
item["id_db"] = data["id"]; item["id_db"] = data["id"];
item["source_id_db"] = child_data.id_db; item["source_id_db"] = child_data.id_db;
item["target_id_db"] = parent_data.id; item["target_id_db"] = parent_data.id_db;
item["id_agent_start"] = graph.nodes[child_data.id]["id_agent"]; item["id_agent_start"] = graph.nodes[child_index]["id_agent"];
item["id_agent_end"] = graph.nodes[parent_data.id]["id_agent"]; item["id_agent_end"] = graph.nodes[parent_index]["id_agent"];
item["target"] = graph.nodes[parent_data.id]; item["target"] = graph.nodes[parent_index];
item["source"] = graph.nodes[child_data.id]; item["source"] = graph.nodes[child_index];
graph.links.push(item); graph.links.push(item);
} }
@ -2922,8 +2950,16 @@ function add_fictional_node() {
if (data["correct"]) { if (data["correct"]) {
$("#dialog_node_add").dialog("close"); $("#dialog_node_add").dialog("close");
const new_id =
Math.max.apply(
Math,
graph.nodes.map(function(o) {
return o.id;
})
) + 1;
var temp_node = {}; var temp_node = {};
temp_node["id"] = graph.nodes.length; temp_node["id"] = new_id;
temp_node["id_db"] = data["id_node"]; temp_node["id_db"] = data["id_node"];
temp_node["id_agent"] = data["id_agent"]; temp_node["id_agent"] = data["id_agent"];
temp_node["id_module"] = 0; temp_node["id_module"] = 0;
@ -2951,8 +2987,16 @@ function add_fictional_node() {
} else { } else {
$("#dialog_node_add").dialog("close"); $("#dialog_node_add").dialog("close");
const new_id =
Math.max.apply(
Math,
graph.nodes.map(function(o) {
return o.id;
})
) + 1;
var temp_node = {}; var temp_node = {};
temp_node["id"] = graph.nodes.length; temp_node["id"] = new_id;
temp_node["id_db"] = data["id_node"]; temp_node["id_db"] = data["id_node"];
temp_node["id_agent"] = data["id_agent"]; temp_node["id_agent"] = data["id_agent"];
temp_node["id_module"] = 0; temp_node["id_module"] = 0;

View File

@ -45,7 +45,7 @@ $(document).ready(function() {
jQuery.post( jQuery.post(
"ajax.php", "ajax.php",
{ {
page: "operation/messages/message_list" page: "operation/messages/message_list",
}, },
function(data, status) { function(data, status) {
$("#dialog_messages") $("#dialog_messages")
@ -58,10 +58,10 @@ $(document).ready(function() {
modal: true, modal: true,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
background: "black" background: "black",
}, },
width: 700, width: 700,
height: 300 height: 300,
}) })
.show(); .show();
}, },
@ -80,7 +80,7 @@ $(document).ready(function() {
jQuery.post( jQuery.post(
"ajax.php", "ajax.php",
{ {
page: "operation/system_alert" page: "operation/system_alert",
}, },
function(data, status) { function(data, status) {
$("#alert_messages").show(); $("#alert_messages").show();
@ -104,7 +104,7 @@ $(document).ready(function() {
"ajax.php", "ajax.php",
{ {
page: "general/alert_enterprise", page: "general/alert_enterprise",
message: elem message: elem,
}, },
function(data, status) { function(data, status) {
$("#alert_messages").show(); $("#alert_messages").show();
@ -130,7 +130,7 @@ $(document).ready(function() {
"ajax.php", "ajax.php",
{ {
page: "general/alert_enterprise", page: "general/alert_enterprise",
message: elem message: elem,
}, },
function(data, status) { function(data, status) {
$("#alert_messages").show(); $("#alert_messages").show();
@ -155,7 +155,7 @@ $(document).ready(function() {
"ajax.php", "ajax.php",
{ {
page: "general/alert_enterprise", page: "general/alert_enterprise",
message: elem message: elem,
}, },
function(data, status) { function(data, status) {
$("#alert_messages").show(); $("#alert_messages").show();
@ -174,6 +174,11 @@ $(document).ready(function() {
if (typeof show_error_license == "undefined") show_error_license = 0; if (typeof show_error_license == "undefined") show_error_license = 0;
if (typeof hide_counter == "undefined") hide_counter = 0;
let height = 300;
if (typeof invalid_license != "undefined") height = 350;
if (process_login_ok || show_error_license) { if (process_login_ok || show_error_license) {
$("#license_error_msg_dialog").dialog({ $("#license_error_msg_dialog").dialog({
dialogClass: "no-close", dialogClass: "no-close",
@ -181,13 +186,14 @@ $(document).ready(function() {
resizable: false, resizable: false,
draggable: true, draggable: true,
modal: true, modal: true,
height: 470, height: height,
width: 850, width: 850,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
background: "black" background: "black",
}, },
open: function() { open: function() {
if (hide_counter != 1) {
var remaining = 30; var remaining = 30;
// Timeout counter. // Timeout counter.
@ -203,7 +209,10 @@ $(document).ready(function() {
}; };
setInterval(count, 1000); setInterval(count, 1000);
} else {
$("#ok_buttom").show();
} }
},
}); });
$("#submit-hide-license-error-msg").click(function() { $("#submit-hide-license-error-msg").click(function() {
@ -221,8 +230,8 @@ $(document).ready(function() {
width: 620, width: 620,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
background: "black" background: "black",
} },
}); });
} }
@ -235,8 +244,8 @@ $(document).ready(function() {
width: 520, width: 520,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
background: "black" background: "black",
} },
}); });
} }
@ -249,8 +258,8 @@ $(document).ready(function() {
width: 520, width: 520,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
background: "black" background: "black",
} },
}); });
} }
@ -318,7 +327,7 @@ $(document).ready(function() {
left: left:
+parseInt(screen.width / 2) - +parseInt(screen.width / 2) -
parseInt($("#alert_messages").css("width")) / 2 + parseInt($("#alert_messages").css("width")) / 2 +
"px" "px",
}); });
}); });

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.745'; $version = '7.0NG.745';
$build = '200512'; $build = '200518';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -521,7 +521,9 @@ if ($search != '') {
$search_sql .= ')'; $search_sql .= ')';
} else { } else {
$search_sql = ' AND ( nombre '.$order_collation." $search_sql = ' AND ( nombre '.$order_collation."
COLLATE utf8_general_ci LIKE '%$search%' OR alias ".$order_collation." COLLATE utf8_general_ci LIKE '%$search%') "; COLLATE utf8_general_ci LIKE '%$search%'
OR comentarios ".$order_collation." COLLATE utf8_general_ci LIKE '%$search%'
OR alias ".$order_collation." COLLATE utf8_general_ci LIKE '%$search%') ";
} }
} }

View File

@ -20,6 +20,8 @@ $searchAgents = check_acl($config['id_user'], 0, 'AR');
$selectNameUp = ''; $selectNameUp = '';
$selectNameDown = ''; $selectNameDown = '';
$selectDescriptionUp = '';
$selectDescriptionDown = '';
$selectOsUp = ''; $selectOsUp = '';
$selectOsDown = ''; $selectOsDown = '';
$selectIntervalUp = ''; $selectIntervalUp = '';
@ -50,6 +52,26 @@ switch ($sortField) {
} }
break; break;
case 'comentarios':
switch ($sort) {
case 'up':
$selectDescriptionUp = $selected;
$order = [
'field' => 'comentarios',
'order' => 'ASC',
];
break;
case 'down':
$selectDescriptionDown = $selected;
$order = [
'field' => 'comentarios',
'order' => 'DESC',
];
break;
}
break;
case 'os': case 'os':
switch ($sort) { switch ($sort) {
case 'up': case 'up':
@ -133,6 +155,8 @@ switch ($sortField) {
default: default:
$selectNameUp = $selected; $selectNameUp = $selected;
$selectNameDown = ''; $selectNameDown = '';
$selectDescriptionUp = '';
$selectDescriptionDown = '';
$selectOsUp = ''; $selectOsUp = '';
$selectOsDown = ''; $selectOsDown = '';
$selectIntervalUp = ''; $selectIntervalUp = '';
@ -166,6 +190,7 @@ if ($searchAgents) {
$search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%cd ".$stringSearchSQL."%%' OR $search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%cd ".$stringSearchSQL."%%' OR
t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
t1.id_agente = $aux"; t1.id_agente = $aux";
if (count($id) >= 2) { if (count($id) >= 2) {
@ -178,6 +203,7 @@ if ($searchAgents) {
$search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR $search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
t1.direccion COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t1.direccion COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%'"; t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%'";
} }
@ -211,7 +237,7 @@ if ($searchAgents) {
) )
'; ';
$select = 'SELECT DISTINCT(t1.id_agente), t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet'; $select = 'SELECT DISTINCT(t1.id_agente), t1.ultimo_contacto, t1.nombre, t1.comentarios, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet';
if ($only_count) { if ($only_count) {
$limit = ' ORDER BY '.$order['field'].' '.$order['order'].' LIMIT '.$config['block_size'].' OFFSET 0'; $limit = ' ORDER BY '.$order['field'].' '.$order['order'].' LIMIT '.$config['block_size'].' OFFSET 0';
} else { } else {

View File

@ -39,21 +39,23 @@ if (!$agents || !$searchAgents) {
$table->head = []; $table->head = [];
if ($only_count) { if ($only_count) {
$table->head[0] = __('Agent'); $table->head[0] = __('Agent');
$table->head[1] = __('OS'); $table->head[1] = __('Description');
$table->head[2] = __('Interval'); $table->head[2] = __('OS');
$table->head[3] = __('Group'); $table->head[3] = __('Interval');
$table->head[4] = __('Group');
} else { } else {
$table->head[0] = __('Agent').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).'</a>'; $table->head[0] = __('Agent').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).'</a>';
$table->head[1] = __('OS').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=os&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectOsUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=os&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectOsDown]).'</a>'; $table->head[1] = __('Description').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=comentarios&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectDescriptionUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=comentarios&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectDescriptionDown]).'</a>';
$table->head[2] = __('Interval').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=interval&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectIntervalUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=interval&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectIntervalDown]).'</a>'; $table->head[2] = __('OS').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=os&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectOsUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=os&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectOsDown]).'</a>';
$table->head[3] = __('Group').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=group&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectGroupUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=group&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectGroupDown]).'</a>'; $table->head[3] = __('Interval').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=interval&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectIntervalUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=interval&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectIntervalDown]).'</a>';
$table->head[4] = __('Group').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=group&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectGroupUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=group&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectGroupDown]).'</a>';
} }
$table->head[4] = __('Modules'); $table->head[5] = __('Modules');
$table->head[5] = __('Status'); $table->head[6] = __('Status');
$table->head[6] = __('Alerts'); $table->head[7] = __('Alerts');
$table->head[7] = __('Last contact').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectLastContactUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectLastContactDown]).'</a>'; $table->head[8] = __('Last contact').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectLastContactUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectLastContactDown]).'</a>';
$table->head[8] = ''; $table->head[9] = '';
$table->align = []; $table->align = [];
$table->align[0] = 'left'; $table->align[0] = 'left';
@ -64,7 +66,8 @@ if (!$agents || !$searchAgents) {
$table->align[5] = 'left'; $table->align[5] = 'left';
$table->align[6] = 'left'; $table->align[6] = 'left';
$table->align[7] = 'left'; $table->align[7] = 'left';
$table->align[8] = 'center'; $table->align[8] = 'left';
$table->align[9] = 'center';
$table->data = []; $table->data = [];
@ -116,6 +119,7 @@ if (!$agents || !$searchAgents) {
$table->data, $table->data,
[ [
$cellName, $cellName,
ui_print_truncate_text($agent['comentarios'], 'comentarios', false, true, true, '[&hellip;]'),
ui_print_os_icon($agent['id_os'], false, true), ui_print_os_icon($agent['id_os'], false, true),
human_time_description_raw($agent['intervalo'], false, 'tiny'), human_time_description_raw($agent['intervalo'], false, 'tiny'),
ui_print_group_icon($agent['id_grupo'], true), ui_print_group_icon($agent['id_grupo'], true),

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.745 %define version 7.0NG.745
%define release 200512 %define release 200518
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.745 %define version 7.0NG.745
%define release 200512 %define release 200518
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

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

View File

@ -805,6 +805,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` (
`snmp_privacy_pass` varchar(255) NOT NULL default '', `snmp_privacy_pass` varchar(255) NOT NULL default '',
`snmp_security_level` varchar(25) NOT NULL default '', `snmp_security_level` varchar(25) NOT NULL default '',
`wmi_enabled` tinyint(1) unsigned DEFAULT 0, `wmi_enabled` tinyint(1) unsigned DEFAULT 0,
`rcmd_enabled` tinyint(1) unsigned DEFAULT 0,
`auth_strings` text, `auth_strings` text,
`auto_monitor` TINYINT(1) UNSIGNED DEFAULT 1, `auto_monitor` TINYINT(1) UNSIGNED DEFAULT 1,
`autoconfiguration_enabled` tinyint(1) unsigned default 0, `autoconfiguration_enabled` tinyint(1) unsigned default 0,

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.745-200512 Version: 7.0NG.745-200518
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

@ -105,7 +105,7 @@ sub new ($$$$$$) {
get_server_id ($dbh, $config->{'servername'}, DISCOVERYSERVER)); get_server_id ($dbh, $config->{'servername'}, DISCOVERYSERVER));
# Reset (but do not restart) manual recon tasks. # Reset (but do not restart) manual recon tasks.
db_do ($dbh, 'UPDATE trecon_task SET status = -1 WHERE id_recon_server = ? AND status <> -1 AND interval_sweep = 0', db_do ($dbh, 'UPDATE trecon_task SET status = -1, summary = "cancelled" WHERE id_recon_server = ? AND status <> -1 AND interval_sweep = 0',
get_server_id ($dbh, $config->{'servername'}, DISCOVERYSERVER)); get_server_id ($dbh, $config->{'servername'}, DISCOVERYSERVER));
# Call the constructor of the parent class # Call the constructor of the parent class
@ -250,6 +250,13 @@ sub data_consumer ($$) {
} }
} }
if (!is_empty($task->{'recon_ports'})) {
# Accept only valid symbols.
if ($task->{'recon_ports'} !~ /[\d\-\,\ ]+/) {
$task->{'recon_ports'} = '';
}
}
my $recon = new PandoraFMS::Recon::Base( my $recon = new PandoraFMS::Recon::Base(
communities => \@communities, communities => \@communities,
dbh => $dbh, dbh => $dbh,
@ -276,6 +283,9 @@ sub data_consumer ($$) {
task_id => $task->{'id_rt'}, task_id => $task->{'id_rt'},
vlan_cache_enabled => $task->{'vlan_enabled'}, vlan_cache_enabled => $task->{'vlan_enabled'},
wmi_enabled => $task->{'wmi_enabled'}, wmi_enabled => $task->{'wmi_enabled'},
rcmd_enabled => $task->{'rcmd_enabled'},
rcmd_timeout => $pa_config->{'rcmd_timeout'},
rcmd_timeout_bin => $pa_config->{'rcmd_timeout_bin'},
auth_strings_array => \@auth_strings, auth_strings_array => \@auth_strings,
autoconfiguration_enabled => $task->{'autoconfiguration_enabled'}, autoconfiguration_enabled => $task->{'autoconfiguration_enabled'},
main_event_id => $main_event, main_event_id => $main_event,
@ -399,8 +409,10 @@ sub exec_recon_script ($$$) {
################################################################################ ################################################################################
# Guess the OS using xprobe2 or nmap. # Guess the OS using xprobe2 or nmap.
################################################################################ ################################################################################
sub PandoraFMS::Recon::Base::guess_os($$) { sub PandoraFMS::Recon::Base::guess_os($$;$) {
my ($self, $device) = @_; my ($self, $device, $string_flag) = @_;
return $self->{'os_id'}{$device} if defined($self->{'os_id'}{$device});
$DEVNULL = '/dev/null' if (!defined($DEVNULL)); $DEVNULL = '/dev/null' if (!defined($DEVNULL));
$DEVNULL = '/NUL' if ($^O =~ /win/i && !defined($DEVNULL)); $DEVNULL = '/NUL' if ($^O =~ /win/i && !defined($DEVNULL));
@ -420,7 +432,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
my $return = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL`; my $return = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL`;
if ($? == 0) { if ($? == 0) {
if($return =~ /Running OS:(.*)/) { if($return =~ /Running OS:(.*)/) {
return pandora_get_os($self->{'dbh'}, $1); my $str_os = $1;
return $str_os if is_enabled($string_flag);
return pandora_get_os($self->{'dbh'}, $str_os);
} }
} }
} }
@ -431,7 +445,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
return OS_OTHER if ($? != 0); return OS_OTHER if ($? != 0);
if ($return =~ /Aggressive OS guesses:\s*(.*)/) { if ($return =~ /Aggressive OS guesses:\s*(.*)/) {
return pandora_get_os($self->{'dbh'}, $1); my $str_os = $1;
return $str_os if is_enabled($string_flag);
return pandora_get_os($self->{'dbh'}, $str_os);
} }
} }
@ -444,6 +460,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
sub PandoraFMS::Recon::Base::tcp_scan ($$) { sub PandoraFMS::Recon::Base::tcp_scan ($$) {
my ($self, $host) = @_; my ($self, $host) = @_;
return if is_empty($host);
return if is_empty($self->{'recon_ports'});
my $r = `"$self->{pa_config}->{nmap}" -p$self->{recon_ports} $host`; my $r = `"$self->{pa_config}->{nmap}" -p$self->{recon_ports} $host`;
# Same as ""| grep open | wc -l" but multi-OS; # Same as ""| grep open | wc -l" but multi-OS;
@ -510,6 +529,9 @@ sub PandoraFMS::Recon::Base::test_module($$) {
) { ) {
# Generic, plugins. (21-23 ASYNC) # Generic, plugins. (21-23 ASYNC)
if ($test->{'id_modulo'} == 6) { if ($test->{'id_modulo'} == 6) {
return 0 unless $self->wmi_responds($addr);
# WMI commands. # WMI commands.
$value = $self->call( $value = $self->call(
'wmi_get_value', 'wmi_get_value',
@ -527,9 +549,39 @@ sub PandoraFMS::Recon::Base::test_module($$) {
} elsif ($test->{'id_tipo_modulo'} >= 34 && $test->{'id_tipo_modulo'} <= 37) { } elsif ($test->{'id_tipo_modulo'} >= 34 && $test->{'id_tipo_modulo'} <= 37) {
# Remote command. # Remote command.
# XXX TODO: Test remote commands. return 0 unless $self->rcmd_responds($addr);
# Disabled until we can ensure result.
return 0; my $target_os;
if ($test->{'custom_string_2'} =~ /inherited/i) {
$target_os = pandora_get_os(
$self->{'dbh'},
$self->{'os_cache'}{$test->{'ip_target'}}
);
} else {
$target_os = pandora_get_os($self->{'dbh'}, $test->{'custom_string_2'});
}
$value = enterprise_hook(
'remote_execution_module',
[
# pa_config,
$self->{'pa_config'},
# dbh,
$self->{'dbh'},
# module,
$test,
# target_os,
$target_os,
# ip_target,
$test->{'ip_target'},
# tcp_port
$test->{'tcp_port'}
]
);
chomp($value);
return 0 unless defined($value);
} elsif ($test->{'id_tipo_modulo'} >= 8 && $test->{'id_tipo_modulo'} <= 11) { } elsif ($test->{'id_tipo_modulo'} >= 8 && $test->{'id_tipo_modulo'} <= 11) {
# TCP # TCP
@ -905,6 +957,16 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) {
$np_component->{'id_nc'} $np_component->{'id_nc'}
); );
# Tag cleanup.
if (!is_empty($component->{'tags'})) {
my @tags = map {
if ($_ > 0) { $_ }
else {}
} split ',', $component->{'tags'};
$component->{'tags'} = join ',', @tags;
}
$component->{'name'} = safe_output($component->{'name'}); $component->{'name'} = safe_output($component->{'name'});
if ($component->{'type'} >= 15 && $component->{'type'} <= 18) { if ($component->{'type'} >= 15 && $component->{'type'} <= 18) {
$component->{'snmp_community'} = safe_output($self->get_community($device)); $component->{'snmp_community'} = safe_output($self->get_community($device));
@ -917,6 +979,15 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) {
$component->{'plugin_pass'} = $self->{'snmp_auth_pass'}; $component->{'plugin_pass'} = $self->{'snmp_auth_pass'};
} }
if ($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(
$self->{'dbh'},
$self->guess_os($device)
);
}
$component->{'__module_component'} = 1; $component->{'__module_component'} = 1;
# 3. Try to register module into monitoring list. # 3. Try to register module into monitoring list.
@ -1012,7 +1083,10 @@ sub PandoraFMS::Recon::Base::report_scanned_agents($;$) {
|| $force_creation || $force_creation
) { ) {
my $parent_id; my $parent_id;
my $os_id = $self->guess_os($data->{'agent'}{'direccion'}); my $os_id = $data->{'agent'}{'id_os'};
if (is_empty($os_id)) {
$os_id = $self->guess_os($data->{'agent'}{'direccion'});
}
$self->call('message', "Agent accepted: ".$data->{'agent'}{'nombre'}, 5); $self->call('message', "Agent accepted: ".$data->{'agent'}{'nombre'}, 5);
@ -1337,10 +1411,14 @@ sub PandoraFMS::Recon::Base::report_scanned_agents($;$) {
next if is_empty($label); next if is_empty($label);
# Retrieve target agent OS version.
$self->{'agents_found'}->{$addr}{'agent'}{'id_os'} = $self->guess_os($addr);
$self->call('update_progress', $progress); $self->call('update_progress', $progress);
$progress += $step; $progress += $step;
# Store temporally. Wait user approval. # Store temporally. Wait user approval.
my $encoded; my $encoded;
eval { eval {
local $SIG{__DIE__}; local $SIG{__DIE__};
$encoded = encode_base64( $encoded = encode_base64(
@ -1436,6 +1514,9 @@ sub PandoraFMS::Recon::Base::apply_monitoring($) {
my @hosts = keys %{$self->{'agents_found'}}; my @hosts = keys %{$self->{'agents_found'}};
my $progress = 80;
if (scalar @hosts > 0) {
$self->{'step'} = STEP_MONITORING; $self->{'step'} = STEP_MONITORING;
# From 80% to 90%. # From 80% to 90%.
my ($progress, $step) = (80, 10.0 / scalar(@hosts)); my ($progress, $step) = (80, 10.0 / scalar(@hosts));
@ -1460,6 +1541,8 @@ sub PandoraFMS::Recon::Base::apply_monitoring($) {
} }
}
$self->{'c_network_percent'} = 100; $self->{'c_network_percent'} = 100;
$self->call('update_progress', $progress); $self->call('update_progress', $progress);
} }

View File

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

View File

@ -160,6 +160,12 @@ sub new {
# Globally enable/disable WMI scans. # Globally enable/disable WMI scans.
wmi_enabled => 0, wmi_enabled => 0,
# Globally enable/disable RCMD scans.
rcmd_enabled => 0,
rcmd_timeout => 4,
rcmd_timeout_bin => '/usr/bin/timeout',
auth_strings_array => [], auth_strings_array => [],
wmi_timeout => 3, wmi_timeout => 3,
timeout_cmd => '', timeout_cmd => '',
@ -1429,6 +1435,12 @@ sub test_capabilities($$) {
# Add wmi scan if enabled. # Add wmi scan if enabled.
$self->wmi_discovery($addr); $self->wmi_discovery($addr);
} }
# RCMD discovery.
if (is_enabled($self->{'rcmd_enabled'})) {
# Add wmi scan if enabled.
$self->rcmd_discovery($addr);
}
} }
################################################################################ ################################################################################
@ -1537,6 +1549,11 @@ sub scan_subnet($) {
# Populate. # Populate.
$self->call('update_progress', ceil($progress)); $self->call('update_progress', ceil($progress));
# Filter by port (if enabled).
if (!is_empty($self->{'recon_ports'})) {
next unless $self->call("tcp_scan", $addr) > 0;
}
# Enable/ disable capabilities. # Enable/ disable capabilities.
$self->test_capabilities($addr); $self->test_capabilities($addr);
} }
@ -2268,6 +2285,110 @@ sub wmi_credentials_calculation {
return undef; return undef;
} }
################################################################################
# Returns the credentials with which the host responds to WMI queries or
# undef if it does not respond to WMI.
################################################################################
sub rcmd_credentials {
my ($self, $target) = @_;
return $self->{'rcmd_auth'}{$target};
}
################################################################################
# Returns the credentials KEY with which the host responds to WMI queries or
# undef if it does not respond to WMI.
################################################################################
sub rcmd_credentials_key {
my ($self, $target) = @_;
return $self->{'rcmd_auth_key'}{$target};
}
################################################################################
# Calculate WMI credentials for target, 1 if calculated, undef if cannot
# connect to target. Credentials could be empty (-N)
################################################################################
sub rcmd_credentials_calculation {
my ($self, $target) = @_;
my $rcmd = PandoraFMS::Recon::Util::enterprise_new(
'PandoraFMS::RemoteCmd',[{
'psexec' => $self->{'parent'}->{'pa_config'}->{'psexec'},
'winexe' => $self->{'parent'}->{'pa_config'}->{'winexe'},
'plink' => $self->{'parent'}->{'pa_config'}->{'plink'}
}]
);
if (!$rcmd) {
# Library not available.
$self->call('message', "PandoraFMS::RemoteCmd library not available", 10);
return undef;
}
my $os = $self->{'os_cache'}{$target};
$os = $self->call('guess_os', $target, 1) if is_empty($os);
$rcmd->set_host($target);
$rcmd->set_os($os);
$self->{'os_cache'}{$target} = $os;
# Test all credentials selected.
foreach my $key_index (@{$self->{'auth_strings_array'}}) {
my $cred = $self->call('get_credentials', $key_index);
next if ref($cred) ne 'HASH';
$rcmd->clean_ssh_lib();
my $username;
my $domain;
if($cred->{'username'} =~ /^(.*?)\\(.*)$/) {
$domain = $1;
$username = $2;
} else {
$username = $cred->{'username'};
}
$rcmd->set_credentials(
{
'user' => $username,
'pass' => $cred->{'password'},
'domain' => $domain
}
);
$rcmd->set_timeout(
$self->{'rcmd_timeout_bin'},
$self->{'rcmd_timeout'}
);
my $result;
eval {
$result = $rcmd->rcmd('echo 1');
chomp($result);
my $out = '';
$out = $result if !is_empty($result);
$self->call('message', "Trying [".$key_index."] in [". $target."] [".$os."]: [$out]", 10);
};
if ($@) {
$self->call('message', "Failed while trying [".$key_index."] in [". $target."] [".$os."]:" . @_, 10);
}
if (!is_empty($result) && $result == "1") {
$self->{'rcmd_auth'}{$target} = $cred;
$self->{'rcmd_auth_key'}{$target} = $key_index;
$self->{'rcmd'}{$target} = 1;
$self->{'summary'}->{'RCMD'} += 1;
$self->call('message', "RCMD available for $target", 10);
return 1;
} else {
$self->call('message', "Last error ($target|$os|$result) was [".$rcmd->get_last_error()."]", 10);
}
}
# Not found.
return 0;
}
################################################################################ ################################################################################
# Tests wmi capability for addr. # Tests wmi capability for addr.
################################################################################ ################################################################################
@ -2282,6 +2403,20 @@ sub wmi_discovery {
} }
################################################################################
# Tests credentials against addr.
################################################################################
sub rcmd_discovery {
my ($self, $addr) = @_;
# Initialization.
$self->{'rcmd'} = {} unless ref($self->{'rcmd'}) eq 'HASH';
# Calculate credentials.
$self->rcmd_credentials_calculation($addr);
}
################################################################################ ################################################################################
# Extra: WMI imported methods. DO NOT EXPORT TO AVOID DOUBLE DEF. # Extra: WMI imported methods. DO NOT EXPORT TO AVOID DOUBLE DEF.
################################################################################ ################################################################################
@ -2371,6 +2506,15 @@ sub wmi_responds {
return 0; return 0;
} }
################################################################################
# Checks if target is reachable using rcmd.
################################################################################
sub rcmd_responds {
my ($self, $target) = @_;
return 1 if is_enabled($self->{'rcmd'}{$target});
return 0;
}
################################################################################ ################################################################################
# Performs a WMI request and returns the requested column of the first row. # Performs a WMI request and returns the requested column of the first row.
# Returns undef on error. # Returns undef on error.

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.745 %define version 7.0NG.745
%define release 200512 %define release 200518
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.745 %define version 7.0NG.745
%define release 200512 %define release 200518
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

2
pandora_server/util/pandora_db.pl Normal file → Executable file
View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.745 PS200512"; my $version = "7.0NG.745 PS200518";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.745 PS200512"; my $version = "7.0NG.745 PS200518";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);

2
tests/.gitignore vendored
View File

@ -1 +1,3 @@
*.pyc *.pyc
geckodriver.log
wmic

View File

@ -1,65 +1,46 @@
FROM centos:centos6 FROM centos:7
MAINTAINER Pandora FMS Team <info@pandorafms.com>
RUN { \
echo '[EPEL]'; \
echo 'name = CentOS Epel'; \
echo 'baseurl = http://dl.fedoraproject.org/pub/epel/6/x86_64'; \
echo 'enabled=1'; \
echo 'gpgcheck=0'; \
echo ''; \
echo '[remi-php72]'; \
echo 'name=Remi php72'; \
echo 'baseurl=http://rpms.remirepo.net/enterprise/6/php72/x86_64/'; \
echo 'enabled=1'; \
echo 'gpgcheck=0'; \
echo ''; \
echo '[remi-safe]'; \
echo 'name=Safe Remis RPM repository'; \
echo 'mirrorlist=http://cdn.remirepo.net/enterprise/$releasever/safe/mirror'; \
echo 'enabled=1'; \
echo 'gpgcheck=0'; \
echo ''; \
} > /etc/yum.repos.d/extra_repos.repo
RUN { \ RUN { \
echo '[artica_pandorafms]'; \ echo '[artica_pandorafms]'; \
echo 'name=CentOS6 - PandoraFMS official repo'; \ echo 'name=CentOS7 - PandoraFMS official repo'; \
echo 'baseurl=http://artica.es/centos6'; \ echo 'baseurl=http://firefly.artica.es/centos7'; \
echo 'gpgcheck=0'; \ echo 'gpgcheck=0'; \
echo 'enabled=1'; \ echo 'enabled=1'; \
} > /etc/yum.repos.d/pandorafms.repo } > /etc/yum.repos.d/pandorafms.repo
RUN yum -y update; yum clean all; # Pandora FMS dependencies.
RUN yum install -y epel-release vim wget bzip2 curl && \
RUN yum --disablerepo=updates install -y firefox yum install yum-utils && \
yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm && \
# Generic dependencies yum-config-manager --disable mysql80-community && \
RUN yum install -y \ yum-config-manager --enable mysql57-community && \
yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm && \
yum-config-manager --enable remi-php74 && \
yum install -y gtk3 python-pip \
python-pip \ python-pip \
xorg-x11-server-Xvfb; yum clean all; firefox \
RUN pip install pyvirtualdisplay xorg-x11-server-Xvfb \
RUN pip install 'selenium==2.53.0' x11vnc && \
RUN pip install unittest2 wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz && \
RUN pip install testtools tar xvzf geckodriver-v0.26.0-linux64.tar.gz && \
mv geckodriver /usr/bin/ && rm geckodriver-v0.26.0-linux64.tar.gz && \
# Pandora FMS Console dependencies pip install pyvirtualdisplay && \
RUN yum install -y \ pip install "selenium==3.141" && \
git \ pip install unittest2 && \
pip install testtools && \
yum install -y git \
httpd \ httpd \
cronie \ cronie \
ntp \ ntp \
openldap \ openldap \
nfdump \ nfdump \
wget \
curl \
openldap \ openldap \
plymouth \ plymouth \
xterm \ xterm \
php \ php \
php-gd \ php-gd \
graphviz \ graphviz \
php-mysql \ php-mysqlnd \
php-pear-DB \ php-pear-DB \
php-pear \ php-pear \
php-pdo \ php-pdo \
@ -73,16 +54,11 @@ RUN yum install -y \
nmap \ nmap \
xprobe2 \ xprobe2 \
mysql-server \ mysql-server \
mysql; yum clean all; mysql \
# Pandora FMS Server dependencies
RUN yum install -y \
ntp \ ntp \
vim \
htop \ htop \
nano \ nano \
postfix \ postfix \
wmic \
perl-HTML-Tree \ perl-HTML-Tree \
perl-DBI \ perl-DBI \
perl-DBD-mysql \ perl-DBD-mysql \
@ -95,6 +71,7 @@ RUN yum install -y \
net-tools \ net-tools \
perl-IO-Socket-INET6 \ perl-IO-Socket-INET6 \
perl-Socket6 \ perl-Socket6 \
perl-Sys-Syslog \
nmap \ nmap \
sudo \ sudo \
xprobe2 \ xprobe2 \
@ -111,20 +88,19 @@ RUN yum install -y \
freetype-devel \ freetype-devel \
fontconfig-devel \ fontconfig-devel \
libstdc++ \ libstdc++ \
perl-Test-Simple; yum clean all; gettext \
cpanminus && \
cpanm Geo::IP && \
mkdir -p /opt/phantomjs/bin && cd /opt/phantomjs/bin && \
wget https://netcologne.dl.sourceforge.net/project/pandora/Tools%20and%20dependencies%20%28All%20versions%29/DEB%20Debian%2C%20Ubuntu/phantomjs && \
chmod +x phantomjs && \
ln -s /opt/phantomjs/bin/phantomjs /usr/bin/ && \
yum update -y && \
echo -e '#!/bin/bash\nhttpd -k $1\n' > /etc/init.d/httpd && \
chmod +x /etc/init.d/httpd && \
yum clean all
RUN wget http://rpmfind.net/linux/centos/6.9/os/i386/Packages/gettext-0.17-18.el6.i686.rpm; \ ADD wmic /usr/bin/
yum localinstall -y gettext-0.17-18.el6.i686.rpm; \
rm -rf gettext-0.17-18.el6.i686.rpm; \
wget http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/perl-Geo-IP-1.38-1.el6.rf.x86_64.rpm; \
yum localinstall -y perl-Geo-IP-1.38-1.el6.rf.x86_64.rpm; \
rm -rf perl-Geo-IP-1.38-1.el6.rf.x86_64.rpm;
#Install phantomjs required for export graph pdf.
RUN mkdir -p /opt/phantomjs/bin && cd /opt/phantomjs/bin; \
wget https://netcologne.dl.sourceforge.net/project/pandora/Tools%20and%20dependencies%20%28All%20versions%29/DEB%20Debian%2C%20Ubuntu/phantomjs; \
chmod +x phantomjs; \
ln -s /opt/phantomjs/bin/phantomjs /usr/bin/;
# Install debugg dependencies. # Install debugg dependencies.
RUN yum install -y \ RUN yum install -y \
@ -133,6 +109,7 @@ RUN yum install -y \
gcc \ gcc \
gcc-c++ \ gcc-c++ \
autoconf \ autoconf \
file \
automake && \ automake && \
pecl install Xdebug && \ pecl install Xdebug && \
git clone https://github.com/tideways/php-xhprof-extension && \ git clone https://github.com/tideways/php-xhprof-extension && \
@ -142,7 +119,8 @@ RUN yum install -y \
make && \ make && \
make install && \ make install && \
cd .. && \ cd .. && \
rm -rf php-xhprof-extension rm -rf php-xhprof-extension && \
yum clean all
#Exposing ports for: HTTP, SNMP Traps, Tentacle protocol #Exposing ports for: HTTP, SNMP Traps, Tentacle protocol
EXPOSE 80 162/udp 41121 EXPOSE 80 162/udp 41121

View File

@ -10,7 +10,7 @@ if ('DISPLAY' not in os.environ):
display.start() display.start()
# Go to the installation page. # Go to the installation page.
browser = webdriver.Firefox() browser = webdriver.Firefox(timeout=15)
browser.implicitly_wait(5) browser.implicitly_wait(5)
browser.get('http://localhost/pandora_console/install.php') browser.get('http://localhost/pandora_console/install.php')
assert("Pandora FMS - Installation Wizard" in browser.title) assert("Pandora FMS - Installation Wizard" in browser.title)