From 9f977d263d0c4b2eaf6e4d0214ba944e49177c8c Mon Sep 17 00:00:00 2001 From: Toni de la Fuente Date: Wed, 7 Feb 2018 22:47:13 -0500 Subject: [PATCH] Fixed mktemp in OSX --- prowler | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/prowler b/prowler index 527d90d2..02e0e3e9 100755 --- a/prowler +++ b/prowler @@ -168,6 +168,7 @@ SCRIPT_START_TIME=$( date -u +"%Y-%m-%dT%H:%M:%S%z" ) # Functions to manage dates depending on OS if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == "linux-musl" ]; then + TEMP_REPORT_FILE=$(mktemp -t -p /tmp prowler.cred_report-XXXXXX) # function to compare in days, usage how_older_from_today date # date format %Y-%m-%d how_older_from_today() @@ -193,6 +194,7 @@ if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == "linux-musl" ]; then } elif [[ "$OSTYPE" == "darwin"* ]]; then # BSD/OSX commands compatibility + TEMP_REPORT_FILE=$(mktemp -t prowler.cred_report-XXXXXX) how_older_from_today() { DATE_TO_COMPARE=$1 @@ -570,7 +572,6 @@ genCredReport() { # Save report to a file, decode it, deletion at finish and after every single check saveReport(){ - TEMP_REPORT_FILE=$(mktemp -t -p /tmp prowler-${ACCOUNT_NUM}.cred_report-XXXXXX) $AWSCLI iam get-credential-report --query 'Content' --output text $PROFILE_OPT --region $REGION | decode_report > $TEMP_REPORT_FILE if [[ $KEEPCREDREPORT -eq 1 ]]; then textTitle "0.2" "Saving IAM Credential Report ..." "NOT_SCORED" "SUPPORT" @@ -581,6 +582,7 @@ saveReport(){ # Delete temporary report file cleanTemp(){ if [[ $KEEPCREDREPORT -ne 1 ]]; then + cd /tmp rm -fr $TEMP_REPORT_FILE fi }