Files
prowler/checks/check_extra739
Morey Straus 8935233a05 Update check_extra739
typo correction
2018-12-14 14:32:38 -08:00

36 lines
1.6 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_extra739="7.39"
CHECK_TITLE_extra739="[extra739] Check if ELBs have logging enabled (Not Scored) (Not part of CIS benchmark)"
CHECK_SCORED_extra739="NOT_SCORED"
CHECK_TYPE_extra739="EXTRA"
CHECK_ALTERNATE_check739="extra739"
extra739(){
for regx in $REGIONS; do
LIST_OF_ELB=$($AWSCLI elb describe-load-balancers --region $regx $PROFILE_OPT --query LoadBalancerDescriptions[*].LoadBalancerName --output text)
if [[ $LIST_OF_ELB ]];then
for elb_id in $LIST_OF_ELB; do
CHECK_LOG_STATUS=$($AWSCLI elb describe-load-balancer-attributes --region $regx $PROFILE_OPT --load-balancer-name $elb_id --query LoadBalancerAttributes.AccessLog.Enabled --output text|grep False)
if [[ $CHECK_LOG_STATUS ]]; then
textFail "$regx: ELB $elb_id has logging disabled!" "$regx"
else
textPass "$regx: ELB $elb_id has logging enabled" "$regx"
fi
done
else
textInfo "$regx: No ELBs found" "$regx"
fi
done
}