logstash-output-elasticsearch 2.5.0-java → 2.5.1-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
  SHA1:
3
- metadata.gz: 94080174a41d46422a7f94b0e9354554d3e0d66a
4
- data.tar.gz: bddb86d2a5bbbae75734c41610588c3cf5c04f71
3
+ metadata.gz: e2be6702ec45ea049c714fc3d3481405c8d9d4b5
4
+ data.tar.gz: 376cb1122b3bc91c2747813dee512cd89bef4bcd
5
5
  SHA512:
6
- metadata.gz: 4d59bc4d44c2b1918519e286efb995805abd63dd8d411ae87b82551750182b743ee56ed453d557e12769c21a3535496aa02d79ff77580ba9508499914edc61e2
7
- data.tar.gz: fdba23ed47b9414ca87d2d7bd75a3c07c440fce5d86c49adcdb4be1a95884266e908f0b73ef55a1c895947714cd2fc19ec6bf0c8887274b9dc9ffab5c51190cc
6
+ metadata.gz: f06e6bc71c5faa1ba4296231e0c2f555c4c7caf73031a09a776ec1ff17a127afeaa7967396a41ecbb2ecbf9fd939858fcbd042855d0b72c4e2cffb5edd9f9f63
7
+ data.tar.gz: c2c403a0690b04aa328eb005312cc1d69d43bc50585e5ef6a0900e0258a8eafa59a7c2c475048e7b15077d5c3982e225bbcb3b6371456cc951b7ae6f1f736ade
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 2.5.1
2
+ - Fix bug where SSL would sometimes not be enabled
3
+
1
4
  ## 2.5.0
2
5
  - Host settings now are more robust to bad input
3
6
  - Host settings can now take full URLs
@@ -105,7 +105,8 @@ module LogStash; module Outputs; class ElasticSearch;
105
105
  client_settings = options[:client_settings] || {}
106
106
  timeout = options[:timeout] || 0
107
107
 
108
- urls = hosts.map {|host| host_to_url(host, client_settings[:ssl], client_settings[:path])}
108
+ host_ssl_opt = client_settings[:ssl].nil? ? nil : client_settings[:ssl][:enabled]
109
+ urls = hosts.map {|host| host_to_url(host, host_ssl_opt, client_settings[:path])}
109
110
 
110
111
  @client_options = {
111
112
  :hosts => urls,
@@ -137,8 +138,10 @@ module LogStash; module Outputs; class ElasticSearch;
137
138
  "https"
138
139
  when false
139
140
  "http"
140
- else
141
+ when nil
141
142
  nil
143
+ else
144
+ raise ArgumentError, "Unexpected SSL value!"
142
145
  end
143
146
 
144
147
  # Ensure path starts with a /
@@ -59,7 +59,8 @@ module LogStash; module Outputs; class ElasticSearch;
59
59
  end
60
60
 
61
61
  def self.setup_ssl(logger, params)
62
- return {} unless params["ssl"]
62
+ return {} if params["ssl"].nil?
63
+ return {:ssl => {:enabled => false}} if params["ssl"] == false
63
64
 
64
65
  cacert, truststore, truststore_password, keystore, keystore_password =
65
66
  params.values_at('cacert', 'truststore', 'truststore_password', 'keystore', 'keystore_password')
@@ -68,7 +69,7 @@ module LogStash; module Outputs; class ElasticSearch;
68
69
  raise(LogStash::ConfigurationError, "Use either \"cacert\" or \"truststore\" when configuring the CA certificate") if truststore
69
70
  end
70
71
 
71
- ssl_options = {}
72
+ ssl_options = {:enabled => true}
72
73
 
73
74
  if cacert
74
75
  ssl_options[:ca_file] = cacert
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-output-elasticsearch'
4
- s.version = '2.5.0'
4
+ s.version = '2.5.1'
5
5
  s.licenses = ['apache-2.0']
6
6
  s.summary = "Logstash Output to Elasticsearch"
7
7
  s.description = "Output events to elasticsearch"
@@ -58,6 +58,10 @@ describe LogStash::Outputs::ElasticSearch::HttpClient do
58
58
  it "should handle an ssl url correctly when SSL is nil" do
59
59
  expect(subject.send(:host_to_url, https_hostname_port, nil)).to eql(https_hostname_port)
60
60
  end
61
+
62
+ it "should raise an exception if an unexpected value is passed in" do
63
+ expect { subject.send(:host_to_url, https_hostname_port, {})}.to raise_error(ArgumentError)
64
+ end
61
65
  end
62
66
 
63
67
  describe "path" do
@@ -175,4 +175,29 @@ describe "outputs/elasticsearch" do
175
175
  end
176
176
  end
177
177
 
178
+ describe "SSL end to end" do
179
+ shared_examples("an encrypted client connection") do
180
+ it "should enable SSL in manticore" do
181
+ expect(eso.client.client_options[:hosts].map {|h| URI.parse(h).scheme}.uniq).to eql(['https'])
182
+ end
183
+ end
184
+
185
+ let(:eso) {LogStash::Outputs::ElasticSearch.new(options)}
186
+ subject(:manticore) { eso.client.client}
187
+
188
+ before do
189
+ eso.register
190
+ end
191
+
192
+ context "With the 'ssl' option" do
193
+ let(:options) { {"ssl" => true}}
194
+
195
+ include_examples("an encrypted client connection")
196
+ end
197
+
198
+ context "With an https host" do
199
+ let(:options) { {"hosts" => "https://localhost"} }
200
+ include_examples("an encrypted client connection")
201
+ end
202
+ end
178
203
  end
@@ -15,7 +15,7 @@ describe "SSL option" do
15
15
 
16
16
  it "should pass the flag to the ES client" do
17
17
  expect(::Elasticsearch::Client).to receive(:new) do |args|
18
- expect(args[:ssl]).to eq(:verify => false)
18
+ expect(args[:ssl]).to eq(:enabled => true, :verify => false)
19
19
  end
20
20
  subject.register
21
21
  end
@@ -44,7 +44,6 @@ describe "SSL option" do
44
44
  next LogStash::Outputs::ElasticSearch.new(settings)
45
45
  end
46
46
 
47
-
48
47
  it "should pass the keystore parameters to the ES client" do
49
48
  expect(::Elasticsearch::Client).to receive(:new) do |args|
50
49
  expect(args[:ssl]).to include(:keystore => keystore_path, :keystore_password => "test")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-10 00:00:00.000000000 Z
11
+ date: 2016-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby