certbot-route53
certbot-route53 copied to clipboard
Problem when strip out the hostname part to leave only the domain
Thanks for this script. I realized that the internal sed command does not work when the host name is made up of more than three levels, for example: mail.external.example.com should return DOMAIN "example.com" but the value is "external.example. com "
# CERTBOT_DOMAIN is a hostname, not a domain (zone)
# We strip out the hostname part to leave only the domain
DOMAIN="$(sed -r 's/^[^.]+.(.*)$/\1/' <<< "${CERTBOT_DOMAIN}")"
echo something.very.long.example.com | sed -r 's/^([^.]+.)+.(com|net|org)$/\1.\2/' will return example.com
for me it did the trick as we own few domains outside of .com it was quick to adapt.