Class: Fluent::Plugin::SslCheck::SslInfo
- Inherits:
-
Object
- Object
- Fluent::Plugin::SslCheck::SslInfo
- Defined in:
- lib/fluent/plugin/ssl_check/ssl_info.rb
Overview
ssl info
to encapsulate extracted ssl information
Constant Summary collapse
- OK =
1
- KO =
0
Instance Attribute Summary collapse
-
#cert ⇒ Object
Returns the value of attribute cert.
-
#cert_chain ⇒ Object
Returns the value of attribute cert_chain.
-
#error ⇒ Object
Returns the value of attribute error.
-
#host ⇒ Object
Returns the value of attribute host.
-
#path ⇒ Object
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
-
#ssl_version ⇒ Object
Returns the value of attribute ssl_version.
Instance Method Summary collapse
- #error_class ⇒ Object
- #expire_in_days ⇒ Object
-
#initialize(host: nil, port: nil, path: nil, cert: nil, cert_chain: nil, ssl_version: nil, error: nil, time: nil) ⇒ SslInfo
constructor
rubocop:disable Metrics/ParameterLists.
- #not_after ⇒ Object
- #serial ⇒ Object
- #status ⇒ Object
-
#subject_s ⇒ Object
rubocop:enable Metrics/ParameterLists.
- #time ⇒ Object
- #time_utc ⇒ Object
Constructor Details
#initialize(host: nil, port: nil, path: nil, cert: nil, cert_chain: nil, ssl_version: nil, error: nil, time: nil) ⇒ SslInfo
rubocop:disable Metrics/ParameterLists
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 17 def initialize(host: nil, port: nil, path: nil, cert: nil, cert_chain: nil, ssl_version: nil, error: nil, time: nil) @host = host @port = port @path = path @cert = cert @cert_chain = cert_chain @ssl_version = ssl_version @error = error @time = time end |
Instance Attribute Details
#cert ⇒ Object
Returns the value of attribute cert.
14 15 16 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 14 def cert @cert end |
#cert_chain ⇒ Object
Returns the value of attribute cert_chain.
14 15 16 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 14 def cert_chain @cert_chain end |
#error ⇒ Object
Returns the value of attribute error.
14 15 16 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 14 def error @error end |
#host ⇒ Object
Returns the value of attribute host.
14 15 16 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 14 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
14 15 16 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 14 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
14 15 16 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 14 def port @port end |
#ssl_version ⇒ Object
Returns the value of attribute ssl_version.
14 15 16 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 14 def ssl_version @ssl_version end |
Instance Method Details
#error_class ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 65 def error_class return unless error return error if error.is_a?(String) error.class.to_s end |
#expire_in_days ⇒ Object
34 35 36 37 38 39 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 34 def expire_in_days return unless cert&.not_after expire_in = cert.not_after ((expire_in - time) / 3600 / 24).to_i end |
#not_after ⇒ Object
41 42 43 44 45 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 41 def not_after return unless cert cert.not_after.iso8601(3) end |
#serial ⇒ Object
47 48 49 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 47 def serial cert&.serial&.to_s(16)&.downcase end |
#status ⇒ Object
51 52 53 54 55 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 51 def status return KO if error OK end |
#subject_s ⇒ Object
rubocop:enable Metrics/ParameterLists
30 31 32 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 30 def subject_s cert.subject.to_utf8 if cert&.subject end |
#time ⇒ Object
57 58 59 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 57 def time @time ||= Time.now.utc end |
#time_utc ⇒ Object
61 62 63 |
# File 'lib/fluent/plugin/ssl_check/ssl_info.rb', line 61 def time_utc time.utc end |