Skip to content

Commit 673f62e

Browse files
committed
Fix cPanel scripts to handle wild card domains and use correct API parameters
1 parent 1d8f91b commit 673f62e

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

dns_scripts/dns_add_cpanel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ fi
6161

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

dns_scripts/dns_del_cpanel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fi
5858
line=$(echo "$resp" | sed -e 's/.*line":\([0-9]*\),.*/\1/')
5959
if [[ "$line" != "" ]]; then
6060
# Delete the challenge token
61-
request_params="&cpanel_jsonapi_func=remove_zone_record&domain=$domain&type=TXT&name=_acme-challenge$name&line=$line"
61+
request_params="&cpanel_jsonapi_func=remove_zone_record&domain=${domain}&type=TXT&name=_acme-challenge&line=${line}"
6262
resp=$(curl --silent "${curl_params[@]}" "$request_func$request_params")
6363
fi
6464

getssl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@
293293
# 2024-03-26 Test for "true" in wildcard property of authorization responses
294294
# 2024-10-16 Add newlines to /directory response (#765)(#859)
295295
# 2025-06-18 Support profiles
296+
# 2025-12-02 Fix cPanel support for API zone record updates and wildcard domain support
296297
# ----------------------------------------------------------------------------------------
297298

298299
case :$SHELLOPTS: in
@@ -301,7 +302,7 @@ esac
301302

302303
PROGNAME=${0##*/}
303304
PROGDIR="$(cd "$(dirname "$0")" || exit; pwd -P;)"
304-
VERSION="2.49"
305+
VERSION="2.50"
305306

306307
# defaults
307308
ACCOUNT_KEY_LENGTH=4096

other_scripts/cpanel_cert_upload

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# use with RELOAD_CMD="${HOME}/cpanel_cert_upload domain.com"
66

77
domain="$1"
8+
nowild=$(echo "${1//\*\./}")
89

910
rawurlencode() {
1011
local string
@@ -28,4 +29,4 @@ ecert=$( rawurlencode "${HOME}/.getssl/${domain}/${domain}.crt" )
2829
ekey=$( rawurlencode "${HOME}/.getssl/${domain}/${domain}.key" )
2930
echain=$( rawurlencode "${HOME}/.getssl/${domain}/chain.crt" )
3031

31-
uapi SSL install_ssl domain="${domain}" cert="${ecert}" key="${ekey}" cabundle="${echain}"
32+
uapi SSL install_ssl domain="${nowild}" cert="${ecert}" key="${ekey}" cabundle="${echain}"

0 commit comments

Comments
 (0)