mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-16 00:14:23 +00:00
Fix assume-role: check if -T and -A options are set together @jfagoagas
Fix assume-role: check if `-T` and `-A` options are set together @jfagoagas
This commit is contained in:
2 files changed
+5
-5
No files matched your search
+3
-3
@@ -11,9 +11,9 @@
|
||||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations under the License.
|
||||
|
||||
# both variables are mandatory to be set together
|
||||
assume_role(){
|
||||
if [[ -z $ROLE_TO_ASSUME ]]; then
|
||||
# Both variables are mandatory to be set togethe
|
||||
if [[ -z $ROLE_TO_ASSUME || -z $ACCOUNT_TO_ASSUME ]]; then
|
||||
echo "$OPTRED ERROR!$OPTNORMAL - Both Account ID (-A) and IAM Role to assume (-R) must be set"
|
||||
exit 1
|
||||
fi
|
||||
@@ -89,4 +89,4 @@ assume_role(){
|
||||
|
||||
cleanSTSAssumeFile() {
|
||||
rm -fr "${TEMP_STS_ASSUMED_FILE}"
|
||||
}
|
||||
}
|
||||
@@ -392,7 +392,7 @@ show_group_title() {
|
||||
# Function to execute the check
|
||||
execute_check() {
|
||||
|
||||
if [[ $ACCOUNT_TO_ASSUME ]]; then
|
||||
if [[ -n "${ACCOUNT_TO_ASSUME}" || -n "${ROLE_TO_ASSUME}" ]]; then
|
||||
# Following logic looks for time remaining in the session and review it
|
||||
# if it is less than 600 seconds, 10 minutes.
|
||||
CURRENT_TIMESTAMP=$(date -u "+%s")
|
||||
@@ -639,7 +639,7 @@ fi
|
||||
|
||||
# Gather account data / test aws cli connectivity
|
||||
getWhoami
|
||||
if [[ $ACCOUNT_TO_ASSUME ]]; then
|
||||
if [[ -n "${ACCOUNT_TO_ASSUME}" || -n "${ROLE_TO_ASSUME}" ]]; then
|
||||
assume_role
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user