Class: Net::Openvpn::Generators::Keys::Authority
- Inherits:
-
Base
- Object
- Base
- Net::Openvpn::Generators::Keys::Authority
show all
- Defined in:
- lib/net/openvpn/generators/keys/authority.rb
Instance Attribute Summary
Attributes inherited from Base
#props
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#exist?, #revoke!, #valid?
Constructor Details
#initialize(**props) ⇒ Authority
Returns a new instance of Authority.
7
8
9
|
# File 'lib/net/openvpn/generators/keys/authority.rb', line 7
def initialize(**props)
super(nil, props)
end
|
Class Method Details
.exist? ⇒ Boolean
31
32
33
|
# File 'lib/net/openvpn/generators/keys/authority.rb', line 31
def self.exist?
Authority.new.exist?
end
|
Instance Method Details
#filepaths ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/net/openvpn/generators/keys/authority.rb', line 23
def filepaths
[
"#{@props[:key_dir]}/ca.key",
"#{@props[:key_dir]}/ca.crt",
"#{@props[:key_dir]}/dh#{@props[:key_size]}.pem"
]
end
|
#generate ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/net/openvpn/generators/keys/authority.rb', line 11
def generate
@key_dir.exist? or raise Errors::KeyGeneration, "Key directory has not been generated yet"
!exist? or raise Errors::KeyGeneration, "Authority already exists!"
FileUtils.cd(@props[:easy_rsa]) do
system "#{cli_prop_vars} ./pkitool --initca"
system "#{cli_prop_vars} ./build-dh"
end
true
end
|