Add configuration options for vulnerability scans.

This commit is contained in:
Ramon Novoa 2023-10-26 18:50:27 +02:00
parent 23a55a9f66
commit 1fbba70eb1
2 changed files with 10 additions and 3 deletions

View File

@ -206,6 +206,9 @@ sub pandora_get_sharedconfig ($$) {
# Server identifier
$pa_config->{'server_unique_identifier'} = pandora_get_tconfig_token ($dbh, 'server_unique_identifier', '');
# Vulnerability scans
$pa_config->{'agent_vulnerabilities'} = pandora_get_tconfig_token ($dbh, 'agent_vulnerabilities', 0);
}
##########################################################################

View File

@ -8010,9 +8010,13 @@ sub process_inventory_module_data ($$$$$$$$) {
}
# Vulnerability scan.
my $vulnerability_data = enterprise_hook('process_inventory_vulnerabilities', [$pa_config, $agent->{'os_version'}, $data, $inventory_module, $dbh]);
if (defined($vulnerability_data) && $vulnerability_data ne '') {
process_inventory_module_data ($pa_config, $vulnerability_data, $server_id, $agent_name, 'Vulnerabilities', $interval, $timestamp, $dbh);
if (($pa_config->{'agent_vulnerabilities'} == 0 && $agent->{'vul_scan_enabled'} == 1) ||
($pa_config->{'agent_vulnerabilities'} == 1 && $agent->{'vul_scan_enabled'} == 1) ||
($pa_config->{'agent_vulnerabilities'} == 1 && $agent->{'vul_scan_enabled'} == 2)) {
my $vulnerability_data = enterprise_hook('process_inventory_vulnerabilities', [$pa_config, $agent->{'os_version'}, $data, $inventory_module, $dbh]);
if (defined($vulnerability_data) && $vulnerability_data ne '') {
process_inventory_module_data ($pa_config, $vulnerability_data, $server_id, $agent_name, 'Vulnerabilities', $interval, $timestamp, $dbh);
}
}
}