Class: MyPKI::CA
Constant Summary
collapse
- DEFAULT_PATH =
'/etc/pki/tls/certs/ca-bundle.crt'
Instance Attribute Summary
#options
Instance Method Summary
collapse
included, #initialize
Methods included from Prompter
#file_prompt, #pass_prompt, #prompter
Instance Method Details
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/mypki/loaders/ca.rb', line 10
def configure config, path
if File.readable? DEFAULT_PATH
config['ca'] = DEFAULT_PATH
elsif config['ca'].nil?
prompt = "Path to CA chains (press enter to skip): "
path = file_prompt prompt, required: false
if path.nil?
config['ca'] = ''
else
if File.directory? path
fail "'#{path}' is a directory"
elsif not File.readable? path
fail "Cannot read '#{path}'"
else
config['ca'] = path
end
end
end
end
|
#load(config) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/mypki/loaders/ca.rb', line 31
def load config
unless config['ca'].empty?
Instance.cert_store = OpenSSL::X509::Store.new
Instance.cert_store.add_file config['ca']
Instance.verify_mode = OpenSSL::SSL::VERIFY_PEER
end
end
|