Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Problem when strip out the hostname part to leave only the domain #15

Open
duke-count opened this issue Mar 12, 2018 · 1 comment
Open

Comments

@duke-count
Copy link

duke-count commented Mar 12, 2018

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}")"
@noonespecial2
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants