mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-13 15:04:19 +00:00
Merge branch 'master' into merge_from_tony
# Conflicts: # checks/check_extra716 # checks/check_extra764
This commit is contained in:
commit
80d0e4b3b3
6 files changed
+11
-5
No files matched your search
@@ -16,3 +16,8 @@ Sessionx.vim
|
||||
tags
|
||||
# Persistent undo
|
||||
[._]*.un~
|
||||
|
||||
# Development
|
||||
.idea
|
||||
secrets-*
|
||||
|
||||
@@ -18,6 +18,7 @@ check26(){
|
||||
# "Ensure S3 bucket access logging is enabled on the CloudTrail S3 bucket (Scored)"
|
||||
|
||||
CLOUDTRAILS=$($AWSCLI cloudtrail describe-trails $PROFILE_OPT --region "$REGION" --query 'trailList[*].Name' --output text| tr '\011' '\012' | awk -F: '{print $1}')
|
||||
ACCOUNT_ID=$($AWSCLI sts get-caller-identity --output json $PROFILE_OPT --region $REGION --query "Account" | tr -d '"')
|
||||
|
||||
if [[ $CLOUDTRAILS ]]; then
|
||||
for trail in $CLOUDTRAILS; do
|
||||
|
||||
@@ -18,7 +18,7 @@ CHECK_ALTERNATE_check748="extra748"
|
||||
|
||||
extra748(){
|
||||
for regx in $REGIONS; do
|
||||
SG_LIST=$($AWSCLI ec2 describe-security-groups --query 'SecurityGroups[?length(IpPermissions[?((FromPort==null && ToPort==null) || (FromPort==null && ToPort==null)) && (contains(IpRanges[].CidrIp, `0.0.0.0/0`) || contains(Ipv6Ranges[].CidrIpv6, `::/0`))]) > `0`].{GroupId:GroupId}' $PROFILE_OPT --region $regx --output text)
|
||||
SG_LIST=$($AWSCLI ec2 describe-security-groups --query 'SecurityGroups[?length(IpPermissions[?((FromPort==null && ToPort==null) || (FromPort==`0` && ToPort==`65535`)) && (contains(IpRanges[].CidrIp, `0.0.0.0/0`) || contains(Ipv6Ranges[].CidrIpv6, `::/0`))]) > `0`].{GroupId:GroupId}' $PROFILE_OPT --region $regx --output text)
|
||||
if [[ $SG_LIST ]];then
|
||||
for SG in $SG_LIST;do
|
||||
textFail "$regx: Found Security Group: $SG open to 0.0.0.0/0" "$regx"
|
||||
|
||||
@@ -28,7 +28,7 @@ extra763(){
|
||||
fi
|
||||
if [[ $(echo "$BUCKET_VERSIONING_ENABLED" | grep "^Enabled$") ]]; then
|
||||
textPass "Bucket $bucket has versioning enabled"
|
||||
else
|
||||
else
|
||||
textFail "Bucket $bucket has versioning disabled!"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -36,7 +36,7 @@ extra764(){
|
||||
fi
|
||||
|
||||
# https://aws.amazon.com/premiumsupport/knowledge-center/s3-bucket-policy-for-config-rule/
|
||||
CHECK_BUCKET_STP_POLICY_PRESENT=$(cat $TEMP_STP_POLICY_FILE | jq --arg arn "arn:aws:s3:::${bucket}" '.Statement[]|select(((.Principal|type == "string") and .Principal == "*") and .Action=="s3:*" and (.Resource|type == "array") and (.Resource|map({(.):0})[]|has($arn)) and (.Resource|map({(.):0})[]|has($arn+"/*")) and .Condition.Bool."aws:SecureTransport" == "false")')
|
||||
CHECK_BUCKET_STP_POLICY_PRESENT=$(cat $TEMP_STP_POLICY_FILE | jq --arg arn "arn:aws:s3:::${bucket}" '.Statement[]|select((((.Principal|type == "object") and .Principal.AWS == "*") or ((.Principal|type == "string") and .Principal == "*")) and .Action=="s3:*" and (.Resource|type == "array") and (.Resource|map({(.):0})[]|has($arn)) and (.Resource|map({(.):0})[]|has($arn+"/*")) and .Condition.Bool."aws:SecureTransport" == "false")')
|
||||
if [[ $CHECK_BUCKET_STP_POLICY_PRESENT ]]; then
|
||||
textPass "Bucket $bucket has S3 bucket policy to deny requests over insecure transport"
|
||||
else
|
||||
|
||||
@@ -33,8 +33,8 @@ extra768(){
|
||||
TASK_DEFINITION_ENV_VARIABLES_FILE="$SECRETS_TEMP_FOLDER/extra768-$TASK_DEFINITION-$regx-variables.txt"
|
||||
TASK_DEFINITION_ENV_VARIABLES=$($AWSCLI ecs $PROFILE_OPT --region $regx describe-task-definition --task-definition $taskDefinition --query 'taskDefinition.containerDefinitions[*].environment' --output text > $TASK_DEFINITION_ENV_VARIABLES_FILE)
|
||||
if [ -s $TASK_DEFINITION_ENV_VARIABLES_FILE ];then
|
||||
# Implementation using https://github.com/Yelp/detect-secrets
|
||||
FINDINGS=$(secretsDetector file $TASK_DEFINITION_ENV_VARIABLES_FILE)
|
||||
# Implementation using https://github.com/Yelp/detect-secrets
|
||||
FINDINGS=$(secretsDetector file $TASK_DEFINITION_ENV_VARIABLES_FILE)
|
||||
if [[ $FINDINGS -eq 0 ]]; then
|
||||
textPass "$regx: No secrets found in ECS task definition $TASK_DEFINITION variables" "$regx"
|
||||
# delete file if nothing interesting is there
|
||||
|
||||
Reference in new issue
Block a user