sslic

SSL certificate installer for Cpanel

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

Error handling

Errors are put in the error_log file in the working directory.

Contribute:

If you are a developer, you can consider contributing to this project by forking this repository and making changes for better and do a pull request, or sharing ideas and suggestions or finding bugs, anything at all, what you think will be beneficial for this project.

If you aren't a developer, but still want to contribute, then you can support the contributing developers spiritually, by starring the repository and/or sharing ideas. If you want to be notified of the continuous development, you can add this in your watch list in Github.

If you see any problems or bugs please open an issue here