logstash-input-http 3.10.0-java → 4.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: 5da80cab8cc393b3a17069505ee11f7e29446a8d5593f5b1a8727641b9b983dc
4
- data.tar.gz: '068a700971f647791e2badbd5391538978f82e2abb9c8e2d939c086b0c683d32'
3
+ metadata.gz: c406f5e0d989c833db3c35529b4012053539955f830fde6ca9e44235f4a39d3b
4
+ data.tar.gz: 22916a6402a2c55edfbee1bf3af0a578b630d2fd756356733bfc0c7de3359fdf
5
5
  SHA512:
6
- metadata.gz: a431fb3abc16f2bfca58de5fb91d8920999134fd2dd0a8fff94ce40ebdc36110ef7dcd0471f832deb4d9c36f437c5694c3ae7a1080bc9c782e8eabe183a3fde9
7
- data.tar.gz: 61c3e32a3314438bcd4f1be32e691c7cf6c2936fbfeb7ea9ef4f4c4459e97d1ed895347d274f450e469d451c81cfdb834767d4922bb1ab53924db300478afe63
6
+ metadata.gz: 2c2616bcde330f2d0a2d0f4273f45e7bd2ad7e09e3a1322d0c759c146c38e13c92f202b45c4a1df6a19b0b9e1ae46eaaa0e3ec1fc81f5e8421a591479122ab3e
7
+ data.tar.gz: 1b4d208dc8e180ee5818270f1ceb36625870d4429b9570102f69beb96c253bc5a64fc3837c90d8960b2bca1391b9b93bff76fd648d67ed27cb8b9b366b238ca2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
- ## 3.10.0
2
- - add improved proactive rate-limiting, rejecting new requests when queue has been actively blocking for more than 10 seconds [#179](https://github.com/logstash-plugins/logstash-input-http/pull/179)
1
+ ## 4.0.0
2
+ - SSL settings that were marked deprecated in version `3.7.0` are now marked obsolete, and will prevent the plugin from starting.
3
+ - These settings are:
4
+ - `tls_min_version`, which should be replaced by `ssl_supported_protocols`
5
+ - `tls_max_version`, which should be replaced by `ssl_supported_protocols`
6
+ - `cipher_suites`, which should bre replaced by `ssl_cipher_suites`
7
+ - `ssl`, which should bre replaced by `ssl_enabled`
8
+ - `keystore`, which should bre replaced by `ssl_keystore_path`
9
+ - `keystore_password`, which should bre replaced by `ssl_keystore_password`
10
+ - `ssl_verify_mode`, which should bre replaced by `ssl_client_authentication`
11
+ - `verify_mode`, which should bre replaced by `ssl_client_authentication`
12
+ - [#182](https://github.com/logstash-plugins/logstash-input-http/pull/182)
3
13
 
4
14
  ## 3.9.2
5
15
  - Upgrade netty to 4.1.115 [#183](https://github.com/logstash-plugins/logstash-input-http/pull/183)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.10.0
1
+ 4.0.0
data/docs/index.asciidoc CHANGED
@@ -87,21 +87,21 @@ for the request's content-type is found in the `additional_codecs` setting.
87
87
 
88
88
  This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
89
89
 
90
+ NOTE: As of version `4.0.0` of this plugin, a number of previously deprecated settings related to SSL have been removed.
91
+ Please check out <<plugins-{type}s-{plugin}-obsolete-options>> for details.
92
+
93
+
90
94
  [cols="<,<,<",options="header",]
91
95
  |=======================================================================
92
96
  |Setting |Input type|Required
93
97
  | <<plugins-{type}s-{plugin}-additional_codecs>> |<<hash,hash>>|No
94
- | <<plugins-{type}s-{plugin}-cipher_suites>> |<<array,array>>|__Deprecated__
95
98
  | <<plugins-{type}s-{plugin}-ecs_compatibility>> | <<string,string>>|No
96
99
  | <<plugins-{type}s-{plugin}-host>> |<<string,string>>|No
97
- | <<plugins-{type}s-{plugin}-keystore>> |<<path,path>>|__Deprecated__
98
- | <<plugins-{type}s-{plugin}-keystore_password>> |<<password,password>>|__Deprecated__
99
100
  | <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
100
101
  | <<plugins-{type}s-{plugin}-port>> |<<number,number>>|No
101
102
  | <<plugins-{type}s-{plugin}-max_pending_requests>> |<<number,number>>|No
102
103
  | <<plugins-{type}s-{plugin}-response_headers>> |<<hash,hash>>|No
103
104
  | <<plugins-{type}s-{plugin}-response_code>> |<<number,number>>, one of `[200, 201, 202, 204]`|No
104
- | <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|__Deprecated__
105
105
  | <<plugins-{type}s-{plugin}-ssl_certificate>> |a valid filesystem path|No
106
106
  | <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> |<<array,array>>|No
107
107
  | <<plugins-{type}s-{plugin}-ssl_cipher_suites>> |<<array,array>>|No
@@ -117,12 +117,8 @@ This plugin supports the following configuration options plus the <<plugins-{typ
117
117
  | <<plugins-{type}s-{plugin}-ssl_truststore_password>> |<<password,password>>|No
118
118
  | <<plugins-{type}s-{plugin}-ssl_truststore_path>> |<<path,path>>|No
119
119
  | <<plugins-{type}s-{plugin}-ssl_truststore_type>> |<<string,string>>|No
120
- | <<plugins-{type}s-{plugin}-ssl_verify_mode>> |<<string,string>>, one of `["none", "peer", "force_peer"]`|__Deprecated__
121
120
  | <<plugins-{type}s-{plugin}-threads>> |<<number,number>>|No
122
- | <<plugins-{type}s-{plugin}-tls_max_version>> |<<number,number>>|__Deprecated__
123
- | <<plugins-{type}s-{plugin}-tls_min_version>> |<<number,number>>|__Deprecated__
124
121
  | <<plugins-{type}s-{plugin}-user>> |<<string,string>>|No
125
- | <<plugins-{type}s-{plugin}-verify_mode>> |<<string,string>>, one of `["none", "peer", "force_peer"]`|__Deprecated__
126
122
  |=======================================================================
127
123
 
128
124
  Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
@@ -140,13 +136,6 @@ Apply specific codecs for specific content types.
140
136
  The default codec will be applied only after this list is checked
141
137
  and no codec for the request's content-type is found
142
138
 
143
- [id="plugins-{type}s-{plugin}-cipher_suites"]
144
- ===== `cipher_suites`
145
- deprecated[3.6.0, Replaced by <<plugins-{type}s-{plugin}-ssl_cipher_suites>>]
146
-
147
- * Value type is <<array,array>>
148
-
149
- The list of cipher suites to use, listed by priorities.
150
139
 
151
140
  [id="plugins-{type}s-{plugin}-ecs_compatibility"]
152
141
  ===== `ecs_compatibility`
@@ -220,23 +209,6 @@ See <<plugins-{type}s-{plugin}-ecs_metadata>> for detailed information.
220
209
 
221
210
  The host or ip to bind
222
211
 
223
- [id="plugins-{type}s-{plugin}-keystore"]
224
- ===== `keystore`
225
- deprecated[3.7.0, Use <<plugins-{type}s-{plugin}-ssl_keystore_path>> instead]
226
-
227
- * Value type is <<path,path>>
228
- * There is no default value for this setting.
229
-
230
- The JKS keystore to validate the client's certificates
231
-
232
- [id="plugins-{type}s-{plugin}-keystore_password"]
233
- ===== `keystore_password`
234
- deprecated[3.7.0, Use <<plugins-{type}s-{plugin}-ssl_keystore_password>> instead]
235
-
236
- * Value type is <<password,password>>
237
- * There is no default value for this setting.
238
-
239
- Set the keystore password
240
212
 
241
213
  [id="plugins-{type}s-{plugin}-password"]
242
214
  ===== `password`
@@ -314,16 +286,6 @@ specify a target field for the client host of the http request
314
286
 
315
287
  specify target field for the client host of the http request
316
288
 
317
- [id="plugins-{type}s-{plugin}-ssl"]
318
- ===== `ssl`
319
- deprecated[3.7.0, Replaced by <<plugins-{type}s-{plugin}-ssl_enabled>>]
320
-
321
- * Value type is <<boolean,boolean>>
322
- * Default value is `false`
323
-
324
- Events are, by default, sent in plain text. You can
325
- enable encryption by setting `ssl` to true and configuring
326
- the `ssl_certificate` and `ssl_key` options.
327
289
 
328
290
  [id="plugins-{type}s-{plugin}-ssl_certificate"]
329
291
  ===== `ssl_certificate`
@@ -473,22 +435,6 @@ NOTE: You cannot use this setting and <<plugins-{type}s-{plugin}-ssl_certificate
473
435
 
474
436
  The format of the truststore file. It must be either `jks` or `pkcs12`.
475
437
 
476
- [id="plugins-{type}s-{plugin}-ssl_verify_mode"]
477
- ===== `ssl_verify_mode`
478
- deprecated[3.7.0, Replaced by <<plugins-{type}s-{plugin}-ssl_client_authentication>>]
479
-
480
- * Value can be any of: `none`, `peer`, `force_peer`
481
- * Default value is `"none"`
482
-
483
- By default the server doesn't do any client verification.
484
-
485
- `peer` will make the server ask the client to provide a certificate.
486
- If the client provides a certificate, it will be validated.
487
-
488
- `force_peer` will make the server ask the client to provide a certificate.
489
- If the client doesn't provide a certificate, the connection will be closed.
490
-
491
- This option needs to be used with <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> and a defined list of CAs.
492
438
 
493
439
  [id="plugins-{type}s-{plugin}-threads"]
494
440
  ===== `threads`
@@ -498,23 +444,6 @@ This option needs to be used with <<plugins-{type}s-{plugin}-ssl_certificate_aut
498
444
 
499
445
  Number of threads to use for both accepting connections and handling requests
500
446
 
501
- [id="plugins-{type}s-{plugin}-tls_max_version"]
502
- ===== `tls_max_version`
503
- deprecated[3.6.0]
504
-
505
- * Value type is <<number,number>>
506
-
507
- The maximum TLS version allowed for the encrypted connections.
508
- The value must be the one of the following: 1.1 for TLS 1.1, 1.2 for TLS 1.2, 1.3 for TLSv1.3
509
-
510
- [id="plugins-{type}s-{plugin}-tls_min_version"]
511
- ===== `tls_min_version`
512
- deprecated[3.6.0]
513
-
514
- * Value type is <<number,number>>
515
-
516
- The minimum TLS version allowed for the encrypted connections.
517
- The value must be one of the following: 1.1 for TLS 1.1, 1.2 for TLS 1.2, 1.3 for TLSv1.3
518
447
 
519
448
  [id="plugins-{type}s-{plugin}-user"]
520
449
  ===== `user`
@@ -524,15 +453,24 @@ The value must be one of the following: 1.1 for TLS 1.1, 1.2 for TLS 1.2, 1.3 fo
524
453
 
525
454
  Username for basic authorization
526
455
 
527
- [id="plugins-{type}s-{plugin}-verify_mode"]
528
- ===== `verify_mode`
529
- deprecated[3.6.0, Replaced by <<plugins-{type}s-{plugin}-ssl_verify_mode>>]
530
-
531
- * Value can be any of: `none`, `peer`, `force_peer`
532
- * Default value is `"none"`
456
+ [id="plugins-{type}s-{plugin}-obsolete-options"]
457
+ ==== HTTP Input Obsolete Configuration Options
533
458
 
534
- Set the client certificate verification method. Valid methods: none, peer, force_peer
459
+ WARNING: As of version `4.0.0` of this plugin, some configuration options have been replaced.
460
+ The plugin will fail to start if it contains any of these obsolete options.
535
461
 
462
+ [cols="<,<",options="header",]
463
+ |=======================================================================
464
+ |Setting|Replaced by
465
+ | cipher_suites |<<plugins-{type}s-{plugin}-ssl_cipher_suites>>
466
+ | keystore |<<plugins-{type}s-{plugin}-ssl_keystore_path>>
467
+ | keystore_password |<<plugins-{type}s-{plugin}-ssl_keystore_password>>
468
+ | ssl |<<plugins-{type}s-{plugin}-ssl_enabled>>
469
+ | ssl_verify_mode |<<plugins-{type}s-{plugin}-ssl_client_authentication>>
470
+ | tls_max_version |<<plugins-{type}s-{plugin}-ssl_supported_protocols>>
471
+ | tls_min_version |<<plugins-{type}s-{plugin}-ssl_supported_protocols>>
472
+ | verify_mode |<<plugins-{type}s-{plugin}-ssl_client_authentication>>
473
+ |=======================================================================
536
474
 
537
475
  [id="plugins-{type}s-{plugin}-common-options"]
538
476
  include::{include_path}/{type}.asciidoc[]
@@ -55,11 +55,6 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
55
55
  # Password for basic authorization
56
56
  config :password, :validate => :password, :required => false
57
57
 
58
- # Events are by default sent in plain text. You can
59
- # enable encryption by setting `ssl` to true and configuring
60
- # the `ssl_certificate` and `ssl_key` options.
61
- config :ssl, :validate => :boolean, :default => false, :deprecated => "Set 'ssl_enabled' instead."
62
-
63
58
  # Events are by default sent in plain text. You can
64
59
  # enable encryption by setting `ssl` to true and configuring
65
60
  # the `ssl_certificate` and `ssl_key` options.
@@ -108,17 +103,6 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
108
103
  # This option needs to be used with `ssl_certificate_authorities` and a defined list of CAs.
109
104
  config :ssl_client_authentication, :validate => %w[none optional required], :default => 'none'
110
105
 
111
- # By default the server doesn't do any client verification.
112
- #
113
- # `peer` will make the server ask the client to provide a certificate.
114
- # If the client provides a certificate, it will be validated.
115
- #
116
- # `force_peer` will make the server ask the client to provide a certificate.
117
- # If the client doesn't provide a certificate, the connection will be closed.
118
- #
119
- # This option needs to be used with `ssl_certificate_authorities` and a defined list of CAs.
120
- config :ssl_verify_mode, :validate => ["none", "peer", "force_peer"], :default => "none", :deprecated => "Set 'ssl_client_authentication' instead."
121
-
122
106
  # Time in milliseconds for an incomplete ssl handshake to timeout
123
107
  config :ssl_handshake_timeout, :validate => :number, :default => 10000
124
108
 
@@ -150,25 +134,15 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
150
134
 
151
135
  config :response_code, :validate => [200, 201, 202, 204], :default => 200
152
136
 
153
- # Deprecated options
154
-
155
- # The JKS keystore to validate the client's certificates
156
- config :keystore, :validate => :path, :deprecated => "Set 'ssl_keystore_path' instead."
157
-
158
- # The JKS keystore password
159
- config :keystore_password, :validate => :password, :deprecated => "Set 'ssl_keystore_password' instead."
160
-
161
- config :verify_mode, :validate => ['none', 'peer', 'force_peer'], :default => 'none', :deprecated => "Set 'ssl_client_authentication' instead."
162
-
163
- config :cipher_suites, :validate => :array, :default => [], :deprecated => "Set 'ssl_cipher_suites' instead."
164
-
165
- # The minimum TLS version allowed for the encrypted connections. The value must be one of the following:
166
- # 1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2, 1.3 for TLS 1.3
167
- config :tls_min_version, :validate => :number, :default => TLS.min.version, :deprecated => "Set 'ssl_supported_protocols' instead."
168
-
169
- # The maximum TLS version allowed for the encrypted connections. The value must be the one of the following:
170
- # 1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2, 1.3 for TLS 1.3
171
- config :tls_max_version, :validate => :number, :default => TLS.max.version, :deprecated => "Set 'ssl_supported_protocols' instead."
137
+ # Obsolete Settings
138
+ config :ssl, :obsolete => "Set 'ssl_enabled' instead."
139
+ config :keystore, :obsolete => "Set 'ssl_keystore_path' instead."
140
+ config :keystore_password, :validate => :password, :obsolete => "Set 'ssl_keystore_password' instead."
141
+ config :verify_mode, :obsolete => "Set 'ssl_client_authentication' instead."
142
+ config :cipher_suites, :obsolete => "Set 'ssl_cipher_suites' instead."
143
+ config :tls_min_version, :obsolete => "Set 'ssl_supported_protocols' instead."
144
+ config :tls_max_version, :obsolete => "Set 'ssl_supported_protocols' instead."
145
+ config :ssl_verify_mode, :obsolete => "Set 'ssl_client_authentication' instead."
172
146
 
173
147
  attr_reader :codecs
174
148
 
@@ -200,8 +174,6 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
200
174
  public
201
175
  def register
202
176
 
203
- setup_ssl_params!
204
-
205
177
  validate_ssl_settings!
206
178
 
207
179
  if @user && @password
@@ -342,34 +314,6 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
342
314
  end
343
315
 
344
316
  def setup_ssl_params!
345
- @ssl_enabled = normalize_config(:ssl_enabled) do |normalizer|
346
- normalizer.with_deprecated_alias(:ssl)
347
- end
348
-
349
- @ssl_cipher_suites = normalize_config(:ssl_cipher_suites) do |normalizer|
350
- normalizer.with_deprecated_alias(:cipher_suites)
351
- end
352
-
353
- @ssl_supported_protocols = normalize_config(:ssl_supported_protocols) do |normalizer|
354
- normalizer.with_deprecated_mapping(:tls_min_version, :tls_max_version) do |tls_min_version, tls_max_version|
355
- TLS.get_supported(tls_min_version..tls_max_version).map(&:name)
356
- end
357
- end
358
-
359
- @ssl_client_authentication = normalize_config(:ssl_client_authentication) do |normalizer|
360
- normalizer.with_deprecated_mapping(:verify_mode, :ssl_verify_mode) do |verify_mode, ssl_verify_mode|
361
- normalize_ssl_client_authentication_value!(verify_mode, ssl_verify_mode)
362
- end
363
- end
364
-
365
- @ssl_keystore_path = normalize_config(:ssl_keystore_path) do |normalizer|
366
- normalizer.with_deprecated_alias(:keystore)
367
- end
368
-
369
- @ssl_keystore_password = normalize_config(:ssl_keystore_password) do |normalizer|
370
- normalizer.with_deprecated_alias(:keystore_password)
371
- end
372
-
373
317
  params['ssl_enabled'] = @ssl_enabled unless @ssl_enabled.nil?
374
318
  params['ssl_cipher_suites'] = @ssl_cipher_suites unless @ssl_cipher_suites.nil?
375
319
  params['ssl_supported_protocols'] = @ssl_supported_protocols unless @ssl_supported_protocols.nil?
@@ -378,17 +322,6 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
378
322
  params['ssl_keystore_password'] = @ssl_keystore_password unless @ssl_keystore_password.nil?
379
323
  end
380
324
 
381
- def normalize_ssl_client_authentication_value!(verify_mode, ssl_verify_mode)
382
- verify_mode_explicitly_set = original_params.key?("verify_mode")
383
-
384
- if verify_mode_explicitly_set && original_params.key?("ssl_verify_mode")
385
- raise LogStash::ConfigurationError, "Both (deprecated) `ssl_verify_mode` and `verify_mode` were set. Use only `ssl_verify_mode`"
386
- end
387
-
388
- deprecated_value = (verify_mode_explicitly_set ? verify_mode : ssl_verify_mode).downcase
389
- SSL_VERIFY_MODE_TO_CLIENT_AUTHENTICATION_MAP[deprecated_value]
390
- end
391
-
392
325
  def create_http_server(message_handler)
393
326
  org.logstash.plugins.inputs.http.NettyHttpServer.new(
394
327
  @host, @port, message_handler, build_ssl_params, @threads, @max_pending_requests, @max_content_length, @response_code)
@@ -467,13 +400,7 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
467
400
  end
468
401
 
469
402
  def provided_ssl_client_authentication_config(values = [@ssl_client_authentication])
470
- if original_params.include?('ssl_verify_mode')
471
- ['ssl_verify_mode', *values.map { |v| SSL_VERIFY_MODE_TO_CLIENT_AUTHENTICATION_MAP.key(v) }]
472
- elsif original_params.include?('verify_mode')
473
- ['verify_mode', *values.map { |v| SSL_VERIFY_MODE_TO_CLIENT_AUTHENTICATION_MAP.key(v) }]
474
- else
475
403
  ['ssl_client_authentication', *values]
476
- end
477
404
  end
478
405
 
479
406
  private
@@ -8,4 +8,4 @@ require_jar('io.netty', 'netty-common', '4.1.115.Final')
8
8
  require_jar('io.netty', 'netty-transport', '4.1.115.Final')
9
9
  require_jar('io.netty', 'netty-handler', '4.1.115.Final')
10
10
  require_jar('io.netty', 'netty-transport-native-unix-common', '4.1.115.Final')
11
- require_jar('org.logstash.plugins.input.http', 'logstash-input-http', '3.10.0')
11
+ require_jar('org.logstash.plugins.input.http', 'logstash-input-http', '4.0.0')
@@ -3,8 +3,4 @@ CERTS_DIR = File.expand_path('../fixtures/certs/generated', File.dirname(__FILE_
3
3
 
4
4
  def certificate_path(filename)
5
5
  File.join(CERTS_DIR, filename)
6
- end
7
-
8
- RSpec.configure do |config|
9
- config.formatter = :documentation
10
- end
6
+ end
@@ -57,7 +57,7 @@ describe LogStash::Inputs::Http do
57
57
  let(:config) { { "port" => port, "threads" => threads, "max_pending_requests" => max_pending_requests } }
58
58
 
59
59
  context "when sending more requests than queue slots" do
60
- it "rejects additional incoming requests with HTTP 429" do
60
+ it "should block when the queue is full" do
61
61
  # these will queue and return 200
62
62
  logstash_queue_size.times.each do |i|
63
63
  response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
@@ -65,77 +65,15 @@ describe LogStash::Inputs::Http do
65
65
  end
66
66
 
67
67
  # these will block
68
- blocked_calls = (threads + max_pending_requests).times.map do
69
- Thread.new do
70
- begin
71
- {:result => client.post("http://127.0.0.1:#{port}", :body => '{}').call}
72
- rescue Manticore::SocketException, Manticore::SocketTimeout => e
73
- {:exception => e}
74
- end
75
- end
68
+ (threads + max_pending_requests).times.each do |i|
69
+ expect {
70
+ client.post("http://127.0.0.1:#{port}", :body => '{}').call
71
+ }.to raise_error(Manticore::SocketTimeout)
76
72
  end
77
73
 
78
- sleep 1 # let those requests go, but not so long that our block-detector starts emitting 429's
79
-
80
- # by now we should be rejecting with 429 since the backlog is full
74
+ # by now we should be rejecting with 429
81
75
  response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
82
76
  expect(response.code).to eq(429)
83
-
84
- # ensure that our blocked connections did block
85
- aggregate_failures do
86
- blocked_calls.map(&:value).each do |blocked|
87
- expect(blocked[:result]).to be_nil
88
- expect(blocked[:exception]).to be_a_kind_of Manticore::SocketTimeout
89
- end
90
- end
91
- end
92
- end
93
- end
94
-
95
- describe "observing queue back-pressure" do
96
- let(:logstash_queue_size) { rand(10) + 1 }
97
- let(:max_pending_requests) { rand(5) + 1 }
98
- let(:threads) { rand(4) + 1 }
99
- let(:logstash_queue) { SizedQueue.new(logstash_queue_size) }
100
- let(:client_options) { {
101
- "request_timeout" => 0.1,
102
- "connect_timeout" => 3,
103
- "socket_timeout" => 0.1
104
- } }
105
-
106
- let(:config) { { "port" => port, "threads" => threads, "max_pending_requests" => max_pending_requests } }
107
-
108
- context "when sending request to an input that has blocked connections" do
109
- it "rejects incoming requests with HTTP 429" do
110
- # these will queue and return 200
111
- logstash_queue_size.times.each do |i|
112
- response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
113
- expect(response.code).to eq(200)
114
- end
115
-
116
- # these will block
117
- blocked_call = Thread.new do
118
- begin
119
- {:result => client.post("http://127.0.0.1:#{port}", :body => '{}').call}
120
- rescue Manticore::SocketException, Manticore::SocketTimeout => e
121
- {:exception => e}
122
- end
123
- end
124
-
125
- sleep 12 # let that requests go, and ensure it is blocking long enough to be problematic
126
-
127
- # by now we should be rejecting with 429 since at least one existing request is blocked
128
- # for more than 10s.
129
- response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
130
- expect(response.code).to eq(429)
131
-
132
- # ensure that our blocked connections did block
133
- aggregate_failures do
134
- blocked_call.value.tap do |blocked|
135
- expect(blocked[:result]).to be_nil
136
- expect(blocked[:exception]).to be_a_kind_of Manticore::SocketTimeout
137
- end
138
- end
139
77
  end
140
78
  end
141
79
  end
@@ -288,22 +226,7 @@ describe LogStash::Inputs::Http do
288
226
  event = logstash_queue.pop
289
227
  expect(event.get("message")).to eq("Hello")
290
228
  end
291
-
292
229
  end
293
-
294
- context 'enforced TLSv1.3 (deprecated options)' do
295
-
296
- let(:config) { super().merge 'tls_min_version' => 1.3,
297
- 'cipher_suites' => [ 'TLS_AES_128_GCM_SHA256' ] }
298
-
299
- it "should parse the json body" do
300
- expect(response.code).to eq(200)
301
- event = logstash_queue.pop
302
- expect(event.get("message")).to eq("Hello")
303
- end
304
-
305
- end
306
-
307
230
  end if TLS13_ENABLED_BY_DEFAULT
308
231
 
309
232
  end
@@ -623,16 +546,6 @@ describe LogStash::Inputs::Http do
623
546
  subject.run(nil)
624
547
  end
625
548
  end
626
-
627
- context "and `ssl_` settings provided" do
628
- let(:ssc) { SelfSignedCertificate.new }
629
- let(:config) { { "port" => 0, "ssl_enabled" => false, "ssl_certificate" => ssc.certificate.path, "ssl_client_authentication" => "none", "cipher_suites" => ["TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA"] } }
630
-
631
- it "should warn about not using the configs" do
632
- expect(subject.logger).to receive(:warn).with(/^Configured SSL settings are not used when `ssl_enabled` is set to `false`: \[("ssl_certificate"(,\s)?|"ssl_client_authentication"(,\s)?|"cipher_suites"(,\s)?)*\]$/)
633
- subject.register
634
- end
635
- end
636
549
  end
637
550
 
638
551
  context "with :ssl_enabled => true" do
@@ -690,31 +603,7 @@ describe LogStash::Inputs::Http do
690
603
  expect { subject.register }.to_not raise_exception
691
604
  end
692
605
  end
693
- ["ssl_verify_mode", "verify_mode"].each do |config_name|
694
- ["peer", "force_peer"].each do |verify_mode|
695
- context "with deprecated #{config_name} = #{verify_mode}" do
696
- subject { LogStash::Inputs::Http.new("port" => port,
697
- "ssl_enabled" => true,
698
- "ssl_certificate" => ssl_certificate.path,
699
- "ssl_certificate_authorities" => ssl_certificate.path,
700
- "ssl_key" => ssl_key.path,
701
- config_name => verify_mode
702
- ) }
703
- it "should not raise exception" do
704
- expect { subject.register }.to_not raise_exception
705
- end
706
- end
707
- end
708
- end
709
- ["ssl_verify_mode", "verify_mode"].each do |config_name|
710
- context "with deprecated #{config_name} = none" do
711
- subject { LogStash::Inputs::Http.new(config.merge(config_name => "none")) }
712
606
 
713
- it "should not raise exception" do
714
- expect { subject.register }.to_not raise_exception
715
- end
716
- end
717
- end
718
607
  context "with invalid ssl certificate" do
719
608
  before do
720
609
  cert = File.readlines path = config["ssl_certificate"]
@@ -762,76 +651,6 @@ describe LogStash::Inputs::Http do
762
651
  end
763
652
  end
764
653
 
765
- context "with both verify_mode and ssl_verify_mode options set" do
766
- let(:config) do
767
- super().merge('verify_mode' => 'none', 'ssl_verify_mode' => 'none')
768
- end
769
-
770
- it "should raise a configuration error" do
771
- expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_verify_mode`.?/i
772
- end
773
- end
774
-
775
- context "with both ssl_client_authentication and ssl_verify_mode options set" do
776
- let(:config) do
777
- super().merge('ssl_client_authentication' => 'optional', 'ssl_verify_mode' => 'none')
778
- end
779
-
780
- it "should raise a configuration error" do
781
- expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_client_authentication.?/i
782
- end
783
- end
784
-
785
- context "with both ssl_client_authentication and verify_mode options set" do
786
- let(:config) do
787
- super().merge('ssl_client_authentication' => 'optional', 'verify_mode' => 'none')
788
- end
789
-
790
- it "should raise a configuration error" do
791
- expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_client_authentication.?/i
792
- end
793
- end
794
-
795
- context "with ssl_cipher_suites and cipher_suites set" do
796
- let(:config) do
797
- super().merge('ssl_cipher_suites' => ['TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384'],
798
- 'cipher_suites' => ['TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384'])
799
- end
800
-
801
- it "should raise a configuration error" do
802
- expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_cipher_suites.?/i
803
- end
804
- end
805
-
806
- context "with ssl_supported_protocols and tls_min_version set" do
807
- let(:config) do
808
- super().merge('ssl_supported_protocols' => ['TLSv1.2'], 'tls_min_version' => 1.0)
809
- end
810
-
811
- it "should raise a configuration error" do
812
- expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_supported_protocols.?/i
813
- end
814
- end
815
-
816
- context "with ssl_supported_protocols and tls_max_version set" do
817
- let(:config) do
818
- super().merge('ssl_supported_protocols' => ['TLSv1.2'], 'tls_max_version' => 1.2)
819
- end
820
-
821
- it "should raise a configuration error" do
822
- expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_supported_protocols.?/i
823
- end
824
- end
825
-
826
- context "with both ssl and ssl_enabled set" do
827
- let(:config) do
828
- super().merge('ssl' => true, 'ssl_enabled' => true )
829
- end
830
-
831
- it "should raise a configuration error" do
832
- expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_enabled.?/i
833
- end
834
- end
835
654
 
836
655
  context "and with :ssl_keystore_path" do
837
656
  let(:config) do
@@ -844,41 +663,6 @@ describe LogStash::Inputs::Http do
844
663
  end
845
664
 
846
665
  context "with ssl_client_authentication" do
847
- context "normalized from ssl_verify_mode 'none'" do
848
- let(:config) { super().merge("ssl_verify_mode" => "none") }
849
-
850
- it "should transform the value to 'none'" do
851
- subject.register
852
- expect(subject.params).to match hash_including("ssl_client_authentication" => "none")
853
- expect(subject.instance_variable_get(:@ssl_client_authentication)).to eql("none")
854
- end
855
-
856
- context "and ssl_certificate_authorities is set" do
857
- let(:config) { super().merge("ssl_certificate_authorities" => [certificate_path( 'root.crt')]) }
858
- it "raise a configuration error" do
859
- expect { subject.register }.to raise_error(LogStash::ConfigurationError, "The configuration of `ssl_certificate_authorities` requires setting `ssl_verify_mode` to `peer` or 'force_peer'")
860
- end
861
- end
862
- end
863
-
864
- [%w[peer optional], %w[force_peer required]].each do |ssl_verify_mode, ssl_client_authentication|
865
- context "normalized from ssl_verify_mode '#{ssl_verify_mode}'" do
866
- let(:config) { super().merge("ssl_verify_mode" => ssl_verify_mode, "ssl_certificate_authorities" => [certificate_path( 'root.crt')]) }
867
-
868
- it "should transform the value to '#{ssl_client_authentication}'" do
869
- subject.register
870
- expect(subject.params).to match hash_including("ssl_client_authentication" => ssl_client_authentication)
871
- expect(subject.instance_variable_get(:@ssl_client_authentication)).to eql(ssl_client_authentication)
872
- end
873
-
874
- context "with no ssl_certificate_authorities set " do
875
- let(:config) { super().reject { |key| "ssl_certificate_authorities".eql?(key) } }
876
- it "raise a configuration error" do
877
- expect {subject.register}.to raise_error(LogStash::ConfigurationError, "Using `ssl_verify_mode` set to `peer` or `force_peer`, requires the configuration of `ssl_certificate_authorities` or `ssl_truststore_path`")
878
- end
879
- end
880
- end
881
- end
882
666
 
883
667
  context "configured to 'none'" do
884
668
  let(:config) { super().merge("ssl_client_authentication" => "none") }
@@ -1015,7 +799,26 @@ describe LogStash::Inputs::Http do
1015
799
  end
1016
800
  end
1017
801
  end
802
+ end
1018
803
 
804
+ describe 'handling obsolete settings' do
805
+ [{:name => 'tls_min_version', :replacement => 'ssl_supported_protocols', :sample_value => 1.3},
806
+ {:name => 'tls_max_version', :replacement => 'ssl_supported_protocols', :sample_value => 1.3},
807
+ {:name => 'cipher_suites', :replacement => 'ssl_cipher_suites', :sample_value => ['TLS_AES_128_GCM_SHA256']},
808
+ {:name => 'ssl', :replacement => 'ssl_enabled', :sample_value => true},
809
+ {:name => 'keystore', :replacement => 'ssl_keystore_path', :sample_value => certificate_path( 'server_from_root.p12')},
810
+ {:name => 'keystore_password', :replacement => 'ssl_keystore_password', :sample_value => 'none'},
811
+ {:name => 'ssl_verify_mode', :replacement => 'ssl_client_authentication', :sample_value => 'peer'},
812
+ {:name => 'verify_mode', :replacement => 'ssl_client_authentication', :sample_value => 'peer'}].each do | obsolete_setting|
813
+ context "with obsolete #{obsolete_setting[:name]}" do
814
+ let (:deprecated_config) do
815
+ config.merge({obsolete_setting[:name] => obsolete_setting[:sample_value]})
816
+ end
817
+ it "should raise a config error with the appropriate message" do
818
+ expect { LogStash::Inputs::Http.new(deprecated_config).register }.to raise_error LogStash::ConfigurationError, /The setting `#{obsolete_setting[:name]}` in plugin `http` is obsolete and is no longer available. Set '#{obsolete_setting[:replacement]}' instead/i
819
+ end
820
+ end
821
+ end
1019
822
  end
1020
823
  end
1021
824
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.0
4
+ version: 4.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: 2024-12-19 00:00:00.000000000 Z
11
+ date: 2024-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -176,7 +176,7 @@ files:
176
176
  - vendor/jar-dependencies/io/netty/netty-handler/4.1.115.Final/netty-handler-4.1.115.Final.jar
177
177
  - vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/4.1.115.Final/netty-transport-native-unix-common-4.1.115.Final.jar
178
178
  - vendor/jar-dependencies/io/netty/netty-transport/4.1.115.Final/netty-transport-4.1.115.Final.jar
179
- - vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/3.10.0/logstash-input-http-3.10.0.jar
179
+ - vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/4.0.0/logstash-input-http-4.0.0.jar
180
180
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
181
181
  licenses:
182
182
  - Apache License (2.0)