minor fix

Former-commit-id: 4222b217953e88da43d0f50d3217a065dbb13332
This commit is contained in:
fbsanchez 2019-04-12 23:47:21 +02:00
parent 45c9f6d51c
commit 8bdc980ab0
2 changed files with 7 additions and 6 deletions

View File

@ -202,15 +202,15 @@ sub data_consumer ($$) {
|| $cnf_extra{'cloud_util_path'} ne $ENV{'AWS_SECRET_ACCESS_KEY'}) { || $cnf_extra{'cloud_util_path'} ne $ENV{'AWS_SECRET_ACCESS_KEY'}) {
# Environmental data is out of date. Create a tmp file to manage # Environmental data is out of date. Create a tmp file to manage
# credentials. Perl limitation. We cannot update ENV here. # credentials. Perl limitation. We cannot update ENV here.
$cnf_extra{'cred_file'} = $pa_config->{'temporal'} . '/tmp_discovery.' . md5($task->{'id_rt'} . $task->{'name'} . time()); $cnf_extra{'creds_file'} = $pa_config->{'temporal'} . '/tmp_discovery.' . md5($task->{'id_rt'} . $task->{'name'} . time());
eval { eval {
open(my $__file_cfg, '> '. $cnf_extra{'cred_file'}) or die($!); open(my $__file_cfg, '> '. $cnf_extra{'creds_file'}) or die($!);
print $__file_cfg $cnf_extra{'aws_access_key_id'} . "\n"; print $__file_cfg $cnf_extra{'aws_access_key_id'} . "\n";
print $__file_cfg $cnf_extra{'aws_secret_access_key'} . "\n"; print $__file_cfg $cnf_extra{'aws_secret_access_key'} . "\n";
close($__file_cfg); close($__file_cfg);
set_file_permissions( set_file_permissions(
$pa_config, $pa_config,
$cnf_extra{'cred_file'}, $cnf_extra{'creds_file'},
"0600" "0600"
); );
}; };
@ -270,9 +270,9 @@ sub data_consumer ($$) {
$recon->scan(); $recon->scan();
# Clean tmp file. # Clean tmp file.
if (defined($cnf_extra{'cred_file'}) if (defined($cnf_extra{'creds_file'})
&& -f $cnf_extra{'cred_file'}) { && -f $cnf_extra{'creds_file'}) {
unlink($cnf_extra{'cred_file'}); unlink($cnf_extra{'creds_file'});
} }
}; };
if ($@) { if ($@) {

View File

@ -1456,6 +1456,7 @@ sub cloud_scan($) {
aws_access_key_id => $self->{'aws_access_key_id'}, aws_access_key_id => $self->{'aws_access_key_id'},
aws_secret_access_key => $self->{'aws_secret_access_key'}, aws_secret_access_key => $self->{'aws_secret_access_key'},
cloud_util_path => $self->{'cloud_util_path'}, cloud_util_path => $self->{'cloud_util_path'},
creds_file => $self->{'creds_file'},
parent => $self parent => $self
] ]