Include CA Bundle in API call

Added in the cabundle parameter and included the CA in it, for situations where the Let's Encrypt root CA isn't on the system.
This commit is contained in:
m00nh34d 2018-01-02 17:44:30 +11:00 committed by GitHub
parent 7b8a82ce90
commit bc42b563bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,11 +35,14 @@ cpanel_uapi_deploy() {
# read cert and key files and urlencode both # read cert and key files and urlencode both
_certstr=$(cat "$_ccert") _certstr=$(cat "$_ccert")
_keystr=$(cat "$_ckey") _keystr=$(cat "$_ckey")
_castr=$(cat "$_cca")
_cert=$(php -r "echo urlencode(\"$_certstr\");") _cert=$(php -r "echo urlencode(\"$_certstr\");")
_key=$(php -r "echo urlencode(\"$_keystr\");") _key=$(php -r "echo urlencode(\"$_keystr\");")
_ca=$(php -r "echo urlencode(\"$_castr\");")
_debug _cert "$_cert" _debug _cert "$_cert"
_debug _key "$_key" _debug _key "$_key"
_debug _ca "$_ca"
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
if [ -z "$DEPLOY_CPANEL_USER" ]; then if [ -z "$DEPLOY_CPANEL_USER" ]; then
@ -47,9 +50,9 @@ cpanel_uapi_deploy() {
return 1 return 1
fi fi
_savedomainconf DEPLOY_CPANEL_USER "$DEPLOY_CPANEL_USER" _savedomainconf DEPLOY_CPANEL_USER "$DEPLOY_CPANEL_USER"
_response=$(uapi --user="$DEPLOY_CPANEL_USER" SSL install_ssl domain="$_cdomain" cert="$_cert" key="$_key") _response=$(uapi --user="$DEPLOY_CPANEL_USER" SSL install_ssl domain="$_cdomain" cert="$_cert" key="$_key" cabundle="$_ca")
else else
_response=$(uapi SSL install_ssl domain="$_cdomain" cert="$_cert" key="$_key") _response=$(uapi SSL install_ssl domain="$_cdomain" cert="$_cert" key="$_key" cabundle="$_ca")
fi fi
error_response="status: 0" error_response="status: 0"
if test "${_response#*$error_response}" != "$_response"; then if test "${_response#*$error_response}" != "$_response"; then