Merge branch '104-group-security' into 'develop'

104 group security

Parte open de la seguridad de grupos.

See merge request !2
This commit is contained in:
nramon 2016-11-25 12:53:35 +01:00
commit 44f60994aa
3 changed files with 18 additions and 1 deletions

View File

@ -135,6 +135,7 @@ my %DefaultConf = (
'agent_name_cmd' => '',
'description' => '',
'group' => '',
'group_password' => undef,
'encoding' => 'UTF-8',
'server_port' => 41121,
'transfer_mode' => 'tentacle',
@ -2419,7 +2420,8 @@ while (1) {
# Compose the XML
my $xml_header = "<?xml version='1.0' encoding='" . $Conf{'encoding'} . "'?>\n" .
"<agent_data description='" . $Conf{'description'} ."' group='" . $Conf{'group'} .
"<agent_data description='" . $Conf{'description'} . "' group='" . $Conf{'group'} .
(defined($Conf{'group_password'}) ? ("' group_password='" . $Conf{'group_password'}) : '') .
"' os_name='$OS' os_version='$OS_VERSION' interval='" . $Conf{'interval'} .
"' version='" . AGENT_VERSION . '(Build ' . AGENT_BUILD . ')' . ($Conf{'autotime'} eq '1' ? '' : "' timestamp='" . strftime ('%Y/%m/%d %H:%M:%S', localtime ())) .
"' agent_name='" . $Conf{'agent_name'} . "' timezone_offset='". $Conf{'timezone_offset'} .

View File

@ -385,6 +385,7 @@ Pandora_Windows_Service::getXmlHeader () {
char timestamp[20];
string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd;
string custom_id, url_address, latitude, longitude, altitude, position_description, gis_exec, gis_result, agent_mode;
string group_password;
time_t ctime;
struct tm *ctime_tm = NULL;
int pos;
@ -478,6 +479,13 @@ Pandora_Windows_Service::getXmlHeader () {
xml += url_address;
}
// Get Url Address
group_password = conf->getValue ("group_password");
if (group_password != "") {
xml += "\" group_password=\"";
xml += group_password;
}
// Get Coordinates
gis_exec = conf->getValue ("gis_exec");

View File

@ -358,6 +358,13 @@ sub process_xml_data ($$$$$) {
}
}
# Check the group password.
my $rc = enterprise_hook('check_group_password', [$dbh, $group_id, $data->{'group_password'}]);
if (defined($rc) && $rc != 1) {
logger($pa_config, "Agent $agent_name did not send a valid password for group id $group_id.", 10);
return;
}
my $description = '';
$description = $data->{'description'} if (defined ($data->{'description'}));