class ManageIQ::ApplianceConsole::CertificateAuthority
Constants
- CFME_DIR
Attributes
ca_name[RW]
name of certificate authority
hostname[RW]
hostname of current machine
http[RW]
true if we should configure http endpoint
realm[RW]
verbose[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 19 def initialize(options = {}) options.each { |n, v| public_send("#{n}=", v) } @ca_name ||= "ipa" end
Public Instance Methods
activate()
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 33 def activate valid_environment? configure_http if http status_string end
ask_questions()
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 24 def ask_questions if ipa? self.principal = just_ask("IPA Server Principal", @principal) self.password = ask_for_password("IPA Server Principal Password", @password) end self.http = ask_yn("Configure certificate for http server", "Y") true end
complete?()
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 77 def complete? !status.values.detect { |v| v != ManageIQ::ApplianceConsole::Certificate::STATUS_COMPLETE } end
configure_http()
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 49 def configure_http cert = Certificate.new( :key_filename => "#{CFME_DIR}/server.cer.key", :cert_filename => "#{CFME_DIR}/server.cer", :root_filename => "#{CFME_DIR}/root.crt", :service => "HTTP", :extensions => %w(server), :ca_name => ca_name, :hostname => hostname, :owner => "apache.apache", ).request if cert.complete? say "configuring apache to use new certs" LinuxAdmin::Service.new("httpd").restart cert.enable_certmonger end self.http = cert.status end
ipa?()
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 81 def ipa? ca_name == "ipa" end
status()
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 69 def status {"http" => http}.delete_if { |_n, v| !v } end
status_string()
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 73 def status_string status.collect { |n, v| "#{n}: #{v}" }.join " " end
valid_environment?()
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 41 def valid_environment? if ipa? && !ExternalHttpdAuthentication.ipa_client_configured? raise ArgumentError, "ipa client not configured" end raise ArgumentError, "hostname needs to be defined" unless hostname end
Private Instance Methods
log() { || ... }
click to toggle source
# File lib/manageiq/appliance_console/certificate_authority.rb, line 87 def log say yield if verbose && block_given? end