module ILO_SDK::HttpsCertHelper
Contains helper methods for HTTPS Certificates
Public Instance Methods
generate_csr(country, state, city, org_name, org_unit, common_name)
click to toggle source
Generate a Certificate Signing Request @param [String] country @param [String] state @param [String] city @param [String] orgName @param [String] orgUnit @param [String] commonName @raise [RuntimeError] if the request failed @return true
# File lib/ilo-sdk/helpers/https_cert_helper.rb, line 51 def generate_csr(country, state, city, org_name, org_unit, common_name) new_action = { 'Action' => 'GenerateCSR', 'Country' => country, 'State' => state, 'City' => city, 'OrgName' => org_name, 'OrgUnit' => org_unit, 'CommonName' => common_name } response = rest_post('/redfish/v1/Managers/1/SecurityService/HttpsCert/', body: new_action) response_handler(response) true end
get_certificate()
click to toggle source
Get the SSL Certificate @raise [RuntimeError] if the request failed @return [OpenSSL::X509::Certificate] x509_certificate rubocop:disable Style/SymbolProc
# File lib/ilo-sdk/helpers/https_cert_helper.rb, line 19 def get_certificate uri = URI.parse(URI.escape(@host)) options = { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE } Net::HTTP.start(uri.host, uri.port, options) do |http| http.peer_cert end end
get_csr()
click to toggle source
Get the Certificate Signing Request @raise [RuntimeError] if the request failed @return [String] certificate_signing_request
# File lib/ilo-sdk/helpers/https_cert_helper.rb, line 69 def get_csr response = rest_get('/redfish/v1/Managers/1/SecurityService/HttpsCert/') response_handler(response)['CertificateSigningRequest'] end
import_certificate(certificate)
click to toggle source
Import the x509 certificate @param [String] certificate @raise [RuntimeError] if the request failed @return true
# File lib/ilo-sdk/helpers/https_cert_helper.rb, line 32 def import_certificate(certificate) new_action = { 'Action' => 'ImportCertificate', 'Certificate' => certificate } response = rest_post('/redfish/v1/Managers/1/SecurityService/HttpsCert/', body: new_action) response_handler(response) true end