mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-10 14:12:43 +00:00
Merge 822421f1812ca548ced9783a3c5fbef828121ee6 into 9173140ddfa0476bfb79874dcfd0ed995a35a3f7
This commit is contained in:
commit
87d49c50f1
@ -47,73 +47,42 @@ dns_freedns_add() {
|
|||||||
_saveaccountconf FREEDNS_COOKIE "$FREEDNS_COOKIE"
|
_saveaccountconf FREEDNS_COOKIE "$FREEDNS_COOKIE"
|
||||||
|
|
||||||
# split our full domain name into two parts...
|
# split our full domain name into two parts...
|
||||||
i="$(echo "$fulldomain" | tr '.' ' ' | wc -w)"
|
# top_domain is everything after the first dot
|
||||||
i="$(_math "$i" - 1)"
|
# sub_domain is the element before the first dot
|
||||||
top_domain="$(echo "$fulldomain" | cut -d. -f "$i"-100)"
|
top_domain="$(echo "$fulldomain" | cut -d. -f 2-)"
|
||||||
i="$(_math "$i" - 1)"
|
sub_domain="$(echo "$fulldomain" | cut -d. -f 1)"
|
||||||
sub_domain="$(echo "$fulldomain" | cut -d. -f -"$i")"
|
DNSdomainid=
|
||||||
|
|
||||||
|
while [ -z "$DNSdomainid" ]; do
|
||||||
_debug "top_domain: $top_domain"
|
_debug "top_domain: $top_domain"
|
||||||
_debug "sub_domain: $sub_domain"
|
_debug "sub_domain: $sub_domain"
|
||||||
|
|
||||||
# Sometimes FreeDNS does not return the subdomain page but rather
|
found_domainid="$(_freedns_find_domain "$FREEDNS_COOKIE" "$top_domain")"
|
||||||
# returns a page regarding becoming a premium member. This usually
|
|
||||||
# happens after a period of inactivity. Immediately trying again
|
|
||||||
# returns the correct subdomain page. So, we will try twice to
|
|
||||||
# load the page and obtain our domain ID
|
|
||||||
attempts=2
|
|
||||||
while [ "$attempts" -gt "0" ]; do
|
|
||||||
attempts="$(_math "$attempts" - 1)"
|
|
||||||
|
|
||||||
htmlpage="$(_freedns_retrieve_subdomain_page "$FREEDNS_COOKIE")"
|
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
if [ "$using_cached_cookies" = "true" ]; then
|
# Check if there is a dot in the top_domain
|
||||||
_err "Has your FreeDNS username and password changed? If so..."
|
# If not, we can't split any more and should assume the domain doesn't exist
|
||||||
_err "Please export as FREEDNS_User / FREEDNS_Password and try again."
|
if ! echo "$top_domain" | grep -qF '.'; then
|
||||||
fi
|
_info "Domain $top_domain not found at FreeDNS. All domain parts exhausted"
|
||||||
|
_err "Domain $fulldomain not found at FreeDNS"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
subdomain_csv="$(echo "$htmlpage" | tr -d "\n\r" | _egrep_o '<form .*</form>' | sed 's/<tr>/@<tr>/g' | tr '@' '\n' | grep edit.php | grep "$top_domain")"
|
# Move the subdomain part from top_domain to the bottom of top_domain
|
||||||
_debug3 "subdomain_csv: $subdomain_csv"
|
# e.g a | b.c.d becomes a.b | c.d where the pipe represents the split
|
||||||
|
_info "Domain $top_domain not found at FreeDNS. Splitting again"
|
||||||
|
sub_domain="$sub_domain.$(echo "$top_domain" | cut -d. -f 1)"
|
||||||
|
top_domain="$(echo "$top_domain" | cut -d. -f 2-)"
|
||||||
|
|
||||||
# The above beauty ends with striping out rows that do not have an
|
# Try again with the newly split domain
|
||||||
# href to edit.php and do not have the top domain we are looking for.
|
continue
|
||||||
# So all we should be left with is CSV of table of subdomains we are
|
|
||||||
# interested in.
|
|
||||||
|
|
||||||
# Now we have to read through this table and extract the data we need
|
|
||||||
lines="$(echo "$subdomain_csv" | wc -l)"
|
|
||||||
i=0
|
|
||||||
found=0
|
|
||||||
DNSdomainid=""
|
|
||||||
while [ "$i" -lt "$lines" ]; do
|
|
||||||
i="$(_math "$i" + 1)"
|
|
||||||
line="$(echo "$subdomain_csv" | sed -n "${i}p")"
|
|
||||||
_debug2 "line: $line"
|
|
||||||
if [ $found = 0 ] && _contains "$line" "<td>$top_domain</td>"; then
|
|
||||||
# this line will contain DNSdomainid for the top_domain
|
|
||||||
DNSdomainid="$(echo "$line" | _egrep_o "edit_domain_id *= *.*>" | cut -d = -f 2 | cut -d '>' -f 1)"
|
|
||||||
_debug2 "DNSdomainid: $DNSdomainid"
|
|
||||||
found=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "$DNSdomainid" ]; then
|
|
||||||
# If domain ID is empty then something went wrong (top level
|
|
||||||
# domain not found at FreeDNS).
|
|
||||||
if [ "$attempts" = "0" ]; then
|
|
||||||
# exhausted maximum retry attempts
|
|
||||||
_err "Domain $top_domain not found at FreeDNS"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
# break out of the 'retry' loop... we have found our domain ID
|
# Domain found, carry on!
|
||||||
|
DNSdomainid="$found_domainid"
|
||||||
|
_info "Domain $top_domain found at FreeDNS!"
|
||||||
|
_debug2 "DNSdomainid for $top_domain: $DNSdomainid"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
_info "Domain $top_domain not found at FreeDNS"
|
|
||||||
_info "Retry loading subdomain page ($attempts attempts remaining)"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Add in new TXT record with the value provided
|
# Add in new TXT record with the value provided
|
||||||
@ -245,6 +214,73 @@ _freedns_login() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# usage: _freedns_find_domain "<FREEDNS_COOKIE>" "www.domain.com"
|
||||||
|
# print DNSdomainid on success
|
||||||
|
# returns 0 on success
|
||||||
|
_freedns_find_domain() {
|
||||||
|
FREEDNS_COOKIE="$1"
|
||||||
|
top_domain="$2"
|
||||||
|
|
||||||
|
# Sometimes FreeDNS does not return the subdomain page but rather
|
||||||
|
# returns a page regarding becoming a premium member. This usually
|
||||||
|
# happens after a period of inactivity. Immediately trying again
|
||||||
|
# returns the correct subdomain page. So, we will try twice to
|
||||||
|
# load the page and obtain our domain ID
|
||||||
|
attempts=2
|
||||||
|
while [ "$attempts" -gt "0" ]; do
|
||||||
|
attempts="$(_math "$attempts" - 1)"
|
||||||
|
|
||||||
|
htmlpage="$(_freedns_retrieve_subdomain_page "$FREEDNS_COOKIE")"
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
if [ "$using_cached_cookies" = "true" ]; then
|
||||||
|
_err "Has your FreeDNS username and password changed? If so..."
|
||||||
|
_err "Please export as FREEDNS_User / FREEDNS_Password and try again."
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
subdomain_csv="$(echo "$htmlpage" | tr -d "\n\r" | _egrep_o '<form .*</form>' | sed 's/<tr>/@<tr>/g' | tr '@' '\n' | grep edit.php | grep "$top_domain")"
|
||||||
|
_debug3 "subdomain_csv: $subdomain_csv"
|
||||||
|
|
||||||
|
# The above beauty ends with striping out rows that do not have an
|
||||||
|
# href to edit.php and do not have the top domain we are looking for.
|
||||||
|
# So all we should be left with is CSV of table of subdomains we are
|
||||||
|
# interested in.
|
||||||
|
|
||||||
|
# Now we have to read through this table and extract the data we need
|
||||||
|
lines="$(echo "$subdomain_csv" | wc -l)"
|
||||||
|
i=0
|
||||||
|
found=0
|
||||||
|
DNSdomainid=""
|
||||||
|
while [ "$i" -lt "$lines" ]; do
|
||||||
|
i="$(_math "$i" + 1)"
|
||||||
|
line="$(echo "$subdomain_csv" | sed -n "${i}p")"
|
||||||
|
_debug2 "line: $line"
|
||||||
|
if [ $found = 0 ] && _contains "$line" "<td>$top_domain</td>"; then
|
||||||
|
# this line will contain DNSdomainid for the top_domain
|
||||||
|
DNSdomainid="$(echo "$line" | _egrep_o "edit_domain_id *= *.*>" | cut -d = -f 2 | cut -d '>' -f 1)"
|
||||||
|
_debug2 "DNSdomainid: $DNSdomainid"
|
||||||
|
found=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$DNSdomainid" ]; then
|
||||||
|
# If domain ID is empty then something went wrong (top level
|
||||||
|
# domain not found at FreeDNS).
|
||||||
|
if [ "$attempts" = "0" ]; then
|
||||||
|
# exhausted maximum retry attempts
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# break out of the 'retry' loop... we have found our domain ID
|
||||||
|
printf "%s" "$DNSdomainid"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
_debug "Retry loading subdomain page ($attempts attempts remaining)"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# usage _freedns_retrieve_subdomain_page login_cookies
|
# usage _freedns_retrieve_subdomain_page login_cookies
|
||||||
# echo page retrieved (html)
|
# echo page retrieved (html)
|
||||||
# returns 0 success
|
# returns 0 success
|
||||||
|
@ -158,7 +158,8 @@ _inwx_login() {
|
|||||||
export _H1
|
export _H1
|
||||||
|
|
||||||
#https://github.com/inwx/php-client/blob/master/INWX/Domrobot.php#L71
|
#https://github.com/inwx/php-client/blob/master/INWX/Domrobot.php#L71
|
||||||
if _contains "$response" "tfa"; then
|
if _contains "$response" "<member><name>code</name><value><int>1000</int></value></member>" \
|
||||||
|
&& _contains "$response" "<member><name>tfa</name><value><string>GOOGLE-AUTH</string></value></member>"; then
|
||||||
if [ -z "$INWX_Shared_Secret" ]; then
|
if [ -z "$INWX_Shared_Secret" ]; then
|
||||||
_err "Mobile TAN detected."
|
_err "Mobile TAN detected."
|
||||||
_err "Please define a shared secret."
|
_err "Please define a shared secret."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user