logstash-integration-kafka 10.5.2-java → 10.5.3-java

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: 877f38709d9280199d61c2c7755461223a9695bd966d8d7ad77676b40c071102
4
- data.tar.gz: 34d9f91fc7ae51cc4419ef19ada731b8a122006338371daf0d5c6b23c692a46c
3
+ metadata.gz: 4383db6ec7c8fa26ef358d104c490f51620f615afb2f68359b6f6e98d4e58f8b
4
+ data.tar.gz: 040637202d15cb1e5784104ff505f10a6610e91187a57f104a8f81cd2b24475a
5
5
  SHA512:
6
- metadata.gz: e1587ee36b4e8038c17c8ed9182d7e25e040447df017917bc4b8dc69f1ffe0c3ab9c624bccabe6ba4439d9ac7ffa38dfab417ac93ee46e0aef6308a303ba5dee
7
- data.tar.gz: 45c48cf5e734e86e9454b4084a83289d89ae51613d100c8b02587d7be4ce9914cb7956b0a2fa51bfd1dea2d9929081becf9ebc1c5f90cf4e03d6076bf3ed8f63
6
+ metadata.gz: 98da085bceebd241a6d45f9166aa4ff1a132551cd2cda8825ceab3c22ebbb5f78579f0d1a0b596aeaf3d504147d656cf2ef784570ef3fd9ab98c792ae6e15be4
7
+ data.tar.gz: f552e5ec8d84f3ae7d85b3d4bc4ba4f7309321ea81efaa9bfb69a4a493141868b2576a626f0ee061bb0ebe6cbc8071993dd8592bc53030478baad2b5173e1086
@@ -1,3 +1,8 @@
1
+ ## 10.5.3
2
+ - Fix: set (optional) truststore when endpoint id check disabled [#60](https://github.com/logstash-plugins/logstash-integration-kafka/pull/60).
3
+ Since **10.1.0** disabling server host-name verification (`ssl_endpoint_identification_algorithm => ""`) did not allow
4
+ the (output) plugin to set `ssl_truststore_location => "..."`.
5
+
1
6
  ## 10.5.2
2
7
  - Docs: explain group_id in case of multiple inputs [#59](https://github.com/logstash-plugins/logstash-integration-kafka/pull/59)
3
8
 
@@ -3,6 +3,7 @@ require 'logstash/inputs/base'
3
3
  require 'stud/interval'
4
4
  require 'java'
5
5
  require 'logstash-integration-kafka_jars.rb'
6
+ require 'logstash/plugin_mixins/kafka_support'
6
7
 
7
8
  # This input will read events from a Kafka topic. It uses the 0.10 version of
8
9
  # the consumer API provided by Kafka to read messages from the broker.
@@ -48,6 +49,9 @@ require 'logstash-integration-kafka_jars.rb'
48
49
  # Kafka consumer configuration: http://kafka.apache.org/documentation.html#consumerconfigs
49
50
  #
50
51
  class LogStash::Inputs::Kafka < LogStash::Inputs::Base
52
+
53
+ include LogStash::PluginMixins::KafkaSupport
54
+
51
55
  config_name 'kafka'
52
56
 
53
57
  default :codec, 'plain'
@@ -370,29 +374,4 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
370
374
  end
371
375
  end
372
376
 
373
- def set_trustore_keystore_config(props)
374
- props.put("ssl.truststore.type", ssl_truststore_type) unless ssl_truststore_type.nil?
375
- props.put("ssl.truststore.location", ssl_truststore_location) unless ssl_truststore_location.nil?
376
- props.put("ssl.truststore.password", ssl_truststore_password.value) unless ssl_truststore_password.nil?
377
-
378
- # Client auth stuff
379
- props.put("ssl.keystore.type", ssl_keystore_type) unless ssl_keystore_type.nil?
380
- props.put("ssl.key.password", ssl_key_password.value) unless ssl_key_password.nil?
381
- props.put("ssl.keystore.location", ssl_keystore_location) unless ssl_keystore_location.nil?
382
- props.put("ssl.keystore.password", ssl_keystore_password.value) unless ssl_keystore_password.nil?
383
- props.put("ssl.endpoint.identification.algorithm", ssl_endpoint_identification_algorithm) unless ssl_endpoint_identification_algorithm.nil?
384
- end
385
-
386
- def set_sasl_config(props)
387
- java.lang.System.setProperty("java.security.auth.login.config", jaas_path) unless jaas_path.nil?
388
- java.lang.System.setProperty("java.security.krb5.conf", kerberos_config) unless kerberos_config.nil?
389
-
390
- props.put("sasl.mechanism", sasl_mechanism)
391
- if sasl_mechanism == "GSSAPI" && sasl_kerberos_service_name.nil?
392
- raise LogStash::ConfigurationError, "sasl_kerberos_service_name must be specified when SASL mechanism is GSSAPI"
393
- end
394
-
395
- props.put("sasl.kerberos.service.name", sasl_kerberos_service_name) unless sasl_kerberos_service_name.nil?
396
- props.put("sasl.jaas.config", sasl_jaas_config) unless sasl_jaas_config.nil?
397
- end
398
377
  end #class LogStash::Inputs::Kafka
@@ -2,6 +2,7 @@ require 'logstash/namespace'
2
2
  require 'logstash/outputs/base'
3
3
  require 'java'
4
4
  require 'logstash-integration-kafka_jars.rb'
5
+ require 'logstash/plugin_mixins/kafka_support'
5
6
 
6
7
  # Write events to a Kafka topic. This uses the Kafka Producer API to write messages to a topic on
7
8
  # the broker.
@@ -50,6 +51,8 @@ class LogStash::Outputs::Kafka < LogStash::Outputs::Base
50
51
 
51
52
  java_import org.apache.kafka.clients.producer.ProducerRecord
52
53
 
54
+ include LogStash::PluginMixins::KafkaSupport
55
+
53
56
  declare_threadsafe!
54
57
 
55
58
  config_name 'kafka'
@@ -389,35 +392,4 @@ class LogStash::Outputs::Kafka < LogStash::Outputs::Base
389
392
  end
390
393
  end
391
394
 
392
- def set_trustore_keystore_config(props)
393
- unless ssl_endpoint_identification_algorithm.to_s.strip.empty?
394
- if ssl_truststore_location.nil?
395
- raise LogStash::ConfigurationError, "ssl_truststore_location must be set when SSL is enabled"
396
- end
397
- props.put("ssl.truststore.type", ssl_truststore_type) unless ssl_truststore_type.nil?
398
- props.put("ssl.truststore.location", ssl_truststore_location)
399
- props.put("ssl.truststore.password", ssl_truststore_password.value) unless ssl_truststore_password.nil?
400
- end
401
-
402
- # Client auth stuff
403
- props.put("ssl.keystore.type", ssl_keystore_type) unless ssl_keystore_type.nil?
404
- props.put("ssl.key.password", ssl_key_password.value) unless ssl_key_password.nil?
405
- props.put("ssl.keystore.location", ssl_keystore_location) unless ssl_keystore_location.nil?
406
- props.put("ssl.keystore.password", ssl_keystore_password.value) unless ssl_keystore_password.nil?
407
- props.put("ssl.endpoint.identification.algorithm", ssl_endpoint_identification_algorithm) unless ssl_endpoint_identification_algorithm.nil?
408
- end
409
-
410
- def set_sasl_config(props)
411
- java.lang.System.setProperty("java.security.auth.login.config", jaas_path) unless jaas_path.nil?
412
- java.lang.System.setProperty("java.security.krb5.conf", kerberos_config) unless kerberos_config.nil?
413
-
414
- props.put("sasl.mechanism",sasl_mechanism)
415
- if sasl_mechanism == "GSSAPI" && sasl_kerberos_service_name.nil?
416
- raise LogStash::ConfigurationError, "sasl_kerberos_service_name must be specified when SASL mechanism is GSSAPI"
417
- end
418
-
419
- props.put("sasl.kerberos.service.name", sasl_kerberos_service_name) unless sasl_kerberos_service_name.nil?
420
- props.put("sasl.jaas.config", sasl_jaas_config) unless sasl_jaas_config.nil?
421
- end
422
-
423
395
  end #class LogStash::Outputs::Kafka
@@ -0,0 +1,29 @@
1
+ module LogStash module PluginMixins module KafkaSupport
2
+
3
+ def set_trustore_keystore_config(props)
4
+ props.put("ssl.truststore.type", ssl_truststore_type) unless ssl_truststore_type.nil?
5
+ props.put("ssl.truststore.location", ssl_truststore_location) unless ssl_truststore_location.nil?
6
+ props.put("ssl.truststore.password", ssl_truststore_password.value) unless ssl_truststore_password.nil?
7
+
8
+ # Client auth stuff
9
+ props.put("ssl.keystore.type", ssl_keystore_type) unless ssl_keystore_type.nil?
10
+ props.put("ssl.key.password", ssl_key_password.value) unless ssl_key_password.nil?
11
+ props.put("ssl.keystore.location", ssl_keystore_location) unless ssl_keystore_location.nil?
12
+ props.put("ssl.keystore.password", ssl_keystore_password.value) unless ssl_keystore_password.nil?
13
+ props.put("ssl.endpoint.identification.algorithm", ssl_endpoint_identification_algorithm) unless ssl_endpoint_identification_algorithm.nil?
14
+ end
15
+
16
+ def set_sasl_config(props)
17
+ java.lang.System.setProperty("java.security.auth.login.config", jaas_path) unless jaas_path.nil?
18
+ java.lang.System.setProperty("java.security.krb5.conf", kerberos_config) unless kerberos_config.nil?
19
+
20
+ props.put("sasl.mechanism", sasl_mechanism)
21
+ if sasl_mechanism == "GSSAPI" && sasl_kerberos_service_name.nil?
22
+ raise LogStash::ConfigurationError, "sasl_kerberos_service_name must be specified when SASL mechanism is GSSAPI"
23
+ end
24
+
25
+ props.put("sasl.kerberos.service.name", sasl_kerberos_service_name) unless sasl_kerberos_service_name.nil?
26
+ props.put("sasl.jaas.config", sasl_jaas_config) unless sasl_jaas_config.nil?
27
+ end
28
+
29
+ end end end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-integration-kafka'
3
- s.version = '10.5.2'
3
+ s.version = '10.5.3'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "Integration with Kafka - input and output plugins"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline "+
File without changes
@@ -50,9 +50,10 @@ describe "outputs/kafka" do
50
50
  kafka.multi_receive([event])
51
51
  end
52
52
 
53
- it 'should raise config error when truststore location is not set and ssl is enabled' do
53
+ it 'should not raise config error when truststore location is not set and ssl is enabled' do
54
54
  kafka = LogStash::Outputs::Kafka.new(simple_kafka_config.merge("security_protocol" => "SSL"))
55
- expect { kafka.register }.to raise_error(LogStash::ConfigurationError, /ssl_truststore_location must be set when SSL is enabled/)
55
+ expect(org.apache.kafka.clients.producer.KafkaProducer).to receive(:new)
56
+ expect { kafka.register }.to_not raise_error
56
57
  end
57
58
  end
58
59
 
@@ -225,21 +226,31 @@ describe "outputs/kafka" do
225
226
  context 'when ssl endpoint identification disabled' do
226
227
 
227
228
  let(:config) do
228
- simple_kafka_config.merge('ssl_endpoint_identification_algorithm' => '', 'security_protocol' => 'SSL')
229
+ simple_kafka_config.merge(
230
+ 'security_protocol' => 'SSL',
231
+ 'ssl_endpoint_identification_algorithm' => '',
232
+ 'ssl_truststore_location' => truststore_path,
233
+ )
234
+ end
235
+
236
+ let(:truststore_path) do
237
+ File.join(File.dirname(__FILE__), '../../fixtures/trust-store_stub.jks')
229
238
  end
230
239
 
231
240
  subject { LogStash::Outputs::Kafka.new(config) }
232
241
 
233
- it 'does not configure truststore' do
242
+ it 'sets empty ssl.endpoint.identification.algorithm' do
234
243
  expect(org.apache.kafka.clients.producer.KafkaProducer).
235
- to receive(:new).with(hash_excluding('ssl.truststore.location' => anything))
244
+ to receive(:new).with(hash_including('ssl.endpoint.identification.algorithm' => ''))
236
245
  subject.register
237
246
  end
238
247
 
239
- it 'sets empty ssl.endpoint.identification.algorithm' do
248
+ it 'configures truststore' do
240
249
  expect(org.apache.kafka.clients.producer.KafkaProducer).
241
- to receive(:new).with(hash_including('ssl.endpoint.identification.algorithm' => ''))
250
+ to receive(:new).with(hash_including('ssl.truststore.location' => truststore_path))
242
251
  subject.register
243
252
  end
253
+
244
254
  end
255
+
245
256
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.5.2
4
+ version: 10.5.3
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-15 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -183,7 +183,9 @@ files:
183
183
  - lib/logstash-integration-kafka_jars.rb
184
184
  - lib/logstash/inputs/kafka.rb
185
185
  - lib/logstash/outputs/kafka.rb
186
+ - lib/logstash/plugin_mixins/kafka_support.rb
186
187
  - logstash-integration-kafka.gemspec
188
+ - spec/fixtures/trust-store_stub.jks
187
189
  - spec/integration/inputs/kafka_spec.rb
188
190
  - spec/integration/outputs/kafka_spec.rb
189
191
  - spec/unit/inputs/kafka_spec.rb
@@ -222,6 +224,7 @@ signing_key:
222
224
  specification_version: 4
223
225
  summary: Integration with Kafka - input and output plugins
224
226
  test_files:
227
+ - spec/fixtures/trust-store_stub.jks
225
228
  - spec/integration/inputs/kafka_spec.rb
226
229
  - spec/integration/outputs/kafka_spec.rb
227
230
  - spec/unit/inputs/kafka_spec.rb