fluent-plugin-ssl-check 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f02f38e91d229dc73544825292eac6c885e1720ce93cc9a5c121746204437442
4
- data.tar.gz: 42f3a3d2369f699db149e92eeb93e0660bc95e4eb925fefdd6f7dc77e84e141b
3
+ metadata.gz: bd66e101f055ca5f4cf4d6ab29d548cb73df7783c9429171f03a397aaddd856f
4
+ data.tar.gz: 69fd54b23c4a88fa90565cf6bcb8d73990e96e0f42f869fd3fabf1ca16fa5f72
5
5
  SHA512:
6
- metadata.gz: 786757380f973b13d7f220a0c32759b57f28e2ae449ef55f51f639bf79c8a360b05afadf84521292c006a02ba408e8bb63cc50dd9e4a9a64a3436c95390a95ce
7
- data.tar.gz: 027f9042684d4114b3a18a12af0a29b629a7b7954c7f8c8b61726c51ba70c620b13617828c32a0df8120dc0f9e6a99dedc3c186e9b1a324e894f2ee7779ea732
6
+ metadata.gz: 04500e488c04750d2f480037aa80feb16baf8d7a23b9b01f1921bbe201510b3b35a5694703da018a43705786af6d95ce67d7ee40fc0e661cd1df42823b640e4f
7
+ data.tar.gz: 13da4ca2dd02dd8c9a983570097cfa30b12b0f7e9dd0f573762d440c366fe0e0afc9b67deebf8c735dc87eaf52d8b1915dc3728b3179aa4d3686c5cc9a64c652
data/.rubocop.yml CHANGED
@@ -27,8 +27,7 @@ Metrics/MethodLength:
27
27
  Max: 20
28
28
 
29
29
  Metrics/ParameterLists:
30
- Exclude:
31
- - test/helper.rb
30
+ Max: 6
32
31
 
33
32
  # Naming/MethodParameterName:
34
33
  # Exclude:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-ssl-check (2.0.1)
4
+ fluent-plugin-ssl-check (2.1.0)
5
5
  fluentd (>= 0.14.10, < 2)
6
6
 
7
7
  GEM
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'fluent-plugin-ssl-check'
8
- spec.version = '2.0.1'
8
+ spec.version = '2.1.0'
9
9
  spec.authors = ['Thomas Tych']
10
10
  spec.email = ['thomas.tych@gmail.com']
11
11
 
@@ -35,7 +35,8 @@ module Fluent
35
35
  DEFAULT_TAG = NAME
36
36
  DEFAULT_HOST = 'localhost'
37
37
  DEFAULT_PORT = 443
38
- DEFAULT_TIME = 600
38
+ DEFAULT_INTERVAL = 600
39
+ DEFAULT_SNI = true
39
40
  DEFAULT_TIMEOUT = 5
40
41
  DEFAULT_LOG_EVENTS = true
41
42
  DEFAULT_METRIC_EVENTS = false
@@ -47,11 +48,13 @@ module Fluent
47
48
  desc 'Host of the service to check'
48
49
  config_param :hosts, :array, default: [], value_type: :string
49
50
  desc 'Interval for the check execution'
50
- config_param :interval, :time, default: DEFAULT_TIME
51
+ config_param :interval, :time, default: DEFAULT_INTERVAL
51
52
  desc 'CA path to load'
52
53
  config_param :ca_path, :string, default: nil
53
54
  desc 'CA file to load'
54
55
  config_param :ca_file, :string, default: nil
56
+ desc 'SNI support'
57
+ config_param :sni, :bool, default: DEFAULT_SNI
55
58
 
56
59
  desc 'Timeout for check'
57
60
  config_param :timeout, :integer, default: DEFAULT_TIMEOUT
@@ -104,7 +107,7 @@ module Fluent
104
107
  ssl_client = SslClient.new(
105
108
  host: host, port: port,
106
109
  ca_path: ca_path, ca_file: ca_file,
107
- timeout: timeout
110
+ sni: sni, timeout: timeout
108
111
  )
109
112
  ssl_client.ssl_info
110
113
  end
@@ -211,13 +214,14 @@ module Fluent
211
214
  # ssl client
212
215
  # to check ssl status
213
216
  class SslClient
214
- attr_reader :host, :port, :ca_path, :ca_file, :timeout
217
+ attr_reader :host, :port, :ca_path, :ca_file, :sni, :timeout
215
218
 
216
- def initialize(host:, port:, ca_path: nil, ca_file: nil, timeout: 5)
219
+ def initialize(host:, port:, ca_path: nil, ca_file: nil, sni: true, timeout: 5)
217
220
  @host = host
218
221
  @port = port
219
222
  @ca_path = ca_path
220
223
  @ca_file = ca_file
224
+ @sni = sni
221
225
  @timeout = timeout
222
226
  end
223
227
 
@@ -227,6 +231,7 @@ module Fluent
227
231
  Timeout.timeout(timeout) do
228
232
  tcp_socket = TCPSocket.open(host, port)
229
233
  ssl_socket = OpenSSL::SSL::SSLSocket.new(tcp_socket, ssl_context)
234
+ ssl_socket.hostname = host if sni
230
235
  ssl_socket.connect
231
236
  ssl_socket.sysclose
232
237
  tcp_socket.close
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-ssl-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Tych
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-24 00:00:00.000000000 Z
11
+ date: 2023-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bump