Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation



integrationblogcta.jpg

SSL Module Documentation

This module allows users to control their CRTs, CSRs, and keys.

The functions within this module may or may not be governed by a feature list. The required feature list may vary from function to function, to review a total list of the available features sets on a cPanel server, please see "Feature Manager" in WHM.

SSL::sslsharedstatus

API Version: 1 - Click here for documentation
Syntax: SSL::sslsharedstatus( )
Description: Display whether a shared SSL certificate is in use.
Returns:  
 
If the function returns true, it simply makes $cpanel::CPVAR{'sslsharedstatus'} true in the HTML environment.

SSL::showcsr

API Version: 1 - Click here for documentation
Syntax: SSL::showcsr( host, textmode )
Description: Print a specific Certificate Signing Request. This function requires access to the 'sslmanager' feature.
Parameters:  
  host (string)
  The hostname corresponding to the CSR to view.
  textmode (boolean)
  Passing 0 to this parameter causes the function to print the literal CSR data. Passing 1 to this parameter causes the function to print a human-readable text version of the CSR.
Returns:  
 
The output of this function contains the CSR information.

SSL::showcrt

API Version: 1 - Click here for documentation
Syntax: SSL::showcrt( host, textmode )
Description: Print the current cert for a specific host. This function requires access to the 'sslmanager' feature.
Parameters:  
  host (string)
  The hostname corresponding to the certificate to view.
  textmode (boolean)
  When 0 is passed to this parameter, the literal cert data is printed. Passing 1 to this parameter causes the function to print a human-readable text version of the certificate.
Returns:  
 
The output of this function will contain the certificate info.

SSL::showkey

API Version: 1 - Click here for documentation
Syntax: SSL::showkey( host, textmode )
Description: Print a key that has already been generated. This function requires access to the 'sslmanager' feature.
Parameters:  
  host (string)
  The hostname corresponding to the key to be viewed.
  textmode (boolean)
  When 0 is passed to this parameter, the literal key data is printed. When 1 is passed to this parameter, a human-readable text mode version is printed.
Returns:  
 
The output will contain the contents of the key.

SSL::getcabundle

API Version: 1 - Click here for documentation
Syntax: SSL::getcabundle( domain, crt )
Description: Retrieve the hostname and CA bundle for a specified domain and certificate. This function requires access to the 'sslinstall' feature.
Parameters:  
  domain (string)
  The domain (hostname) corresponding to the CA bundle to retrieve.
  crt (string)
  The certificate data corresponding to the CA bundle to retrieve.
Returns:  
 
The output should resemble the following:

CRT DOMAIN: example.com BUNDLE: --BEGIN CERTIFICATE DATA....

SSL::gencsr

API Version: 1 - Click here for documentation
Syntax: SSL::gencsr( host, country, state, city, co, cod, email, pass )
Description: Generate a Certificate Signing Request. This function requires access to the 'sslmanager' feature. It also requires that a valid key already reside in the account's ssl directory.
Parameters:  
  host (string)
  The hostname for which to generate the CSR. A valid key must already exist.
  country (string)
  Country code, such as 'us'.
  state (string)
  State or province.
  city (string)
  The user's city.
  co (string)
  The company name.
  cod (string)
  The company division.
  email (string)
  The email address to encode in the certificate.
  pass (string)
  The password that will correspond to the certificate.
Returns:  
 
This function does not generate any output. The CSR is written to the user's ssl/private directory.

SSL::genkey

API Version: 1 - Click here for documentation
Syntax: SSL::genkey( host, keysize )
Description: Generate an SSL key for a specified host. This function requires access to the 'sslmanager' feature.
Parameters:  
  host (string)
  The hostname for which to generate a key. The domain or hostname must exist.
  keysize (integer)
  The size of the key. This value defaults to 1024. The highest accepted value is 4096.
Returns:  
 
This function does not generate any output. The key file is written to /home/<user>/ssl/private/<host>.key.

SSL::uploadcrt

API Version: 1 - Click here for documentation
Syntax: SSL::uploadcrt( )
Description: Upload an SSL certificate to the server. This function requires access to the 'sslmanager' feature.
Form Data:  
  crt (string)
  The certificate to upload to the server. An HTTP POST command will have to be used for this parameter.
  file-* (string)
  If the certificate is already in the server's filesystem, it can be specified with a file-* parameter. The value will need to contain the path to the certificate file (e.g., file-/home/user/cert-1).
Returns:  
 
The output should resemble the following:
example.com (auto-detected)

If the function fails, it will return a relevant error message.

SSL::uploadkey

API Version: 1 - Click here for documentation
Syntax: SSL::uploadkey( )
Description: Upload an SSL key. This function copies the key into the account's $home/ssl/private directory. It requires access to the 'sslmanager' feature.
Form Data:  
  key (string)
  The contents of the certificate key file.
  host (string)
  The hostname to which the key will correspond. This value is the filename as it will appear in the account's $home/ssl/private directory. This value will not be validated to ensure that it is correct.
  file-* (string (optional))
  The file from which the key should be read. Anything can stand in place of the asterisk (*) in the form variable name, but the function will only use the first file-* field it finds.
