Created
May 21, 2020 20:05
-
-
Save jonjozwiak/727dff6413e1da6dc16e96fc0742c9bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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_extra786="7.86" | |
| CHECK_TITLE_extra786="[extra786] Check if CloudFront distributions are using deprecated SSL protocols" | |
| CHECK_SCORED_extra786="NOT_SCORED" | |
| CHECK_TYPE_extra786="EXTRA" | |
| CHECK_ALTERNATE_check786="extra786" | |
| extra786(){ | |
| LIST_OF_DISTRIBUTIONS=$($AWSCLI cloudfront list-distributions --query 'DistributionList.Items[*].Id' $PROFILE_OPT --output text|grep -v ^None) | |
| if [[ $LIST_OF_DISTRIBUTIONS ]];then | |
| for dist in $LIST_OF_DISTRIBUTIONS; do | |
| CHECK_ORIGINSSLPROTOCOL_STATUS=$($AWSCLI cloudfront get-distribution --id $dist --query Distribution.DistributionConfig.Origins.Items[].CustomOriginConfig.OriginSslProtocols.Items $PROFILE_OPT --output text) | |
| if [[ $CHECK_ORIGINSSLPROTOCOL_STATUS == *"SSLv2"* ]] || [[ $CHECK_ORIGINSSLPROTOCOL_STATUS == *"SSLv3"* ]]; then | |
| textFail "CloudFront distribution $dist is using a deprecated SSL protocol!" "$regx" | |
| else | |
| textPass "CloudFront distribution $dist is not using a deprecated SSL protocol" "$regx" | |
| fi | |
| done | |
| else | |
| textInfo "No CloudFront distributions found" "$regx" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment