From 26ab454bfa6fc97c590221646b38183f5202ad7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mevl=C3=BCt=20furkan=20demir?= Date: Sun, 9 Oct 2022 19:01:24 +0300 Subject: [PATCH] cpanel_uapi deploy-hook with root user cpanel_uapi deploy-hook with root user, first time issue time cannot deploy cert. and give error "Error in deploying certificate - cannot retrieve sitelist" source of error: cpanel asks for username in site list: solution: root user set the username DEPLOY_CPANEL_USER and sitelist command processes the code with this argument test env: 106.0.7 cpanel centos 7 latest acme.sh --- deploy/cpanel_uapi.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deploy/cpanel_uapi.sh b/deploy/cpanel_uapi.sh index e5381b61..3a40c7b9 100644 --- a/deploy/cpanel_uapi.sh +++ b/deploy/cpanel_uapi.sh @@ -79,7 +79,13 @@ cpanel_uapi_deploy() { # Auto mode if [ "$DEPLOY_CPANEL_AUTO_ENABLED" = "true" ]; then # call API for site config - _response=$(uapi DomainInfo list_domains) + if [ -n "$_uapi_user" ]; then + _response=$(uapi --user="$_uapi_user" DomainInfo list_domains) + else + _response=$(uapi DomainInfo list_domains) + fi + + # exit if error in response if [ -z "$_response" ] || [ "${_response#*"$uapi_error_response"}" != "$_response" ]; then _err "Error in deploying certificate - cannot retrieve sitelist:"