mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 06:45:08 +00:00
48 lines
2.3 KiB
Bash
48 lines
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Prowler - the handy cloud security tool (copyright 2018) 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_extra7158="7.158"
|
|
CHECK_TITLE_extra7158="[extra7158] Check if ELBV2 has listeners underneath"
|
|
CHECK_SCORED_extra7158="NOT_SCORED"
|
|
CHECK_CIS_LEVEL_extra7158="EXTRA"
|
|
CHECK_SEVERITY_extra7158="Medium"
|
|
CHECK_ASFF_RESOURCE_TYPE_extra7158="AwsElbv2LoadBalancer"
|
|
CHECK_ALTERNATE_check7158="extra7158"
|
|
CHECK_SERVICENAME_extra7158="elb"
|
|
CHECK_RISK_extra7158='The rules that are defined for a listener determine how the load balancer routes requests to its registered targets.'
|
|
CHECK_REMEDIATION_extra7158='Add listeners to Elastic Load Balancers V2.'
|
|
CHECK_DOC_extra7158='https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-listener-config.html'
|
|
CHECK_CAF_EPIC_extra7158='Data Protection'
|
|
|
|
extra7158(){
|
|
for regx in $REGIONS; do
|
|
LIST_OF_ELBSV2=$($AWSCLI elbv2 describe-load-balancers --query 'LoadBalancers[*].LoadBalancerArn' $PROFILE_OPT --region $regx --output text 2>&1)
|
|
if [[ $(echo "$LIST_OF_ELBSV2" | grep -E 'AccessDenied|UnauthorizedOperation|AuthorizationError') ]]; then
|
|
textInfo "$regx: Access Denied trying to describe load balancers" "$regx"
|
|
continue
|
|
fi
|
|
if [[ $LIST_OF_ELBSV2 ]]; then
|
|
for elb in $LIST_OF_ELBSV2; do
|
|
LIST_OF_LISTENERS=$($AWSCLI elbv2 describe-listeners $PROFILE_OPT --region $regx --load-balancer-arn $elb --query 'Listeners[*]' --output text)
|
|
ELBV2_NAME=$(echo $elb|cut -d\/ -f3)
|
|
if [[ $LIST_OF_LISTENERS ]]; then
|
|
textPass "$regx: $ELBV2_NAME has listeners underneath" "$regx" "$elb"
|
|
else
|
|
textFail "$regx: $ELBV2_NAME has no listeners underneath" "$regx" "$elb"
|
|
fi
|
|
done
|
|
else
|
|
textInfo "$regx: No ELBs found" "$regx"
|
|
fi
|
|
done
|
|
}
|