Skip to content

Commit

Permalink
Update scripts/certs.sh
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
robertaandersen and coderabbitai[bot] authored Dec 13, 2024
1 parent 7878060 commit cdf5832
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion scripts/certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,26 @@ printf "Við fengum beiðni um áframsendingu á slóð inn á undirssíðu hjá
printf "Bæta þarf CNAME færslum við til hægt sé að sannreyna að þau séu í nafni eiganda lénsins.\n\n\n" >>email.md
printf "Hér koma lénin og gildin á CNAME færslunum:\n" >>email.md

arns=$(aws acm list-certificates --certificate-statuses PENDING_VALIDATION --includes keyTypes=RSA_1024,RSA_2048,RSA_3072,RSA_4096,EC_prime256v1,EC_secp384r1,EC_secp521r1 | jq -r '.CertificateSummaryList[] | .CertificateArn')
# Check AWS CLI availability
command -v aws >/dev/null 2>&1 || { echo "Error: AWS CLI is required but not installed"; exit 1; }

# Check AWS credentials
aws sts get-caller-identity >/dev/null 2>&1 || { echo "Error: AWS credentials not configured"; exit 1; }

# Fetch certificates pending validation
echo "Fetching certificates pending validation..."
arns=$(aws acm list-certificates \
--certificate-statuses PENDING_VALIDATION \
--includes keyTypes=RSA_1024,RSA_2048,RSA_3072,RSA_4096,EC_prime256v1,EC_secp384r1,EC_secp521r1 \
2>/dev/null | \
jq -r '.CertificateSummaryList[] | .CertificateArn') || \
{ echo "Error: Failed to fetch certificates"; exit 1; }

# Validate we got some certificates
if [ -z "$arns" ]; then
echo "No certificates found pending validation"
exit 0
fi
for arn in $arns; do
cert=$(aws acm describe-certificate --certificate-arn "$arn" | jq '.Certificate.DomainValidationOptions')
domains=$(echo "$cert" | jq -r '.[] | .DomainName')
Expand Down

0 comments on commit cdf5832

Please sign in to comment.