From 5be38a15d9a42c33f0061b1f313de2ea28593d50 Mon Sep 17 00:00:00 2001 From: Toni de la Fuente Date: Thu, 17 Dec 2020 10:24:25 +0100 Subject: [PATCH 1/3] Update os_detector bsd_convert_date_to_timestamp --- include/os_detector | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/os_detector b/include/os_detector index a99ad45f..db3462ef 100644 --- a/include/os_detector +++ b/include/os_detector @@ -113,7 +113,7 @@ gnu_convert_date_to_timestamp() { } bsd_convert_date_to_timestamp() { - date -j -f "%Y-%m-%dT%H:%M:%SZ" "$1" "+%s" + date -j -f "%Y-%m-%dT%H:%M:%S" "$1" "+%s" } gnu_test_tcp_connectivity() { From 5c620949f04a4ba449952499793ce13f0a5c5bc3 Mon Sep 17 00:00:00 2001 From: Toni de la Fuente Date: Thu, 17 Dec 2020 15:20:20 +0100 Subject: [PATCH 2/3] Update os_detector Change above is because epoch time generator in BSD is 1h less than in Linux --- include/os_detector | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/os_detector b/include/os_detector index db3462ef..f30de3a5 100644 --- a/include/os_detector +++ b/include/os_detector @@ -113,7 +113,9 @@ gnu_convert_date_to_timestamp() { } bsd_convert_date_to_timestamp() { - date -j -f "%Y-%m-%dT%H:%M:%S" "$1" "+%s" + echo $(( $(date -j -f %Y-%m-%dT%H:%M:%S "$1" +%s) + 3600 )) + # Change above is because epoch time generator in BSD is 1h less than in Linux ¯\_(ツ)_/¯ + #date -j -f "%Y-%m-%dT%H:%M:%S" "$1" "+%s" } gnu_test_tcp_connectivity() { From 8c19583ac70d6cb78f7b2f3f2280a20f8dad703e Mon Sep 17 00:00:00 2001 From: Toni de la Fuente Date: Thu, 17 Dec 2020 15:21:50 +0100 Subject: [PATCH 3/3] Update prowler Adapted execute_check to renew creds --- prowler | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prowler b/prowler index d6a3aa59..99e1fa5b 100755 --- a/prowler +++ b/prowler @@ -321,10 +321,10 @@ show_group_title() { # Function to execute the check execute_check() { if [[ $ACCOUNT_TO_ASSUME ]]; then - MINIMUM_REMAINING_TIME_ALLOWED=$(( SESSION_DURATION_TO_ASSUME / 10 )) + MINIMUM_REMAINING_TIME_ALLOWED=$(($SESSION_DURATION_TO_ASSUME / 10 )) CURRENT_TIMESTAMP=$(date -u "+%s") - SESSION_CUTOFF=$(( CURRENT_TIMESTAMP + MINIMUM_REMAINING_TIME_ALLOWED )) - if (( AWS_SESSION_EXPIRATION < SESSION_CUTOFF )); then + SESSION_CUTOFF=$(($CURRENT_TIMESTAMP + $MINIMUM_REMAINING_TIME_ALLOWED)) + if [[ $AWS_SESSION_EXPIRATION < $SESSION_CUTOFF ]]; then unset AWS_ACCESS_KEY_ID unset AWS_SECRET_ACCESS_KEY unset AWS_SESSION_TOKEN