Giter Club home page Giter Club logo

sslic's Introduction

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

sslic's People

Contributors

neurobin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sslic's Issues

[Solved] 2FA compatibility

https://documentation.cpanel.net/display/DD/Guide+to+API+Authentication+-+Two-Factor+Authentication

Have you looked into if this will work here for compatibility with 2FA? It looks like the user doesn't need to be around due to the username and pass being in the script so I would expect it to work but its the first time I've ever looked at the cpanel API so not familiar with it.

When I have some time to spend on it, could play around with it and check it out. You're welcome to get to it first or maybe you've already tried it.

[Solved] Failed to install certificate in Cpanel

For some reason the certificate fails to install by script

Successfully renewed certificate followed by Failed to install certificate in Cpanel

Previously got it to work once by setting cpanel cron job to run right away (eg one to five minutes) and it installed. This time it won't so had to download the dom.crt and manually install it in cpanel.

I'm still not sure what the reason is but there are a few things I can find from the logs and email:

<b>Warning</b>: error_log(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function.

The CURL call did not return valid JSON

<!-- EXTERNAL CSS -->
<link href="/cPanel_magic_revision_1386192030/unprotected/nc-cpanel/fonts/open_sans/open_sans.min.css" rel="stylesheet" type="text/css" />
<link href="/cPanel_magic_revision_1513675560/unprotected/nc-cpanel/style_v2_optimized.css" rel="stylesheet" type="text/css" />
<style type="text/css">
/* This css is included in the base template in case the css cannot be loaded because of access restrictions
    If this css is updated, please update main.tmpl as well */

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.