From ef26086330d67eb82512f8368d696639da6e7dec Mon Sep 17 00:00:00 2001 From: Nimrod Kor Date: Sat, 16 Nov 2019 20:46:30 -0800 Subject: [PATCH] Update dockerfile and scripts --- Dockerfile | 8 +++++--- credentials.py | 4 ++-- run.sh | 12 +++--------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 335937224f..cc2ac80e0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ FROM python MAINTAINER Bridgecrew -RUN apt-get update && apt-get upgrade -y && apt-get install jq -y && pip install awscli detect-secrets +RUN apt-get update && apt-get upgrade -y && apt-get install jq -y && pip install awscli detect-secrets boto3 -RUN curl -sL https://github.com/bridgecrewio/prowler/archive/master.tar.gz | tar xz +RUN curl -sL https://github.com/bridgecrewio/prowler/archive/feature/dockerized_prowler.tar.gz | tar xz -RUN run.sh +WORKDIR "./prowler-feature-dockerized_prowler" + +ENTRYPOINT ["./run.sh"] diff --git a/credentials.py b/credentials.py index 3f1fd9f46c..e6233e8614 100644 --- a/credentials.py +++ b/credentials.py @@ -22,5 +22,5 @@ print('Got account details, assuming role') temporary_creds = sts.assume_role(RoleArn=account_details['cross_account_role_arn'], ExternalId=account_details['external_id'], RoleSessionName='prowler')['Credentials'] -os.environ['AWS_ACCESS_KEY_ID2'] = temporary_creds['AccessKeyId'] -os.environ['AWS_SECRET_ACCESS_KEY2'] = temporary_creds['SecretAccessKey'] +os.environ['AWS_ACCESS_KEY_ID'] = temporary_creds['AccessKeyId'] +os.environ['AWS_SECRET_ACCESS_KEY'] = temporary_creds['SecretAccessKey'] diff --git a/run.sh b/run.sh index e24c258248..b0d8f699ae 100755 --- a/run.sh +++ b/run.sh @@ -1,14 +1,8 @@ #!/bin/bash -AccountId=$1 -Alias=$2 -echo $AWS_ACCESS_KEY_ID -python3 credentials.py $AccountId +python3 credentials.py $ACCOUNT_ID -echo $AWS_ACCESS_KEY_ID -echo $AWS_ACCESS_KEY_ID2 -echo "Running prowler on $Alias" +echo "Running prowler on $ALIAS" ./prowler -c extra741 -M json > output.json -unset AWS_ACCESS_KEY_ID -echo $AWS_ACCESS_KEY_ID +aws s3api put-object --bucket $BUCKET --key prowler/$ACCOUNT_ID/results \ No newline at end of file