Browse Source

Fix cPanel scripts to handle wild card domains and use correct API parameters

pull/874/head
Preston Goforth 10 months ago
parent
commit
673f62e7b6
4 changed files with 7 additions and 5 deletions
  1. +2
    -2
      dns_scripts/dns_add_cpanel
  2. +1
    -1
      dns_scripts/dns_del_cpanel
  3. +2
    -1
      getssl
  4. +2
    -1
      other_scripts/cpanel_cert_upload

+ 2
- 2
dns_scripts/dns_add_cpanel View File

@ -61,11 +61,11 @@ fi
# If no existing record, create a new TXT record, otherwise edit the existing record
if [[ "$resp" == *\"data\":[]* ]]; then
request_params="&cpanel_jsonapi_func=add_zone_record&domain=$domain&type=TXT&name=_acme-challenge$name&txtdata=$token"
request_params="&cpanel_jsonapi_func=add_zone_record&domain=${domain}&type=TXT&name=_acme-challenge&txtdata=${token}"
else
# shellcheck disable=SC2001
line=$(echo "$resp" | sed -e 's/.*line":\([0-9]*\),.*/\1/')
request_params="&cpanel_jsonapi_func=edit_zone_record&domain=$domain&type=TXT&name=_acme-challenge$name&txtdata=${token}&line=${line}"
request_params="&cpanel_jsonapi_func=edit_zone_record&domain=${domain}&type=TXT&name=_acme-challenge&txtdata=${token}&line=${line}"
fi
resp=$(curl --silent "${curl_params[@]}" "$request_func$request_params")


+ 1
- 1
dns_scripts/dns_del_cpanel View File

@ -58,7 +58,7 @@ fi
line=$(echo "$resp" | sed -e 's/.*line":\([0-9]*\),.*/\1/')
if [[ "$line" != "" ]]; then
# Delete the challenge token
request_params="&cpanel_jsonapi_func=remove_zone_record&domain=$domain&type=TXT&name=_acme-challenge$name&line=$line"
request_params="&cpanel_jsonapi_func=remove_zone_record&domain=${domain}&type=TXT&name=_acme-challenge&line=${line}"
resp=$(curl --silent "${curl_params[@]}" "$request_func$request_params")
fi


+ 2
- 1
getssl View File

@ -293,6 +293,7 @@
# 2024-03-26 Test for "true" in wildcard property of authorization responses
# 2024-10-16 Add newlines to /directory response (#765)(#859)
# 2025-06-18 Support profiles
# 2025-12-02 Fix cPanel support for API zone record updates and wildcard domain support
# ----------------------------------------------------------------------------------------
case :$SHELLOPTS: in
@ -301,7 +302,7 @@ esac
PROGNAME=${0##*/}
PROGDIR="$(cd "$(dirname "$0")" || exit; pwd -P;)"
VERSION="2.49"
VERSION="2.50"
# defaults
ACCOUNT_KEY_LENGTH=4096


+ 2
- 1
other_scripts/cpanel_cert_upload View File

@ -5,6 +5,7 @@
# use with RELOAD_CMD="${HOME}/cpanel_cert_upload domain.com"
domain="$1"
nowild=$(echo "${1//\*\./}")
rawurlencode() {
local string
@ -28,4 +29,4 @@ ecert=$( rawurlencode "${HOME}/.getssl/${domain}/${domain}.crt" )
ekey=$( rawurlencode "${HOME}/.getssl/${domain}/${domain}.key" )
echain=$( rawurlencode "${HOME}/.getssl/${domain}/chain.crt" )
uapi SSL install_ssl domain="${domain}" cert="${ecert}" key="${ekey}" cabundle="${echain}"
uapi SSL install_ssl domain="${nowild}" cert="${ecert}" key="${ekey}" cabundle="${echain}"

Loading…
Cancel
Save