mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-25 14:41:40 +00:00
Travis fixes
This commit is contained in:
parent
a6614abd24
commit
9299a83b17
@ -30,8 +30,7 @@
|
|||||||
##
|
##
|
||||||
## The `pleskxml_uri`, `pleskxml_user` and `pleskxml_pass` will be saved in `~/.acme.sh/account.conf` and reused when needed.
|
## The `pleskxml_uri`, `pleskxml_user` and `pleskxml_pass` will be saved in `~/.acme.sh/account.conf` and reused when needed.
|
||||||
|
|
||||||
|
#################### INTERNAL VARIABLES + NEWLINE + API TEMPLATES ##################################
|
||||||
#################### INTERNAL VARIABLES + NEWLINE ##################################
|
|
||||||
|
|
||||||
pleskxml_init_checks_done=0
|
pleskxml_init_checks_done=0
|
||||||
|
|
||||||
@ -40,9 +39,6 @@ pleskxml_init_checks_done=0
|
|||||||
NEWLINE='\
|
NEWLINE='\
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
||||||
#################### API Templates ##################################
|
|
||||||
|
|
||||||
pleskxml_tplt_get_domains="<packet><customer><get-domain-list><filter/></get-domain-list></customer></packet>"
|
pleskxml_tplt_get_domains="<packet><customer><get-domain-list><filter/></get-domain-list></customer></packet>"
|
||||||
# Get a list of domains that PLESK can manage, so we can check root domain + host for acme.sh
|
# Get a list of domains that PLESK can manage, so we can check root domain + host for acme.sh
|
||||||
# Also used to test credentials and URI.
|
# Also used to test credentials and URI.
|
||||||
@ -60,7 +56,6 @@ pleskxml_tplt_rmv_dns_record="<packet><dns><del_rec><filter><id>%s</id></filter>
|
|||||||
# Add a TXT record to a domain.
|
# Add a TXT record to a domain.
|
||||||
# ARG = the Plesk internal ID for the dns record to be deleted
|
# ARG = the Plesk internal ID for the dns record to be deleted
|
||||||
|
|
||||||
|
|
||||||
#################### Public functions ##################################
|
#################### Public functions ##################################
|
||||||
|
|
||||||
#Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
|
#Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
|
||||||
@ -141,7 +136,7 @@ dns_pleskxml_rm() {
|
|||||||
reclist="$(_api_response_split "$pleskxml_prettyprint_result" 'result' '<status>ok</status>' \
|
reclist="$(_api_response_split "$pleskxml_prettyprint_result" 'result' '<status>ok</status>' \
|
||||||
| grep "<site-id>${root_domain_id}</site-id>" \
|
| grep "<site-id>${root_domain_id}</site-id>" \
|
||||||
| grep -E '<id>[0-9]+</id>' \
|
| grep -E '<id>[0-9]+</id>' \
|
||||||
| grep '<type>TXT</type>' \
|
| grep '<type>TXT</type>'
|
||||||
)"
|
)"
|
||||||
|
|
||||||
if [ -z "$reclist" ]; then
|
if [ -z "$reclist" ]; then
|
||||||
@ -154,8 +149,8 @@ dns_pleskxml_rm() {
|
|||||||
recid="$(_value "$reclist" \
|
recid="$(_value "$reclist" \
|
||||||
| grep "<host>$1.</host>" \
|
| grep "<host>$1.</host>" \
|
||||||
| grep "<value>$txtvalue</value>" \
|
| grep "<value>$txtvalue</value>" \
|
||||||
| sed -E 's/(^.*<id>|<\/id>.*$)//g' \
|
| sed -E 's/(^.*<id>|<\/id>.*$)//g'
|
||||||
)"
|
)"
|
||||||
|
|
||||||
_debug "List of DNS TXT records for host:"'\n'"$(_value "$reclist" | grep "<host>$1.</host>")"
|
_debug "List of DNS TXT records for host:"'\n'"$(_value "$reclist" | grep "<host>$1.</host>")"
|
||||||
|
|
||||||
@ -193,8 +188,6 @@ dns_pleskxml_rm() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#################### Private functions below ##################################
|
#################### Private functions below ##################################
|
||||||
|
|
||||||
# Outputs value of a variable
|
# Outputs value of a variable
|
||||||
@ -202,7 +195,6 @@ _value() {
|
|||||||
printf '%s' "$1"
|
printf '%s' "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Outputs value of a variable (FQDN) and cuts it at 2 delimiters
|
# Outputs value of a variable (FQDN) and cuts it at 2 delimiters
|
||||||
# $1, $2 = where to cut
|
# $1, $2 = where to cut
|
||||||
# $3 = FQDN
|
# $3 = FQDN
|
||||||
@ -210,20 +202,18 @@ _valuecut() {
|
|||||||
printf '%s' "$3" | cut -d . -f "${1}-${2}"
|
printf '%s' "$3" | cut -d . -f "${1}-${2}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Cleans up an API response, splits it "per item" and greps for a string to validate useful lines
|
# Cleans up an API response, splits it "per item" and greps for a string to validate useful lines
|
||||||
# $1 - result string from API
|
# $1 - result string from API
|
||||||
# $2 - tag to resplit on (usually "result" or "domain")
|
# $2 - tag to resplit on (usually "result" or "domain")
|
||||||
# $3 - regex to recognise useful return lines
|
# $3 - regex to recognise useful return lines
|
||||||
_api_response_split() {
|
_api_response_split() {
|
||||||
printf '%s' "$1" \
|
printf '%s' "$1" \
|
||||||
| sed -E 's/(^[[:space:]]+|[[:space:]]+$)//g' \
|
| sed -E 's/(^[[:space:]]+|[[:space:]]+$)//g' \
|
||||||
| tr -d '\n\r' \
|
| tr -d '\n\r' \
|
||||||
| sed -E "s/<\/?$2>/${NEWLINE}/g" \
|
| sed -E "s/<\/?$2>/${NEWLINE}/g" \
|
||||||
| grep -E "$3"
|
| grep -E "$3"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Calls Plesk XML API, and checks results for obvious issues
|
# Calls Plesk XML API, and checks results for obvious issues
|
||||||
_call_api() {
|
_call_api() {
|
||||||
request="$1"
|
request="$1"
|
||||||
@ -249,11 +239,11 @@ _call_api() {
|
|||||||
if _value "$statuslines" | grep -qv '<status>ok</status>'; then
|
if _value "$statuslines" | grep -qv '<status>ok</status>'; then
|
||||||
|
|
||||||
# We have some status lines that aren't "ok". Get the details
|
# We have some status lines that aren't "ok". Get the details
|
||||||
errtext="$( _value "$pleskxml_prettyprint_result" \
|
errtext="$(_value "$pleskxml_prettyprint_result" \
|
||||||
| grep -iE "(<status>|<errcode>|<errtext>)" \
|
| grep -iE "(<status>|<errcode>|<errtext>)" \
|
||||||
| sed -E 's/(^[[:space:]]+|<\/[a-z]+$)//g' \
|
| sed -E 's/(^[[:space:]]+|<\/[a-z]+$)//g' \
|
||||||
| sed -E 's/^<([a-z]+)>/\1: /' \
|
| sed -E 's/^<([a-z]+)>/\1: /'
|
||||||
)"
|
)"
|
||||||
|
|
||||||
elif ! _value "$statuslines" | grep -q '<status>ok</status>'; then
|
elif ! _value "$statuslines" | grep -q '<status>ok</status>'; then
|
||||||
|
|
||||||
@ -278,10 +268,8 @@ _call_api() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Startup checks (credentials, URI)
|
||||||
_credential_check() {
|
_credential_check() {
|
||||||
# Startup checks (credentials, URI)
|
|
||||||
|
|
||||||
_debug "Checking Plesk XML API login credentials and URI..."
|
_debug "Checking Plesk XML API login credentials and URI..."
|
||||||
|
|
||||||
if [ "$pleskxml_init_checks_done" -eq 1 ]; then
|
if [ "$pleskxml_init_checks_done" -eq 1 ]; then
|
||||||
@ -289,7 +277,6 @@ _credential_check() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
pleskxml_user="${pleskxml_user:-$(_readaccountconf_mutable pleskxml_user)}"
|
pleskxml_user="${pleskxml_user:-$(_readaccountconf_mutable pleskxml_user)}"
|
||||||
pleskxml_pass="${pleskxml_pass:-$(_readaccountconf_mutable pleskxml_pass)}"
|
pleskxml_pass="${pleskxml_pass:-$(_readaccountconf_mutable pleskxml_pass)}"
|
||||||
pleskxml_uri="${pleskxml_uri:-$(_readaccountconf_mutable pleskxml_uri)}"
|
pleskxml_uri="${pleskxml_uri:-$(_readaccountconf_mutable pleskxml_uri)}"
|
||||||
@ -325,7 +312,6 @@ _credential_check() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# For a FQDN, identify the root domain managed by Plesk, its domain ID in Plesk, and the host if any.
|
# For a FQDN, identify the root domain managed by Plesk, its domain ID in Plesk, and the host if any.
|
||||||
|
|
||||||
# IMPORTANT NOTE: a result with host = empty string is OK for this API, see
|
# IMPORTANT NOTE: a result with host = empty string is OK for this API, see
|
||||||
@ -369,7 +355,7 @@ _pleskxml_get_root_domain() {
|
|||||||
|
|
||||||
_debug "Checking if '$root_domain_name' is managed by the Plesk server..."
|
_debug "Checking if '$root_domain_name' is managed by the Plesk server..."
|
||||||
|
|
||||||
root_domain_id="$(_value "$output" | grep "<name>$root_domain_name</name>" | _head_n 1 | sed -E 's/^.*<id>([0-9]+)<\/id>.*$/\1/')"
|
root_domain_id="$(_value "$output" | grep "<name>$root_domain_name</name>" | _head_n 1 | sed -E 's/^.*<id>([0-9]+)<\/id>.*$/\1/')"
|
||||||
|
|
||||||
if [ -n "$root_domain_id" ]; then
|
if [ -n "$root_domain_id" ]; then
|
||||||
# Found a match
|
# Found a match
|
||||||
|
Loading…
Reference in New Issue
Block a user