logstash-input-beats 6.9.10-java → 7.0.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.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -26
  3. data/VERSION +1 -1
  4. data/docs/index.asciidoc +17 -73
  5. data/lib/logstash/inputs/beats.rb +21 -106
  6. data/lib/logstash-input-beats_jars.rb +7 -8
  7. data/lib/tasks/test.rake +2 -2
  8. data/logstash-input-beats.gemspec +1 -1
  9. data/spec/inputs/beats_spec.rb +41 -167
  10. data/spec/integration/filebeat_spec.rb +4 -6
  11. data/vendor/jar-dependencies/io/netty/netty-buffer/{4.1.135.Final/netty-buffer-4.1.135.Final.jar → 4.1.115.Final/netty-buffer-4.1.115.Final.jar} +0 -0
  12. data/vendor/jar-dependencies/io/netty/netty-codec/{4.1.135.Final/netty-codec-4.1.135.Final.jar → 4.1.115.Final/netty-codec-4.1.115.Final.jar} +0 -0
  13. data/vendor/jar-dependencies/io/netty/netty-common/{4.1.135.Final/netty-common-4.1.135.Final.jar → 4.1.115.Final/netty-common-4.1.115.Final.jar} +0 -0
  14. data/vendor/jar-dependencies/io/netty/netty-handler/4.1.115.Final/netty-handler-4.1.115.Final.jar +0 -0
  15. data/vendor/jar-dependencies/io/netty/netty-transport/{4.1.135.Final/netty-transport-4.1.135.Final.jar → 4.1.115.Final/netty-transport-4.1.115.Final.jar} +0 -0
  16. data/vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/{4.1.135.Final/netty-transport-native-unix-common-4.1.135.Final.jar → 4.1.115.Final/netty-transport-native-unix-common-4.1.115.Final.jar} +0 -0
  17. data/vendor/jar-dependencies/org/logstash/beats/logstash-input-beats/7.0.0/logstash-input-beats-7.0.0.jar +0 -0
  18. metadata +40 -35
  19. data/lib/logstash/inputs/beats/tls.rb +0 -41
  20. data/spec/inputs/beats/tls_spec.rb +0 -39
  21. data/vendor/jar-dependencies/io/netty/netty-handler/4.1.135.Final/netty-handler-4.1.135.Final.jar +0 -0
  22. data/vendor/jar-dependencies/io/netty/netty-resolver/4.1.135.Final/netty-resolver-4.1.135.Final.jar +0 -0
  23. data/vendor/jar-dependencies/org/logstash/beats/logstash-input-beats/6.9.10/logstash-input-beats-6.9.10.jar +0 -0
@@ -38,7 +38,7 @@ describe LogStash::Inputs::Beats do
38
38
  let(:port) { 9001 }
39
39
 
40
40
  it "sends the required options to the server" do
41
- expect(org.logstash.beats.Server).to receive(:new).with(plugin.id, host, port, client_inactivity_timeout, event_loop_threads, executor_threads)
41
+ expect(org.logstash.beats.Server).to receive(:new).with(host, port, client_inactivity_timeout, event_loop_threads, executor_threads)
42
42
  subject.register
43
43
  end
44
44
  end
@@ -83,92 +83,14 @@ describe LogStash::Inputs::Beats do
83
83
  end
84
84
 
85
85
  context "with invalid ciphers" do
86
- let(:config) { super().merge("cipher_suites" => "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA38") }
86
+ let(:config) { super().merge("ssl_cipher_suites" => "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA38") }
87
87
 
88
88
  it "should raise a configuration error" do
89
- plugin = LogStash::Inputs::Beats.new(config)
90
- expect( plugin.logger ).to receive(:error) do |msg, opts|
91
- expect( msg ).to match /.*?configuration invalid/
92
- expect( opts[:message] ).to match /TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA38.*? not available/
93
- end
94
- expect { plugin.register }.to raise_error(LogStash::ConfigurationError)
95
- end
96
- end
97
-
98
- context "deprecated ssl_verify_mode set to 'none'" do
99
- let(:config) { super().merge("ssl_verify_mode" => "none") }
100
-
101
- context "and ssl_certificate_authorities is set" do
102
- let(:config) { super().merge("ssl_certificate_authorities" => [certificate.ssl_cert]) }
103
- it "should ignore the ssl_verify_mode and use force_peer" do
104
- plugin = LogStash::Inputs::Beats.new(config)
105
- plugin.register
106
- context_builder = plugin.send(:new_ssl_context_builder)
107
- expect(context_builder.isClientAuthenticationRequired()).to be_truthy
108
- end
89
+ expect { LogStash::Inputs::Beats.new(config) }.to raise_error(LogStash::ConfigurationError, a_string_including("Something is wrong with your configuration."))
109
90
  end
110
91
  end
111
92
 
112
93
  context "ssl_client_authentication" do
113
- context "normalized from ssl_verify_mode 'none'" do
114
- let(:config) { super().merge("ssl_verify_mode" => "none") }
115
-
116
- it "should transform the value to 'none'" do
117
- plugin = LogStash::Inputs::Beats.new(config)
118
- plugin.register
119
-
120
- expect(plugin.params).to match hash_including("ssl_client_authentication" => "none")
121
- expect(plugin.instance_variable_get(:@ssl_client_authentication)).to eql("none")
122
- end
123
-
124
- context "and ssl_certificate_authorities is set" do
125
- let(:config) { super().merge("ssl_certificate_authorities" => [certificate.ssl_cert]) }
126
- it "should not raise an error" do
127
- plugin = LogStash::Inputs::Beats.new(config)
128
- expect { plugin.register }.to_not raise_error
129
- end
130
- end
131
- end
132
-
133
- context "normalized from ssl_verify_mode 'peer'" do
134
- let(:config) { super().merge("ssl_verify_mode" => "peer", "ssl_certificate_authorities" => [certificate.ssl_cert]) }
135
-
136
- it 'should transform the value to OPTIONAL' do
137
- plugin = LogStash::Inputs::Beats.new(config)
138
- plugin.register
139
-
140
- expect(plugin.params).to match hash_including("ssl_client_authentication" => "optional")
141
- expect(plugin.instance_variable_get(:@ssl_client_authentication)).to eql("optional")
142
- end
143
-
144
- context "with no ssl_certificate_authorities set " do
145
- let(:config) { super().reject { |key| "ssl_certificate_authorities".eql?(key) } }
146
- it "raise a configuration error" do
147
- plugin = LogStash::Inputs::Beats.new(config)
148
- expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when ssl_verify_mode => 'peer' is configured")
149
- end
150
- end
151
- end
152
-
153
- context "normalized from ssl_verify_mode 'force_peer'" do
154
- let(:config) { super().merge("ssl_verify_mode" => "force_peer", "ssl_certificate_authorities" => [certificate.ssl_cert]) }
155
-
156
- it "should transform the value to 'required'" do
157
- plugin = LogStash::Inputs::Beats.new(config)
158
- plugin.register
159
-
160
- expect(plugin.params).to match hash_including("ssl_client_authentication" => "required")
161
- expect(plugin.instance_variable_get(:@ssl_client_authentication)).to eql("required")
162
- end
163
-
164
- context "with no ssl_certificate_authorities set " do
165
- let(:config) { super().reject { |key| "ssl_certificate_authorities".eql?(key) } }
166
- it "raise a configuration error" do
167
- plugin = LogStash::Inputs::Beats.new(config)
168
- expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when ssl_verify_mode => 'force_peer' is configured")
169
- end
170
- end
171
- end
172
94
 
173
95
  context "configured to 'none'" do
174
96
  let(:config) { super().merge("ssl_client_authentication" => "none") }
@@ -193,7 +115,7 @@ describe LogStash::Inputs::Beats do
193
115
 
194
116
  it "raise a ConfigurationError when certificate_authorities is not set" do
195
117
  plugin = LogStash::Inputs::Beats.new(config)
196
- expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when ssl_client_authentication => 'required' is configured")
118
+ expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when `ssl_client_authentication => 'required'` is configured")
197
119
  end
198
120
 
199
121
  context "with certificate_authorities set" do
@@ -211,7 +133,7 @@ describe LogStash::Inputs::Beats do
211
133
 
212
134
  it "raise a ConfigurationError when certificate_authorities is not set" do
213
135
  plugin = LogStash::Inputs::Beats.new(config)
214
- expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when ssl_client_authentication => 'optional' is configured")
136
+ expect {plugin.register}.to raise_error(LogStash::ConfigurationError, "ssl_certificate_authorities => is a required setting when `ssl_client_authentication => 'optional'` is configured")
215
137
  end
216
138
 
217
139
  context "with certificate_authorities set" do
@@ -224,59 +146,10 @@ describe LogStash::Inputs::Beats do
224
146
  end
225
147
  end
226
148
 
227
- context "with ssl_cipher_suites and cipher_suites set" do
228
- let(:config) do
229
- super().merge('ssl_cipher_suites' => ['TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384'],
230
- 'cipher_suites' => ['TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384'])
231
- end
232
-
233
- it "should raise a configuration error" do
234
- plugin = LogStash::Inputs::Beats.new(config)
235
- expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_cipher_suites.?/i
236
- end
237
- end
238
-
239
- context "with ssl_supported_protocols and tls_min_version set" do
240
- let(:config) do
241
- super().merge('ssl_supported_protocols' => ['TLSv1.2'], 'tls_min_version' => 1.2)
242
- end
243
-
244
- it "should raise a configuration error" do
245
- plugin = LogStash::Inputs::Beats.new(config)
246
- expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_supported_protocols.?/i
247
- end
248
- end
249
-
250
- context "with ssl_supported_protocols and tls_max_version set" do
251
- let(:config) do
252
- super().merge('ssl_supported_protocols' => ['TLSv1.2'], 'tls_max_version' => 1.2)
253
- end
254
-
255
- it "should raise a configuration error" do
256
- plugin = LogStash::Inputs::Beats.new(config)
257
- expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_supported_protocols.?/i
258
- end
259
- end
260
-
261
- context "with ssl_client_authentication and ssl_verify_mode set" do
262
- let(:config) { super().merge("ssl_verify_mode" => "none", "ssl_client_authentication" => "none") }
263
- it "raise a configuration error" do
264
- plugin = LogStash::Inputs::Beats.new(config)
265
- expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_client_authentication.?/i
266
- end
267
- end
268
- end
269
-
270
- context "with ssl and ssl_enabled set" do
271
- let(:config) { super().merge("ssl" => true) }
272
- it "raise a configuration error" do
273
- plugin = LogStash::Inputs::Beats.new(config)
274
- expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_enabled.?/i
275
- end
276
149
  end
277
150
  end
278
151
 
279
- context "with ssl disabled" do
152
+ context "with SSL disabled" do
280
153
  context "and certificate configuration" do
281
154
  let(:config) { { "port" => 0, "ssl_enabled" => false, "ssl_certificate" => certificate.ssl_cert, "type" => "example", "tags" => "Beats" } }
282
155
 
@@ -305,11 +178,11 @@ describe LogStash::Inputs::Beats do
305
178
  end
306
179
 
307
180
  context "and `ssl_` settings provided" do
308
- let(:config) { { "port" => 0, "ssl_enabled" => false, "ssl_certificate" => certificate.ssl_cert, "ssl_client_authentication" => "none", "cipher_suites" => ["FOO"] } }
181
+ let(:config) { { "port" => 0, "ssl_enabled" => false, "ssl_certificate" => certificate.ssl_cert, "ssl_client_authentication" => "none", "ssl_cipher_suites" => ["TLS_RSA_WITH_AES_128_CBC_SHA256"] } }
309
182
 
310
183
  it "should warn about not using the configs" do
311
184
  plugin = LogStash::Inputs::Beats.new(config)
312
- 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"]')
185
+ 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", "ssl_cipher_suites"]')
313
186
 
314
187
  plugin.register
315
188
 
@@ -397,28 +270,22 @@ describe LogStash::Inputs::Beats do
397
270
  end
398
271
 
399
272
  shared_examples "ssl_peer_metadata enabled" do
400
- it "is configured to enrich ssl_peer_metadata" do
401
- expect(registered_plugin.ssl_peer_metadata).to be_truthy
273
+ it "is configured to include the SSL peer tag" do
274
+ expect(registered_plugin.include_ssl_peer_metadata).to be true
402
275
  end
403
276
  end
404
277
 
405
278
  shared_examples "ssl_peer_metadata disabled" do
406
- it "is configured to NOT enrich ssl_peer_metadata" do
407
- expect(registered_plugin.ssl_peer_metadata).to be_falsey
279
+ it "is configured to NOT include the SSL peer tag" do
280
+ expect(registered_plugin.include_ssl_peer_metadata).to be false
408
281
  end
409
282
  end
410
283
 
411
- shared_examples "reject deprecated enrichment flags" do
412
- context "with deprecated `ssl_peer_metadata`" do
413
- let(:config) { super().merge("ssl_peer_metadata" => true) }
414
- it 'rejects the configuration with a helpful error message' do
415
- expect { plugin.register }.to raise_exception(LogStash::ConfigurationError, "both `enrich` and (deprecated) ssl_peer_metadata were provided; use only `enrich`")
416
- end
417
- end
284
+ shared_examples "reject deprecated enrichment flag" do
418
285
  context "with deprecated `include_codec_tag`" do
419
286
  let(:config) { super().merge("include_codec_tag" => false) }
420
287
  it 'rejects the configuration with a helpful error message' do
421
- expect { plugin.register }.to raise_exception(LogStash::ConfigurationError, "both `enrich` and (deprecated) include_codec_tag were provided; use only `enrich`")
288
+ expect { plugin.register }.to raise_exception(LogStash::ConfigurationError, "both `enrich` and (deprecated) `include_codec_tag` were provided; use only `enrich`")
422
289
  end
423
290
  end
424
291
  end
@@ -429,18 +296,6 @@ describe LogStash::Inputs::Beats do
429
296
  include_examples "source_metadata enabled"
430
297
  include_examples "ssl_peer_metadata disabled"
431
298
 
432
- # validate interaction with deprecated settings
433
- context "with deprecated `ssl_peer_metadata => true`" do
434
- let(:config) { super().merge("ssl_peer_metadata" => true) }
435
-
436
- # intended delta
437
- include_examples "ssl_peer_metadata enabled"
438
-
439
- # ensure no side-effects
440
- include_examples "codec_metadata enabled"
441
- include_examples "source_metadata enabled"
442
- end
443
-
444
299
  context "with deprecated `include_codec_tag => false`" do
445
300
  let(:config) { super().merge("include_codec_tag" => false) }
446
301
 
@@ -463,7 +318,7 @@ describe LogStash::Inputs::Beats do
463
318
  include_examples "source_metadata enabled"
464
319
  include_examples "ssl_peer_metadata enabled"
465
320
 
466
- include_examples "reject deprecated enrichment flags"
321
+ include_examples "reject deprecated enrichment flag"
467
322
  end
468
323
 
469
324
  context "with alias `enrich => none`" do
@@ -473,7 +328,7 @@ describe LogStash::Inputs::Beats do
473
328
  include_examples "source_metadata disabled"
474
329
  include_examples "ssl_peer_metadata disabled"
475
330
 
476
- include_examples "reject deprecated enrichment flags"
331
+ include_examples "reject deprecated enrichment flag"
477
332
  end
478
333
  end
479
334
 
@@ -491,7 +346,7 @@ describe LogStash::Inputs::Beats do
491
346
  include_examples "#{enrichment} #{activated.include?(enrichment) ? 'enabled' : 'disabled'}"
492
347
  end
493
348
 
494
- include_examples "reject deprecated enrichment flags"
349
+ include_examples "reject deprecated enrichment flag"
495
350
  end
496
351
  end
497
352
 
@@ -516,8 +371,8 @@ describe LogStash::Inputs::Beats do
516
371
  super().merge(
517
372
  "host" => host,
518
373
  "ssl_enabled" => true,
519
- "ssl_verify_mode" => 'force_peer',
520
- "ssl_peer_metadata" => true,
374
+ "enrich" => ["ssl_peer_metadata"],
375
+ "ssl_client_authentication" => "required",
521
376
  "ssl_certificate_authorities" => [ certificate.ssl_cert ],
522
377
  "ecs_compatibility" => 'disabled'
523
378
  )
@@ -531,8 +386,8 @@ describe LogStash::Inputs::Beats do
531
386
  subject(:plugin) { LogStash::Inputs::Beats.new(config) }
532
387
 
533
388
  before do
