logstash-input-http 3.6.1-java → 3.7.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 +10 -0
- data/VERSION +1 -1
- data/docs/index.asciidoc +52 -9
- data/lib/logstash/inputs/http.rb +184 -64
- data/lib/logstash-input-http_jars.rb +8 -8
- data/logstash-input-http.gemspec +1 -0
- data/spec/inputs/helpers.rb +6 -0
- data/spec/inputs/http_spec.rb +162 -45
- data/vendor/jar-dependencies/io/netty/netty-buffer/{4.1.87.Final/netty-buffer-4.1.87.Final.jar → 4.1.93.Final/netty-buffer-4.1.93.Final.jar} +0 -0
- data/vendor/jar-dependencies/io/netty/netty-codec/{4.1.87.Final/netty-codec-4.1.87.Final.jar → 4.1.93.Final/netty-codec-4.1.93.Final.jar} +0 -0
- data/vendor/jar-dependencies/io/netty/netty-codec-http/{4.1.87.Final/netty-codec-http-4.1.87.Final.jar → 4.1.93.Final/netty-codec-http-4.1.93.Final.jar} +0 -0
- data/vendor/jar-dependencies/io/netty/netty-common/{4.1.87.Final/netty-common-4.1.87.Final.jar → 4.1.93.Final/netty-common-4.1.93.Final.jar} +0 -0
- data/vendor/jar-dependencies/io/netty/netty-handler/{4.1.87.Final/netty-handler-4.1.87.Final.jar → 4.1.93.Final/netty-handler-4.1.93.Final.jar} +0 -0
- data/vendor/jar-dependencies/io/netty/netty-transport/{4.1.87.Final/netty-transport-4.1.87.Final.jar → 4.1.93.Final/netty-transport-4.1.93.Final.jar} +0 -0
- data/vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/{4.1.87.Final/netty-transport-native-unix-common-4.1.87.Final.jar → 4.1.93.Final/netty-transport-native-unix-common-4.1.93.Final.jar} +0 -0
- data/vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/3.7.1/logstash-input-http-3.7.1.jar +0 -0
- metadata +27 -11
- data/vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/3.6.1/logstash-input-http-3.6.1.jar +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5051fcab4f259ed1622bbc4e7e9d75fd8eb182d5cbae5feb15a369580a41df8
|
|
4
|
+
data.tar.gz: 454bd2d2668c6139c5a2deb0328414a2feaa40c59f93861b18c14657d3016edf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33d7a0d63c69215e0f8739041620a2db88adb25573d73341045c35aa931757cc0b2339ab94d3b783a72ac584eeb7b7957af01308c8947194d35547e671524cb5
|
|
7
|
+
data.tar.gz: 0eef68812f2e12544ad291cf9daa4f3b2222876a5efa31354c4a23ac5623c802019fc636aa1ef3209248ff3b8670b983a61382003b54ba029939bc1c6f1b1f6c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 3.7.1
|
|
2
|
+
- bump netty to 4.1.93 [#166](https://github.com/logstash-plugins/logstash-input-http/pull/166)
|
|
3
|
+
|
|
4
|
+
## 3.7.0
|
|
5
|
+
- Reviewed and deprecated SSL settings to comply with Logstash's naming convention [#165](https://github.com/logstash-plugins/logstash-input-http/pull/165)
|
|
6
|
+
- Deprecated `ssl` in favor of `ssl_enabled`
|
|
7
|
+
- Deprecated `ssl_verify_mode` in favor of `ssl_client_authentication`
|
|
8
|
+
- Deprecated `keystore` in favor of `ssl_keystore_path`
|
|
9
|
+
- Deprecated `keystore_password` in favor of `ssl_keystore_password`
|
|
10
|
+
|
|
1
11
|
## 3.6.1
|
|
2
12
|
- Update Netty dependency to 4.1.87 [#162](https://github.com/logstash-plugins/logstash-input-http/pull/162)
|
|
3
13
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.7.1
|
data/docs/index.asciidoc
CHANGED
|
@@ -101,15 +101,19 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
|
101
101
|
| <<plugins-{type}s-{plugin}-max_pending_requests>> |<<number,number>>|No
|
|
102
102
|
| <<plugins-{type}s-{plugin}-response_headers>> |<<hash,hash>>|No
|
|
103
103
|
| <<plugins-{type}s-{plugin}-response_code>> |<<number,number>>, one of `[200, 201, 202, 204]`|No
|
|
104
|
-
| <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|
|
|
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
|
|
108
|
+
| <<plugins-{type}s-{plugin}-ssl_client_authentication>> |<<string,string>>, one of `["none", "optional", "required"]`|No
|
|
109
|
+
| <<plugins-{type}s-{plugin}-ssl_enabled>> |<<boolean,boolean>>|No
|
|
108
110
|
| <<plugins-{type}s-{plugin}-ssl_handshake_timeout>> |<<number,number>>|No
|
|
109
111
|
| <<plugins-{type}s-{plugin}-ssl_key>> |a valid filesystem path|No
|
|
110
112
|
| <<plugins-{type}s-{plugin}-ssl_key_passphrase>> |<<password,password>>|No
|
|
113
|
+
| <<plugins-{type}s-{plugin}-ssl_keystore_password>> |<<password,password>>|No
|
|
114
|
+
| <<plugins-{type}s-{plugin}-ssl_keystore_path>> |<<path,path>>|No
|
|
111
115
|
| <<plugins-{type}s-{plugin}-ssl_supported_protocols>> |<<array,array>>|No
|
|
112
|
-
| <<plugins-{type}s-{plugin}-ssl_verify_mode>> |<<string,string>>, one of `["none", "peer", "force_peer"]`|
|
|
116
|
+
| <<plugins-{type}s-{plugin}-ssl_verify_mode>> |<<string,string>>, one of `["none", "peer", "force_peer"]`|__Deprecated__
|
|
113
117
|
| <<plugins-{type}s-{plugin}-threads>> |<<number,number>>|No
|
|
114
118
|
| <<plugins-{type}s-{plugin}-tls_max_version>> |<<number,number>>|__Deprecated__
|
|
115
119
|
| <<plugins-{type}s-{plugin}-tls_min_version>> |<<number,number>>|__Deprecated__
|
|
@@ -214,7 +218,7 @@ The host or ip to bind
|
|
|
214
218
|
|
|
215
219
|
[id="plugins-{type}s-{plugin}-keystore"]
|
|
216
220
|
===== `keystore`
|
|
217
|
-
deprecated[3.
|
|
221
|
+
deprecated[3.7.0, Use <<plugins-{type}s-{plugin}-ssl_keystore_path>> instead]
|
|
218
222
|
|
|
219
223
|
* Value type is <<path,path>>
|
|
220
224
|
* There is no default value for this setting.
|
|
@@ -223,12 +227,12 @@ The JKS keystore to validate the client's certificates
|
|
|
223
227
|
|
|
224
228
|
[id="plugins-{type}s-{plugin}-keystore_password"]
|
|
225
229
|
===== `keystore_password`
|
|
226
|
-
deprecated[3.
|
|
230
|
+
deprecated[3.7.0, Use <<plugins-{type}s-{plugin}-ssl_keystore_password>> instead]
|
|
227
231
|
|
|
228
232
|
* Value type is <<password,password>>
|
|
229
233
|
* There is no default value for this setting.
|
|
230
234
|
|
|
231
|
-
Set the
|
|
235
|
+
Set the keystore password
|
|
232
236
|
|
|
233
237
|
[id="plugins-{type}s-{plugin}-password"]
|
|
234
238
|
===== `password`
|
|
@@ -308,11 +312,12 @@ specify target field for the client host of the http request
|
|
|
308
312
|
|
|
309
313
|
[id="plugins-{type}s-{plugin}-ssl"]
|
|
310
314
|
===== `ssl`
|
|
315
|
+
deprecated[3.7.0, Replaced by <<plugins-{type}s-{plugin}-ssl_enabled>>]
|
|
311
316
|
|
|
312
317
|
* Value type is <<boolean,boolean>>
|
|
313
318
|
* Default value is `false`
|
|
314
319
|
|
|
315
|
-
Events are by default sent in plain text. You can
|
|
320
|
+
Events are, by default, sent in plain text. You can
|
|
316
321
|
enable encryption by setting `ssl` to true and configuring
|
|
317
322
|
the `ssl_certificate` and `ssl_key` options.
|
|
318
323
|
|
|
@@ -332,8 +337,8 @@ SSL certificate to use.
|
|
|
332
337
|
|
|
333
338
|
Validate client certificates against these authorities.
|
|
334
339
|
You can define multiple files or paths. All the certificates will
|
|
335
|
-
be read and added to the trust store. You need to configure the
|
|
336
|
-
to `
|
|
340
|
+
be read and added to the trust store. You need to configure the <<plugins-{type}s-{plugin}-ssl_client_authentication>>
|
|
341
|
+
to `optional` or `required` to enable the verification.
|
|
337
342
|
|
|
338
343
|
|
|
339
344
|
[id="plugins-{type}s-{plugin}-ssl_cipher_suites"]
|
|
@@ -347,6 +352,27 @@ This default list applies for OpenJDK 11.0.14 and higher.
|
|
|
347
352
|
For older JDK versions, the default list includes only suites supported by that version.
|
|
348
353
|
For example, the ChaCha20 family of ciphers is not supported in older versions.
|
|
349
354
|
|
|
355
|
+
[id="plugins-{type}s-{plugin}-ssl_client_authentication"]
|
|
356
|
+
===== `ssl_client_authentication`
|
|
357
|
+
|
|
358
|
+
* Value can be any of: `none`, `optional`, `required`
|
|
359
|
+
* Default value is `"none"`
|
|
360
|
+
|
|
361
|
+
Controls the server's behavior in regard to requesting a certificate from client connections:
|
|
362
|
+
`required` forces a client to present a certificate, while `optional` requests a client certificate
|
|
363
|
+
but the client is not required to present one. Defaults to `none`, which disables the client authentication.
|
|
364
|
+
|
|
365
|
+
NOTE: This setting can be used only if <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> is set.
|
|
366
|
+
|
|
367
|
+
[id="plugins-{type}s-{plugin}-ssl_enabled"]
|
|
368
|
+
===== `ssl_enabled`
|
|
369
|
+
|
|
370
|
+
* Value type is <<boolean,boolean>>
|
|
371
|
+
* Default value is `false`
|
|
372
|
+
|
|
373
|
+
Events are, by default, sent in plain text. You can enable encryption by setting `ssl_enabled` to true and configuring
|
|
374
|
+
the <<plugins-{type}s-{plugin}-ssl_certificate>> and <<plugins-{type}s-{plugin}-ssl_key>> options.
|
|
375
|
+
|
|
350
376
|
[id="plugins-{type}s-{plugin}-ssl_handshake_timeout"]
|
|
351
377
|
===== `ssl_handshake_timeout`
|
|
352
378
|
|
|
@@ -373,6 +399,22 @@ for more information.
|
|
|
373
399
|
|
|
374
400
|
SSL key passphrase to use.
|
|
375
401
|
|
|
402
|
+
[id="plugins-{type}s-{plugin}-ssl_keystore_path"]
|
|
403
|
+
===== `ssl_keystore_path`
|
|
404
|
+
|
|
405
|
+
* Value type is <<path,path>>
|
|
406
|
+
* There is no default value for this setting.
|
|
407
|
+
|
|
408
|
+
The JKS keystore to validate the client's certificates
|
|
409
|
+
|
|
410
|
+
[id="plugins-{type}s-{plugin}-ssl_keystore_password"]
|
|
411
|
+
===== `ssl_keystore_password`
|
|
412
|
+
|
|
413
|
+
* Value type is <<password,password>>
|
|
414
|
+
* There is no default value for this setting.
|
|
415
|
+
|
|
416
|
+
Set the JKS keystore password
|
|
417
|
+
|
|
376
418
|
[id="plugins-{type}s-{plugin}-ssl_supported_protocols"]
|
|
377
419
|
===== `ssl_supported_protocols`
|
|
378
420
|
|
|
@@ -392,6 +434,7 @@ the *$JDK_HOME/conf/security/java.security* configuration file. That is, `TLSv1.
|
|
|
392
434
|
|
|
393
435
|
[id="plugins-{type}s-{plugin}-ssl_verify_mode"]
|
|
394
436
|
===== `ssl_verify_mode`
|
|
437
|
+
deprecated[3.7.0, Replaced by <<plugins-{type}s-{plugin}-ssl_client_authentication>>]
|
|
395
438
|
|
|
396
439
|
* Value can be any of: `none`, `peer`, `force_peer`
|
|
397
440
|
* Default value is `"none"`
|
|
@@ -404,7 +447,7 @@ If the client provides a certificate, it will be validated.
|
|
|
404
447
|
`force_peer` will make the server ask the client to provide a certificate.
|
|
405
448
|
If the client doesn't provide a certificate, the connection will be closed.
|
|
406
449
|
|
|
407
|
-
This option needs to be used with
|
|
450
|
+
This option needs to be used with <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> and a defined list of CAs.
|
|
408
451
|
|
|
409
452
|
[id="plugins-{type}s-{plugin}-threads"]
|
|
410
453
|
===== `threads`
|
data/lib/logstash/inputs/http.rb
CHANGED
|
@@ -4,6 +4,7 @@ require "logstash/namespace"
|
|
|
4
4
|
require "stud/interval"
|
|
5
5
|
require "logstash-input-http_jars"
|
|
6
6
|
require "logstash/plugin_mixins/ecs_compatibility_support"
|
|
7
|
+
require "logstash/plugin_mixins/normalize_config_support"
|
|
7
8
|
|
|
8
9
|
# Using this input you can receive single or multiline events over http(s).
|
|
9
10
|
# Applications can send a HTTP POST request with a body to the endpoint started by this
|
|
@@ -27,6 +28,9 @@ require "logstash/plugin_mixins/ecs_compatibility_support"
|
|
|
27
28
|
#
|
|
28
29
|
class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
29
30
|
include LogStash::PluginMixins::ECSCompatibilitySupport(:disabled, :v1, :v8 => :v1)
|
|
31
|
+
|
|
32
|
+
include LogStash::PluginMixins::NormalizeConfigSupport
|
|
33
|
+
|
|
30
34
|
require "logstash/inputs/http/tls"
|
|
31
35
|
|
|
32
36
|
java_import "io.netty.handler.codec.http.HttpUtil"
|
|
@@ -54,7 +58,12 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
|
54
58
|
# Events are by default sent in plain text. You can
|
|
55
59
|
# enable encryption by setting `ssl` to true and configuring
|
|
56
60
|
# the `ssl_certificate` and `ssl_key` options.
|
|
57
|
-
config :ssl, :validate => :boolean, :default => false
|
|
61
|
+
config :ssl, :validate => :boolean, :default => false, :deprecated => "Set 'ssl_enabled' instead."
|
|
62
|
+
|
|
63
|
+
# Events are by default sent in plain text. You can
|
|
64
|
+
# enable encryption by setting `ssl` to true and configuring
|
|
65
|
+
# the `ssl_certificate` and `ssl_key` options.
|
|
66
|
+
config :ssl_enabled, :validate => :boolean, :default => false
|
|
58
67
|
|
|
59
68
|
# SSL certificate to use.
|
|
60
69
|
config :ssl_certificate, :validate => :path
|
|
@@ -64,15 +73,29 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
|
64
73
|
# for more information.
|
|
65
74
|
config :ssl_key, :validate => :path
|
|
66
75
|
|
|
76
|
+
# The JKS keystore password
|
|
77
|
+
config :ssl_keystore_password, :validate => :password
|
|
78
|
+
|
|
79
|
+
# The JKS keystore to validate the client's certificates
|
|
80
|
+
config :ssl_keystore_path, :validate => :path
|
|
81
|
+
|
|
67
82
|
# SSL key passphrase to use.
|
|
68
83
|
config :ssl_key_passphrase, :validate => :password
|
|
69
84
|
|
|
70
85
|
# Validate client certificates against these authorities.
|
|
71
86
|
# You can define multiple files or paths. All the certificates will
|
|
72
|
-
# be read and added to the trust store. You need to configure the `
|
|
73
|
-
# to `
|
|
87
|
+
# be read and added to the trust store. You need to configure the `ssl_client_authentication`
|
|
88
|
+
# to `optional` or `required` to enable the verification.
|
|
74
89
|
config :ssl_certificate_authorities, :validate => :array, :default => []
|
|
75
90
|
|
|
91
|
+
# Controls the server’s behavior in regard to requesting a certificate from client connections.
|
|
92
|
+
# `none`: No client authentication
|
|
93
|
+
# `optional`: Requests a client certificate but the client is not required to present one.
|
|
94
|
+
# `required`: Forces a client to present a certificate.
|
|
95
|
+
#
|
|
96
|
+
# This option needs to be used with `ssl_certificate_authorities` and a defined list of CAs.
|
|
97
|
+
config :ssl_client_authentication, :validate => %w[none optional required], :default => 'none'
|
|
98
|
+
|
|
76
99
|
# By default the server doesn't do any client verification.
|
|
77
100
|
#
|
|
78
101
|
# `peer` will make the server ask the client to provide a certificate.
|
|
@@ -82,7 +105,7 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
|
82
105
|
# If the client doesn't provide a certificate, the connection will be closed.
|
|
83
106
|
#
|
|
84
107
|
# This option needs to be used with `ssl_certificate_authorities` and a defined list of CAs.
|
|
85
|
-
config :ssl_verify_mode, :validate => ["none", "peer", "force_peer"], :default => "none"
|
|
108
|
+
config :ssl_verify_mode, :validate => ["none", "peer", "force_peer"], :default => "none", :deprecated => "Set 'ssl_client_authentication' instead."
|
|
86
109
|
|
|
87
110
|
# Time in milliseconds for an incomplete ssl handshake to timeout
|
|
88
111
|
config :ssl_handshake_timeout, :validate => :number, :default => 10000
|
|
@@ -118,10 +141,13 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
|
118
141
|
# Deprecated options
|
|
119
142
|
|
|
120
143
|
# The JKS keystore to validate the client's certificates
|
|
121
|
-
config :keystore, :validate => :path, :deprecated => "Set '
|
|
122
|
-
|
|
144
|
+
config :keystore, :validate => :path, :deprecated => "Set 'ssl_keystore_path' instead."
|
|
145
|
+
|
|
146
|
+
# The JKS keystore password
|
|
147
|
+
config :keystore_password, :validate => :password, :deprecated => "Set 'ssl_keystore_password' instead."
|
|
148
|
+
|
|
149
|
+
config :verify_mode, :validate => ['none', 'peer', 'force_peer'], :default => 'none', :deprecated => "Set 'ssl_client_authentication' instead."
|
|
123
150
|
|
|
124
|
-
config :verify_mode, :validate => ['none', 'peer', 'force_peer'], :default => 'none', :deprecated => "Set 'ssl_verify_mode' instead."
|
|
125
151
|
config :cipher_suites, :validate => :array, :default => [], :deprecated => "Set 'ssl_cipher_suites' instead."
|
|
126
152
|
|
|
127
153
|
# The minimum TLS version allowed for the encrypted connections. The value must be one of the following:
|
|
@@ -134,9 +160,36 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
|
134
160
|
|
|
135
161
|
attr_reader :codecs
|
|
136
162
|
|
|
163
|
+
NON_PREFIXED_SSL_CONFIGS = Set[
|
|
164
|
+
'keystore',
|
|
165
|
+
'keystore_password',
|
|
166
|
+
'verify_mode',
|
|
167
|
+
'tls_min_version',
|
|
168
|
+
'tls_max_version',
|
|
169
|
+
'cipher_suites',
|
|
170
|
+
].freeze
|
|
171
|
+
|
|
172
|
+
SSL_CLIENT_AUTH_NONE = 'none'.freeze
|
|
173
|
+
SSL_CLIENT_AUTH_OPTIONAL = 'optional'.freeze
|
|
174
|
+
SSL_CLIENT_AUTH_REQUIRED = 'required'.freeze
|
|
175
|
+
|
|
176
|
+
SSL_VERIFY_MODE_TO_CLIENT_AUTHENTICATION_MAP = {
|
|
177
|
+
'none' => SSL_CLIENT_AUTH_NONE,
|
|
178
|
+
'peer' => SSL_CLIENT_AUTH_OPTIONAL,
|
|
179
|
+
'force_peer' => SSL_CLIENT_AUTH_REQUIRED
|
|
180
|
+
}.freeze
|
|
181
|
+
|
|
182
|
+
private_constant :SSL_CLIENT_AUTH_NONE
|
|
183
|
+
private_constant :SSL_CLIENT_AUTH_OPTIONAL
|
|
184
|
+
private_constant :SSL_CLIENT_AUTH_REQUIRED
|
|
185
|
+
private_constant :NON_PREFIXED_SSL_CONFIGS
|
|
186
|
+
private_constant :SSL_VERIFY_MODE_TO_CLIENT_AUTHENTICATION_MAP
|
|
187
|
+
|
|
137
188
|
public
|
|
138
189
|
def register
|
|
139
190
|
|
|
191
|
+
setup_ssl_params!
|
|
192
|
+
|
|
140
193
|
validate_ssl_settings!
|
|
141
194
|
|
|
142
195
|
if @user && @password
|
|
@@ -234,78 +287,123 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
|
234
287
|
end
|
|
235
288
|
|
|
236
289
|
def validate_ssl_settings!
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
290
|
+
ssl_config_name = original_params.include?('ssl') ? 'ssl' : 'ssl_enabled'
|
|
291
|
+
|
|
292
|
+
unless @ssl_enabled
|
|
293
|
+
ignored_ssl_settings = original_params.select { |k| k != 'ssl_enabled' && k.start_with?('ssl_') || NON_PREFIXED_SSL_CONFIGS.include?(k) }
|
|
294
|
+
@logger.warn("Configured SSL settings are not used when `#{ssl_config_name}` is set to `false`: #{ignored_ssl_settings.keys}") if ignored_ssl_settings.any?
|
|
295
|
+
return # code bellow assumes `ssl_enabled => true`
|
|
242
296
|
end
|
|
243
297
|
|
|
244
|
-
if
|
|
245
|
-
raise LogStash::ConfigurationError, "
|
|
298
|
+
if @ssl_certificate && !@ssl_key
|
|
299
|
+
raise LogStash::ConfigurationError, "Using an `ssl_certificate` requires an `ssl_key`"
|
|
300
|
+
elsif @ssl_key && !@ssl_certificate
|
|
301
|
+
raise LogStash::ConfigurationError, 'An `ssl_certificate` is required when using an `ssl_key`'
|
|
246
302
|
end
|
|
247
303
|
|
|
248
|
-
|
|
249
|
-
raise LogStash::ConfigurationError, "
|
|
250
|
-
elsif original_params.key?("verify_mode")
|
|
251
|
-
@ssl_verify_mode_final = @verify_mode
|
|
252
|
-
else
|
|
253
|
-
@ssl_verify_mode_final = @ssl_verify_mode
|
|
304
|
+
unless ssl_key_configured? || ssl_jks_configured?
|
|
305
|
+
raise LogStash::ConfigurationError, "Either an `ssl_certificate` or `ssl_keystore_path` is required when SSL is enabled `#{ssl_config_name} => true`"
|
|
254
306
|
end
|
|
255
307
|
|
|
256
|
-
if
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
@ssl_cipher_suites_final = @cipher_suites
|
|
260
|
-
else
|
|
261
|
-
@ssl_cipher_suites_final = @ssl_cipher_suites
|
|
308
|
+
if require_certificate_authorities? && !certificate_authorities_configured?
|
|
309
|
+
config_name, optional, required = provided_client_authentication_config([SSL_CLIENT_AUTH_OPTIONAL, SSL_CLIENT_AUTH_REQUIRED])
|
|
310
|
+
raise LogStash::ConfigurationError, "Using `#{config_name}` set to `#{optional}` or `#{required}`, requires the configuration of `ssl_certificate_authorities`"
|
|
262
311
|
end
|
|
263
312
|
|
|
264
|
-
if
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
313
|
+
if !require_certificate_authorities? && certificate_authorities_configured?
|
|
314
|
+
config_name, optional, required = provided_client_authentication_config([SSL_CLIENT_AUTH_OPTIONAL, SSL_CLIENT_AUTH_REQUIRED])
|
|
315
|
+
raise LogStash::ConfigurationError, "The configuration of `ssl_certificate_authorities` requires setting `#{config_name}` to `#{optional}` or '#{required}'"
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def setup_ssl_params!
|
|
320
|
+
@ssl_enabled = normalize_config(:ssl_enabled) do |normalizer|
|
|
321
|
+
normalizer.with_deprecated_alias(:ssl)
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
@ssl_cipher_suites = normalize_config(:ssl_cipher_suites) do |normalizer|
|
|
325
|
+
normalizer.with_deprecated_alias(:cipher_suites)
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
@ssl_supported_protocols = normalize_config(:ssl_supported_protocols) do |normalizer|
|
|
329
|
+
normalizer.with_deprecated_mapping(:tls_min_version, :tls_max_version) do |tls_min_version, tls_max_version|
|
|
330
|
+
TLS.get_supported(tls_min_version..tls_max_version).map(&:name)
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
@ssl_client_authentication = normalize_config(:ssl_client_authentication) do |normalizer|
|
|
335
|
+
normalizer.with_deprecated_mapping(:verify_mode, :ssl_verify_mode) do |verify_mode, ssl_verify_mode|
|
|
336
|
+
normalize_ssl_client_authentication_value!(verify_mode, ssl_verify_mode)
|
|
273
337
|
end
|
|
274
338
|
end
|
|
275
339
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
340
|
+
@ssl_keystore_path = normalize_config(:ssl_keystore_path) do |normalizer|
|
|
341
|
+
normalizer.with_deprecated_alias(:keystore)
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
@ssl_keystore_password = normalize_config(:ssl_keystore_password) do |normalizer|
|
|
345
|
+
normalizer.with_deprecated_alias(:keystore_password)
|
|
280
346
|
end
|
|
347
|
+
|
|
348
|
+
params['ssl_enabled'] = @ssl_enabled unless @ssl_enabled.nil?
|
|
349
|
+
params['ssl_cipher_suites'] = @ssl_cipher_suites unless @ssl_cipher_suites.nil?
|
|
350
|
+
params['ssl_supported_protocols'] = @ssl_supported_protocols unless @ssl_supported_protocols.nil?
|
|
351
|
+
params['ssl_client_authentication'] = @ssl_client_authentication unless @ssl_client_authentication.nil?
|
|
352
|
+
params['ssl_keystore_path'] = @ssl_keystore_path unless @ssl_keystore_path.nil?
|
|
353
|
+
params['ssl_keystore_password'] = @ssl_keystore_password unless @ssl_keystore_password.nil?
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def normalize_ssl_client_authentication_value!(verify_mode, ssl_verify_mode)
|
|
357
|
+
verify_mode_explicitly_set = original_params.key?("verify_mode")
|
|
358
|
+
|
|
359
|
+
if verify_mode_explicitly_set && original_params.key?("ssl_verify_mode")
|
|
360
|
+
raise LogStash::ConfigurationError, "Both (deprecated) `ssl_verify_mode` and `verify_mode` were set. Use only `ssl_verify_mode`"
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
deprecated_value = (verify_mode_explicitly_set ? verify_mode : ssl_verify_mode).downcase
|
|
364
|
+
SSL_VERIFY_MODE_TO_CLIENT_AUTHENTICATION_MAP[deprecated_value]
|
|
281
365
|
end
|
|
282
366
|
|
|
283
367
|
def create_http_server(message_handler)
|
|
284
368
|
org.logstash.plugins.inputs.http.NettyHttpServer.new(
|
|
285
|
-
@host, @port, message_handler, build_ssl_params
|
|
369
|
+
@host, @port, message_handler, build_ssl_params, @threads, @max_pending_requests, @max_content_length, @response_code)
|
|
286
370
|
end
|
|
287
371
|
|
|
288
372
|
def build_ssl_params
|
|
289
|
-
return nil unless @
|
|
373
|
+
return nil unless @ssl_enabled
|
|
290
374
|
|
|
291
|
-
if @
|
|
292
|
-
ssl_builder = org.logstash.plugins.inputs.http.util.JksSslBuilder.new(@
|
|
375
|
+
if @ssl_keystore_path && @ssl_keystore_password
|
|
376
|
+
ssl_builder = org.logstash.plugins.inputs.http.util.JksSslBuilder.new(@ssl_keystore_path, @ssl_keystore_password.value)
|
|
293
377
|
else
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
378
|
+
ssl_builder = new_ssl_simple_builder
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
new_ssl_handshake_provider(ssl_builder)
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
def new_ssl_simple_builder
|
|
385
|
+
passphrase = @ssl_key_passphrase.nil? ? nil : @ssl_key_passphrase.value
|
|
386
|
+
begin
|
|
387
|
+
ssl_context_builder = SslSimpleBuilder.new(@ssl_certificate, @ssl_key, passphrase)
|
|
388
|
+
.setProtocols(@ssl_supported_protocols)
|
|
389
|
+
.setCipherSuites(normalized_cipher_suites)
|
|
302
390
|
|
|
303
|
-
if
|
|
304
|
-
|
|
391
|
+
if client_authentication_enabled?
|
|
392
|
+
ssl_context_builder.setClientAuthentication(ssl_simple_builder_verify_mode, @ssl_certificate_authorities)
|
|
305
393
|
end
|
|
394
|
+
|
|
395
|
+
ssl_context_builder
|
|
396
|
+
rescue java.lang.IllegalArgumentException => e
|
|
397
|
+
@logger.error("SSL configuration invalid", error_details(e))
|
|
398
|
+
raise LogStash::ConfigurationError, e
|
|
306
399
|
end
|
|
400
|
+
end
|
|
307
401
|
|
|
308
|
-
|
|
402
|
+
def ssl_simple_builder_verify_mode
|
|
403
|
+
return SslSimpleBuilder::SslClientVerifyMode::OPTIONAL if client_authentication_optional?
|
|
404
|
+
return SslSimpleBuilder::SslClientVerifyMode::REQUIRED if client_authentication_required?
|
|
405
|
+
return SslSimpleBuilder::SslClientVerifyMode::NONE if client_authentication_none?
|
|
406
|
+
raise LogStash::ConfigurationError, "Invalid `ssl_client_authentication` value #{@ssl_client_authentication}"
|
|
309
407
|
end
|
|
310
408
|
|
|
311
409
|
def ssl_key_configured?
|
|
@@ -313,30 +411,52 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
|
313
411
|
end
|
|
314
412
|
|
|
315
413
|
def ssl_jks_configured?
|
|
316
|
-
!!(@
|
|
414
|
+
!!(@ssl_keystore_path && @ssl_keystore_password)
|
|
317
415
|
end
|
|
318
416
|
|
|
319
|
-
def
|
|
320
|
-
|
|
417
|
+
def client_authentication_enabled?
|
|
418
|
+
client_authentication_optional? || client_authentication_required?
|
|
321
419
|
end
|
|
322
420
|
|
|
323
421
|
def require_certificate_authorities?
|
|
324
|
-
|
|
422
|
+
client_authentication_required? || client_authentication_optional?
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
def certificate_authorities_configured?
|
|
426
|
+
@ssl_certificate_authorities && @ssl_certificate_authorities.size > 0
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
def client_authentication_required?
|
|
430
|
+
@ssl_client_authentication && @ssl_client_authentication.downcase == SSL_CLIENT_AUTH_REQUIRED
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
def client_authentication_none?
|
|
434
|
+
@ssl_client_authentication && @ssl_client_authentication.downcase == SSL_CLIENT_AUTH_NONE
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
def client_authentication_optional?
|
|
438
|
+
@ssl_client_authentication && @ssl_client_authentication.downcase == SSL_CLIENT_AUTH_OPTIONAL
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
def provided_client_authentication_config(values = [@ssl_client_authentication])
|
|
442
|
+
if original_params.include?('ssl_verify_mode')
|
|
443
|
+
['ssl_verify_mode', *values.map { |v| SSL_VERIFY_MODE_TO_CLIENT_AUTHENTICATION_MAP.key(v) }]
|
|
444
|
+
elsif original_params.include?('verify_mode')
|
|
445
|
+
['verify_mode', *values.map { |v| SSL_VERIFY_MODE_TO_CLIENT_AUTHENTICATION_MAP.key(v) }]
|
|
446
|
+
else
|
|
447
|
+
['ssl_client_authentication', *values]
|
|
448
|
+
end
|
|
325
449
|
end
|
|
326
450
|
|
|
327
451
|
private
|
|
328
452
|
|
|
329
453
|
def normalized_cipher_suites
|
|
330
|
-
@
|
|
454
|
+
@ssl_cipher_suites.map(&:upcase)
|
|
331
455
|
end
|
|
332
456
|
|
|
333
457
|
def new_ssl_handshake_provider(ssl_builder)
|
|
334
458
|
begin
|
|
335
|
-
|
|
336
|
-
ssl_handler_provider.setVerifyMode(@ssl_verify_mode_final.upcase)
|
|
337
|
-
ssl_handler_provider.setProtocols(@ssl_supported_protocols_final)
|
|
338
|
-
ssl_handler_provider.setHandshakeTimeoutMilliseconds(@ssl_handshake_timeout)
|
|
339
|
-
ssl_handler_provider
|
|
459
|
+
org.logstash.plugins.inputs.http.util.SslHandlerProvider.new(ssl_builder.build(), @ssl_handshake_timeout)
|
|
340
460
|
rescue java.lang.IllegalArgumentException => e
|
|
341
461
|
@logger.error("SSL configuration invalid", error_details(e))
|
|
342
462
|
raise LogStash::ConfigurationError, e
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
require 'jar_dependencies'
|
|
4
|
-
require_jar('io.netty', 'netty-buffer', '4.1.
|
|
5
|
-
require_jar('io.netty', 'netty-codec', '4.1.
|
|
6
|
-
require_jar('io.netty', 'netty-codec-http', '4.1.
|
|
7
|
-
require_jar('io.netty', 'netty-common', '4.1.
|
|
8
|
-
require_jar('io.netty', 'netty-transport', '4.1.
|
|
9
|
-
require_jar('io.netty', 'netty-handler', '4.1.
|
|
10
|
-
require_jar('io.netty', 'netty-transport-native-unix-common', '4.1.
|
|
11
|
-
require_jar('org.logstash.plugins.input.http', 'logstash-input-http', '3.
|
|
4
|
+
require_jar('io.netty', 'netty-buffer', '4.1.93.Final')
|
|
5
|
+
require_jar('io.netty', 'netty-codec', '4.1.93.Final')
|
|
6
|
+
require_jar('io.netty', 'netty-codec-http', '4.1.93.Final')
|
|
7
|
+
require_jar('io.netty', 'netty-common', '4.1.93.Final')
|
|
8
|
+
require_jar('io.netty', 'netty-transport', '4.1.93.Final')
|
|
9
|
+
require_jar('io.netty', 'netty-handler', '4.1.93.Final')
|
|
10
|
+
require_jar('io.netty', 'netty-transport-native-unix-common', '4.1.93.Final')
|
|
11
|
+
require_jar('org.logstash.plugins.input.http', 'logstash-input-http', '3.7.1')
|
data/logstash-input-http.gemspec
CHANGED
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
s.add_runtime_dependency 'logstash-codec-plain'
|
|
25
25
|
s.add_runtime_dependency 'jar-dependencies', '~> 0.3', '>= 0.3.4'
|
|
26
26
|
s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.2'
|
|
27
|
+
s.add_runtime_dependency 'logstash-mixin-normalize_config_support', '~>1.0'
|
|
27
28
|
|
|
28
29
|
s.add_development_dependency 'logstash-devutils'
|
|
29
30
|
s.add_development_dependency 'logstash-codec-json'
|
data/spec/inputs/http_spec.rb
CHANGED
|
@@ -7,6 +7,7 @@ require "stud/temporary"
|
|
|
7
7
|
require "zlib"
|
|
8
8
|
require "stringio"
|
|
9
9
|
require 'logstash/plugin_mixins/ecs_compatibility_support/spec_helper'
|
|
10
|
+
require 'inputs/helpers'
|
|
10
11
|
|
|
11
12
|
java_import "io.netty.handler.ssl.util.SelfSignedCertificate"
|
|
12
13
|
|
|
@@ -165,22 +166,20 @@ describe LogStash::Inputs::Http do
|
|
|
165
166
|
|
|
166
167
|
let(:url) { super().sub('http://', 'https://') }
|
|
167
168
|
|
|
168
|
-
certs_dir = File.expand_path('../fixtures/certs/generated', File.dirname(__FILE__))
|
|
169
|
-
|
|
170
169
|
let(:config) do
|
|
171
|
-
super().merge '
|
|
172
|
-
'ssl_certificate_authorities' => [
|
|
173
|
-
'ssl_certificate' =>
|
|
174
|
-
'ssl_key' =>
|
|
175
|
-
'
|
|
170
|
+
super().merge 'ssl_enabled' => true,
|
|
171
|
+
'ssl_certificate_authorities' => [certificate_path('root.crt')],
|
|
172
|
+
'ssl_certificate' => certificate_path( 'server_from_root.crt'),
|
|
173
|
+
'ssl_key' => certificate_path( 'server_from_root.key.pkcs8'),
|
|
174
|
+
'ssl_client_authentication' => 'optional'
|
|
176
175
|
end
|
|
177
176
|
|
|
178
177
|
let(:client_options) do
|
|
179
178
|
super().merge ssl: {
|
|
180
179
|
verify: false,
|
|
181
|
-
ca_file:
|
|
182
|
-
client_cert:
|
|
183
|
-
client_key:
|
|
180
|
+
ca_file: certificate_path( 'root.crt'),
|
|
181
|
+
client_cert: certificate_path( 'client_from_root.crt'),
|
|
182
|
+
client_key: certificate_path( 'client_from_root.key.pkcs8'),
|
|
184
183
|
}
|
|
185
184
|
end
|
|
186
185
|
|
|
@@ -538,15 +537,27 @@ describe LogStash::Inputs::Http do
|
|
|
538
537
|
end
|
|
539
538
|
end
|
|
540
539
|
|
|
541
|
-
context "with :
|
|
542
|
-
|
|
540
|
+
context "with :ssl_enabled => false" do
|
|
541
|
+
let(:config) { {"port" => port, "ssl_enabled" => false} }
|
|
542
|
+
|
|
543
543
|
it "should not raise exception" do
|
|
544
544
|
expect { subject.register }.to_not raise_exception
|
|
545
545
|
end
|
|
546
|
+
|
|
547
|
+
context "and `ssl_` settings provided" do
|
|
548
|
+
let(:ssc) { SelfSignedCertificate.new }
|
|
549
|
+
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"] } }
|
|
550
|
+
|
|
551
|
+
it "should warn about not using the configs" do
|
|
552
|
+
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)?)*\]$/)
|
|
553
|
+
subject.register
|
|
554
|
+
end
|
|
555
|
+
end
|
|
546
556
|
end
|
|
547
|
-
|
|
557
|
+
|
|
558
|
+
context "with :ssl_enabled => true" do
|
|
548
559
|
context "without :ssl_certificate" do
|
|
549
|
-
subject { LogStash::Inputs::Http.new("port" => port, "
|
|
560
|
+
subject { LogStash::Inputs::Http.new("port" => port, "ssl_enabled" => true) }
|
|
550
561
|
it "should raise exception" do
|
|
551
562
|
expect { subject.register }.to raise_exception(LogStash::ConfigurationError)
|
|
552
563
|
end
|
|
@@ -563,7 +574,7 @@ describe LogStash::Inputs::Http do
|
|
|
563
574
|
let(:ssl_key) { ssc.private_key }
|
|
564
575
|
|
|
565
576
|
let(:config) do
|
|
566
|
-
{ "port" => port, "
|
|
577
|
+
{ "port" => port, "ssl_enabled" => true, "ssl_certificate" => ssl_certificate.path, "ssl_key" => ssl_key.path }
|
|
567
578
|
end
|
|
568
579
|
|
|
569
580
|
after(:each) { ssc.delete }
|
|
@@ -575,46 +586,37 @@ describe LogStash::Inputs::Http do
|
|
|
575
586
|
end
|
|
576
587
|
|
|
577
588
|
context "with ssl_verify_mode = none" do
|
|
578
|
-
subject { LogStash::Inputs::Http.new(config.merge("
|
|
589
|
+
subject { LogStash::Inputs::Http.new(config.merge("ssl_client_authentication" => "none")) }
|
|
579
590
|
|
|
580
591
|
it "should not raise exception" do
|
|
581
592
|
expect { subject.register }.to_not raise_exception
|
|
582
593
|
end
|
|
583
594
|
end
|
|
584
|
-
["
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
595
|
+
["ssl_verify_mode", "verify_mode"].each do |config_name|
|
|
596
|
+
["peer", "force_peer"].each do |verify_mode|
|
|
597
|
+
context "with deprecated #{config_name} = #{verify_mode}" do
|
|
598
|
+
subject { LogStash::Inputs::Http.new("port" => port,
|
|
599
|
+
"ssl_enabled" => true,
|
|
600
|
+
"ssl_certificate" => ssl_certificate.path,
|
|
601
|
+
"ssl_certificate_authorities" => ssl_certificate.path,
|
|
602
|
+
"ssl_key" => ssl_key.path,
|
|
603
|
+
config_name => verify_mode
|
|
604
|
+
) }
|
|
605
|
+
it "should not raise exception" do
|
|
606
|
+
expect { subject.register }.to_not raise_exception
|
|
607
|
+
end
|
|
594
608
|
end
|
|
595
609
|
end
|
|
596
610
|
end
|
|
597
|
-
|
|
598
|
-
|
|
611
|
+
["ssl_verify_mode", "verify_mode"].each do |config_name|
|
|
612
|
+
context "with deprecated #{config_name} = none" do
|
|
613
|
+
subject { LogStash::Inputs::Http.new(config.merge(config_name => "none")) }
|
|
599
614
|
|
|
600
|
-
it "should not raise exception" do
|
|
601
|
-
expect { subject.register }.to_not raise_exception
|
|
602
|
-
end
|
|
603
|
-
end
|
|
604
|
-
["peer", "force_peer"].each do |verify_mode|
|
|
605
|
-
context "with verify_mode = #{verify_mode}" do
|
|
606
|
-
subject { LogStash::Inputs::Http.new("port" => port, "ssl" => true,
|
|
607
|
-
"ssl_certificate" => ssl_certificate.path,
|
|
608
|
-
"ssl_certificate_authorities" => ssl_certificate.path,
|
|
609
|
-
"ssl_key" => ssl_key.path,
|
|
610
|
-
"verify_mode" => verify_mode
|
|
611
|
-
) }
|
|
612
615
|
it "should not raise exception" do
|
|
613
616
|
expect { subject.register }.to_not raise_exception
|
|
614
617
|
end
|
|
615
618
|
end
|
|
616
619
|
end
|
|
617
|
-
|
|
618
620
|
context "with invalid ssl certificate" do
|
|
619
621
|
before do
|
|
620
622
|
cert = File.readlines path = config["ssl_certificate"]
|
|
@@ -646,7 +648,7 @@ describe LogStash::Inputs::Http do
|
|
|
646
648
|
|
|
647
649
|
context "with invalid ssl certificate_authorities" do
|
|
648
650
|
let(:config) do
|
|
649
|
-
super().merge("
|
|
651
|
+
super().merge("ssl_client_authentication" => "optional", "ssl_certificate_authorities" => [ ssc.certificate.path, ssc.private_key.path ])
|
|
650
652
|
end
|
|
651
653
|
|
|
652
654
|
it "should raise a cert error" do
|
|
@@ -662,13 +664,33 @@ describe LogStash::Inputs::Http do
|
|
|
662
664
|
end
|
|
663
665
|
end
|
|
664
666
|
|
|
665
|
-
context "with both verify_mode options set" do
|
|
667
|
+
context "with both verify_mode and ssl_verify_mode options set" do
|
|
666
668
|
let(:config) do
|
|
667
|
-
super().merge('
|
|
669
|
+
super().merge('verify_mode' => 'none', 'ssl_verify_mode' => 'none')
|
|
668
670
|
end
|
|
669
671
|
|
|
670
672
|
it "should raise a configuration error" do
|
|
671
|
-
expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_verify_mode
|
|
673
|
+
expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_verify_mode`.?/i
|
|
674
|
+
end
|
|
675
|
+
end
|
|
676
|
+
|
|
677
|
+
context "with both ssl_client_authentication and ssl_verify_mode options set" do
|
|
678
|
+
let(:config) do
|
|
679
|
+
super().merge('ssl_client_authentication' => 'optional', 'ssl_verify_mode' => 'none')
|
|
680
|
+
end
|
|
681
|
+
|
|
682
|
+
it "should raise a configuration error" do
|
|
683
|
+
expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_client_authentication.?/i
|
|
684
|
+
end
|
|
685
|
+
end
|
|
686
|
+
|
|
687
|
+
context "with both ssl_client_authentication and verify_mode options set" do
|
|
688
|
+
let(:config) do
|
|
689
|
+
super().merge('ssl_client_authentication' => 'optional', 'verify_mode' => 'none')
|
|
690
|
+
end
|
|
691
|
+
|
|
692
|
+
it "should raise a configuration error" do
|
|
693
|
+
expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_client_authentication.?/i
|
|
672
694
|
end
|
|
673
695
|
end
|
|
674
696
|
|
|
@@ -703,6 +725,101 @@ describe LogStash::Inputs::Http do
|
|
|
703
725
|
end
|
|
704
726
|
end
|
|
705
727
|
|
|
728
|
+
context "with both ssl and ssl_enabled set" do
|
|
729
|
+
let(:config) do
|
|
730
|
+
super().merge('ssl' => true, 'ssl_enabled' => true )
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
it "should raise a configuration error" do
|
|
734
|
+
expect { subject.register }.to raise_error LogStash::ConfigurationError, /Use only .?ssl_enabled.?/i
|
|
735
|
+
end
|
|
736
|
+
end
|
|
737
|
+
|
|
738
|
+
context "with ssl_client_authentication" do
|
|
739
|
+
context "normalized from ssl_verify_mode 'none'" do
|
|
740
|
+
let(:config) { super().merge("ssl_verify_mode" => "none") }
|
|
741
|
+
|
|
742
|
+
it "should transform the value to 'none'" do
|
|
743
|
+
subject.register
|
|
744
|
+
expect(subject.params).to match hash_including("ssl_client_authentication" => "none")
|
|
745
|
+
expect(subject.instance_variable_get(:@ssl_client_authentication)).to eql("none")
|
|
746
|
+
end
|
|
747
|
+
|
|
748
|
+
context "and ssl_certificate_authorities is set" do
|
|
749
|
+
let(:config) { super().merge("ssl_certificate_authorities" => [certificate_path( 'root.crt')]) }
|
|
750
|
+
it "raise a configuration error" do
|
|
751
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError, "The configuration of `ssl_certificate_authorities` requires setting `ssl_verify_mode` to `peer` or 'force_peer'")
|
|
752
|
+
end
|
|
753
|
+
end
|
|
754
|
+
end
|
|
755
|
+
|
|
756
|
+
[%w[peer optional], %w[force_peer required]].each do |ssl_verify_mode, ssl_client_authentication|
|
|
757
|
+
context "normalized from ssl_verify_mode '#{ssl_verify_mode}'" do
|
|
758
|
+
let(:config) { super().merge("ssl_verify_mode" => ssl_verify_mode, "ssl_certificate_authorities" => [certificate_path( 'root.crt')]) }
|
|
759
|
+
|
|
760
|
+
it "should transform the value to '#{ssl_client_authentication}'" do
|
|
761
|
+
subject.register
|
|
762
|
+
expect(subject.params).to match hash_including("ssl_client_authentication" => ssl_client_authentication)
|
|
763
|
+
expect(subject.instance_variable_get(:@ssl_client_authentication)).to eql(ssl_client_authentication)
|
|
764
|
+
end
|
|
765
|
+
|
|
766
|
+
context "with no ssl_certificate_authorities set " do
|
|
767
|
+
let(:config) { super().reject { |key| "ssl_certificate_authorities".eql?(key) } }
|
|
768
|
+
it "raise a configuration error" do
|
|
769
|
+
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`")
|
|
770
|
+
end
|
|
771
|
+
end
|
|
772
|
+
end
|
|
773
|
+
end
|
|
774
|
+
|
|
775
|
+
context "configured to 'none'" do
|
|
776
|
+
let(:config) { super().merge("ssl_client_authentication" => "none") }
|
|
777
|
+
|
|
778
|
+
it "doesn't raise an error when certificate_authorities is not set" do
|
|
779
|
+
expect {subject.register}.to_not raise_error
|
|
780
|
+
end
|
|
781
|
+
|
|
782
|
+
context "with certificate_authorities set" do
|
|
783
|
+
let(:config) { super().merge("ssl_certificate_authorities" => [certificate_path( 'root.crt')]) }
|
|
784
|
+
|
|
785
|
+
it "raise a configuration error" do
|
|
786
|
+
expect {subject.register}.to raise_error(LogStash::ConfigurationError, "The configuration of `ssl_certificate_authorities` requires setting `ssl_client_authentication` to `optional` or 'required'")
|
|
787
|
+
end
|
|
788
|
+
end
|
|
789
|
+
end
|
|
790
|
+
|
|
791
|
+
context "configured to 'required'" do
|
|
792
|
+
let(:config) { super().merge("ssl_client_authentication" => "required") }
|
|
793
|
+
|
|
794
|
+
it "raise a ConfigurationError when certificate_authorities is not set" do
|
|
795
|
+
expect {subject.register}.to raise_error(LogStash::ConfigurationError, "Using `ssl_client_authentication` set to `optional` or `required`, requires the configuration of `ssl_certificate_authorities`")
|
|
796
|
+
end
|
|
797
|
+
|
|
798
|
+
context "with ssl_certificate_authorities set" do
|
|
799
|
+
let(:config) { super().merge("ssl_certificate_authorities" => [certificate_path( 'root.crt')]) }
|
|
800
|
+
|
|
801
|
+
it "doesn't raise a configuration error" do
|
|
802
|
+
expect {subject.register}.not_to raise_error
|
|
803
|
+
end
|
|
804
|
+
end
|
|
805
|
+
end
|
|
806
|
+
|
|
807
|
+
context "configured to 'optional'" do
|
|
808
|
+
let(:config) { super().merge("ssl_client_authentication" => "optional") }
|
|
809
|
+
|
|
810
|
+
it "raise a ConfigurationError when certificate_authorities is not set" do
|
|
811
|
+
expect {subject.register}.to raise_error(LogStash::ConfigurationError, "Using `ssl_client_authentication` set to `optional` or `required`, requires the configuration of `ssl_certificate_authorities`")
|
|
812
|
+
end
|
|
813
|
+
|
|
814
|
+
context "with certificate_authorities set" do
|
|
815
|
+
let(:config) { super().merge("ssl_certificate_authorities" => [certificate_path( 'root.crt')]) }
|
|
816
|
+
|
|
817
|
+
it "doesn't raise a configuration error" do
|
|
818
|
+
expect {subject.register}.not_to raise_error
|
|
819
|
+
end
|
|
820
|
+
end
|
|
821
|
+
end
|
|
822
|
+
end
|
|
706
823
|
end
|
|
707
824
|
end
|
|
708
825
|
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
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.
|
|
4
|
+
version: 3.7.1
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Elastic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-01
|
|
11
|
+
date: 2023-06-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -78,6 +78,20 @@ dependencies:
|
|
|
78
78
|
- - "~>"
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
80
|
version: '1.2'
|
|
81
|
+
- !ruby/object:Gem::Dependency
|
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - "~>"
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '1.0'
|
|
87
|
+
name: logstash-mixin-normalize_config_support
|
|
88
|
+
prerelease: false
|
|
89
|
+
type: :runtime
|
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
91
|
+
requirements:
|
|
92
|
+
- - "~>"
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '1.0'
|
|
81
95
|
- !ruby/object:Gem::Dependency
|
|
82
96
|
requirement: !ruby/object:Gem::Requirement
|
|
83
97
|
requirements:
|
|
@@ -171,15 +185,16 @@ files:
|
|
|
171
185
|
- spec/fixtures/certs/generated/server_from_root.key
|
|
172
186
|
- spec/fixtures/certs/generated/server_from_root.key.pkcs8
|
|
173
187
|
- spec/fixtures/certs/openssl.cnf
|
|
188
|
+
- spec/inputs/helpers.rb
|
|
174
189
|
- spec/inputs/http_spec.rb
|
|
175
|
-
- vendor/jar-dependencies/io/netty/netty-buffer/4.1.
|
|
176
|
-
- vendor/jar-dependencies/io/netty/netty-codec-http/4.1.
|
|
177
|
-
- vendor/jar-dependencies/io/netty/netty-codec/4.1.
|
|
178
|
-
- vendor/jar-dependencies/io/netty/netty-common/4.1.
|
|
179
|
-
- vendor/jar-dependencies/io/netty/netty-handler/4.1.
|
|
180
|
-
- vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/4.1.
|
|
181
|
-
- vendor/jar-dependencies/io/netty/netty-transport/4.1.
|
|
182
|
-
- vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/3.
|
|
190
|
+
- vendor/jar-dependencies/io/netty/netty-buffer/4.1.93.Final/netty-buffer-4.1.93.Final.jar
|
|
191
|
+
- vendor/jar-dependencies/io/netty/netty-codec-http/4.1.93.Final/netty-codec-http-4.1.93.Final.jar
|
|
192
|
+
- vendor/jar-dependencies/io/netty/netty-codec/4.1.93.Final/netty-codec-4.1.93.Final.jar
|
|
193
|
+
- vendor/jar-dependencies/io/netty/netty-common/4.1.93.Final/netty-common-4.1.93.Final.jar
|
|
194
|
+
- vendor/jar-dependencies/io/netty/netty-handler/4.1.93.Final/netty-handler-4.1.93.Final.jar
|
|
195
|
+
- vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/4.1.93.Final/netty-transport-native-unix-common-4.1.93.Final.jar
|
|
196
|
+
- vendor/jar-dependencies/io/netty/netty-transport/4.1.93.Final/netty-transport-4.1.93.Final.jar
|
|
197
|
+
- vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/3.7.1/logstash-input-http-3.7.1.jar
|
|
183
198
|
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
|
184
199
|
licenses:
|
|
185
200
|
- Apache License (2.0)
|
|
@@ -202,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
202
217
|
- !ruby/object:Gem::Version
|
|
203
218
|
version: '0'
|
|
204
219
|
requirements: []
|
|
205
|
-
rubygems_version: 3.
|
|
220
|
+
rubygems_version: 3.2.33
|
|
206
221
|
signing_key:
|
|
207
222
|
specification_version: 4
|
|
208
223
|
summary: Receives events over HTTP or HTTPS
|
|
@@ -221,4 +236,5 @@ test_files:
|
|
|
221
236
|
- spec/fixtures/certs/generated/server_from_root.key
|
|
222
237
|
- spec/fixtures/certs/generated/server_from_root.key.pkcs8
|
|
223
238
|
- spec/fixtures/certs/openssl.cnf
|
|
239
|
+
- spec/inputs/helpers.rb
|
|
224
240
|
- spec/inputs/http_spec.rb
|