fluent-plugin-ssl-check 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -2
- data/Gemfile.lock +1 -1
- data/README.md +5 -0
- data/fluent-plugin-ssl-check.gemspec +1 -1
- data/lib/fluent/plugin/in_ssl_check.rb +12 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd66e101f055ca5f4cf4d6ab29d548cb73df7783c9429171f03a397aaddd856f
|
|
4
|
+
data.tar.gz: 69fd54b23c4a88fa90565cf6bcb8d73990e96e0f42f869fd3fabf1ca16fa5f72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04500e488c04750d2f480037aa80feb16baf8d7a23b9b01f1921bbe201510b3b35a5694703da018a43705786af6d95ce67d7ee40fc0e661cd1df42823b640e4f
|
|
7
|
+
data.tar.gz: 13da4ca2dd02dd8c9a983570097cfa30b12b0f7e9dd0f573762d440c366fe0e0afc9b67deebf8c735dc87eaf52d8b1915dc3728b3179aa4d3686c5cc9a64c652
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
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
|
|
|
@@ -35,7 +35,8 @@ module Fluent
|
|
|
35
35
|
DEFAULT_TAG = NAME
|
|
36
36
|
DEFAULT_HOST = 'localhost'
|
|
37
37
|
DEFAULT_PORT = 443
|
|
38
|
-
|
|
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:
|
|
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.
|
|
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-
|
|
11
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bump
|