sslic (SSL certificate installer for Cpanel)


Updated: Friday, 04. October 2019 04:46 PM UTC


SSL certificate installer for Cpanel

The PHP script takes required parameters and installs a SSL/TLS certificate using Cpanel UAPI's install_ssl function. It uses cURL to send payload to the UAPI. It uses Cpanel username and password to authenticate with the API. Connections to the API are made through HTTPS.

An working example can be found here.

Usage:

The script can be used in CLI environment or by HTTP request. For HTTP request, do not use GET method (It's insecure), use POST method instead.

CLI

Command:

php sslic.php domain crt-file key-file CABUNDLE-file/chain-file
Environment Variables:

USER:  username
PASS:  password
EMAIL: email address

HTTP REQUEST:

Parameters:

user: username
pass: password
dom: domain
crt: Certificate file
key: Key file
chain: CABUNDLE file

Options

Option Details
domain Domain name with TLD (e.g: example.com)
cert_file Path to SSL certificate file
key_file Path to key file that was used to create CSR
chain_file Path to CABUNDLE file
--help, -h Show help

Example usage:

USER='your username' PASS='your password' php sslic.php example.com signed.crt dom.key chain.crt
If you want to send email on success or failure, then

USER='your username' PASS='your password' EMAIL='your email address' php sslic.php example.com signed.crt dom.key chain.crt

The shell script sslic is a wrapper of the sslic.php script. It's provided for convenience of use:

USER='your username' PASS='your password' ./sslic example.com signed.crt dom.key chain.crt
#Or with email
USER='your username' PASS='your password' EMAIL='your email address' ./sslic example.com signed.crt dom.key chain.crt