Sha256: e5ffbb90592ecb2c55de6b870704e9683619bbed26796dc0927661ff8ffd4afe

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

module Cert
  module Certs
    def self.ueber_cert(organization)
      organization.debug_cert
    end

    def self.ca_cert
      File.open(Setting[:ssl_ca_file], 'r').read
    end

    def self.candlepin_client_ca_cert
      File.read(SETTINGS[:katello][:candlepin][:ca_cert_file])
    end

    def self.ssl_client_cert
      @ssl_client_cert ||= OpenSSL::X509::Certificate.new(File.open(ssl_client_cert_filename, 'r').read)
    end

    def self.ssl_client_cert_filename
      Setting['pulp_client_cert']
    end

    def self.ssl_client_key
      @ssl_client_key ||= OpenSSL::PKey::RSA.new(File.open(ssl_client_key_filename, 'r').read)
    end

    def self.ssl_client_key_filename
      Setting['pulp_client_key']
    end

    def self.verify_ueber_cert(organization)
      ueber_cert = OpenSSL::X509::Certificate.new(self.ueber_cert(organization)[:cert])
      cert_store = OpenSSL::X509::Store.new
      cert_store.add_file SETTINGS[:katello][:candlepin][:ca_cert_file]
      organization.regenerate_ueber_cert unless cert_store.verify ueber_cert
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.0.3 app/services/cert/certs.rb
katello-4.0.2.1 app/services/cert/certs.rb
katello-4.0.2 app/services/cert/certs.rb