Skip to content

Instantly share code, notes, and snippets.

@br0ziliy
Created May 19, 2015 20:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save br0ziliy/4f44a1fa59aabf945cb4 to your computer and use it in GitHub Desktop.
Save br0ziliy/4f44a1fa59aabf945cb4 to your computer and use it in GitHub Desktop.
Reset CPanel SSL certificates from command line (CLI) using API
# Create root account access hash, if it's not there
[ -f /root/.accesshash ] || /usr/local/cpanel/bin/mkaccesshash
# List 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 in this example
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment