fluent-plugin-ssl-check 2.0.0 → 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: b2f7b5486c0f7706d4894b8095fdb61bae4ef4c13f737c50b0bd27c84f38d53d
4
- data.tar.gz: '0186c6d987c747656417d61517e49d45de4a871e2a58dbb27c39aefedd0f1760'
3
+ metadata.gz: bd66e101f055ca5f4cf4d6ab29d548cb73df7783c9429171f03a397aaddd856f
4
+ data.tar.gz: 69fd54b23c4a88fa90565cf6bcb8d73990e96e0f42f869fd3fabf1ca16fa5f72
5
5
  SHA512:
6
- metadata.gz: 6001e67a1e89cfad9cb37cc826e21b7af532c4ec12d2966fe3e0a3c790cec50ec5d028cd103b7bf105f0f38060db2e8de6f1eb285714d597b01dfe2e47f00a4d
7
- data.tar.gz: c61103f0171fda24ef6f8323a018f7c012795e258993e46132940b69bcb152e1fdba80ec416105eec93debfe542895a8d1211da006cbaab5d0a28eb3bd4ca233
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.0)
4
+ fluent-plugin-ssl-check (2.1.0)
5
5
  fluentd (>= 0.14.10, < 2)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -30,6 +30,11 @@ Options are:
30
30
  * interval: check every X seconds
31
31
  * ca_path: directory that contains CA files
32
32
  * ca_file: specify a CA file directly
33
+ * timeout: timeout for ssl check execution (5sec)
34
+ * log_events: emit log format (true)
35
+ * metric_events: emit metric format (false)
36
+ * event_prefix: metric event prefix for extra dimension
37
+ * timestamp_format: iso, epochmillis timestamp format (iso)
33
38
 
34
39
  If no port is specified with host, default port is 443.
35
40
 
@@ -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.0'
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
@@ -82,6 +85,8 @@ module Fluent
82
85
  def start
83
86
  super
84
87
 
88
+ timer_execute(:ssl_check_timer, 1, repeat: false, &method(:check)) if interval > 60
89
+
85
90
  timer_execute(:ssl_check_timer, interval, repeat: true, &method(:check))
86
91
  end
87
92
 
@@ -102,7 +107,7 @@ module Fluent
102
107
  ssl_client = SslClient.new(
103
108
  host: host, port: port,
104
109
  ca_path: ca_path, ca_file: ca_file,
105
- timeout: timeout
110
+ sni: sni, timeout: timeout
106
111
  )
107
112
  ssl_client.ssl_info
108
113
  end
@@ -209,13 +214,14 @@ module Fluent
209
214
  # ssl client
210
215
  # to check ssl status
211
216
  class SslClient
212
- attr_reader :host, :port, :ca_path, :ca_file, :timeout
217
+ attr_reader :host, :port, :ca_path, :ca_file, :sni, :timeout
213
218
 
214
- 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)
215
220
  @host = host
216
221
  @port = port
217
222
  @ca_path = ca_path
218
223
  @ca_file = ca_file
224
+ @sni = sni
219
225
  @timeout = timeout
220
226
  end
221
227
 
@@ -225,6 +231,7 @@ module Fluent
225
231
  Timeout.timeout(timeout) do
226
232
  tcp_socket = TCPSocket.open(host, port)
227
233
  ssl_socket = OpenSSL::SSL::SSLSocket.new(tcp_socket, ssl_context)
234
+ ssl_socket.hostname = host if sni
228
235
  ssl_socket.connect
229
236
  ssl_socket.sysclose
230
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.0
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-17 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