logstash-input-tcp 6.0.5-java → 6.0.10-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cb08a389f60e23d92944fa9d34519326425c8c794da67134dd6f36ce5c156e6
4
- data.tar.gz: 8e3c0728570dcf17e9f38330a9118576f08343730cfa06935b99c2cbb1ef4ccf
3
+ metadata.gz: 877ef458e968d48f3cd99ecd7f6846ac2f371e8c3897a6ed831b86e1f584d245
4
+ data.tar.gz: fab3cedbc3b4fab8c5915e219e03cfa6da6ba3aa9bb61d3245e0339535067894
5
5
  SHA512:
6
- metadata.gz: 899df3894b0a24fe75dfa054be9a30fd3b43208bce377d215778c2f162bfdb541679e8aa7d173e915798b7dfbef07bb0274b6d0fc066b524e387c174fb6d1b13
7
- data.tar.gz: 61ec0890ccbcc36e4554aca9bbbcb0c8adeaeb322419c8e3e47b1a9c3deb6ffef195efe77664cac13761cdb5c452c1be08953b292355bf67fa58ff544b359d85
6
+ metadata.gz: 6196c01efc835b13d84528bbc780d6915d40adc7e86b7427d5b0e445fef3f9b3df6049301dbeb6f7321510b908dc16910920b50d602a30e6f049461f9fc8509c
7
+ data.tar.gz: 41102085f47d341e9db45d8ded793ced779f703102c22929c1382b1047d41269849d8d116e2a73531498b2b9b4430cde135c38a50e29b43aab2e8dc015784231
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 6.0.10
2
+ - bumping dependency commons-io [#174](https://github.com/logstash-plugins/logstash-input-tcp/pull/174)
3
+
4
+ ## 6.0.9
5
+ - [DOC] Reorder options alphabetically [#171](https://github.com/logstash-plugins/logstash-input-tcp/pull/171)
6
+
7
+ ## 6.0.8
8
+ - [DOC] better description for `tcp_keep_alive` option [#169](https://github.com/logstash-plugins/logstash-input-tcp/pull/169)
9
+
10
+ ## 6.0.7
11
+ - Fix: reduce error logging (to info level) on connection resets [#168](https://github.com/logstash-plugins/logstash-input-tcp/pull/168)
12
+ - Refactor: only patch Socket classes once (on first input)
13
+ - Refactor: use a proper log4j logger (in Java to avoid surprises when unwrapping `LogStash::Logging::Logger`)
14
+
15
+ ## 6.0.6
16
+ - Updated Netty dependencies. Additionally, this release removes the dependency on `tcnative` +
17
+ `boringssl`, using JVM supplied ciphers instead. This may result in fewer ciphers being available if the JCE
18
+ unlimited strength jurisdiction policy is not installed. (This policy is installed by default on versions of the
19
+ JDK from u161 onwards)[#157](https://github.com/logstash-plugins/logstash-input-tcp/pull/157)
20
+
1
21
  ## 6.0.5
2
22
  - Fix potential startup crash that could occur when multiple instances of this plugin were started simultaneously [#155](https://github.com/logstash-plugins/logstash-input-tcp/pull/155)
3
23
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Logstash Plugin
2
2
 
3
- [![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-input-tcp.svg)](https://travis-ci.org/logstash-plugins/logstash-input-tcp)
3
+ [![Travis Build Status](https://travis-ci.com/logstash-plugins/logstash-input-tcp.svg)](https://travis-ci.com/logstash-plugins/logstash-input-tcp)
4
4
 
5
5
  This is a plugin for [Logstash](https://github.com/elastic/logstash).
6
6
 
data/docs/index.asciidoc CHANGED
@@ -78,6 +78,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
78
78
  [cols="<,<,<",options="header",]
79
79
  |=======================================================================
80
80
  |Setting |Input type|Required
81
+ | <<plugins-{type}s-{plugin}-dns_reverse_lookup_enabled>> |<<boolean,boolean>>|No
81
82
  | <<plugins-{type}s-{plugin}-host>> |<<string,string>>|No
82
83
  | <<plugins-{type}s-{plugin}-mode>> |<<string,string>>, one of `["server", "client"]`|No
83
84
  | <<plugins-{type}s-{plugin}-port>> |<<number,number>>|Yes
@@ -90,7 +91,6 @@ This plugin supports the following configuration options plus the <<plugins-{typ
90
91
  | <<plugins-{type}s-{plugin}-ssl_key_passphrase>> |<<password,password>>|No
91
92
  | <<plugins-{type}s-{plugin}-ssl_verify>> |<<boolean,boolean>>|No
92
93
  | <<plugins-{type}s-{plugin}-tcp_keep_alive>> |<<boolean,boolean>>|No
93
- | <<plugins-{type}s-{plugin}-dns_reverse_lookup_enabled>> |<<boolean,boolean>>|No
94
94
  |=======================================================================
95
95
 
96
96
  Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
@@ -98,6 +98,16 @@ input plugins.
98
98
 
99
99
  &nbsp;
100
100
 
101
+ [id="plugins-{type}s-{plugin}-dns_reverse_lookup_enabled"]
102
+ ===== `dns_reverse_lookup_enabled`
103
+
104
+ * Value type is <<boolean,boolean>>
105
+ * Default value is `true`
106
+
107
+ It is possible to avoid DNS reverse-lookups by disabling this setting. If disabled,
108
+ the address metadata that is added to events will contain the source address as-specified
109
+ at the TCP layer and IPs will not be resolved to hostnames.
110
+
101
111
  [id="plugins-{type}s-{plugin}-host"]
102
112
  ===== `host`
103
113
 
@@ -202,17 +212,9 @@ For input, sets the field `sslsubject` to that of the client certificate.
202
212
  * Value type is <<boolean,boolean>>
203
213
  * Default value is `false`
204
214
 
205
- Instruct the socket to use TCP keep alives. Uses OS defaults for keep alive settings.
206
-
207
- [id="plugins-{type}s-{plugin}-dns_reverse_lookup_enabled"]
208
- ===== `dns_reverse_lookup_enabled`
209
-
210
- * Value type is <<boolean,boolean>>
211
- * Default value is `true`
212
-
213
- It is possible to avoid DNS reverse-lookups by disabling this setting. If disabled,
214
- the address metadata that is added to events will contain the source address as-specified
215
- at the TCP layer and IPs will not be resolved to hostnames.
215
+ Instruct the socket to use TCP keep alive. If it's `true` then the underlying socket
216
+ will use the OS defaults settings for keep alive. If it's `false` it doesn't configure any
217
+ keep alive setting for the underlying socket.
216
218
 
217
219
 
218
220
  [id="plugins-{type}s-{plugin}-common-options"]
@@ -119,15 +119,21 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
119
119
  PROXY_PORT_FIELD = "proxy_port".freeze
120
120
  SSLSUBJECT_FIELD = "sslsubject".freeze
121
121
 
122
- PLUGIN_GLOBAL_MUTEX = Mutex.new
123
- private_constant :PLUGIN_GLOBAL_MUTEX
122
+ # Monkey patch TCPSocket and SSLSocket to include socket peer
123
+ # @private
124
+ def self.patch_socket_peer!
125
+ unless TCPSocket < ::LogStash::Util::SocketPeer
126
+ TCPSocket.send :include, ::LogStash::Util::SocketPeer
127
+ end
128
+ unless OpenSSL::SSL::SSLSocket < ::LogStash::Util::SocketPeer
129
+ OpenSSL::SSL::SSLSocket.send :include, ::LogStash::Util::SocketPeer
130
+ end
131
+ end
124
132
 
125
133
  def initialize(*args)
126
134
  super(*args)
127
135
 
128
- # monkey patch TCPSocket and SSLSocket to include socket peer
129
- TCPSocket.module_eval{include ::LogStash::Util::SocketPeer}
130
- OpenSSL::SSL::SSLSocket.module_eval{include ::LogStash::Util::SocketPeer}
136
+ self.class.patch_socket_peer!
131
137
 
132
138
  # threadsafe socket bookkeeping
133
139
  @server_socket = nil
@@ -144,22 +150,15 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
144
150
  if server?
145
151
  ssl_context = get_ssl_context(SslOptions)
146
152
 
147
- # RubyObject#to_java is not threadsafe, and we cannot guarantee
148
- # that ours is the only reference to the underlying logger, which
149
- # is memoized at a class level.
150
- log4j_logger = PLUGIN_GLOBAL_MUTEX.synchronize do
151
- @logger.to_java(org.apache.logging.log4j.Logger)
152
- end
153
153
 
154
- @loop = InputLoop.new(@host, @port, DecoderImpl.new(@codec, self), @tcp_keep_alive,
155
- ssl_context, log4j_logger)
154
+ @loop = InputLoop.new(@host, @port, DecoderImpl.new(@codec, self), @tcp_keep_alive, ssl_context)
156
155
  end
157
156
  end
158
157
 
159
158
  def run(output_queue)
160
159
  @output_queue = output_queue
161
160
  if server?
162
- @logger.info("Starting tcp input listener", :address => "#{@host}:#{@port}", :ssl_enable => "#{@ssl_enable}")
161
+ @logger.info("Starting tcp input listener", :address => "#{@host}:#{@port}", :ssl_enable => @ssl_enable)
163
162
  @loop.run
164
163
  else
165
164
  run_client()
@@ -252,12 +251,10 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
252
251
  rescue Errno::ECONNRESET
253
252
  @logger.debug? && @logger.debug("Connection reset by peer", :client => peer)
254
253
  rescue OpenSSL::SSL::SSLError => e
255
- # Fixes issue #23
256
- @logger.error("SSL Error", :exception => e, :backtrace => e.backtrace)
257
- socket.close rescue nil
254
+ @logger.error("SSL error", :client => peer, :message => e.message, :exception => e.class, :backtrace => e.backtrace)
258
255
  rescue => e
259
256
  # if plugin is stopping, don't bother logging it as an error
260
- !stop? && @logger.error("An error occurred. Closing connection", :client => peer, :exception => e, :backtrace => e.backtrace)
257
+ !stop? && @logger.error("An error occurred, closing connection", :client => peer, :message => e.message, :exception => e.class, :backtrace => e.backtrace)
261
258
  ensure
262
259
  # catch all rescue nil on close to discard any close errors or invalid socket
263
260
  socket.close rescue nil
@@ -293,7 +290,7 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
293
290
  @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
294
291
  end
295
292
  rescue => e
296
- @logger.error("Could not inititalize SSL context", :exception => e, :backtrace => e.backtrace)
293
+ @logger.error("Could not inititalize SSL context", :message => e.message, :exception => e.class, :backtrace => e.backtrace)
297
294
  raise e
298
295
  end
299
296
 
@@ -1,4 +1,5 @@
1
1
  require 'openssl'
2
+ require "logstash/util/loggable"
2
3
 
3
4
  # Simulate a normal SslOptions builder:
4
5
  #
@@ -12,10 +13,12 @@ require 'openssl'
12
13
  # .set_ssl_certificate_authorities(@ssl_certificate_authorities.to_java(:string))
13
14
  # .build.toSslContext()
14
15
  class SslOptions
16
+ include LogStash::Util::Loggable
15
17
 
16
18
  java_import 'io.netty.handler.ssl.ClientAuth'
17
19
  java_import 'io.netty.handler.ssl.SslContextBuilder'
18
20
  java_import 'java.security.cert.X509Certificate'
21
+ java_import 'javax.crypto.Cipher'
19
22
  java_import 'org.bouncycastle.asn1.pkcs.PrivateKeyInfo'
20
23
  java_import 'org.bouncycastle.jce.provider.BouncyCastleProvider'
21
24
  java_import 'org.bouncycastle.openssl.PEMKeyPair'
@@ -70,6 +73,8 @@ class SslOptions
70
73
  def toSslContext
71
74
  return nil unless @ssl_enabled
72
75
 
76
+ # Check key strength
77
+ logger.warn("JCE Unlimited Strength Jurisdiction Policy not installed - max key length is 128 bits") unless Cipher.getMaxAllowedKeyLength("AES") > 128
73
78
  # create certificate object
74
79
  cf = java.security.cert.CertificateFactory.getInstance("X.509")
75
80
  cert_chain = []
@@ -38,8 +38,8 @@ class DecoderImpl
38
38
  pp_info = pp_hdr.split(/\s/)
39
39
  # PROXY proto clientip proxyip clientport proxyport
40
40
  if pp_info[0] != "PROXY"
41
- @tcp.logger.error("invalid proxy protocol header label", :hdr => pp_hdr)
42
- raise IOError
41
+ @tcp.logger.error("Invalid proxy protocol header label", :header => pp_hdr)
42
+ raise IOError.new("Invalid proxy protocol header label #{pp_hdr.inspect}")
43
43
  else
44
44
  @proxy_address = pp_info[3]
45
45
  @proxy_port = pp_info[5]
@@ -341,8 +341,7 @@ describe LogStash::Inputs::Tcp do
341
341
  "port" => port,
342
342
  "ssl_enable" => true,
343
343
  "ssl_cert" => certificate_file.path,
344
- "ssl_key" => key_file.path,
345
- "ssl_extra_chain_certs" => certificate_file.path
344
+ "ssl_key" => key_file.path
346
345
  }
347
346
  end
348
347
 
@@ -368,7 +367,6 @@ describe LogStash::Inputs::Tcp do
368
367
  File.unlink(certificate_file.path)
369
368
  File.unlink(key_file.path)
370
369
  end
371
-
372
370
  end
373
371
 
374
372
  context "with pkcs#8 keys" do
data/version CHANGED
@@ -1 +1 @@
1
- 6.0.5
1
+ 6.0.10
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: 6.0.5
4
+ version: 6.0.10
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-02 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +178,7 @@ files:
178
178
  - logstash-input-tcp.gemspec
179
179
  - spec/inputs/tcp_spec.rb
180
180
  - spec/spec_helper.rb
181
- - vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/6.0.5/logstash-input-tcp-6.0.5.jar
181
+ - vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/6.0.10/logstash-input-tcp-6.0.10.jar
182
182
  - version
183
183
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
184
184
  licenses: