logstash-input-tcp 6.0.10-java → 6.2.1-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 +16 -0
- data/docs/index.asciidoc +61 -0
- data/lib/logstash/inputs/tcp/decoder_impl.rb +12 -9
- data/lib/logstash/inputs/tcp.rb +53 -27
- data/logstash-input-tcp.gemspec +6 -0
- data/spec/fixtures/encrypted-pkcs5v15.crt +14 -0
- data/spec/fixtures/encrypted-pkcs5v15.key +17 -0
- data/spec/fixtures/encrypted-pkcs8.crt +11 -0
- data/spec/fixtures/encrypted-pkcs8.key +18 -0
- data/spec/fixtures/encrypted_aes256.crt +17 -0
- data/spec/fixtures/encrypted_aes256.key +30 -0
- data/spec/fixtures/encrypted_des.crt +9 -0
- data/spec/fixtures/encrypted_des.key +12 -0
- data/spec/fixtures/encrypted_seed.crt +17 -0
- data/spec/fixtures/encrypted_seed.key +30 -0
- data/spec/fixtures/small.crt +9 -0
- data/spec/fixtures/small.key +9 -0
- data/spec/inputs/tcp_spec.rb +243 -116
- data/vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/{6.0.10/logstash-input-tcp-6.0.10.jar → 6.2.1/logstash-input-tcp-6.2.1.jar} +0 -0
- data/version +1 -1
- metadata +86 -16
- data/lib/logstash/inputs/tcp/compat_ssl_options.rb +0 -147
@@ -0,0 +1,9 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIBJDCBzwIUHQzJgyMCU0MIRFQe/tf7VKuisH8wDQYJKoZIhvcNAQELBQAwFDES
|
3
|
+
MBAGA1UEAwwJbG9jYWxob3N0MB4XDTIxMDgyNTEyMTAxMFoXDTI0MTIwNzEyMTAx
|
4
|
+
MFowFDESMBAGA1UEAwwJbG9jYWxob3N0MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJB
|
5
|
+
APJeOzK15pLZ1c3dyCJpNw2Uupj0LrFXmoOT5be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/WZZyX3YKW6S123qUAiGO40vpAZ3WIttq1x
|
6
|
+
Gb4+fF81/jDuodfFgu2zm3cCAwEAATANBgkqhkiG9w0BAQsFAANBAHByJqZFOPFr
|
7
|
+
OE0BRv7KCd0IMNbVzr99de74jZKx7qBK8soV4ZAUsVX/+Qldtta2+q2WXaMEKHXS
|
8
|
+
7xpnYQjSkNs=
|
9
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1,9 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIBOgIBAAJBAMv+w+WDbrAPQCNqBkry52ayQyLnx/WZZyX3YKW6S123qUAiGO40
|
3
|
+
vpAZ3WIttq1xGb4+fF81/jDuodfFgu2zm3cCAwEAAQJBALigAUhN5fXuN4xVvxBC
|
4
|
+
O3BU0jJbODxt9E8GTzBvJRrRKLVv8eLF7IubPPh+CW2D32JMSj8XZLBjkjj6y5P5
|
5
|
+
p8ECIQD9mZbe5iT4SowhlGO0YqyxnN2C1Id+CloUmIoOyNDR0QIhAM3s/uGpjxvD
|
6
|
+
6zdJQds5tp4WpFhrQzs5lAf7wFUrRuLHAiByc0OEmycqKzKs4PRSb4nyqpHJvrLb
|
7
|
+
bj6TNvhvja+4UQIgCSf6hUomxNNHSCQHu5mrVwgmso/CY4XB4UD+YksUUc0CIAIm
|
8
|
+
cjJtX/A4DdaSMwdNp8q8f8MrppQjErltD80oRpxv
|
9
|
+
-----END RSA PRIVATE KEY-----
|
data/spec/inputs/tcp_spec.rb
CHANGED
@@ -15,9 +15,11 @@ java_import "io.netty.handler.ssl.util.SelfSignedCertificate"
|
|
15
15
|
|
16
16
|
require_relative "../spec_helper"
|
17
17
|
|
18
|
+
require 'logstash/plugin_mixins/ecs_compatibility_support/spec_helper'
|
19
|
+
|
18
20
|
#Cabin::Channel.get(LogStash).subscribe(STDOUT)
|
19
21
|
#Cabin::Channel.get(LogStash).level = :debug
|
20
|
-
describe LogStash::Inputs::Tcp do
|
22
|
+
describe LogStash::Inputs::Tcp, :ecs_compatibility_support do
|
21
23
|
|
22
24
|
def get_port
|
23
25
|
begin
|
@@ -52,160 +54,176 @@ describe LogStash::Inputs::Tcp do
|
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
ecs_compatibility_matrix(:disabled,:v1, :v8 => :v1) do |ecs_select|
|
58
|
+
before(:each) do
|
59
|
+
allow_any_instance_of(described_class).to receive(:ecs_compatibility).and_return(ecs_compatibility)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should read plain with unicode" do
|
63
|
+
event_count = 10
|
64
|
+
conf = <<-CONFIG
|
65
|
+
input {
|
66
|
+
tcp {
|
67
|
+
port => #{port}
|
68
|
+
}
|
61
69
|
}
|
62
|
-
|
63
|
-
|
70
|
+
CONFIG
|
71
|
+
|
72
|
+
host = 'localhost'
|
73
|
+
events = input(conf) do |pipeline, queue|
|
74
|
+
socket = Stud::try(5.times) { TCPSocket.new(host, port) }
|
75
|
+
event_count.times do |i|
|
76
|
+
# unicode smiley for testing unicode support!
|
77
|
+
socket.puts("#{i} ☹")
|
78
|
+
socket.flush
|
79
|
+
end
|
80
|
+
socket.close
|
64
81
|
|
65
|
-
|
66
|
-
events = input(conf) do |pipeline, queue|
|
67
|
-
socket = Stud::try(5.times) { TCPSocket.new(host, port) }
|
68
|
-
event_count.times do |i|
|
69
|
-
# unicode smiley for testing unicode support!
|
70
|
-
socket.puts("#{i} ☹")
|
71
|
-
socket.flush
|
82
|
+
event_count.times.collect {queue.pop}
|
72
83
|
end
|
73
|
-
socket.close
|
74
84
|
|
75
|
-
|
76
|
-
|
85
|
+
expect(events.length).to eq(event_count)
|
86
|
+
events = events.sort_by {|e| e.get("message")} # the ordering of events in the queue is highly timing-dependent
|
87
|
+
event_count.times do |i|
|
88
|
+
event = events[i]
|
77
89
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
insist { event.get("[@metadata][ip_address]") } == '127.0.0.1'
|
90
|
+
aggregate_failures("event #{i}") do
|
91
|
+
expect(event.get("message")).to eq("#{i} ☹")
|
92
|
+
expect(event.get(ecs_select[disabled: "host", v1: "[@metadata][input][tcp][source][name]"])).to eq("localhost").or eq("ip6-localhost")
|
93
|
+
expect(event.get(ecs_select[disabled: "[@metadata][ip_address]", v1: "[@metadata][input][tcp][source][ip]"])).to eq('127.0.0.1')
|
94
|
+
end
|
95
|
+
end
|
85
96
|
end
|
86
|
-
end
|
87
97
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
98
|
+
it "should handle PROXY protocol v1 connections" do
|
99
|
+
event_count = 10
|
100
|
+
conf = <<-CONFIG
|
101
|
+
input {
|
102
|
+
tcp {
|
103
|
+
proxy_protocol => true
|
104
|
+
port => '#{port}'
|
105
|
+
}
|
95
106
|
}
|
96
|
-
|
97
|
-
CONFIG
|
107
|
+
CONFIG
|
98
108
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
socket.flush
|
103
|
-
event_count.times do |i|
|
104
|
-
# unicode smiley for testing unicode support!
|
105
|
-
socket.puts("#{i} ☹")
|
109
|
+
events = input(conf) do |pipeline, queue|
|
110
|
+
socket = Stud::try(5.times) { TCPSocket.new("127.0.0.1", port) }
|
111
|
+
socket.puts("PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678\r");
|
106
112
|
socket.flush
|
107
|
-
|
108
|
-
|
113
|
+
event_count.times do |i|
|
114
|
+
# unicode smiley for testing unicode support!
|
115
|
+
socket.puts("#{i} ☹")
|
116
|
+
socket.flush
|
117
|
+
end
|
118
|
+
socket.close
|
109
119
|
|
110
|
-
|
111
|
-
|
120
|
+
event_count.times.collect {queue.pop}
|
121
|
+
end
|
112
122
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
123
|
+
expect(events.length).to eq(event_count)
|
124
|
+
events = events.sort_by {|e| e.get("message")} # the ordering of events in the queue is highly timing-dependent
|
125
|
+
events.each_with_index do |event, i|
|
126
|
+
aggregate_failures("event #{i}") do
|
127
|
+
expect(event.get("message")).to eq("#{i} ☹")
|
128
|
+
expect(event.get(ecs_select[disabled: "host", v1: "[@metadata][input][tcp][source][name]"])).to eq('1.2.3.4')
|
129
|
+
expect(event.get(ecs_select[disabled: "[@metadata][ip_address]", v1: "[@metadata][input][tcp][source][ip]" ])).to eq('1.2.3.4')
|
130
|
+
expect(event.get(ecs_select[disabled: "port", v1: "[@metadata][input][tcp][source][port]"])).to eq('1234')
|
131
|
+
expect(event.get(ecs_select[disabled: "proxy_host", v1: "[@metadata][input][tcp][proxy][ip]" ])).to eq('5.6.7.8')
|
132
|
+
expect(event.get(ecs_select[disabled: "proxy_port", v1: "[@metadata][input][tcp][proxy][port]" ])).to eq('5678')
|
133
|
+
end
|
134
|
+
end
|
121
135
|
end
|
122
|
-
end
|
123
136
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
137
|
+
it "should read events with json codec" do
|
138
|
+
conf = <<-CONFIG
|
139
|
+
input {
|
140
|
+
tcp {
|
141
|
+
port => #{port}
|
142
|
+
codec => json
|
143
|
+
}
|
131
144
|
}
|
145
|
+
CONFIG
|
146
|
+
|
147
|
+
data = {
|
148
|
+
"hello" => "world",
|
149
|
+
"foo" => [1,2,3],
|
150
|
+
"baz" => { "1" => "2" },
|
151
|
+
"host" => "example host"
|
132
152
|
}
|
133
|
-
CONFIG
|
134
153
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
socket.puts(text)
|
140
|
-
socket.close
|
154
|
+
event = input(conf) do |pipeline, queue|
|
155
|
+
socket = Stud::try(5.times) { TCPSocket.new("127.0.0.1", port) }
|
156
|
+
socket.puts(LogStash::Json.dump(data))
|
157
|
+
socket.close
|
141
158
|
|
142
|
-
|
143
|
-
|
159
|
+
queue.pop
|
160
|
+
end
|
144
161
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
insist { event.get("message") } == "£"
|
149
|
-
end
|
162
|
+
insist { event.get("hello") } == data["hello"]
|
163
|
+
insist { event.get("foo").to_a } == data["foo"] # to_a to cast Java ArrayList produced by JrJackson
|
164
|
+
insist { event.get("baz") } == data["baz"]
|
150
165
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
166
|
+
# Make sure the tcp input, w/ json codec, uses the event's 'host' value,
|
167
|
+
# if present, instead of providing its own
|
168
|
+
insist { event.get("host") } == data["host"]
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should read events with json codec (testing 'host' handling)" do
|
172
|
+
conf = <<-CONFIG
|
173
|
+
input {
|
174
|
+
tcp {
|
175
|
+
port => #{port}
|
176
|
+
codec => json
|
177
|
+
}
|
157
178
|
}
|
179
|
+
CONFIG
|
180
|
+
|
181
|
+
data = {
|
182
|
+
"hello" => "world"
|
158
183
|
}
|
159
|
-
CONFIG
|
160
184
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
"host" => "example host"
|
166
|
-
}
|
185
|
+
event = input(conf) do |pipeline, queue|
|
186
|
+
socket = Stud::try(5.times) { TCPSocket.new("127.0.0.1", port) }
|
187
|
+
socket.puts(LogStash::Json.dump(data))
|
188
|
+
socket.close
|
167
189
|
|
168
|
-
|
169
|
-
|
170
|
-
socket.puts(LogStash::Json.dump(data))
|
171
|
-
socket.close
|
190
|
+
queue.pop
|
191
|
+
end
|
172
192
|
|
173
|
-
|
193
|
+
aggregate_failures("event") do
|
194
|
+
expect(event.get("hello")).to eq(data["hello"])
|
195
|
+
expect(event).to include(ecs_select[disabled: "host", v1: "[@metadata][input][tcp][source][name]"])
|
196
|
+
expect(event).to include(ecs_select[disabled: "[@metadata][ip_address]", v1: "[@metadata][input][tcp][source][ip]" ])
|
197
|
+
end
|
174
198
|
end
|
175
|
-
|
176
|
-
insist { event.get("hello") } == data["hello"]
|
177
|
-
insist { event.get("foo").to_a } == data["foo"] # to_a to cast Java ArrayList produced by JrJackson
|
178
|
-
insist { event.get("baz") } == data["baz"]
|
179
|
-
|
180
|
-
# Make sure the tcp input, w/ json codec, uses the event's 'host' value,
|
181
|
-
# if present, instead of providing its own
|
182
|
-
insist { event.get("host") } == data["host"]
|
183
199
|
end
|
184
200
|
|
185
|
-
it "should read events with
|
201
|
+
it "should read events with plain codec and ISO-8859-1 charset" do
|
202
|
+
charset = "ISO-8859-1"
|
186
203
|
conf = <<-CONFIG
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
204
|
+
input {
|
205
|
+
tcp {
|
206
|
+
port => #{port}
|
207
|
+
codec => plain { charset => "#{charset}" }
|
208
|
+
}
|
191
209
|
}
|
192
|
-
}
|
193
210
|
CONFIG
|
194
211
|
|
195
|
-
data = {
|
196
|
-
"hello" => "world"
|
197
|
-
}
|
198
|
-
|
199
212
|
event = input(conf) do |pipeline, queue|
|
200
213
|
socket = Stud::try(5.times) { TCPSocket.new("127.0.0.1", port) }
|
201
|
-
|
214
|
+
text = "\xA3" # the £ symbol in ISO-8859-1 aka Latin-1
|
215
|
+
text.force_encoding("ISO-8859-1")
|
216
|
+
socket.puts(text)
|
202
217
|
socket.close
|
203
218
|
|
204
219
|
queue.pop
|
205
220
|
end
|
206
221
|
|
207
|
-
|
208
|
-
|
222
|
+
# Make sure the 0xA3 latin-1 code converts correctly to UTF-8.
|
223
|
+
aggregate_failures("event") do
|
224
|
+
expect(event.get("message")).to have_attributes(size: 1, bytesize: 2, encoding: Encoding.find("UTF-8"))
|
225
|
+
expect(event.get("message")).to eq("£")
|
226
|
+
end
|
209
227
|
end
|
210
228
|
|
211
229
|
it "should read events with json_lines codec" do
|
@@ -411,6 +429,115 @@ describe LogStash::Inputs::Tcp do
|
|
411
429
|
expect { subject.register }.to_not raise_error
|
412
430
|
end
|
413
431
|
end
|
432
|
+
|
433
|
+
context "encrypted (AES-156) key" do
|
434
|
+
let(:config) do
|
435
|
+
{
|
436
|
+
"host" => "127.0.0.1",
|
437
|
+
"port" => port,
|
438
|
+
"ssl_enable" => true,
|
439
|
+
"ssl_cert" => File.expand_path('../fixtures/encrypted_aes256.crt', File.dirname(__FILE__)),
|
440
|
+
"ssl_key" => File.expand_path('../fixtures/encrypted_aes256.key', File.dirname(__FILE__)),
|
441
|
+
"ssl_key_passphrase" => '1234',
|
442
|
+
}
|
443
|
+
end
|
444
|
+
|
445
|
+
it "should register without errors" do
|
446
|
+
expect { subject.register }.to_not raise_error
|
447
|
+
end
|
448
|
+
|
449
|
+
end
|
450
|
+
|
451
|
+
context "encrypted (SEED) key" do # algorithm not supported by Sun provider
|
452
|
+
let(:config) do
|
453
|
+
{
|
454
|
+
"host" => "127.0.0.1",
|
455
|
+
"port" => port,
|
456
|
+
"ssl_enable" => true,
|
457
|
+
"ssl_cert" => File.expand_path('../fixtures/encrypted_seed.crt', File.dirname(__FILE__)),
|
458
|
+
"ssl_key" => File.expand_path('../fixtures/encrypted_seed.key', File.dirname(__FILE__)),
|
459
|
+
"ssl_key_passphrase" => '1234',
|
460
|
+
}
|
461
|
+
end
|
462
|
+
|
463
|
+
it "should register without errors" do
|
464
|
+
pending # newer BC should be able to read this
|
465
|
+
expect { subject.register }.to_not raise_error
|
466
|
+
end
|
467
|
+
|
468
|
+
end
|
469
|
+
|
470
|
+
context "encrypted (DES) key" do
|
471
|
+
let(:config) do
|
472
|
+
{
|
473
|
+
"host" => "127.0.0.1",
|
474
|
+
"port" => port,
|
475
|
+
"ssl_enable" => true,
|
476
|
+
"ssl_cert" => File.expand_path('../fixtures/encrypted_des.crt', File.dirname(__FILE__)),
|
477
|
+
"ssl_key" => File.expand_path('../fixtures/encrypted_des.key', File.dirname(__FILE__)),
|
478
|
+
"ssl_key_passphrase" => '1234',
|
479
|
+
}
|
480
|
+
end
|
481
|
+
|
482
|
+
it "should register without errors" do
|
483
|
+
expect { subject.register }.to_not raise_error
|
484
|
+
end
|
485
|
+
|
486
|
+
end
|
487
|
+
|
488
|
+
context "encrypted PKCS#8 key" do
|
489
|
+
let(:config) do
|
490
|
+
{
|
491
|
+
"host" => "127.0.0.1",
|
492
|
+
"port" => port,
|
493
|
+
"ssl_enable" => true,
|
494
|
+
"ssl_cert" => File.expand_path('../fixtures/encrypted-pkcs8.crt', File.dirname(__FILE__)),
|
495
|
+
"ssl_key" => File.expand_path('../fixtures/encrypted-pkcs8.key', File.dirname(__FILE__)),
|
496
|
+
"ssl_key_passphrase" => '1234',
|
497
|
+
}
|
498
|
+
end
|
499
|
+
|
500
|
+
it "should register without errors" do
|
501
|
+
expect { subject.register }.to_not raise_error
|
502
|
+
end
|
503
|
+
|
504
|
+
end
|
505
|
+
|
506
|
+
# NOTE: only BC provider can read the legacy (OpenSSL) format
|
507
|
+
context "encrypted PKCS#5 v1.5 key" do # openssl pkcs8 -topk8 -v1 PBE-MD5-DES
|
508
|
+
let(:config) do
|
509
|
+
{
|
510
|
+
"host" => "127.0.0.1",
|
511
|
+
"port" => port,
|
512
|
+
"ssl_enable" => true,
|
513
|
+
"ssl_cert" => File.expand_path('../fixtures/encrypted-pkcs5v15.crt', File.dirname(__FILE__)),
|
514
|
+
"ssl_key" => File.expand_path('../fixtures/encrypted-pkcs5v15.key', File.dirname(__FILE__)),
|
515
|
+
"ssl_key_passphrase" => '1234',
|
516
|
+
}
|
517
|
+
end
|
518
|
+
|
519
|
+
it "should register without errors" do
|
520
|
+
expect { subject.register }.to_not raise_error
|
521
|
+
end
|
522
|
+
|
523
|
+
end
|
524
|
+
|
525
|
+
context "small (legacy) key" do
|
526
|
+
let(:config) do
|
527
|
+
{
|
528
|
+
"host" => "127.0.0.1",
|
529
|
+
"port" => port,
|
530
|
+
"ssl_enable" => true,
|
531
|
+
"ssl_cert" => File.expand_path('../fixtures/small.crt', File.dirname(__FILE__)),
|
532
|
+
"ssl_key" => File.expand_path('../fixtures/small.key', File.dirname(__FILE__)),
|
533
|
+
}
|
534
|
+
end
|
535
|
+
|
536
|
+
it "should register without errors" do
|
537
|
+
expect { subject.register }.to_not raise_error
|
538
|
+
end
|
539
|
+
|
540
|
+
end
|
414
541
|
end
|
415
542
|
end
|
416
543
|
|