Class: Fluent::Plugin::SslCheckInput::SslInfo
- Inherits:
-
Object
- Object
- Fluent::Plugin::SslCheckInput::SslInfo
- Defined in:
- lib/fluent/plugin/in_ssl_check.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.
-
#port ⇒ Object
Returns the value of attribute port.
-
#ssl_version ⇒ Object
Returns the value of attribute ssl_version.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #error_class ⇒ Object
- #expire_in_days ⇒ Object
-
#initialize(host: nil, port: nil, cert: nil, cert_chain: nil, ssl_version: nil, error: nil, time: Time.now) ⇒ SslInfo
constructor
rubocop:disable Metrics/ParameterLists.
- #not_after ⇒ Object
- #serial ⇒ Object
- #status ⇒ Object
-
#subject_s ⇒ Object
rubocop:enable Metrics/ParameterLists.
Constructor Details
#initialize(host: nil, port: nil, cert: nil, cert_chain: nil, ssl_version: nil, error: nil, time: Time.now) ⇒ SslInfo
rubocop:disable Metrics/ParameterLists
197 198 199 200 201 202 203 204 205 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 197 def initialize(host: nil, port: nil, cert: nil, cert_chain: nil, ssl_version: nil, error: nil, time: Time.now) @host = host @port = port @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.
194 195 196 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 194 def cert @cert end |
#cert_chain ⇒ Object
Returns the value of attribute cert_chain.
194 195 196 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 194 def cert_chain @cert_chain end |
#error ⇒ Object
Returns the value of attribute error.
194 195 196 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 194 def error @error end |
#host ⇒ Object
Returns the value of attribute host.
194 195 196 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 194 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
194 195 196 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 194 def port @port end |
#ssl_version ⇒ Object
Returns the value of attribute ssl_version.
194 195 196 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 194 def ssl_version @ssl_version end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
193 194 195 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 193 def time @time end |
Instance Method Details
#error_class ⇒ Object
235 236 237 238 239 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 235 def error_class return unless error error.class.to_s end |
#expire_in_days ⇒ Object
212 213 214 215 216 217 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 212 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
219 220 221 222 223 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 219 def not_after return unless cert cert.not_after.iso8601(3) end |
#serial ⇒ Object
225 226 227 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 225 def serial cert&.serial&.to_s(16)&.downcase end |
#status ⇒ Object
229 230 231 232 233 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 229 def status return KO if error OK end |
#subject_s ⇒ Object
rubocop:enable Metrics/ParameterLists
208 209 210 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 208 def subject_s cert.subject.to_s if cert&.subject end |