534
- @server = org.logstash.beats.Server.new(plugin.id, host, port, client_inactivity_timeout, event_loop_threads, executor_threads)
535
- expect( org.logstash.beats.Server ).to receive(:new).with(plugin.id, host, port, client_inactivity_timeout, event_loop_threads, executor_threads).and_return @server
389
+ @server = org.logstash.beats.Server.new(host, port, client_inactivity_timeout, event_loop_threads, executor_threads)
390
+ expect( org.logstash.beats.Server ).to receive(:new).with(host, port, client_inactivity_timeout, event_loop_threads, executor_threads).and_return @server
536
391
  expect( @server ).to receive(:listen)
537
392
 
538
393
  subject.register
@@ -595,7 +450,7 @@ describe LogStash::Inputs::Beats do
595
450
  context 'with ssl disabled' do
596
451
  let(:config) { super().merge("ssl_enabled" => false) }
597
452
 
598
- it 'do not set tls fields' do
453
+ it 'does not set tls fields' do
599
454
  @message_listener.onNewMessage(ctx, message)
600
455
 
601
456
  expect( queue.size ).to be 1
@@ -609,4 +464,23 @@ describe LogStash::Inputs::Beats do
609
464
  context "when interrupting the plugin" do
610
465
  it_behaves_like "an interruptible input plugin"
611
466
  end
467
+
468
+ describe "obsolete settings" do
469
+ let(:config) { { "port" => 1234 } }
470
+ [{:name => 'ssl', :canonical_name => 'ssl_enabled'},
471
+ {:name => 'ssl_peer_metadata', :canonical_name => 'enrich'},
472
+ {:name => 'ssl_verify_mode', :canonical_name => 'ssl_client_authentication'},
473
+ {:name => 'cipher_suites', :canonical_name => 'ssl_cipher_suites'},
474
+ {:name => 'tls_min_version', :canonical_name => 'ssl_supported_protocols'},
475
+ {:name => 'tls_max_version', :canonical_name => 'ssl_supported_protocols'}
476
+ ].each do |settings|
477
+ context "with option #{settings[:name]}" do
478
+ let(:obsolete_config) { config.merge(settings[:name] => 'test_value') }
479
+ it "emits an error about the setting `#{settings[:name]}` now being obsolete and provides guidance to use `#{settings[:canonical_name]}`" do
480
+ error_text = "The setting `#{settings[:name]}` in plugin `beats` is obsolete and is no longer available. Use '#{settings[:canonical_name]}' instead."
481
+ expect { LogStash::Inputs::Beats.new(obsolete_config) }.to raise_error LogStash::ConfigurationError, a_string_including(error_text)
482
+ end
483
+ end
484
+ end
485
+ end
612
486
  end
@@ -51,7 +51,7 @@ describe "Filebeat", :integration => true do
51
51
  before :each do
52
52
  FileUtils.rm_rf(File.join(File.dirname(__FILE__), "..", "..", "vendor", "filebeat", "data"))
53
53
  start_client
54
- raise 'Filebeat did not start in alloted time' unless is_alive
54
+ raise 'Filebeat did not start in allocated time' unless is_alive
55
55
  sleep(20) # give some time to FB to send something
56
56
  end
57
57
 
@@ -76,7 +76,7 @@ describe "Filebeat", :integration => true do
76
76
  end
77
77
 
78
78
  ############################################################
79
- # Actuals tests
79
+ # Actual tests
80
80
  context "Plain TCP" do
81
81
  include_examples "send events"
82
82
 
@@ -147,7 +147,7 @@ describe "Filebeat", :integration => true do
147
147
  let(:input_config) {
148
148
  super().merge({
149
149
  "ssl_cipher_suites" => [logstash_cipher],
150
- "tls_min_version" => "1.2"
150
+ "ssl_supported_protocols" => ["TLSv1.2"]
151
151
  })
152
152
  }
153
153
 
@@ -193,9 +193,7 @@ describe "Filebeat", :integration => true do
193
193
 
194
194
  context "when TLSv1.3 enforced in plugin" do
195
195
  let(:input_config) {
196
- super().merge({
197
- "tls_min_version" => "1.3"
198
- })
196
+ super().merge({ "ssl_supported_protocols" => ["TLSv1.3"] })
199
197
  }
200
198
 
201
199
  include_examples "send events"