Class: ForemanX509::Certificate
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ForemanX509::Certificate
show all
- Extended by:
- FriendlyId
- Includes:
- Digest, Extensions, Subject
- Defined in:
- app/models/foreman_x509/certificate.rb
Constant Summary
Constants included
from Extensions
Extensions::EXTENSION_ENTRY_FORMAT
Instance Method Summary
collapse
Methods included from Digest
#digest
Methods included from Extensions
#extension_value_from_section, #extensions_from_section
Methods included from Subject
#subject, #subject_from_certificate, #subject_from_configuration
Instance Method Details
#active? ⇒ Boolean
36
37
38
39
40
|
# File 'app/models/foreman_x509/certificate.rb', line 36
def active?
return false if certificate.nil?
(not_before..not_after).include? Time.now
end
|
#can_self_sign? ⇒ Boolean
29
30
31
32
33
34
|
# File 'app/models/foreman_x509/certificate.rb', line 29
def can_self_sign?
return false if configuration.nil?
section = configuration.get_value('req', 'x509_extensions')
configuration[section].present?
end
|
#certificate_extensions_section ⇒ Object
54
55
56
|
# File 'app/models/foreman_x509/certificate.rb', line 54
def certificate_extensions_section
configuration.get_value('req', 'x509_extensions')
end
|
#key_bits ⇒ Object
58
59
60
61
|
# File 'app/models/foreman_x509/certificate.rb', line 58
def key_bits
return 4096 if configuration.get_value('req', 'default_bits').nil?
configuration.get_value('req', 'default_bits').to_i
end
|
#not_after ⇒ Object
46
47
48
|
# File 'app/models/foreman_x509/certificate.rb', line 46
def not_after
certificate.not_after unless certificate.nil?
end
|
#not_before ⇒ Object
42
43
44
|
# File 'app/models/foreman_x509/certificate.rb', line 42
def not_before
certificate.not_before unless certificate.nil?
end
|
#requested_extensions ⇒ Object
50
51
52
|
# File 'app/models/foreman_x509/certificate.rb', line 50
def requested_extensions
extensions_from_section(configuration.get_value('req', 'req_extensions'))
end
|