# File lib/smart_proxy_openscap/openscap_lib.rb, line 29 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
# File lib/smart_proxy_openscap/openscap_lib.rb, line 50 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
# File lib/smart_proxy_openscap/openscap_lib.rb, line 44 def self.send_spool_to_foreman arf_dir = File.join(Proxy::OpenSCAP::Plugin.settings.spooldir, "/arf") return unless File.exist? arf_dir SpoolForwarder.new.post_arf_from_spool(arf_dir) end