Class: Lumberg::Cpanel::Ssl
- Defined in:
- lib/lumberg/cpanel/ssl.rb
Instance Attribute Summary
Attributes inherited from Base
Attributes inherited from Whm::Base
Class Method Summary collapse
Instance Method Summary collapse
-
#fetchcabundle(options = {}) ⇒ Object
Public: Fetch the cabundle that corresponds to the certificate.
-
#gencrt(options = {}) ⇒ Object
Public: Generate a self-signed SSL certificate for a specific domain.
-
#gencsr(options = {}) ⇒ Object
Public: Generate a certificate signing request.
-
#genkey(options = {}) ⇒ Object
Public: Generate an SSL key.
-
#installssl(options = {}) ⇒ Object
Public: Install an SSL certificate, key, and cabundle.
-
#listcrts(options = {}) ⇒ Object
Public: List SSL certificates currently installed for a cPanel account.
-
#listcsrs(options = {}) ⇒ Object
Public: List CSRs associated with your cPanel account.
-
#listkeys(options = {}) ⇒ Object
Public: List SSL keys associated with a domain.
-
#listsslitems(options = {}) ⇒ Object
Public: Query for SSL related items installed via cPanel.
-
#remove(options = {}) ⇒ Object
Public: Removes a domain’s SSL certificate.
-
#showcrt(options = {}) ⇒ Object
Public: Print the current cert for a specific host.
-
#showcsr(options = {}) ⇒ Object
Public: Print a specific Certificate Signing Request.
-
#showkey(options = {}) ⇒ Object
Public: Print a key that has already been generated.
-
#uploadcrt(options = {}) ⇒ Object
Public: Upload an SSL certificate.
Methods inherited from Base
Methods inherited from Whm::Base
Constructor Details
This class inherits a constructor from Lumberg::Cpanel::Base
Class Method Details
.api_module ⇒ Object
4 |
# File 'lib/lumberg/cpanel/ssl.rb', line 4 def self.api_module; "SSL"; end |
Instance Method Details
#fetchcabundle(options = {}) ⇒ Object
Public: Fetch the cabundle that corresponds to the certificate
options - Hash options for API call params (default: {}):
:crt - Contents of the certificate file
Returns Hash API response.
113 114 115 116 117 |
# File 'lib/lumberg/cpanel/ssl.rb', line 113 def fetchcabundle( = {}) perform_request({ api_function: "fetchcabundle", }.merge()) end |
#gencrt(options = {}) ⇒ Object
Public: Generate a self-signed SSL certificate for a specific domain.
options - Hash options for API call params (default: {}):
:city - The city in which your server resides.
:company - The name of the company.
:company_division - The division of your company.
:country - A two letter abbreviation for the country.
:email - A valid email address that will correspond to
the certificate signing request
:host - The domain that corresponds to the csr.
:state - A two letter abbreviation that corresponds to the
state.
Returns Hash API response.
171 172 173 174 175 176 177 |
# File 'lib/lumberg/cpanel/ssl.rb', line 171 def gencrt( = {}) [:companydivision] = .delete(:company_division) perform_request({ api_function: "gencrt", }.merge()) end |
#gencsr(options = {}) ⇒ Object
Public: Generate a certificate signing request.
options - Hash options for API call params (default: {}):
:city - The city in which your server resides.
:company - The name of the company.
:company_division - The division of your company.
:country - A two letter abbreviation for the country.
:email - A valid email address that will correspond to
the certificate signing request
:host - The domain that corresponds to the csr.
:state - A two letter abbreviation that corresponds to the
state.
:pass - The password of the csr.
Returns Hash API response.
148 149 150 151 152 153 154 155 |
# File 'lib/lumberg/cpanel/ssl.rb', line 148 def gencsr( = {}) [:companydivision] = .delete(:company_division) perform_request({ api_function: "gencsr", response_key: "cpanelresult", }.merge()) end |
#genkey(options = {}) ⇒ Object
Public: Generate an SSL key. You must have access to the ‘sslmanager’.
options - Hash options for API call params (default: {}):
:host - The domain that corresponds to the csr.
:keysize - The size of the key
Optional, may range from 1024 to 4096.
Returns Hash API response.
187 188 189 190 191 |
# File 'lib/lumberg/cpanel/ssl.rb', line 187 def genkey( = {}) perform_request({ api_function: "genkey", }.merge()) end |
#installssl(options = {}) ⇒ Object
Public: Install an SSL certificate, key, and cabundle.
options - Hash options for API call params (default: {}):
:cabundle - Contents of the CA bundle file (optional)
:crt - Contents of the certificate file
:domain - Domain name for the cert (optional)
:key - Contents of the key file associated with the CSR
:subject - String subject line.
Returns Hash API response.
16 17 18 19 20 |
# File 'lib/lumberg/cpanel/ssl.rb', line 16 def installssl( = {}) perform_request({ api_function: "installssl" }.merge()) end |
#listcrts(options = {}) ⇒ Object
Public: List SSL certificates currently installed for a cPanel account.
options - Hash options for API call params (default: {}):
Returns Hash API response.
90 91 92 93 94 |
# File 'lib/lumberg/cpanel/ssl.rb', line 90 def listcrts( = {}) perform_request({ api_function: "listcrts", }.merge()) end |
#listcsrs(options = {}) ⇒ Object
Public: List CSRs associated with your cPanel account.
options - Hash options for API call params (default: {}):
Returns Hash API response.
27 28 29 30 31 |
# File 'lib/lumberg/cpanel/ssl.rb', line 27 def listcsrs( = {}) perform_request({ api_function: "listcsrs", }.merge()) end |
#listkeys(options = {}) ⇒ Object
Public: List SSL keys associated with a domain.
options - Hash options for API call params (default: {}):
Returns Hash API response.
101 102 103 104 105 |
# File 'lib/lumberg/cpanel/ssl.rb', line 101 def listkeys( = {}) perform_request({ api_function: "listkeys", }.merge()) end |
#listsslitems(options = {}) ⇒ Object
Public: Query for SSL related items installed via cPanel
options - Hash options for API call params (default: {}):
:domains - The domains you wish to query.
:items - The type of SSL items for which you wish to query.
Acceptable values include 'key', 'crt', and 'csr'.
Returns Hash API response.
127 128 129 130 131 |
# File 'lib/lumberg/cpanel/ssl.rb', line 127 def listsslitems( = {}) perform_request({ api_function: "listsslitems", }.merge()) end |
#remove(options = {}) ⇒ Object
Public: Removes a domain’s SSL certificate. This function requires access to the ‘sslinstall’ feature
options - Hash options for API call params (default: {})
domain: String domain corresponding to the SSL certificate
to remove
Returns Hash API response
213 214 215 216 217 |
# File 'lib/lumberg/cpanel/ssl.rb', line 213 def remove( = {}) perform_request({ api_version: 1, api_function: "delete", response_key: "data" }.merge()) end |
#showcrt(options = {}) ⇒ Object
Public: Print the current cert for a specific host.
options - Hash options for API call params (default: {}):
Returns Hash API response.
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/lumberg/cpanel/ssl.rb', line 74 def showcrt( = {}) perform_request({ api_function: "showcrt", api_version: 1, user: [:user], response_key: "data", "arg-0" => [:domain], "arg-1" => [:textmode] }) end |
#showcsr(options = {}) ⇒ Object
Public: Print a specific Certificate Signing Request.
options - Hash options for API call params (default: {}):
:domain - The name of the domain the CSR was generated for.
:textmode - 0 for human readable, 1 for binary.
Returns Hash API response.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/lumberg/cpanel/ssl.rb', line 40 def showcsr( = {}) perform_request({ api_function: "showcsr", api_version: 1, user: [:user], response_key: "data", "arg-0" => [:domain], "arg-1" => [:textmode] }) end |
#showkey(options = {}) ⇒ Object
Public: Print a key that has already been generated.
options - Hash options for API call params (default: {}):
:domain - The name of the domain the CSR was generated for.
:textmode - 0 for human readable, 1 for binary.
Returns Hash API response.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/lumberg/cpanel/ssl.rb', line 58 def showkey( = {}) perform_request({ api_function: "showkey", api_version: 1, user: [:user], response_key: "data", "arg-0" => [:domain], "arg-1" => [:textmode] }) end |
#uploadcrt(options = {}) ⇒ Object
Public: Upload an SSL certificate.
options - Hash options for API call params (default: {}):
:crt - Contents of the SSL certificate
Returns Hash API response.
199 200 201 202 203 |
# File 'lib/lumberg/cpanel/ssl.rb', line 199 def uploadcrt( = {}) perform_request({ api_function: "uploadcrt", }.merge()) end |