mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 07:15:15 +00:00
48 lines
2.1 KiB
Bash
48 lines
2.1 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_extra795="7.95"
|
|
CHECK_TITLE_extra795="[extra795] Ensure EKS Clusters are created with Private Endpoint Enabled and Public Access Disabled"
|
|
CHECK_SCORED_extra795="NOT_SCORED"
|
|
CHECK_TYPE_extra795="EXTRA"
|
|
CHECK_ASFF_RESOURCE_TYPE_extra795="AwsEksCluster"
|
|
CHECK_ALTERNATE_check795="extra795"
|
|
|
|
extra795(){
|
|
textInfo "Looking for public access enabled for EKS clusters across all regions... "
|
|
for regx in $REGIONS; do
|
|
# Get a list of EKS clusters (Unless us-west-1 which doesn't support EKS):
|
|
if [[ $regx == "us-west-1" ]]; then
|
|
textInfo "$regx: EKS not supported in this region" "$regx"
|
|
else
|
|
CLUSTERS=$($AWSCLI eks list-clusters $PROFILE_OPT --region $regx --query 'clusters[]' --output text)
|
|
fi
|
|
if [[ $CLUSTERS ]]; then
|
|
for CLUSTER in $CLUSTERS;do
|
|
CLUSTERDEF=$($AWSCLI eks describe-cluster $PROFILE_OPT --region $regx --name $CLUSTER --query 'cluster.resourcesVpcConfig')
|
|
PUB_ENABLED=$(echo $CLUSTERDEF | jq -r '.endpointPublicAccess')
|
|
PRIV_ENABLED=$(echo $CLUSTERDEF | jq -r '.endpointPrivateAccess')
|
|
|
|
if [[ $PUB_ENABLED == "false" ]] && [[ $PRIV_ENABLED == "true" ]] ; then
|
|
textPass "$regx: Cluster endpoint access is private for EKS cluster $CLUSTER" "$regx"
|
|
else
|
|
textFail "$regx: Cluster endpoint access is public for EKS cluster $CLUSTER" "$regx"
|
|
fi
|
|
done
|
|
else
|
|
if [[ $regx != "us-west-1" ]]; then
|
|
textInfo "$regx: No EKS clusters found" "$regx"
|
|
fi
|
|
fi
|
|
done
|
|
}
|