module Proxy::OpenSCAP

Constants

HTTP_ERRORS
VERSION

Public Class Methods

common_name(request) click to toggle source
# File lib/smart_proxy_openscap/openscap_lib.rb, line 44
def self.common_name(request)
  client_cert = request.env['SSL_CLIENT_CERT']
  raise Proxy::Error::Unauthorized, "Client certificate required!" if client_cert.to_s.empty?

  begin
    client_cert = OpenSSL::X509::Certificate.new(client_cert)
  rescue OpenSSL::OpenSSLError => e
    raise Proxy::Error::Unauthorized, e.message
  end
  cn = client_cert.subject.to_a.detect { |name, value| name == 'CN' }
  cn = cn[1] unless cn.nil?
  raise Proxy::Error::Unauthorized, "Common Name not found in the certificate" unless cn
  cn
end
fullpath(path = Proxy::OpenSCAP::Plugin.settings.contentdir) click to toggle source
# File lib/smart_proxy_openscap/openscap_lib.rb, line 65
def self.fullpath(path = Proxy::OpenSCAP::Plugin.settings.contentdir)
  pathname = Pathname.new(path)
  pathname.relative? ? pathname.expand_path(Sinatra::Base.root).to_s : path
end
plugin_settings() click to toggle source
# File lib/smart_proxy_openscap/openscap_lib.rb, line 35
def self.plugin_settings
  @@settings ||= OpenStruct.new(read_settings)
end
read_settings() click to toggle source
# File lib/smart_proxy_openscap/openscap_lib.rb, line 39
def self.read_settings
  ::Proxy::OpenSCAP::Plugin.default_settings.merge(
    YAML.load_file(File.join(::Proxy::SETTINGS.settings_directory, ::Proxy::OpenSCAP::Plugin.settings_file)))
end
send_spool_to_foreman(loaded_settings) click to toggle source
# File lib/smart_proxy_openscap/openscap_lib.rb, line 59
def self.send_spool_to_foreman(loaded_settings)
  arf_dir = File.join(loaded_settings.spooldir, "/arf")
  return unless File.exist? arf_dir
  SpoolForwarder.new(loaded_settings).post_arf_from_spool(arf_dir)
end