Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for ecr-fips endpoint availability #1524

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions files/get-ecr-uri.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,15 @@ else
esac # end region check
fi

AWS_ECR_SUBDOMAIN="ecr"
# if FIPS is enabled on the machine, use the FIPS endpoint.
ECR_DOMAIN="${acct}.dkr.ecr.${region}.${aws_domain}"

# if FIPS is enabled on the machine, use the FIPS endpoint if it's available
if [[ "$(sysctl -n crypto.fips_enabled)" == 1 ]]; then
AWS_ECR_SUBDOMAIN="ecr-fips"
ECR_FIPS_DOMAIN="${acct}.dkr.ecr-fips.${region}.${aws_domain}"
cartermckinnon marked this conversation as resolved.
Show resolved Hide resolved
if [ $(getent hosts "$ECR_FIPS_DOMAIN" | wc -l) -gt 0 ]; then
echo "$ECR_FIPS_DOMAIN"
exit 0
fi
fi

echo "${acct}.dkr.${AWS_ECR_SUBDOMAIN}.${region}.${aws_domain}"
echo "$ECR_DOMAIN"