Question
How to remove all domains from the AutoSSL excluded domains list in the command line?
Answer
CPANEL_WARN: On Ubuntu, you may not have "jq" installed by default.
-
To install
jq, run the command below on Ubuntu servers:# apt install jq
-
As root, to remove all of the domains for a single user:
Note: For
USER, enter your desired username to apply the change to.# user="USER" ; domains=$(whmapi1 --output=json get_autossl_user_excluded_domains username="$user" | jq -r '[.data.payload[].excluded_domain] | join(",")'); [[ -n "$domains" ]] && echo "Removing domains for $user: $domains" && uapi --user="$user" SSL remove_autossl_excluded_domains domains="$domains"
-
To list all users who have excluded domains from AutoSSL:
# whmapi1 listaccts --output=json | jq -r '.data.acct[].user' | while read user ; do echo $user ; whmapi1 --output=json get_autossl_user_excluded_domains username="$user" | jq -r '.data.payload[]' ; done
-
To remove all excluded domains across all users:
# whmapi1 listaccts --output=json | jq -r '.data.acct[].user' | while read user; do domains=$(whmapi1 --output=json get_autossl_user_excluded_domains username="$user" | jq -r '[.data.payload[].excluded_domain] | join(",")'); [[ -n "$domains" ]] && echo "Removing domains for $user: $domains" && uapi --user="$user" SSL remove_autossl_excluded_domains domains="$domains"; done
Additional Resources
WHM API - AutoSSL Generated Certificates
cPanel UAPI - AutoSSL Generated Certificates
How can I include and exclude domains for AutoSSL via the command line
Comments
0 comments
Article is closed for comments.