logstash-input-beats 6.4.4-java → 6.6.0-java
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/CHANGELOG.md +8 -0
- data/VERSION +1 -1
- data/docs/index.asciidoc +157 -29
- data/lib/logstash/inputs/beats/message_listener.rb +6 -3
- data/lib/logstash/inputs/beats.rb +208 -55
- data/lib/logstash-input-beats_jars.rb +1 -1
- data/lib/tasks/test.rake +1 -1
- data/logstash-input-beats.gemspec +2 -0
- data/spec/inputs/beats_spec.rb +353 -29
- data/spec/integration/filebeat_spec.rb +4 -4
- data/spec/integration/logstash_forwarder_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/vendor/jar-dependencies/org/logstash/beats/logstash-input-beats/{6.4.4/logstash-input-beats-6.4.4.jar → 6.6.0/logstash-input-beats-6.6.0.jar} +0 -0
- metadata +31 -3
data/spec/inputs/beats_spec.rb
CHANGED
@@ -48,10 +48,10 @@ describe LogStash::Inputs::Beats do
|
|
48
48
|
|
49
49
|
context "with ssl enabled" do
|
50
50
|
|
51
|
-
let(:config) { { "
|
51
|
+
let(:config) { { "ssl_enabled" => true, "port" => port, "ssl_key" => certificate.ssl_key, "ssl_certificate" => certificate.ssl_cert } }
|
52
52
|
|
53
53
|
context "without certificate configuration" do
|
54
|
-
let(:config) { { "port" => 0, "
|
54
|
+
let(:config) { { "port" => 0, "ssl_enabled" => true, "ssl_key" => certificate.ssl_key, "type" => "example" } }
|
55
55
|
|
56
56
|
it "should fail to register the plugin with ConfigurationError" do
|
57
57
|
plugin = LogStash::Inputs::Beats.new(config)
|
@@ -60,7 +60,7 @@ describe LogStash::Inputs::Beats do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
context "without key configuration" do
|
63
|
-
let(:config) { { "port" => 0, "
|
63
|
+
let(:config) { { "port" => 0, "ssl_enabled" => true, "ssl_certificate" => certificate.ssl_cert, "type" => "example" } }
|
64
64
|
it "should fail to register the plugin with ConfigurationError" do
|
65
65
|
plugin = LogStash::Inputs::Beats.new(config)
|
66
66
|
expect { plugin.register }.to raise_error(LogStash::ConfigurationError)
|
@@ -69,7 +69,7 @@ describe LogStash::Inputs::Beats do
|
|
69
69
|
|
70
70
|
context "with invalid key configuration" do
|
71
71
|
let(:p12_key) { certificate.p12_key }
|
72
|
-
let(:config) { { "port" => 0, "
|
72
|
+
let(:config) { { "port" => 0, "ssl_enabled" => true, "ssl_certificate" => certificate.ssl_cert, "ssl_key" => p12_key } }
|
73
73
|
it "should fail to register the plugin" do
|
74
74
|
plugin = LogStash::Inputs::Beats.new(config)
|
75
75
|
expect( plugin.logger ).to receive(:error) do |msg, opts|
|
@@ -93,34 +93,132 @@ describe LogStash::Inputs::Beats do
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
context "
|
97
|
-
|
98
|
-
let(:config) { super().merge("ssl_verify_mode" => "peer") }
|
96
|
+
context "deprecated ssl_verify_mode set to 'none'" do
|
97
|
+
let(:config) { super().merge("ssl_verify_mode" => "none") }
|
99
98
|
|
100
|
-
|
99
|
+
context "and ssl_certificate_authorities is set" do
|
100
|
+
let(:config) { super().merge("ssl_certificate_authorities" => [certificate.ssl_cert]) }
|
101
|
+
it "should ignore the ssl_verify_mode and use force_peer" do
|
102
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
103
|
+
plugin.register
|
104
|
+
context_builder = plugin.send(:new_ssl_context_builder)
|
105
|
+
expect(context_builder.isClientAuthenticationRequired()).to be_truthy
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context "ssl_client_authentication" do
|
111
|
+
context "normalized from ssl_verify_mode 'none'" do
|
112
|
+
let(:config) { super().merge("ssl_verify_mode" => "none") }
|
113
|
+
|
114
|
+
it "should transform the value to 'none'" do
|
115
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
116
|
+
plugin.register
|
117
|
+
|
118
|
+
expect(plugin.params).to match hash_including("ssl_client_authentication" => "none")
|
119
|
+
expect(plugin.instance_variable_get(:@ssl_client_authentication)).to eql("none")
|
120
|
+
end
|
121
|
+
|
122
|
+
context "and ssl_certificate_authorities is set" do
|
123
|
+
let(:config) { super().merge("ssl_certificate_authorities" => [certificate.ssl_cert]) }
|
124
|
+
it "should not raise an error" do
|
125
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
126
|
+
expect { plugin.register }.to_not raise_error
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context "normalized from ssl_verify_mode 'peer'" do
|
132
|
+
let(:config) { super().merge("ssl_verify_mode" => "peer", "ssl_certificate_authorities" => [certificate.ssl_cert]) }
|
133
|
+
|
134
|
+
it 'should transform the value to OPTIONAL' do
|
135
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
136
|
+
plugin.register
|
137
|
+
|
138
|
+
expect(plugin.params).to match hash_including("ssl_client_authentication" => "optional")
|
139
|
+
expect(plugin.instance_variable_get(:@ssl_client_authentication)).to eql("optional")
|
140
|
+
end
|
141
|
+
|
142
|
+
context "with no ssl_certificate_authorities set " do
|
143
|
+
let(:config) { super().reject { |key| "ssl_certificate_authorities".eql?(key) } }
|
144
|
+
it "raise a configuration error" do
|
145
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
146
|
+
expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when ssl_verify_mode => 'peer' is configured")
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context "normalized from ssl_verify_mode 'force_peer'" do
|
152
|
+
let(:config) { super().merge("ssl_verify_mode" => "force_peer", "ssl_certificate_authorities" => [certificate.ssl_cert]) }
|
153
|
+
|
154
|
+
it "should transform the value to 'required'" do
|
101
155
|
plugin = LogStash::Inputs::Beats.new(config)
|
102
|
-
|
156
|
+
plugin.register
|
157
|
+
|
158
|
+
expect(plugin.params).to match hash_including("ssl_client_authentication" => "required")
|
159
|
+
expect(plugin.instance_variable_get(:@ssl_client_authentication)).to eql("required")
|
103
160
|
end
|
104
161
|
|
105
|
-
|
106
|
-
config.
|
162
|
+
context "with no ssl_certificate_authorities set " do
|
163
|
+
let(:config) { super().reject { |key| "ssl_certificate_authorities".eql?(key) } }
|
164
|
+
it "raise a configuration error" do
|
165
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
166
|
+
expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when ssl_verify_mode => 'force_peer' is configured")
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
context "configured to 'none'" do
|
172
|
+
let(:config) { super().merge("ssl_client_authentication" => "none") }
|
173
|
+
|
174
|
+
it "doesn't raise an error when certificate_authorities is not set" do
|
107
175
|
plugin = LogStash::Inputs::Beats.new(config)
|
108
|
-
expect {plugin.register}.
|
176
|
+
expect {plugin.register}.to_not raise_error
|
177
|
+
end
|
178
|
+
|
179
|
+
context "with certificate_authorities set" do
|
180
|
+
let(:config) { super().merge("ssl_certificate_authorities" => [certificate.ssl_cert]) }
|
181
|
+
|
182
|
+
it "raise a configuration error" do
|
183
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
184
|
+
expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "Configuring ssl_certificate_authorities requires ssl_client_authentication => to be configured with 'optional' or 'required'")
|
185
|
+
end
|
109
186
|
end
|
110
187
|
end
|
111
188
|
|
112
|
-
context "
|
113
|
-
let(:config) { super().merge("
|
189
|
+
context "configured to 'required'" do
|
190
|
+
let(:config) { super().merge("ssl_client_authentication" => "required") }
|
114
191
|
|
115
192
|
it "raise a ConfigurationError when certificate_authorities is not set" do
|
116
193
|
plugin = LogStash::Inputs::Beats.new(config)
|
117
|
-
expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when
|
194
|
+
expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when ssl_client_authentication => 'required' is configured")
|
118
195
|
end
|
119
196
|
|
120
|
-
|
121
|
-
config.merge
|
197
|
+
context "with certificate_authorities set" do
|
198
|
+
let(:config) { super().merge("ssl_certificate_authorities" => [certificate.ssl_cert]) }
|
199
|
+
|
200
|
+
it "doesn't raise a configuration error" do
|
201
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
202
|
+
expect {plugin.register}.not_to raise_error
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context "configured to 'optional'" do
|
208
|
+
let(:config) { super().merge("ssl_client_authentication" => "optional") }
|
209
|
+
|
210
|
+
it "raise a ConfigurationError when certificate_authorities is not set" do
|
122
211
|
plugin = LogStash::Inputs::Beats.new(config)
|
123
|
-
expect {plugin.register}.
|
212
|
+
expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when ssl_client_authentication => 'optional' is configured")
|
213
|
+
end
|
214
|
+
|
215
|
+
context "with certificate_authorities set" do
|
216
|
+
let(:config) { super().merge("ssl_certificate_authorities" => [certificate.ssl_cert]) }
|
217
|
+
|
218
|
+
it "doesn't raise a configuration error" do
|
219
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
220
|
+
expect {plugin.register}.not_to raise_error
|
221
|
+
end
|
124
222
|
end
|
125
223
|
end
|
126
224
|
|
@@ -157,12 +255,28 @@ describe LogStash::Inputs::Beats do
|
|
157
255
|
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_supported_protocols.?/i
|
158
256
|
end
|
159
257
|
end
|
258
|
+
|
259
|
+
context "with ssl_client_authentication and ssl_verify_mode set" do
|
260
|
+
let(:config) { super().merge("ssl_verify_mode" => "none", "ssl_client_authentication" => "none") }
|
261
|
+
it "raise a configuration error" do
|
262
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
263
|
+
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_client_authentication.?/i
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
context "with ssl and ssl_enabled set" do
|
269
|
+
let(:config) { super().merge("ssl" => true) }
|
270
|
+
it "raise a configuration error" do
|
271
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
272
|
+
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_enabled.?/i
|
273
|
+
end
|
160
274
|
end
|
161
275
|
end
|
162
276
|
|
163
277
|
context "with ssl disabled" do
|
164
278
|
context "and certificate configuration" do
|
165
|
-
let(:config) { { "port" => 0, "
|
279
|
+
let(:config) { { "port" => 0, "ssl_enabled" => false, "ssl_certificate" => certificate.ssl_cert, "type" => "example", "tags" => "Beats" } }
|
166
280
|
|
167
281
|
it "should not fail" do
|
168
282
|
plugin = LogStash::Inputs::Beats.new(config)
|
@@ -171,7 +285,7 @@ describe LogStash::Inputs::Beats do
|
|
171
285
|
end
|
172
286
|
|
173
287
|
context "and certificate key configuration" do
|
174
|
-
let(:config) {{ "port" => 0, "
|
288
|
+
let(:config) {{ "port" => 0, "ssl_enabled" => false, "ssl_key" => certificate.ssl_key, "type" => "example", "tags" => "beats" }}
|
175
289
|
|
176
290
|
it "should not fail" do
|
177
291
|
plugin = LogStash::Inputs::Beats.new(config)
|
@@ -180,13 +294,25 @@ describe LogStash::Inputs::Beats do
|
|
180
294
|
end
|
181
295
|
|
182
296
|
context "and no certificate or key configured" do
|
183
|
-
let(:config) {{ "
|
297
|
+
let(:config) {{ "ssl_enabled" => false, "port" => 0, "type" => "example", "tags" => "beats" }}
|
184
298
|
|
185
299
|
it "should work just fine" do
|
186
300
|
plugin = LogStash::Inputs::Beats.new(config)
|
187
301
|
expect {plugin.register}.not_to raise_error
|
188
302
|
end
|
189
303
|
end
|
304
|
+
|
305
|
+
context "and `ssl_` settings provided" do
|
306
|
+
let(:config) { { "port" => 0, "ssl_enabled" => false, "ssl_certificate" => certificate.ssl_cert, "ssl_client_authentication" => "none", "cipher_suites" => ["FOO"] } }
|
307
|
+
|
308
|
+
it "should warn about not using the configs" do
|
309
|
+
plugin = LogStash::Inputs::Beats.new(config)
|
310
|
+
expect( plugin.logger ).to receive(:warn).with('Configured SSL settings are not used when `ssl_enabled` is set to `false`: ["ssl_certificate", "ssl_client_authentication", "cipher_suites"]')
|
311
|
+
|
312
|
+
plugin.register
|
313
|
+
|
314
|
+
end
|
315
|
+
end
|
190
316
|
end
|
191
317
|
|
192
318
|
context "with multiline codec" do
|
@@ -200,12 +326,195 @@ describe LogStash::Inputs::Beats do
|
|
200
326
|
expect { plugin.register }.to raise_error(LogStash::ConfigurationError, "Multiline codec with beats input is not supported. Please refer to the beats documentation for how to best manage multiline data. See https://www.elastic.co/guide/en/beats/filebeat/current/multiline-examples.html")
|
201
327
|
end
|
202
328
|
end
|
329
|
+
|
330
|
+
context "enrich configuration" do
|
331
|
+
# We define a shared example for each enrichment type that can independently
|
332
|
+
# validate whether that enrichment is effectively enabled or disabled.
|
333
|
+
# - "#{enrichment} enabled"
|
334
|
+
# - "#{enrichment} disabled"
|
335
|
+
|
336
|
+
let(:registered_plugin) { plugin.tap(&:register) }
|
337
|
+
|
338
|
+
shared_examples "source_metadata enabled" do
|
339
|
+
it "is configured to enrich source metadata" do
|
340
|
+
expect(registered_plugin.include_source_metadata).to be true
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
shared_examples "source_metadata disabled" do
|
345
|
+
it "is configured to NOT enrich source metadata" do
|
346
|
+
expect(registered_plugin.include_source_metadata).to be false
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
shared_examples "include codec tag" do
|
351
|
+
it "is configured to include the codec tag" do
|
352
|
+
expect(registered_plugin.include_codec_tag).to be true
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
shared_examples "exclude codec tag" do
|
357
|
+
it "is configured to NOT include the codec tag" do
|
358
|
+
expect(registered_plugin.include_codec_tag).to be false
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
shared_examples "default codec configured to avoid metadata" do
|
363
|
+
it "configures the default codec to NOT enrich codec metadata" do
|
364
|
+
fail("spec setup error: not compatible with explicitly-given codec") if config.include?('codec')
|
365
|
+
# note: disabling ECS is an _implementation detail_ of how we prevent
|
366
|
+
# the codec from enriching the event with [event][original]
|
367
|
+
expect(registered_plugin.codec.original_params).to include('ecs_compatibility' => 'disabled')
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
shared_examples "codec is untouched" do
|
372
|
+
it "does NOT configure the codec to avoid enriching codec metadata" do
|
373
|
+
# note: disabling ECS is an _implementation detail_ of how we prevent
|
374
|
+
# the codec from enriching the event with [event][original], so we ensure
|
375
|
+
# the absence of the setting.
|
376
|
+
expect(registered_plugin.codec.original_params).to_not include('ecs_compatibility')
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
shared_examples "codec_metadata enabled" do
|
381
|
+
include_examples "include codec tag"
|
382
|
+
include_examples "codec is untouched"
|
383
|
+
end
|
384
|
+
|
385
|
+
shared_examples "codec_metadata disabled" do
|
386
|
+
include_examples "exclude codec tag"
|
387
|
+
include_examples "default codec configured to avoid metadata"
|
388
|
+
|
389
|
+
context "with an explicitly-provided codec" do
|
390
|
+
let(:config) { super().merge("codec" => "plain") }
|
391
|
+
|
392
|
+
include_examples "exclude codec tag"
|
393
|
+
include_examples "codec is untouched"
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
shared_examples "ssl_peer_metadata enabled" do
|
398
|
+
it "is configured to enrich ssl_peer_metadata" do
|
399
|
+
expect(registered_plugin.ssl_peer_metadata).to be_truthy
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
shared_examples "ssl_peer_metadata disabled" do
|
404
|
+
it "is configured to NOT enrich ssl_peer_metadata" do
|
405
|
+
expect(registered_plugin.ssl_peer_metadata).to be_falsey
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
shared_examples "reject deprecated enrichment flags" do
|
410
|
+
context "with deprecated `ssl_peer_metadata`" do
|
411
|
+
let(:config) { super().merge("ssl_peer_metadata" => true) }
|
412
|
+
it 'rejects the configuration with a helpful error message' do
|
413
|
+
expect { plugin.register }.to raise_exception(LogStash::ConfigurationError, "both `enrich` and (deprecated) ssl_peer_metadata were provided; use only `enrich`")
|
414
|
+
end
|
415
|
+
end
|
416
|
+
context "with deprecated `include_codec_tag`" do
|
417
|
+
let(:config) { super().merge("include_codec_tag" => false) }
|
418
|
+
it 'rejects the configuration with a helpful error message' do
|
419
|
+
expect { plugin.register }.to raise_exception(LogStash::ConfigurationError, "both `enrich` and (deprecated) include_codec_tag were provided; use only `enrich`")
|
420
|
+
end
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
context "when `enrich` is NOT provided" do
|
425
|
+
# validate defaults
|
426
|
+
include_examples "codec_metadata enabled"
|
427
|
+
include_examples "source_metadata enabled"
|
428
|
+
include_examples "ssl_peer_metadata disabled"
|
429
|
+
|
430
|
+
# validate interaction with deprecated settings
|
431
|
+
context "with deprecated `ssl_peer_metadata => true`" do
|
432
|
+
let(:config) { super().merge("ssl_peer_metadata" => true) }
|
433
|
+
|
434
|
+
# intended delta
|
435
|
+
include_examples "ssl_peer_metadata enabled"
|
436
|
+
|
437
|
+
# ensure no side-effects
|
438
|
+
include_examples "codec_metadata enabled"
|
439
|
+
include_examples "source_metadata enabled"
|
440
|
+
end
|
441
|
+
|
442
|
+
context "with deprecated `include_codec_tag => false`" do
|
443
|
+
let(:config) { super().merge("include_codec_tag" => false) }
|
444
|
+
|
445
|
+
# intended delta
|
446
|
+
include_examples "exclude codec tag"
|
447
|
+
include_examples "codec is untouched"
|
448
|
+
|
449
|
+
# ensure no side-effects
|
450
|
+
include_examples "source_metadata enabled"
|
451
|
+
include_examples "ssl_peer_metadata disabled"
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
455
|
+
# validate aliases
|
456
|
+
context "alias resolution" do
|
457
|
+
context "with alias `enrich => all`" do
|
458
|
+
let(:config) { super().merge("enrich" => "all") }
|
459
|
+
|
460
|
+
include_examples "codec_metadata enabled"
|
461
|
+
include_examples "source_metadata enabled"
|
462
|
+
include_examples "ssl_peer_metadata enabled"
|
463
|
+
|
464
|
+
include_examples "reject deprecated enrichment flags"
|
465
|
+
end
|
466
|
+
|
467
|
+
context "with alias `enrich => none`" do
|
468
|
+
let(:config) { super().merge("enrich" => "none") }
|
469
|
+
|
470
|
+
include_examples "codec_metadata disabled"
|
471
|
+
include_examples "source_metadata disabled"
|
472
|
+
include_examples "ssl_peer_metadata disabled"
|
473
|
+
|
474
|
+
include_examples "reject deprecated enrichment flags"
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
available_enrichments = %w(
|
479
|
+
codec_metadata
|
480
|
+
source_metadata
|
481
|
+
ssl_peer_metadata
|
482
|
+
)
|
483
|
+
shared_examples "enrich activations" do |enrich_arg|
|
484
|
+
activated = Array(enrich_arg)
|
485
|
+
context "with `enrich => #{enrich_arg}`" do
|
486
|
+
let(:config) { super().merge("enrich" => enrich_arg) }
|
487
|
+
|
488
|
+
available_enrichments.each do |enrichment|
|
489
|
+
include_examples "#{enrichment} #{activated.include?(enrichment) ? 'enabled' : 'disabled'}"
|
490
|
+
end
|
491
|
+
|
492
|
+
include_examples "reject deprecated enrichment flags"
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
# ensure explicit empty-list does not activate defaults
|
497
|
+
include_examples "enrich activations", []
|
498
|
+
|
499
|
+
# ensure single enrichment does not activate others
|
500
|
+
available_enrichments.each do |single_active_enrichment|
|
501
|
+
include_examples "enrich activations", single_active_enrichment # single
|
502
|
+
include_examples "enrich activations", [single_active_enrichment] # list-of-one
|
503
|
+
end
|
504
|
+
|
505
|
+
# ensure any combination of two enrichment categories activates only those two
|
506
|
+
available_enrichments.combination(2) do |active_enrichments|
|
507
|
+
include_examples "enrich activations", active_enrichments
|
508
|
+
end
|
509
|
+
end
|
203
510
|
end
|
204
511
|
|
205
512
|
context "tls meta-data" do
|
206
513
|
let(:config) do
|
207
514
|
super().merge(
|
208
515
|
"host" => host,
|
516
|
+
"ssl_enabled" => true,
|
517
|
+
"ssl_verify_mode" => 'force_peer',
|
209
518
|
"ssl_peer_metadata" => true,
|
210
519
|
"ssl_certificate_authorities" => [ certificate.ssl_cert ],
|
211
520
|
"ecs_compatibility" => 'disabled'
|
@@ -266,18 +575,33 @@ describe LogStash::Inputs::Beats do
|
|
266
575
|
org.logstash.beats.Message.new(0, java.util.HashMap.new('foo' => 'bar'))
|
267
576
|
end
|
268
577
|
|
269
|
-
|
270
|
-
|
578
|
+
context 'with ssl enabled' do
|
579
|
+
it 'sets tls fields' do
|
580
|
+
@message_listener.onNewMessage(ctx, message)
|
581
|
+
|
582
|
+
expect( queue.size ).to be 1
|
583
|
+
expect( event = queue.pop ).to be_a LogStash::Event
|
584
|
+
|
585
|
+
expect( event.get('[@metadata][tls_peer][status]') ).to eql 'verified'
|
586
|
+
|
587
|
+
expect( event.get('[@metadata][tls_peer][protocol]') ).to eql 'TLS-Mock'
|
588
|
+
expect( event.get('[@metadata][tls_peer][cipher_suite]') ).to eql 'SSL_NULL_WITH_TEST_SPEC'
|
589
|
+
expect( event.get('[@metadata][tls_peer][subject]') ).to eql 'CN=TEST,OU=RSpec,O=Logstash,C=NL'
|
590
|
+
end
|
591
|
+
end
|
271
592
|
|
272
|
-
|
273
|
-
|
593
|
+
context 'with ssl disabled' do
|
594
|
+
let(:config) { super().merge("ssl_enabled" => false) }
|
274
595
|
|
275
|
-
|
596
|
+
it 'do not set tls fields' do
|
597
|
+
@message_listener.onNewMessage(ctx, message)
|
276
598
|
|
277
|
-
|
278
|
-
|
279
|
-
|
599
|
+
expect( queue.size ).to be 1
|
600
|
+
expect( event = queue.pop ).to be_a LogStash::Event
|
601
|
+
expect( event.get('[@metadata][tls_peer]') ).to be_nil
|
602
|
+
end
|
280
603
|
end
|
604
|
+
|
281
605
|
end
|
282
606
|
|
283
607
|
context "when interrupting the plugin" do
|
@@ -112,7 +112,7 @@ describe "Filebeat", :integration => true do
|
|
112
112
|
|
113
113
|
let(:input_config) do
|
114
114
|
super().merge({
|
115
|
-
"
|
115
|
+
"ssl_enabled" => true,
|
116
116
|
"ssl_certificate" => certificate_file,
|
117
117
|
"ssl_key" => certificate_key_file
|
118
118
|
})
|
@@ -146,7 +146,7 @@ describe "Filebeat", :integration => true do
|
|
146
146
|
|
147
147
|
let(:input_config) {
|
148
148
|
super().merge({
|
149
|
-
"
|
149
|
+
"ssl_cipher_suites" => [logstash_cipher],
|
150
150
|
"tls_min_version" => "1.2"
|
151
151
|
})
|
152
152
|
}
|
@@ -281,11 +281,11 @@ describe "Filebeat", :integration => true do
|
|
281
281
|
|
282
282
|
let(:input_config) do
|
283
283
|
super().merge({
|
284
|
-
"
|
284
|
+
"ssl_enabled" => true,
|
285
285
|
"ssl_certificate_authorities" => certificate_authorities,
|
286
286
|
"ssl_certificate" => server_certificate_file,
|
287
287
|
"ssl_key" => server_certificate_key_file,
|
288
|
-
"
|
288
|
+
"ssl_client_authentication" => "required"
|
289
289
|
})
|
290
290
|
end
|
291
291
|
|
@@ -75,7 +75,7 @@ describe "Logstash-Forwarder", :integration => true do
|
|
75
75
|
context "Server Verification" do
|
76
76
|
let(:input_config) do
|
77
77
|
super().merge({
|
78
|
-
"
|
78
|
+
"ssl_enabled" => true,
|
79
79
|
"ssl_certificate" => certificate_file,
|
80
80
|
"ssl_key" => certificate_key_file,
|
81
81
|
})
|
data/spec/spec_helper.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-beats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.6.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +134,34 @@ dependencies:
|
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '1.0'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
requirement: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - "~>"
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '1.0'
|
143
|
+
name: logstash-mixin-plugin_factory_support
|
144
|
+
prerelease: false
|
145
|
+
type: :runtime
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '1.0'
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
requirement: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - "~>"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '1.0'
|
157
|
+
name: logstash-mixin-normalize_config_support
|
158
|
+
prerelease: false
|
159
|
+
type: :runtime
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - "~>"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '1.0'
|
137
165
|
- !ruby/object:Gem::Dependency
|
138
166
|
requirement: !ruby/object:Gem::Requirement
|
139
167
|
requirements:
|
@@ -299,7 +327,7 @@ files:
|
|
299
327
|
- vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/4.1.87.Final/netty-transport-native-unix-common-4.1.87.Final.jar
|
300
328
|
- vendor/jar-dependencies/io/netty/netty-transport/4.1.87.Final/netty-transport-4.1.87.Final.jar
|
301
329
|
- vendor/jar-dependencies/org/javassist/javassist/3.24.0-GA/javassist-3.24.0-GA.jar
|
302
|
-
- vendor/jar-dependencies/org/logstash/beats/logstash-input-beats/6.
|
330
|
+
- vendor/jar-dependencies/org/logstash/beats/logstash-input-beats/6.6.0/logstash-input-beats-6.6.0.jar
|
303
331
|
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
304
332
|
licenses:
|
305
333
|
- Apache License (2.0)
|