Browse Source

Update dns_duckdns.sh

_duckdns_get_domain:
Adjusted sed-command to accept wildcard-domains and sub-sub-domains. Now 
- *.DOMAIN.duckdns.org
- *.sub1.sub2.DOMAIN.duckdns.org
- sub1.sub2.DOMAIN.duckdns.org
will yield DOMAIN. this includes the versions preceeded by "_acme-challenge."

Tested for quite some examples to an extend that I'm quite confident, that this should work under most circumstances. But you never know...
pull/3340/head
Sush 5 years ago
committed by GitHub
parent
commit
f148f22d79
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      dnsapi/dns_duckdns.sh

5
dnsapi/dns_duckdns.sh

@ -91,12 +91,13 @@ dns_duckdns_rm() {
#################### Private functions below ################################## #################### Private functions below ##################################
# fulldomain may be 'domain.duckdns.org' (if using --domain-alias) or '_acme-challenge.domain.duckdns.org'
# fulldomain may be 'subdomain.domain.duckdns.org' (if using --domain-alias) or '_acme-challenge.subdomain.domain.duckdns.org',
# also excepts wildcard-domains.
# either way, return 'domain'. (duckdns does not allow further subdomains and restricts domains to [a-z0-9-].) # either way, return 'domain'. (duckdns does not allow further subdomains and restricts domains to [a-z0-9-].)
_duckdns_get_domain() { _duckdns_get_domain() {
# We'll extract the domain/username from full domain # We'll extract the domain/username from full domain
_duckdns_domain="$(printf "%s" "$fulldomain" | _lower_case | _egrep_o '^(_acme-challenge\.)?[a-z0-9-]*\.duckdns\.org' | sed 's/^\(_acme-challenge\.\)\?\([a-z0-9-]*\)\.duckdns\.org/\2/')"
_duckdns_domain="$(printf "%s" "$fulldomain" | _lower_case | _egrep_o '^(_acme-challenge\.)?(*.)?([a-z0-9-]+\.)*[a-z0-9-]+\.duckdns\.org$' | sed 's/^\(_acme-challenge\.\)\?\(*\.\)\?\([a-z0-9-]\+\.\)*\([a-z0-9-]\+\)\.duckdns\.org$/\4/')"
if [ -z "$_duckdns_domain" ]; then if [ -z "$_duckdns_domain" ]; then
_err "Error extracting the domain." _err "Error extracting the domain."

Loading…
Cancel
Save