mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 23:05:05 +00:00
Added a third parameter to checks textFail and textPass to identify resource name in finding.
51 lines
3.0 KiB
Bash
51 lines
3.0 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Prowler - the handy cloud security tool (copyright 2019) by Toni de la Fuente
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
# use this file except in compliance with the License. You may obtain a copy
|
|
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software distributed
|
|
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations under the License.
|
|
|
|
CHECK_ID_extra769="7.69"
|
|
CHECK_TITLE_extra769="[extra769] Check if IAM Access Analyzer is enabled and its findings (Not Scored) (Not part of CIS benchmark)"
|
|
CHECK_SCORED_extra769="NOT_SCORED"
|
|
CHECK_TYPE_extra769="EXTRA"
|
|
CHECK_SEVERITY_extra769="High"
|
|
CHECK_ALTERNATE_check769="extra769"
|
|
CHECK_SERVICENAME_extra769="accessanalyzer"
|
|
CHECK_RISK_extra769='AWS IAM Access Analyzer helps you identify the resources in your organization and accounts; such as Amazon S3 buckets or IAM roles; that are shared with an external entity. This lets you identify unintended access to your resources and data; which is a security risk. IAM Access Analyzer uses a form of mathematical analysis called automated reasoning; which applies logic and mathematical inference to determine all possible access paths allowed by a resource policy.'
|
|
CHECK_REMEDIATION_extra769='Enable IAM Access Analyzer for all accounts; create analyzer and take action over it is recommendations (IAM Access Analyzer is available at no additional cost).'
|
|
CHECK_DOC_extra769='https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html'
|
|
CHECK_CAF_EPIC_extra769='IAM'
|
|
|
|
extra769(){
|
|
for regx in $REGIONS; do
|
|
LIST_OF_ACCESS_ANALYZERS=$($AWSCLI accessanalyzer list-analyzers $PROFILE_OPT --region $regx --query analyzers[*].arn --output text 2>&1)
|
|
if [[ $(echo "$LIST_OF_ACCESS_ANALYZERS" | grep -i "argument command: Invalid choice") ]]; then
|
|
textInfo "$regx: list-analyzers not supported, newer awscli needed" "$regx"
|
|
continue
|
|
fi
|
|
if [[ $(echo "$LIST_OF_ACCESS_ANALYZERS" | grep -i "AccessDeniedException") ]]; then
|
|
textFail "$regx: Access Denied trying to list-analyzers" "$regx"
|
|
continue
|
|
fi
|
|
if [[ $LIST_OF_ACCESS_ANALYZERS ]]; then
|
|
for accessAnalyzerArn in $LIST_OF_ACCESS_ANALYZERS;do
|
|
ANALYZER_ACTIVE_FINDINGS_COUNT=$($AWSCLI accessanalyzer list-findings $PROFILE_OPT --region $regx --analyzer-arn $accessAnalyzerArn --query 'findings[?status == `ACTIVE`].[id,status]' --output text | wc -l | tr -d ' ')
|
|
if [[ $ANALYZER_ACTIVE_FINDINGS_COUNT -eq 0 ]];then
|
|
textPass "$regx: IAM Access Analyzer $accessAnalyzerArn has no active findings" "$regx" "$accessAnalyzerArn"
|
|
else
|
|
textInfo "$regx: IAM Access Analyzer $accessAnalyzerArn has $ANALYZER_ACTIVE_FINDINGS_COUNT active findings" "$regx"
|
|
fi
|
|
done
|
|
else
|
|
textInfo "$regx: No IAM Access Analyzers found" "$regx"
|
|
fi
|
|
done
|
|
}
|