Perform only the following steps to reset a self-signed certificate and not a signed certificate. If you perform these steps for a signed certificate, you will replace a signed certificate with a self-signed certificate. Use the below steps to reset SSL certificate via command line using API.
How to reset certificate via Command Line
Check the root account access hash and create it if it is not available.
[ -f /root/.accesshash ] || /usr/local/cpanel/bin/mkaccesshash
List all available cPanel services that have SSL installed
curl -s -k -H "Authorization: WHM root:"`cat /root/.accesshash | sed ':a;N;$!ba;s/\n//g'` 'https://localhost:2087/json-api/fetch_service_ssl_components?api.version=1' | python -mjson.tool | grep service
Reset SSL certificate for a service (courier-imapd)
curl -s -k -H "Authorization: WHM root:"`cat /root/.accesshash | sed ':a;N;$!ba;s/\n//g'` 'https://localhost:2087/json-api/reset_service_ssl_certificate?api.version=1&service=courier-imapd' | python -mjson.tool
You can do the same way for other services.
Reset SSL certificate via WHM
To reset any cPanel service’s self-signed SSL certificate, do the following steps:
- Log in to WHM as the root user.
- Navigate to WHM’s Manage SSL Certificates interface (WHM >> Home >> Service Configuration >> Manage SSL Certificates).
- In the Actions column, click Reset Certificate for the desired service.
The new expiration date will display in the Certificate Expiration column.