logstash-input-tcp 5.2.6-java → 6.0.0-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: 540a6f7d6ae06f0f03b71ad02d2872060706cd3ef398baf26538dd0e56dc23aa
4
- data.tar.gz: c96eb4cbf80fe8df8c4115e2da5259770306352315de1354ad2a423d5e08bbe8
3
+ metadata.gz: 8f95c4b965fd69c58c8ea30cebdfbd74838e07051b3491e9c88da3a6029b7bdf
4
+ data.tar.gz: a21e7f3a68395d29f40d083f77933191d702e553f14903d3062a163c0f550aa6
5
5
  SHA512:
6
- metadata.gz: 592a1308abe432552b0fef096ce40556c466ba6ac4d332fd677e299c9704e6c6edbfe255ca7c6dba0c55292e7155c39354d9a27b4317503346e0af7e1fd3f0b8
7
- data.tar.gz: 2ca507f654bc2e236ce59805b7204265acc2492bc8fd8147759012a17d5ac903ce40fb3bcb6df98dc19552c74989176556e9c1e5c6ef69d0a9e66d80acf8cefc
6
+ metadata.gz: a928baf3ca1703fb850d09bc587299809b78b387b41c2a920f525d28d7ae335224b9d1f2dfa9f74ea91a88d1c45e4005c001bfe90fa5f6fa46ca476fe83ebc63
7
+ data.tar.gz: dd835f99eefdcdb04602beb68bb3c2f03a9fea58468f3c90dfb4461710740e9d0e56b992b9528ffc608872af4fc3d032286d4af7abd99d11b847483d4be657eb
data/CHANGELOG.md CHANGED
@@ -1,25 +1,5 @@
1
- ## 5.2.6
2
- - Ensure correct jar paths when building plugin from a non-standard directory
3
-
4
- ## 5.2.5
5
- - Update Log4j dependency to 2.17
6
-
7
- ## 5.2.4
8
- - Update Log4j dependency to 2.16, ensuring this plugin's runtime relies only on log4j-api instead
9
- of providing its own log4j-core [#189](https://github.com/logstash-plugins/logstash-input-tcp/pull/189)
10
-
11
- ## 5.2.3
12
- - Skip empty lines while reading certificate files [#144](https://github.com/logstash-plugins/logstash-input-tcp/issues/144)
13
-
14
- ## 5.2.2
15
- - Fixed race condition where data would be accepted before queue was configured [#142](https://github.com/logstash-plugins/logstash-input-tcp/pull/142)
16
-
17
- ## 5.2.1
18
- - Support multiple certificates per file [#140](https://github.com/logstash-plugins/logstash-input-tcp/pull/140)
19
- - Fixed support for encrypted pkcs8 private keys [#133](https://github.com/logstash-plugins/logstash-input-tcp/pull/133)
20
- - Added support for encrypted pem pkcs1 private keys [#131](https://github.com/logstash-plugins/logstash-input-tcp/pull/131)
21
- - Changed testing to docker [#128](https://github.com/logstash-plugins/logstash-input-tcp/pull/128)
22
- - Fixed heading for `ssl_certificate_authorities` docs [#130](https://github.com/logstash-plugins/logstash-input-tcp/pull/130)
1
+ ## 6.0.0
2
+ - Removed obsolete `data_timeout` and `ssl_cacert` options
23
3
 
24
4
  ## 5.2.0
25
5
  - Added support for pkcs1 and pkcs8 key formats [#122](https://github.com/logstash-plugins/logstash-input-tcp/issues/122)
@@ -76,9 +76,7 @@ class SslOptions
76
76
  # create certificate object
77
77
  cf = CertificateFactory.getInstance("X.509")
78
78
  cert_chain = []
79
- fetch_certificates_from_file(@ssl_cert_path, cf) do |cert|
80
- cert_chain << cert
81
- end
79
+ cert_chain << cf.generateCertificate(FileInputStream.new(@ssl_cert_path))
82
80
 
83
81
  # convert key from pkcs1 to pkcs8 and get PrivateKey object
84
82
  pem_parser = PEMParser.new(FileReader.new(@ssl_key_path))
@@ -102,19 +100,13 @@ class SslOptions
102
100
  raise "Could not recognize 'ssl_key' format. Class: #{obj.class}"
103
101
  end
104
102
 
105
- @ssl_extra_chain_certs.each do |file|
106
- fetch_certificates_from_file(file, cf) do |cert|
107
- cert_chain << cert
108
- end
103
+ @ssl_extra_chain_certs.each do |cert|
104
+ cert_chain << cf.generateCertificate(FileInputStream.new(cert))
109
105
  end
110
106
  sslContextBuilder = SslContextBuilder.forServer(private_key, @ssl_key_passphrase, cert_chain.to_java(X509Certificate))
111
107
 
112
- trust_certs = []
113
-
114
- @ssl_certificate_authorities.each do |file|
115
- fetch_certificates_from_file(file, cf) do |cert|
116
- trust_certs << cert
117
- end
108
+ trust_certs = @ssl_certificate_authorities.map do |cert|
109
+ cf.generateCertificate(FileInputStream.new(cert))
118
110
  end
119
111
 
120
112
  if trust_certs.any?
@@ -124,22 +116,4 @@ class SslOptions
124
116
  sslContextBuilder.clientAuth(@ssl_verify ? ClientAuth::REQUIRE : ClientAuth::NONE)
125
117
  sslContextBuilder.build()
126
118
  end
127
-
128
- private
129
- def fetch_certificates_from_file(file, cf)
130
- fis = java.io.FileInputStream.new(file)
131
-
132
- while (fis.available > 0) do
133
- cert = generate_certificate(cf, fis)
134
- yield cert if cert
135
- end
136
- ensure
137
- fis.close if fis
138
- end
139
-
140
- def generate_certificate(cf, fis)
141
- cf.generateCertificate(fis)
142
- rescue Java::JavaSecurityCert::CertificateException => e
143
- raise e unless e.cause.message == "Empty input"
144
- end
145
119
  end
@@ -74,8 +74,6 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
74
74
  # When mode is `client`, the port to connect to.
75
75
  config :port, :validate => :number, :required => true
76
76
 
77
- config :data_timeout, :validate => :number, :obsolete => "This setting is not used any more."
78
-
79
77
  # Mode to operate in. `server` listens for client connections,
80
78
  # `client` connects to a server.
81
79
  config :mode, :validate => ["server", "client"], :default => "server"
@@ -91,8 +89,6 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
91
89
  # For input, sets the field `sslsubject` to that of the client certificate.
92
90
  config :ssl_verify, :validate => :boolean, :default => true
93
91
 
94
- config :ssl_cacert, :validate => :path, :obsolete => "This setting is obsolete. Use ssl_extra_chain_certs instead"
95
-
96
92
  # SSL certificate path
97
93
  config :ssl_cert, :validate => :path
98
94
 
@@ -141,6 +137,11 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
141
137
  def register
142
138
  fix_streaming_codecs
143
139
 
140
+ # note that since we are opening a socket in register, we must also make sure we close it
141
+ # in the close method even if we also close it in the stop method since we could have
142
+ # a situation where register is called but not run & stop.
143
+
144
+ @logger.info("Starting tcp input listener", :address => "#{@host}:#{@port}", :ssl_enable => "#{@ssl_enable}")
144
145
  if server?
145
146
  ssl_context = get_ssl_context(SslOptions)
146
147
 
@@ -152,7 +153,6 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
152
153
  def run(output_queue)
153
154
  @output_queue = output_queue
154
155
  if server?
155
- @logger.info("Starting tcp input listener", :address => "#{@host}:#{@port}", :ssl_enable => "#{@ssl_enable}")
156
156
  @loop.run
157
157
  else
158
158
  run_client()
@@ -31,11 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.add_runtime_dependency 'logstash-codec-json_lines'
32
32
  s.add_runtime_dependency 'logstash-codec-multiline'
33
33
 
34
- # 5.x branch of this plugin provides support for LS5&6.
35
- # To use LS7+, you must use v6+ of this plugin.
36
- s.add_runtime_dependency 'logstash-core', '< 7.0.0'
37
-
38
- s.add_development_dependency 'logstash-devutils', '~> 1.0'
34
+ s.add_development_dependency 'logstash-devutils'
39
35
  s.add_development_dependency 'flores', '~> 0.0.6'
40
36
  s.add_development_dependency 'stud', '~> 0.0.22'
41
37
  end
@@ -382,35 +382,6 @@ describe LogStash::Inputs::Tcp do
382
382
  ssc.delete
383
383
  end
384
384
  end
385
-
386
- context "with multiple certificates with empty spaces in them" do
387
- let(:ssc) { SelfSignedCertificate.new }
388
- let(:certificate_file) { ssc.certificate }
389
- let(:key_file) { ssc.private_key}
390
- let(:ssc_2) { SelfSignedCertificate.new }
391
- let(:certificate_file_2) { ssc.certificate }
392
- let(:config) do
393
- {
394
- "host" => "127.0.0.1",
395
- "port" => port,
396
- "ssl_enable" => true,
397
- "ssl_cert" => certificate_file.path,
398
- "ssl_key" => key_file.path
399
- }
400
- end
401
- before(:each) do
402
- File.open(certificate_file.path, "a") do |file|
403
- path = ssc_2.certificate.path
404
- file.puts("\n")
405
- file.puts(IO.read(path))
406
- file.puts("\n")
407
- end
408
- end
409
-
410
- it "should register without errors" do
411
- expect { subject.register }.to_not raise_error
412
- end
413
- end
414
385
  end
415
386
  end
416
387
 
@@ -428,7 +399,12 @@ describe LogStash::Inputs::Tcp do
428
399
  chain_of_certificates = TcpHelpers.new.chain_of_certificates
429
400
 
430
401
  let(:tcp) do
431
- Stud::try(5.times) { TCPSocket.new("127.0.0.1", port) }
402
+ begin
403
+ socket = TCPSocket.new("127.0.0.1", port)
404
+ rescue Errno::ECONNREFUSED
405
+ sleep 1
406
+ socket = TCPSocket.new("127.0.0.1", port)
407
+ end
432
408
  end
433
409
  let(:sslcontext) do
434
410
  sslcontext = OpenSSL::SSL::SSLContext.new
@@ -526,8 +502,14 @@ describe LogStash::Inputs::Tcp do
526
502
 
527
503
  context "that disconnects before doing TLS handshake" do
528
504
  before do
529
- client = Stud::try(5.times) { TCPSocket.new("127.0.0.1", port) }
530
- client.close
505
+ begin
506
+ client = TCPSocket.new("127.0.0.1", port)
507
+ client.close
508
+ rescue Errno::ECONNREFUSED
509
+ sleep 1
510
+ client = TCPSocket.new("127.0.0.1", port)
511
+ client.close
512
+ end
531
513
  end
532
514
 
533
515
  it "should not negatively impact the plugin" do
@@ -558,7 +540,7 @@ describe LogStash::Inputs::Tcp do
558
540
  # Assertion to verify this test is actually sending something.
559
541
  expect(garbage.length).to be > 0
560
542
 
561
- client = Stud::try(5.times) { TCPSocket.new("127.0.0.1", port) }
543
+ client = TCPSocket.new("127.0.0.1", port)
562
544
  client.write(garbage)
563
545
  client.flush
564
546
  Thread.new { sleep(1); client.close }
data/version CHANGED
@@ -1 +1 @@
1
- 5.2.6
1
+ 6.0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-tcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.6
4
+ version: 6.0.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-18 00:00:00.000000000 Z
11
+ date: 2019-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -103,31 +103,17 @@ dependencies:
103
103
  - !ruby/object:Gem::Dependency
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - "<"
107
- - !ruby/object:Gem::Version
108
- version: 7.0.0
109
- name: logstash-core
110
- prerelease: false
111
- type: :runtime
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "<"
115
- - !ruby/object:Gem::Version
116
- version: 7.0.0
117
- - !ruby/object:Gem::Dependency
118
- requirement: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - "~>"
106
+ - - ">="
121
107
  - !ruby/object:Gem::Version
122
- version: '1.0'
108
+ version: '0'
123
109
  name: logstash-devutils
124
110
  prerelease: false
125
111
  type: :development
126
112
  version_requirements: !ruby/object:Gem::Requirement
127
113
  requirements:
128
- - - "~>"
114
+ - - ">="
129
115
  - !ruby/object:Gem::Version
130
- version: '1.0'
116
+ version: '0'
131
117
  - !ruby/object:Gem::Dependency
132
118
  requirement: !ruby/object:Gem::Requirement
133
119
  requirements:
@@ -178,7 +164,7 @@ files:
178
164
  - logstash-input-tcp.gemspec
179
165
  - spec/inputs/tcp_spec.rb
180
166
  - spec/spec_helper.rb
181
- - vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/5.2.6/logstash-input-tcp-5.2.6.jar
167
+ - vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/6.0.0/logstash-input-tcp-6.0.0.jar
182
168
  - version
183
169
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
184
170
  licenses:
@@ -202,7 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
188
  - !ruby/object:Gem::Version
203
189
  version: '0'
204
190
  requirements: []
205
- rubygems_version: 3.1.6
191
+ rubyforge_project:
192
+ rubygems_version: 2.6.13
206
193
  signing_key:
207
194
  specification_version: 4
208
195
  summary: Reads events from a TCP socket