Returns:  
 

The output will contain a string value of the hostname corresponding to the key if the function completes successfully. If the upload fails, the function will display a relevant error message.


SSL::listkeysopt

API Version: 1 - Click here for documentation
Syntax: SSL::listkeysopt( )
Description: List private keys associated with a cPanel account. This function requires access to the 'sslmanager' feature.
Returns:  
 
The output should resemble the following:

<option value="example.com">example.com</option>

<option value="example.com.old.1265939336">example.com.old.1265939336</option>


SSL::getcnname

API Version: 1 - Click here for documentation
Syntax: SSL::getcnname( domain, service )
Description: Retrieve the name of the certificate installed for a particular email service.
Parameters:  
  domain (string)
  The domain running the service whose certificate should be retrieved.
  service (string)
  The service whose certificate should be retrieved. Acceptable values include imap, pop3, and smtp.
Returns:  
 
If a certificate name is found, the function will print the hostname of the certificate.

SSL::delete

API Version: 1 - Click here for documentation
Syntax: SSL::delete( domain )
Description: Delete a domain's SSL certificate. This function requires access to the 'sslinstall' feature.
Parameters:  
  domain (string)
  The domain corresponding to the SSL certificate to remove.
Returns:  
 
The output should resemble the following:

SSL certificate was successfully removed from the domain


SSL::install

API Version: 1 - Click here for documentation
Syntax: SSL::install( domain, crt_data, key_data, cab_data )
Description: Install an SSL certificate. The user must have access to the 'sslinstall' feature to use this function.
Parameters:  
  domain (string)
  The domain for which to install the certificate.
  crt_data (string)
  The content of the certificate to install.
  key_data (string)
  The key data corresponding to the certificate to install.
  cab_data (string (optional))
  The CA bundle data of the certificate to install.
Returns:  
 
The output should resemble the following:

Your SSL certificate has been successfully installed to your site.

SSL::deletecsr

API Version: 1 - Click here for documentation
Syntax: SSL::deletecsr( host )
Description: Delete an SSL certificate signing request. This function requires access to the 'sslmanager' feature.
Parameters:  
  host (string)
  The hostname corresponding to the CSR to delete.
Returns:  
 
The function does not produce any output.

SSL::gencrt

API Version: 1 - Click here for documentation
Syntax: SSL::gencrt( host, country, state, city, company, companydivision, email )
Description: Generate a self-signed SSL certificate for a specific domain. This function does not return the certificate. It does return a message of success or a reason for failure. Use SSL::listcrts to retrieve the certificate after it has been created. This function requires access to the 'sslmanager' feature.
Parameters:  
  host (string)
  The domain or subdomain for which to generate the certificate. A key for the host must already exist before generating the certificate.
  country (string)
  A 2-letter abbreviation corresponding to the country in which the domain's server resides. Certificate generation will fail if this parameter is passed more than two letters.
  state (string)
  A 2-letter abbreviation for the state in which the domain's server resides.
  city (string)
  The name of the city in which the domain's server resides.
  company (string)
  The name of the user's company; spaces are acceptable here.
  companydivision (string)
  The division name of the company; spaces are acceptable here.
  email (string)
  A valid email address to associate with the certificate.
Returns:  
 

The output should resemble the following:
Certificate generated!


SSL::deletekey

API Version: 1 - Click here for documentation
Syntax: SSL::deletekey( host )
Description: Delete an SSL key. This function requires access to the 'sslmanager' feature.
Parameters:  
  host (string)
  The hostname corresponding to the key to delete.
Returns:  
 
This function does not produce any output.

SSL::deletecrt

API Version: 1 - Click here for documentation
Syntax: SSL::deletecrt( host )
Description: Delete an SSL certificate. This function requires access to the 'sslmanager' feature.
Parameters:  
  host (string)
  The hostname corresponding to the certificate to delete.
Returns:  
 
This function does not produce any output.

SSL::installedhost

API Version: 1 - Click here for documentation
Syntax: SSL::installedhost( domain )
Description: Retrieve the name of the certificate installed for the IP address of a specific domain. This function requires access to the 'sslinstall' feature. This function also returns any parked domains on the IP address, as well as some JavaScript code.
Parameters:  
  domain (string (optional))
  The domain to query. This value defaults to the account's main domain.
Returns:  
 
The output should resemble the following:

example.com (parked.com parked2.com)

<script>

function getdomainr() {

for(var i=0;i<document.mainform.domain.options.length;i++) {

if (document.mainform.domain.options[i].value == "example.com") {

document.mainform.domain.selectedIndex = i;

}

}

document.mainform.domain.disabled = true;

lookupinfo();

}

</script>

Topic revision: r2 - 29 Mar 2012 - 15:19:01 - Main.JenniferDoubrava