Introduction
If you wish to exclude a certain subdomain from AutoSSL renewal for all the domains on your server you can run the following command.
Procedure
The following command loops over all the users on the server and excludes a chosen subdomain from AutoSSL automatic renewal for all the domains of all the users that have the AutoSSL feature enabled:
SUBDOMAIN=mail;find /var/cpanel/users -type f | cut -d"/" -f5 | while read USERNAME;do LIST=`uapi --user=$USERNAME WebVhosts list_ssl_capable_domains | grep -Ei "domain:" | awk '{print $2}' | grep -Ei "^$SUBDOMAIN" | sed -z 's/\n/,/g;s/,$/\n/'` && uapi --user=$USERNAME SSL add_autossl_excluded_domains domains=$LIST ;done
Note: Here I have used the "SUBDOMAIN=mail" which means that the command will only exclude the "mail" subdomains for each domain. You can choose any subdomains (mail, autodiscover, www, whm, ...) instead, all you need to do is to replace "mail" with your choice in the above command.
After the command has been excuted without errors you can run the following command to confirm if the correct (sub)domains have been excluded as a result:
find /var/cpanel/users -type f | cut -d"/" -f5 | while read USERNAME;do whmapi1 get_autossl_user_excluded_domains username=$USERNAME;done | grep -Ei "excluded_domain:"
Comments
0 comments
Article is closed for comments.