#!/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. # Remediation: # # https://docs.aws.amazon.com/cli/latest/reference/route53domains/enable-domain-transfer-lock.html # # enable-domain-transfer-lock \ # --domain-name example.com CHECK_ID_extra7153="7.153" CHECK_TITLE_extra7153="[extra7153] Enable Transfer Lock for a Route53 Domain (us-east-1 only)" CHECK_SCORED_extra7153="NOT_SCORED" CHECK_CIS_LEVEL_extra7153="EXTRA" CHECK_SEVERITY_extra7153="Medium" CHECK_ASFF_RESOURCE_TYPE_extra7153="AwsRoute53Domain" CHECK_ALTERNATE_check7153="extra7153" CHECK_SERVICENAME_extra7153="route53" CHECK_RISK_extra7153='Without transfer lock enabled; a domain name could be incorrectly moved to a new registrar' CHECK_REMEDIATION_extra7153='Ensure transfer lock is enabled' CHECK_DOC_extra7153='https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-lock.html' CHECK_CAF_EPIC_extra7153='Data Protection' extra7153(){ # Route53 is a global service, looking for domains in US-EAST-1 # this is also valid for GovCloud https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/setting-up-route53.html DOMAIN_NAMES=$($AWSCLI route53domains list-domains $PROFILE_OPT --region us-east-1 --query 'Domains[*].DomainName' --output text ) if [[ $DOMAIN_NAMES ]];then for domain_name in $DOMAIN_NAMES;do DOMAIN_DETAIL=$($AWSCLI route53domains get-domain-detail $PROFILE_OPT --region us-east-1 --query 'StatusList' --domain-name $domain_name) HAS_TRANSFER_LOCK=$( grep -o 'clientTransferProhibited' <<< $DOMAIN_DETAIL) if [[ $HAS_TRANSFER_LOCK ]]; then textPass "us-east-1: clientTransferProhibited found for: $domain_name" "us-east-1" "$domain_name" else textFail "us-east-1: clientTransferProhibited not found for: $domain_name" "us-east-1" "$domain_name" fi done else textInfo "us-east-1: No Domain Names found" "us-east-1" fi }