mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-22 21:21:42 +00:00
Fix few issues from Travis
This commit is contained in:
parent
f7299403f7
commit
ff74778dea
@ -21,16 +21,14 @@ dns_he_add() {
|
|||||||
_info "Using DNS-01 Hurricane Electric hook"
|
_info "Using DNS-01 Hurricane Electric hook"
|
||||||
|
|
||||||
if [ -z "$HE_Username" ] || [ -z "$HE_Password" ]; then
|
if [ -z "$HE_Username" ] || [ -z "$HE_Password" ]; then
|
||||||
_err \
|
_err "No auth details provided. Please set user credentials using the \$HE_Username and \$HE_Password envoronment variables."
|
||||||
'No auth details provided. Please set user credentials using the \
|
|
||||||
\$HE_Username and \$HE_Password envoronment variables.'
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_saveaccountconf HE_Username "$HE_Username"
|
_saveaccountconf HE_Username "$HE_Username"
|
||||||
_saveaccountconf HE_Password "$HE_Password"
|
_saveaccountconf HE_Password "$HE_Password"
|
||||||
|
|
||||||
# fills in the $_zone_id
|
# fills in the $_zone_id
|
||||||
_find_zone $_full_domain || return 1
|
_find_zone "$_full_domain" || return 1
|
||||||
_debug "Zone id \"$_zone_id\" will be used."
|
_debug "Zone id \"$_zone_id\" will be used."
|
||||||
|
|
||||||
body="email=${HE_Username}&pass=${HE_Password}"
|
body="email=${HE_Username}&pass=${HE_Password}"
|
||||||
@ -46,11 +44,10 @@ dns_he_add() {
|
|||||||
body="$body&Content=$_txt_value"
|
body="$body&Content=$_txt_value"
|
||||||
body="$body&TTL=300"
|
body="$body&TTL=300"
|
||||||
body="$body&hosted_dns_editrecord=Submit"
|
body="$body&hosted_dns_editrecord=Submit"
|
||||||
response="$(_post $body "https://dns.he.net/")"
|
response="$(_post "$body" "https://dns.he.net/")"
|
||||||
_debug2 response "$response"
|
_debug2 response "$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#-- dns_he_rm() - Remove TXT record ------------------------------------
|
#-- dns_he_rm() - Remove TXT record ------------------------------------
|
||||||
# Usage: dns_he_rm _acme-challenge.subdomain.domain.com "XyZ123..."
|
# Usage: dns_he_rm _acme-challenge.subdomain.domain.com "XyZ123..."
|
||||||
|
|
||||||
@ -60,7 +57,7 @@ dns_he_rm() {
|
|||||||
_info "Cleaning up after DNS-01 Hurricane Electric hook"
|
_info "Cleaning up after DNS-01 Hurricane Electric hook"
|
||||||
|
|
||||||
# fills in the $_zone_id
|
# fills in the $_zone_id
|
||||||
_find_zone $_full_domain || return 1
|
_find_zone "$_full_domain" || return 1
|
||||||
_debug "Zone id \"$_zone_id\" will be used."
|
_debug "Zone id \"$_zone_id\" will be used."
|
||||||
|
|
||||||
# Find the record id to clean
|
# Find the record id to clean
|
||||||
@ -68,7 +65,7 @@ dns_he_rm() {
|
|||||||
body="$body&hosted_dns_zoneid=$_zone_id"
|
body="$body&hosted_dns_zoneid=$_zone_id"
|
||||||
body="$body&menu=edit_zone"
|
body="$body&menu=edit_zone"
|
||||||
body="$body&hosted_dns_editzone="
|
body="$body&hosted_dns_editzone="
|
||||||
_record_id=$(_post $body "https://dns.he.net/" \
|
_record_id=$(_post "$body" "https://dns.he.net/" \
|
||||||
| tr -d '\n' \
|
| tr -d '\n' \
|
||||||
| _egrep_o "data=\""${_txt_value}"([^>]+>){6}[^<]+<[^;]+;deleteRecord\('[0-9]+','${_full_domain}','TXT'\)" \
|
| _egrep_o "data=\""${_txt_value}"([^>]+>){6}[^<]+<[^;]+;deleteRecord\('[0-9]+','${_full_domain}','TXT'\)" \
|
||||||
| _egrep_o "[0-9]+','${_full_domain}','TXT'\)$" \
|
| _egrep_o "[0-9]+','${_full_domain}','TXT'\)$" \
|
||||||
@ -87,9 +84,9 @@ dns_he_rm() {
|
|||||||
body="$body&hosted_dns_delrecord=1"
|
body="$body&hosted_dns_delrecord=1"
|
||||||
body="$body&hosted_dns_delconfirm=delete"
|
body="$body&hosted_dns_delconfirm=delete"
|
||||||
body="$body&hosted_dns_editzone=1"
|
body="$body&hosted_dns_editzone=1"
|
||||||
_post $body "https://dns.he.net/" \
|
_post "$body" "https://dns.he.net/" \
|
||||||
| grep '<div id="dns_status" onClick="hideThis(this);">Successfully removed record.</div>' \
|
| grep '<div id="dns_status" onClick="hideThis(this);">Successfully removed record.</div>' \
|
||||||
> /dev/null
|
>/dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
_info "Record removed successfuly."
|
_info "Record removed successfuly."
|
||||||
else
|
else
|
||||||
@ -99,12 +96,9 @@ dns_he_rm() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
########################## PRIVATE FUNCTIONS ###########################
|
########################## PRIVATE FUNCTIONS ###########################
|
||||||
|
|
||||||
|
|
||||||
#-- _find_zone() -------------------------------------------------------
|
#-- _find_zone() -------------------------------------------------------
|
||||||
|
|
||||||
# Returns the most specific zone found in administration interface.
|
# Returns the most specific zone found in administration interface.
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
@ -131,31 +125,28 @@ _find_zone() {
|
|||||||
## ( zone1:id zone2:id ... )
|
## ( zone1:id zone2:id ... )
|
||||||
|
|
||||||
body="email=${HE_Username}&pass=${HE_Password}"
|
body="email=${HE_Username}&pass=${HE_Password}"
|
||||||
_all_zones=( $(_post $body "https://dns.he.net/" \
|
# TODO arrays aren't supported in POSIX sh
|
||||||
|
_all_zones=($(_post $body "https://dns.he.net/" \
|
||||||
| _egrep_o "delete_dom.*name=\"[^\"]+\" value=\"[0-9]+" \
|
| _egrep_o "delete_dom.*name=\"[^\"]+\" value=\"[0-9]+" \
|
||||||
| cut -d '"' -f 3,5 --output-delimiter=":" \
|
| cut -d '"' -f 3,5 --output-delimiter=":"
|
||||||
) )
|
))
|
||||||
|
|
||||||
_strip_counter=1
|
_strip_counter=1
|
||||||
while true
|
while true; do
|
||||||
do
|
_attempted_zone=$(echo "$_domain" | cut -d . -f ${_strip_counter}-)
|
||||||
_attempted_zone=$(echo $_domain | cut -d . -f ${_strip_counter}-)
|
|
||||||
|
|
||||||
# All possible zone names have been tried
|
# All possible zone names have been tried
|
||||||
if [ -z "$_attempted_zone" ]
|
if [ -z "$_attempted_zone" ]; then
|
||||||
then
|
|
||||||
_err "No zone for domain \"$_domain\" found."
|
_err "No zone for domain \"$_domain\" found."
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Walk through all zones on the account
|
# Walk through all zones on the account
|
||||||
#echo "$_all_zones" | while IFS=' ' read _zone_name _zone_id
|
#echo "$_all_zones" | while IFS=' ' read _zone_name _zone_id
|
||||||
for i in ${_all_zones[@]}
|
for i in ${_all_zones[@]}; do
|
||||||
do
|
_zone_name=$(echo "$i" | cut -d ':' -f 1)
|
||||||
_zone_name=$(echo $i | cut -d ':' -f 1)
|
_zone_id=$(echo "$i" | cut -d ':' -f 2)
|
||||||
_zone_id=$(echo $i | cut -d ':' -f 2)
|
if [ "$_zone_name" = "$_attempted_zone" ]; then
|
||||||
if [ "$_zone_name" = "$_attempted_zone" ]
|
|
||||||
then
|
|
||||||
# Zone found - we got $_zone_name and $_zone_id, let's get out...
|
# Zone found - we got $_zone_name and $_zone_id, let's get out...
|
||||||
_debug "Found relevant zone \"$_zone_name\" with id" \
|
_debug "Found relevant zone \"$_zone_name\" with id" \
|
||||||
"\"$_zone_id\" - will be used for domain \"$_domain\"."
|
"\"$_zone_id\" - will be used for domain \"$_domain\"."
|
||||||
|
Loading…
Reference in New Issue
Block a user