mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
change name of temp file so that it's random
Allows multiple instances of prowler to run in parallel (eg. via xargs -P ). Also, add trap handler to remove temp file if interrupted.
This commit is contained in:
5
prowler
5
prowler
@@ -362,7 +362,7 @@ genCredReport() {
|
||||
|
||||
# Save report to a file, decode it, deletion at finish and after every single check, acb stands for AWS CIS Benchmark
|
||||
saveReport(){
|
||||
TEMP_REPORT_FILE=/tmp/.acb
|
||||
TEMP_REPORT_FILE=$(mktemp -t prowler-XXXXX.cred_report )
|
||||
$AWSCLI iam get-credential-report --query 'Content' --output text --profile $PROFILE --region $REGION | decode_report > $TEMP_REPORT_FILE
|
||||
}
|
||||
|
||||
@@ -371,6 +371,9 @@ cleanTemp(){
|
||||
rm -fr $TEMP_REPORT_FILE
|
||||
}
|
||||
|
||||
# Delete the temporary report file if we get interrupted/terminated
|
||||
trap cleanTemp SIGHUP SIGINT SIGTERM
|
||||
|
||||
# Get a list of all available AWS Regions
|
||||
REGIONS=$($AWSCLI ec2 describe-regions --query 'Regions[].RegionName' \
|
||||
--output text \
|
||||
|
||||
Reference in New Issue
Block a user