mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 07:15:15 +00:00
40 lines
2.0 KiB
Bash
40 lines
2.0 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_extra74="7.4"
|
|
CHECK_TITLE_extra74="[extra74] Ensure there are no Security Groups without ingress filtering being used (Not Scored) (Not part of CIS benchmark)"
|
|
CHECK_SCORED_extra74="NOT_SCORED"
|
|
CHECK_TYPE_extra74="EXTRA"
|
|
CHECK_SEVERITY_extra74="High"
|
|
CHECK_ASFF_RESOURCE_TYPE_extra74="AwsEc2SecurityGroup"
|
|
CHECK_ALTERNATE_extra704="extra74"
|
|
CHECK_ALTERNATE_check74="extra74"
|
|
CHECK_ALTERNATE_check704="extra74"
|
|
CHECK_ASFF_COMPLIANCE_TYPE_extra74="ens-mp.com.4.aws.sg.2"
|
|
CHECK_SERVICENAME_extra74="ec2"
|
|
|
|
extra74(){
|
|
# "Ensure there are no Security Groups without ingress filtering being used (Not Scored) (Not part of CIS benchmark)"
|
|
textInfo "Looking for Security Groups in all regions... "
|
|
for regx in $REGIONS; do
|
|
LIST_OF_SECURITYGROUPS=$($AWSCLI ec2 describe-security-groups $PROFILE_OPT --region $regx --filters "Name=ip-permission.cidr,Values=0.0.0.0/0" --query "SecurityGroups[].[GroupId]" --output text --max-items $MAXITEMS)
|
|
for SG_ID in $LIST_OF_SECURITYGROUPS; do
|
|
SG_NO_INGRESS_FILTER=$($AWSCLI ec2 describe-network-interfaces $PROFILE_OPT --region $regx --filters "Name=group-id,Values=$SG_ID" --query "length(NetworkInterfaces)" --output text)
|
|
if [[ $SG_NO_INGRESS_FILTER -ne 0 ]];then
|
|
textFail "$regx: $SG_ID has no ingress filtering and it is being used!" "$regx"
|
|
else
|
|
textInfo "$regx: $SG_ID has no ingress filtering but it is not being used" "$regx"
|
|
fi
|
|
done
|
|
done
|
|
}
|