sp-logstash-input-http 3.3.7-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +112 -0
- data/DEVELOPER.md +1 -0
- data/Gemfile +11 -0
- data/LICENSE +202 -0
- data/NOTICE.TXT +5 -0
- data/README.md +98 -0
- data/VERSION +1 -0
- data/docs/index.asciidoc +346 -0
- data/lib/logstash/inputs/http/message_handler.rb +49 -0
- data/lib/logstash/inputs/http/tls.rb +40 -0
- data/lib/logstash/inputs/http.rb +293 -0
- data/lib/logstash/util/http_compressed_requests.rb +39 -0
- data/lib/logstash-input-http_jars.rb +6 -0
- data/lib/tasks/build.rake +16 -0
- data/logstash-input-http.gemspec +33 -0
- data/spec/inputs/http_spec.rb +504 -0
- data/vendor/jar-dependencies/io/netty/netty-all/4.1.49.Final/netty-all-4.1.49.Final.jar +0 -0
- data/vendor/jar-dependencies/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar +0 -0
- data/vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/3.3.7/logstash-input-http-3.3.7.jar +0 -0
- metadata +178 -0
@@ -0,0 +1,504 @@
|
|
1
|
+
require "logstash/devutils/rspec/spec_helper"
|
2
|
+
require "logstash/devutils/rspec/shared_examples"
|
3
|
+
require "logstash/inputs/http"
|
4
|
+
require "json"
|
5
|
+
require "manticore"
|
6
|
+
require "stud/temporary"
|
7
|
+
require "zlib"
|
8
|
+
require "stringio"
|
9
|
+
|
10
|
+
java_import "io.netty.handler.ssl.util.SelfSignedCertificate"
|
11
|
+
|
12
|
+
describe LogStash::Inputs::Http do
|
13
|
+
|
14
|
+
before do
|
15
|
+
srand(RSpec.configuration.seed)
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:client) { Manticore::Client.new(client_options) }
|
19
|
+
let(:client_options) { { } }
|
20
|
+
let(:logstash_queue) { Queue.new }
|
21
|
+
let(:port) { rand(5000) + 1025 }
|
22
|
+
|
23
|
+
it_behaves_like "an interruptible input plugin" do
|
24
|
+
let(:config) { { "port" => port } }
|
25
|
+
end
|
26
|
+
|
27
|
+
after :each do
|
28
|
+
client.clear_pending
|
29
|
+
client.close
|
30
|
+
subject.stop
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "request handling" do
|
34
|
+
subject { LogStash::Inputs::Http.new("port" => port) }
|
35
|
+
|
36
|
+
before :each do
|
37
|
+
subject.register
|
38
|
+
t = Thread.new { subject.run(logstash_queue) }
|
39
|
+
ok = false
|
40
|
+
until ok
|
41
|
+
begin
|
42
|
+
client.post("http://127.0.0.1:#{port}", :body => '{}').call
|
43
|
+
rescue => e
|
44
|
+
# retry
|
45
|
+
else
|
46
|
+
ok = true
|
47
|
+
end
|
48
|
+
sleep 0.01
|
49
|
+
end
|
50
|
+
logstash_queue.pop if logstash_queue.size == 1 # pop test event
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "handling overflowing requests with a 429" do
|
54
|
+
let(:logstash_queue_size) { rand(10) + 1 }
|
55
|
+
let(:max_pending_requests) { rand(5) + 1 }
|
56
|
+
let(:threads) { rand(4) + 1 }
|
57
|
+
let(:logstash_queue) { SizedQueue.new(logstash_queue_size) }
|
58
|
+
let(:client_options) { {
|
59
|
+
"request_timeout" => 0.1,
|
60
|
+
"connect_timeout" => 3,
|
61
|
+
"socket_timeout" => 0.1
|
62
|
+
} }
|
63
|
+
|
64
|
+
subject { described_class.new("port" => port, "threads" => threads, "max_pending_requests" => max_pending_requests) }
|
65
|
+
|
66
|
+
context "when sending more requests than queue slots" do
|
67
|
+
it "should block when the queue is full" do
|
68
|
+
# these will queue and return 200
|
69
|
+
logstash_queue_size.times.each do |i|
|
70
|
+
response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
|
71
|
+
expect(response.code).to eq(200)
|
72
|
+
end
|
73
|
+
|
74
|
+
# these will block
|
75
|
+
(threads + max_pending_requests).times.each do |i|
|
76
|
+
expect {
|
77
|
+
client.post("http://127.0.0.1:#{port}", :body => '{}').call
|
78
|
+
}.to raise_error(Manticore::SocketTimeout)
|
79
|
+
end
|
80
|
+
|
81
|
+
# by now we should be rejecting with 429
|
82
|
+
response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
|
83
|
+
expect(response.code).to eq(429)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "remote host" do
|
89
|
+
subject { LogStash::Inputs::Http.new(config.merge("port" => port)) }
|
90
|
+
context "by default" do
|
91
|
+
let(:config) { {} }
|
92
|
+
it "is written to the \"host\" field" do
|
93
|
+
client.post("http://localhost:#{port}/meh.json",
|
94
|
+
:headers => { "content-type" => "text/plain" },
|
95
|
+
:body => "hello").call
|
96
|
+
event = logstash_queue.pop
|
97
|
+
expect(event.get("host")).to eq("127.0.0.1")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context "when using remote_host_target_field" do
|
102
|
+
let(:config) { { "remote_host_target_field" => "remote_host" } }
|
103
|
+
it "is written to the value of \"remote_host_target_field\" property" do
|
104
|
+
client.post("http://localhost:#{port}/meh.json",
|
105
|
+
:headers => { "content-type" => "text/plain" },
|
106
|
+
:body => "hello").call
|
107
|
+
event = logstash_queue.pop
|
108
|
+
expect(event.get("remote_host")).to eq("127.0.0.1")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe "request headers" do
|
114
|
+
subject { LogStash::Inputs::Http.new(config.merge("port" => port)) }
|
115
|
+
context "by default" do
|
116
|
+
let(:config) { {} }
|
117
|
+
it "are written to the \"headers\" field" do
|
118
|
+
client.post("http://localhost:#{port}/meh.json",
|
119
|
+
:headers => { "content-type" => "text/plain" },
|
120
|
+
:body => "hello").call
|
121
|
+
event = logstash_queue.pop
|
122
|
+
expect(event.get("headers")).to be_a(Hash)
|
123
|
+
expect(event.get("headers")).to include("request_method" => "POST")
|
124
|
+
end
|
125
|
+
end
|
126
|
+
context "when using request_headers_target_field" do
|
127
|
+
let(:config) { { "request_headers_target_field" => "request_headers" } }
|
128
|
+
it "are written to the field set in \"request_headers_target_field\"" do
|
129
|
+
client.post("http://localhost:#{port}/meh.json",
|
130
|
+
:headers => { "content-type" => "text/plain" },
|
131
|
+
:body => "hello").call
|
132
|
+
event = logstash_queue.pop
|
133
|
+
expect(event.get("request_headers")).to be_a(Hash)
|
134
|
+
expect(event.get("request_headers")).to include("request_method" => "POST")
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should include remote host in \"host\" property" do
|
140
|
+
client.post("http://127.0.0.1:#{port}/meh.json",
|
141
|
+
:headers => { "content-type" => "text/plain" },
|
142
|
+
:body => "hello").call
|
143
|
+
event = logstash_queue.pop
|
144
|
+
expect(event.get("host")).to eq("127.0.0.1")
|
145
|
+
end
|
146
|
+
|
147
|
+
context "with default codec" do
|
148
|
+
subject { LogStash::Inputs::Http.new("port" => port) }
|
149
|
+
context "when receiving a text/plain request" do
|
150
|
+
it "should process the request normally" do
|
151
|
+
client.post("http://127.0.0.1:#{port}/meh.json",
|
152
|
+
:headers => { "content-type" => "text/plain" },
|
153
|
+
:body => "hello").call
|
154
|
+
event = logstash_queue.pop
|
155
|
+
expect(event.get("message")).to eq("hello")
|
156
|
+
end
|
157
|
+
end
|
158
|
+
context "when receiving a deflate compressed text/plain request" do
|
159
|
+
it "should process the request normally" do
|
160
|
+
client.post("http://127.0.0.1:#{port}/meh.json",
|
161
|
+
:headers => { "content-type" => "text/plain", "content-encoding" => "deflate" },
|
162
|
+
:body => Zlib::Deflate.deflate("hello")).call
|
163
|
+
event = logstash_queue.pop
|
164
|
+
expect(event.get("message")).to eq("hello")
|
165
|
+
end
|
166
|
+
end
|
167
|
+
context "when receiving a deflate text/plain request that cannot be decompressed" do
|
168
|
+
let(:response) do
|
169
|
+
response = client.post("http://127.0.0.1:#{port}/meh.json",
|
170
|
+
:headers => { "content-type" => "text/plain", "content-encoding" => "deflate" },
|
171
|
+
:body => "hello").call
|
172
|
+
end
|
173
|
+
it "should respond with 400" do
|
174
|
+
expect(response.code).to eq(400)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
context "when receiving a gzip compressed text/plain request" do
|
178
|
+
it "should process the request normally" do
|
179
|
+
wio = StringIO.new("w")
|
180
|
+
z = Zlib::GzipWriter.new(wio)
|
181
|
+
z.write("hello")
|
182
|
+
z.close
|
183
|
+
entity = org.apache.http.entity.ByteArrayEntity.new(wio.string.to_java_bytes)
|
184
|
+
response = client.post("http://127.0.0.1:#{port}",
|
185
|
+
:headers => { "Content-Encoding" => "gzip" },
|
186
|
+
:entity => entity).call
|
187
|
+
expect(response.code).to eq(200)
|
188
|
+
event = logstash_queue.pop
|
189
|
+
expect(event.get("message")).to eq("hello")
|
190
|
+
end
|
191
|
+
end
|
192
|
+
context "when receiving a gzip text/plain request that cannot be decompressed" do
|
193
|
+
let(:response) do
|
194
|
+
client.post("http://127.0.0.1:#{port}",
|
195
|
+
:headers => { "Content-Encoding" => "gzip" },
|
196
|
+
:body => Zlib::Deflate.deflate("hello")).call
|
197
|
+
end
|
198
|
+
it "should respond with 400" do
|
199
|
+
expect(response.code).to eq(400)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
context "when receiving an application/json request" do
|
203
|
+
it "should parse the json body" do
|
204
|
+
client.post("http://127.0.0.1:#{port}/meh.json",
|
205
|
+
:headers => { "content-type" => "application/json" },
|
206
|
+
:body => { "message_body" => "Hello" }.to_json).call
|
207
|
+
event = logstash_queue.pop
|
208
|
+
expect(event.get("message_body")).to eq("Hello")
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
context "with json codec" do
|
214
|
+
subject { LogStash::Inputs::Http.new("port" => port, "codec" => "json") }
|
215
|
+
it "should parse the json body" do
|
216
|
+
response = client.post("http://127.0.0.1:#{port}/meh.json", :body => { "message" => "Hello" }.to_json).call
|
217
|
+
event = logstash_queue.pop
|
218
|
+
expect(event.get("message")).to eq("Hello")
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
context "with json_lines codec without final delimiter" do
|
223
|
+
subject { LogStash::Inputs::Http.new("port" => port, "codec" => "json_lines") }
|
224
|
+
let(:line1) { '{"foo": 1}' }
|
225
|
+
let(:line2) { '{"foo": 2}' }
|
226
|
+
it "should parse all json_lines in body including last one" do
|
227
|
+
client.post("http://localhost:#{port}/meh.json", :body => "#{line1}\n#{line2}").call
|
228
|
+
expect(logstash_queue.size).to eq(2)
|
229
|
+
event = logstash_queue.pop
|
230
|
+
expect(event.get("foo")).to eq(1)
|
231
|
+
event = logstash_queue.pop
|
232
|
+
expect(event.get("foo")).to eq(2)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
context "when using a custom codec mapping" do
|
237
|
+
subject { LogStash::Inputs::Http.new("port" => port,
|
238
|
+
"additional_codecs" => { "application/json" => "plain" }) }
|
239
|
+
it "should decode the message accordingly" do
|
240
|
+
body = { "message" => "Hello" }.to_json
|
241
|
+
client.post("http://127.0.0.1:#{port}/meh.json",
|
242
|
+
:headers => { "content-type" => "application/json" },
|
243
|
+
:body => body).call
|
244
|
+
event = logstash_queue.pop
|
245
|
+
expect(event.get("message")).to eq(body)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
context "when receiving a content-type with a charset" do
|
250
|
+
subject { LogStash::Inputs::Http.new("port" => port,
|
251
|
+
"additional_codecs" => { "application/json" => "plain" }) }
|
252
|
+
it "should decode the message accordingly" do
|
253
|
+
body = { "message" => "Hello" }.to_json
|
254
|
+
client.post("http://127.0.0.1:#{port}/meh.json",
|
255
|
+
:headers => { "content-type" => "application/json; charset=utf-8" },
|
256
|
+
:body => body).call
|
257
|
+
event = logstash_queue.pop
|
258
|
+
expect(event.get("message")).to eq(body)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
context "when using custom headers" do
|
263
|
+
let(:custom_headers) { { 'access-control-allow-origin' => '*' } }
|
264
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_headers" => custom_headers) }
|
265
|
+
|
266
|
+
describe "the response" do
|
267
|
+
it "should include the custom headers" do
|
268
|
+
response = client.post("http://127.0.0.1:#{port}/meh", :body => "hello").call
|
269
|
+
expect(response.headers.to_hash).to include(custom_headers)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
describe "basic auth" do
|
274
|
+
user = "test"; password = "pwd"
|
275
|
+
subject { LogStash::Inputs::Http.new("port" => port, "user" => user, "password" => password) }
|
276
|
+
let(:auth_token) { Base64.strict_encode64("#{user}:#{password}") }
|
277
|
+
context "when client doesn't present auth token" do
|
278
|
+
let!(:response) { client.post("http://127.0.0.1:#{port}/meh", :body => "hi").call }
|
279
|
+
it "should respond with 401" do
|
280
|
+
expect(response.code).to eq(401)
|
281
|
+
end
|
282
|
+
it 'should include a WWW-Authenticate: Basic header' do
|
283
|
+
expect(response['WWW-Authenticate']).to_not be_nil
|
284
|
+
|
285
|
+
expect(response['WWW-Authenticate']).to start_with('Basic realm=')
|
286
|
+
end
|
287
|
+
it "should not generate an event" do
|
288
|
+
expect(logstash_queue).to be_empty
|
289
|
+
end
|
290
|
+
end
|
291
|
+
context "when client presents incorrect auth token" do
|
292
|
+
let!(:response) do
|
293
|
+
client.post("http://127.0.0.1:#{port}/meh",
|
294
|
+
:headers => {
|
295
|
+
"content-type" => "text/plain",
|
296
|
+
"authorization" => "Basic meh"
|
297
|
+
},
|
298
|
+
:body => "hi").call
|
299
|
+
end
|
300
|
+
it "should respond with 401" do
|
301
|
+
expect(response.code).to eq(401)
|
302
|
+
end
|
303
|
+
it 'should not include a WWW-Authenticate header' do
|
304
|
+
expect(response['WWW-Authenticate']).to be_nil
|
305
|
+
end
|
306
|
+
it "should not generate an event" do
|
307
|
+
expect(logstash_queue).to be_empty
|
308
|
+
end
|
309
|
+
end
|
310
|
+
context "when client presents correct auth token" do
|
311
|
+
let!(:response) do
|
312
|
+
client.post("http://127.0.0.1:#{port}/meh",
|
313
|
+
:headers => {
|
314
|
+
"content-type" => "text/plain",
|
315
|
+
"authorization" => "Basic #{auth_token}"
|
316
|
+
}, :body => "hi").call
|
317
|
+
end
|
318
|
+
it "should respond with 200" do
|
319
|
+
expect(response.code).to eq(200)
|
320
|
+
end
|
321
|
+
it "should generate an event" do
|
322
|
+
expect(logstash_queue).to_not be_empty
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
describe "HTTP Protocol Handling" do
|
328
|
+
context "when an HTTP1.1 request is made" do
|
329
|
+
let(:protocol_version) do
|
330
|
+
Java::OrgApacheHttp::HttpVersion::HTTP_1_1
|
331
|
+
end
|
332
|
+
it "responds with a HTTP1.1 response" do
|
333
|
+
response = client.post("http://127.0.0.1:#{port}", :body => "hello")
|
334
|
+
response.request.set_protocol_version(protocol_version)
|
335
|
+
response.call
|
336
|
+
response_protocol_version = response.instance_variable_get(:@response).get_protocol_version
|
337
|
+
expect(response_protocol_version).to eq(protocol_version)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
context "when an HTTP1.0 request is made" do
|
341
|
+
let(:protocol_version) do
|
342
|
+
Java::OrgApacheHttp::HttpVersion::HTTP_1_0
|
343
|
+
end
|
344
|
+
it "responds with a HTTP1.0 response" do
|
345
|
+
response = client.post("http://127.0.0.1:#{port}", :body => "hello")
|
346
|
+
response.request.set_protocol_version(protocol_version)
|
347
|
+
response.call
|
348
|
+
response_protocol_version = response.instance_variable_get(:@response).get_protocol_version
|
349
|
+
expect(response_protocol_version).to eq(protocol_version)
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
describe "return code" do
|
354
|
+
it "responds with a 200" do
|
355
|
+
response = client.post("http://127.0.0.1:#{port}", :body => "hello")
|
356
|
+
response.call
|
357
|
+
expect(response.code).to eq(200)
|
358
|
+
end
|
359
|
+
context "when response_code is configured" do
|
360
|
+
let(:code) { 202 }
|
361
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_code" => code) }
|
362
|
+
it "responds with the configured code" do
|
363
|
+
response = client.post("http://127.0.0.1:#{port}", :body => "hello")
|
364
|
+
response.call
|
365
|
+
expect(response.code).to eq(202)
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
context "with :ssl => false" do
|
372
|
+
subject { LogStash::Inputs::Http.new("port" => port, "ssl" => false) }
|
373
|
+
it "should not raise exception" do
|
374
|
+
expect { subject.register }.to_not raise_exception
|
375
|
+
end
|
376
|
+
end
|
377
|
+
context "with :ssl => true" do
|
378
|
+
context "without :ssl_certificate" do
|
379
|
+
subject { LogStash::Inputs::Http.new("port" => port, "ssl" => true) }
|
380
|
+
it "should raise exception" do
|
381
|
+
expect { subject.register }.to raise_exception(LogStash::ConfigurationError)
|
382
|
+
end
|
383
|
+
end
|
384
|
+
context "with :ssl_certificate" do
|
385
|
+
let(:ssc) { SelfSignedCertificate.new }
|
386
|
+
let(:ssl_certificate) { ssc.certificate }
|
387
|
+
let(:ssl_key) { ssc.private_key }
|
388
|
+
|
389
|
+
let(:config) do
|
390
|
+
{ "port" => port, "ssl" => true, "ssl_certificate" => ssl_certificate.path, "ssl_key" => ssl_key.path }
|
391
|
+
end
|
392
|
+
|
393
|
+
after(:each) { ssc.delete }
|
394
|
+
|
395
|
+
subject { LogStash::Inputs::Http.new(config) }
|
396
|
+
|
397
|
+
it "should not raise exception" do
|
398
|
+
expect { subject.register }.to_not raise_exception
|
399
|
+
end
|
400
|
+
|
401
|
+
context "with ssl_verify_mode = none" do
|
402
|
+
subject { LogStash::Inputs::Http.new(config.merge("ssl_verify_mode" => "none")) }
|
403
|
+
|
404
|
+
it "should not raise exception" do
|
405
|
+
expect { subject.register }.to_not raise_exception
|
406
|
+
end
|
407
|
+
end
|
408
|
+
["peer", "force_peer"].each do |verify_mode|
|
409
|
+
context "with ssl_verify_mode = #{verify_mode}" do
|
410
|
+
subject { LogStash::Inputs::Http.new("port" => port, "ssl" => true,
|
411
|
+
"ssl_certificate" => ssl_certificate.path,
|
412
|
+
"ssl_certificate_authorities" => ssl_certificate.path,
|
413
|
+
"ssl_key" => ssl_key.path,
|
414
|
+
"ssl_verify_mode" => verify_mode
|
415
|
+
) }
|
416
|
+
it "should not raise exception" do
|
417
|
+
expect { subject.register }.to_not raise_exception
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
421
|
+
context "with verify_mode = none" do
|
422
|
+
subject { LogStash::Inputs::Http.new(config.merge("verify_mode" => "none")) }
|
423
|
+
|
424
|
+
it "should not raise exception" do
|
425
|
+
expect { subject.register }.to_not raise_exception
|
426
|
+
end
|
427
|
+
end
|
428
|
+
["peer", "force_peer"].each do |verify_mode|
|
429
|
+
context "with verify_mode = #{verify_mode}" do
|
430
|
+
subject { LogStash::Inputs::Http.new("port" => port, "ssl" => true,
|
431
|
+
"ssl_certificate" => ssl_certificate.path,
|
432
|
+
"ssl_certificate_authorities" => ssl_certificate.path,
|
433
|
+
"ssl_key" => ssl_key.path,
|
434
|
+
"verify_mode" => verify_mode
|
435
|
+
) }
|
436
|
+
it "should not raise exception" do
|
437
|
+
expect { subject.register }.to_not raise_exception
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
context "with invalid cipher_suites" do
|
443
|
+
let(:config) { super.merge("cipher_suites" => "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA38") }
|
444
|
+
|
445
|
+
it "should raise a configuration error" do
|
446
|
+
expect( subject.logger ).to receive(:error) do |msg, opts|
|
447
|
+
expect( msg ).to match /.*?configuration invalid/
|
448
|
+
expect( opts[:message] ).to match /TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA38.*? not available/
|
449
|
+
end
|
450
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
context "with invalid ssl certificate" do
|
455
|
+
before do
|
456
|
+
cert = File.readlines path = config["ssl_certificate"]
|
457
|
+
i = cert.index { |line| line.index('END CERTIFICATE') }
|
458
|
+
cert[i - 1] = ''
|
459
|
+
File.write path, cert.join("\n")
|
460
|
+
end
|
461
|
+
|
462
|
+
it "should raise a configuration error" do
|
463
|
+
expect( subject.logger ).to receive(:error) do |msg, opts|
|
464
|
+
expect( msg ).to match /SSL configuration invalid/
|
465
|
+
expect( opts[:message] ).to match /File does not contain valid certificate/i
|
466
|
+
end
|
467
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
context "with invalid ssl key config" do
|
472
|
+
let(:config) { super.merge("ssl_key_passphrase" => "1234567890") }
|
473
|
+
|
474
|
+
it "should raise a configuration error" do
|
475
|
+
expect( subject.logger ).to receive(:error) do |msg, opts|
|
476
|
+
expect( msg ).to match /SSL configuration invalid/
|
477
|
+
expect( opts[:message] ).to match /File does not contain valid private key/i
|
478
|
+
end
|
479
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
context "with invalid ssl certificate_authorities" do
|
484
|
+
let(:config) do
|
485
|
+
super.merge("ssl_verify_mode" => "peer",
|
486
|
+
"ssl_certificate_authorities" => [ ssc.certificate.path, ssc.private_key.path ])
|
487
|
+
end
|
488
|
+
|
489
|
+
it "should raise a cert error" do
|
490
|
+
expect( subject.logger ).to receive(:error) do |msg, opts|
|
491
|
+
expect( msg ).to match(/SSL configuration failed/), lambda { "unexpected: logger.error #{msg.inspect}, #{opts.inspect}" }
|
492
|
+
expect( opts[:message] ).to match /signed fields invalid/
|
493
|
+
end
|
494
|
+
begin
|
495
|
+
subject.register
|
496
|
+
rescue Java::JavaSecurityCert::CertificateParsingException
|
497
|
+
:pass
|
498
|
+
end
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
502
|
+
end
|
503
|
+
end
|
504
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sp-logstash-input-http
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.3.7
|
5
|
+
platform: java
|
6
|
+
authors:
|
7
|
+
- Elastic
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-01-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: logstash-core-plugin-api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.60'
|
20
|
+
- - <=
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.99'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.60'
|
30
|
+
- - <=
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.99'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: logstash-codec-plain
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: jar-dependencies
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.3'
|
54
|
+
- - '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.3.4
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ~>
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0.3'
|
64
|
+
- - '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.3.4
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: logstash-devutils
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: logstash-codec-json
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: logstash-codec-json_lines
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: manticore
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
type: :development
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
description: This gem is a Logstash plugin required to be installed on top of the
|
124
|
+
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
125
|
+
gem is not a stand-alone program
|
126
|
+
email: info@elastic.co
|
127
|
+
executables: []
|
128
|
+
extensions: []
|
129
|
+
extra_rdoc_files: []
|
130
|
+
files:
|
131
|
+
- lib/logstash/inputs/http/message_handler.rb
|
132
|
+
- lib/logstash/inputs/http/tls.rb
|
133
|
+
- lib/logstash/inputs/http.rb
|
134
|
+
- lib/logstash/util/http_compressed_requests.rb
|
135
|
+
- lib/logstash-input-http_jars.rb
|
136
|
+
- lib/tasks/build.rake
|
137
|
+
- spec/inputs/http_spec.rb
|
138
|
+
- logstash-input-http.gemspec
|
139
|
+
- CHANGELOG.md
|
140
|
+
- DEVELOPER.md
|
141
|
+
- README.md
|
142
|
+
- Gemfile
|
143
|
+
- LICENSE
|
144
|
+
- NOTICE.TXT
|
145
|
+
- vendor/jar-dependencies/io/netty/netty-all/4.1.49.Final/netty-all-4.1.49.Final.jar
|
146
|
+
- vendor/jar-dependencies/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar
|
147
|
+
- vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/3.3.7/logstash-input-http-3.3.7.jar
|
148
|
+
- VERSION
|
149
|
+
- docs/index.asciidoc
|
150
|
+
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
151
|
+
licenses:
|
152
|
+
- Apache License (2.0)
|
153
|
+
metadata:
|
154
|
+
logstash_plugin: 'true'
|
155
|
+
logstash_group: input
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
- vendor/jar-dependencies
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - '>='
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubyforge_project:
|
173
|
+
rubygems_version: 2.0.14.1
|
174
|
+
signing_key:
|
175
|
+
specification_version: 4
|
176
|
+
summary: Receives events over HTTP or HTTPS
|
177
|
+
test_files:
|
178
|
+
- spec/inputs/http_spec.rb
|