Module: ILO_SDK::HttpsCertHelper
- Included in:
- Client
- Defined in:
- lib/ilo-sdk/helpers/https_cert_helper.rb
Overview
Contains helper methods for HTTPS Certificates
Instance Method Summary collapse
-
#generate_csr(country, state, city, org_name, org_unit, common_name) ⇒ Object
Generate a Certificate Signing Request.
-
#get_certificate ⇒ OpenSSL::X509::Certificate
Get the SSL Certificate rubocop:disable Style/SymbolProc.
-
#get_csr ⇒ String
Get the Certificate Signing Request.
-
#import_certificate(certificate) ⇒ Object
Import the x509 certificate.
Instance Method Details
#generate_csr(country, state, city, org_name, org_unit, common_name) ⇒ Object
Generate a Certificate Signing Request
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# 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 ⇒ OpenSSL::X509::Certificate
Get the SSL Certificate rubocop:disable Style/SymbolProc
19 20 21 22 23 24 25 |
# File 'lib/ilo-sdk/helpers/https_cert_helper.rb', line 19 def get_certificate uri = URI.parse(URI.escape(@host)) = { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE } Net::HTTP.start(uri.host, uri.port, ) do |http| http.peer_cert end end |
#get_csr ⇒ String
Get the Certificate Signing Request
69 70 71 72 |
# 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) ⇒ Object
Import the x509 certificate
32 33 34 35 36 37 38 39 40 |
# 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 |