logstash-mixin-http_client 7.3.0 → 7.5.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7113b42811db2555d08f0146bc031203fe686fed7ade1f3da648142385af3e03
|
4
|
+
data.tar.gz: 7f27a58c3bb605ebce070e0659ef32ff6dafa68dca9d1597e1851191e67e774f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e4d182516285b5bbb9be15df611af50dc4fdbdf2cc2ae02d38d74ffa43ba330d74ff6d73f8802b81006cae11747b84294bf9181d588cbe549b315126ed755d8
|
7
|
+
data.tar.gz: 21630cc2c5e65ea70f307996d823486318c14beea2b0f5300d90f0b5d77ac8ab75312b37e24ccd3e8c9b3efa8dcbf44766efb854c5289958ba5eaafe5192d44f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 7.5.0
|
2
|
+
- Adds new mixin configuration option `with_obsolete` to mark `ssl` options as obsolete
|
3
|
+
|
4
|
+
## 7.4.0
|
5
|
+
- Adds new `ssl_enabled` setting for enabling/disabling the SSL configurations [#44](https://github.com/logstash-plugins/logstash-mixin-http_client/pull/44)
|
6
|
+
|
1
7
|
## 7.3.0
|
2
8
|
- Adds standardized SSL settings and deprecates their non-standard counterparts. Deprecated settings will continue to work, and will provide pipeline maintainers with guidance toward using their standardized counterparts [#42](https://github.com/logstash-plugins/logstash-mixin-http_client/pull/42)
|
3
9
|
- Adds new `ssl_truststore_path`, `ssl_truststore_password`, and `ssl_truststore_type` settings for configuring SSL-trust using a PKCS-12 or JKS trust store, deprecating their `truststore`, `truststore_password`, and `truststore_type` counterparts.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module LogStash::PluginMixins::HttpClient
|
2
|
+
module ObsoleteSslConfigSupport
|
3
|
+
def self.included(base)
|
4
|
+
fail ArgumentError unless base <= LogStash::PluginMixins::HttpClient::Implementation
|
5
|
+
|
6
|
+
base.config :cacert, :obsolete => 'Use `ssl_certificate_authorities` instead'
|
7
|
+
base.config :client_cert, :obsolete => 'Use `ssl_certificate` instead'
|
8
|
+
base.config :client_key, :obsolete => 'Use `ssl_key` instead'
|
9
|
+
base.config :keystore, :obsolete => 'Use `ssl_keystore_path` instead'
|
10
|
+
base.config :keystore_type, :obsolete => 'Use `ssl_keystore_type` instead'
|
11
|
+
base.config :truststore, :obsolete => 'Use `ssl_truststore_path` instead'
|
12
|
+
base.config :truststore_type, :obsolete => 'Use `ssl_truststore_type` instead'
|
13
|
+
|
14
|
+
# Retain validation for password types to avoid inadvertent information disclosure
|
15
|
+
base.config :keystore_password, :validate => :password, :obsolete => 'Use `ssl_keystore_password` instead'
|
16
|
+
base.config :truststore_password, :validate => :password, :obsolete => 'Use `ssl_truststore_password` instead'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -19,8 +19,10 @@ module LogStash::PluginMixins::HttpClient
|
|
19
19
|
end
|
20
20
|
|
21
21
|
class Adapter < Module
|
22
|
-
def initialize(with_deprecated: false)
|
22
|
+
def initialize(with_deprecated: false, with_obsolete: false)
|
23
|
+
raise ArgumentError, "A plugin cannot support deprecated and obsolete SSL settings" if with_deprecated && with_obsolete
|
23
24
|
@include_dep = with_deprecated
|
25
|
+
@include_obsolete = with_obsolete
|
24
26
|
end
|
25
27
|
|
26
28
|
def included(base)
|
@@ -28,7 +30,11 @@ module LogStash::PluginMixins::HttpClient
|
|
28
30
|
if @include_dep
|
29
31
|
require_relative 'http_client/deprecated_ssl_config_support'
|
30
32
|
base.include(DeprecatedSslConfigSupport)
|
33
|
+
elsif @include_obsolete
|
34
|
+
require_relative 'http_client/obsolete_ssl_config_support'
|
35
|
+
base.include(ObsoleteSslConfigSupport)
|
31
36
|
end
|
37
|
+
|
32
38
|
nil
|
33
39
|
end
|
34
40
|
end
|
@@ -75,6 +81,9 @@ module LogStash::PluginMixins::HttpClient
|
|
75
81
|
# See https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html#setValidateAfterInactivity(int)[these docs for more info]
|
76
82
|
base.config :validate_after_inactivity, :validate => :number, :default => 200
|
77
83
|
|
84
|
+
# Enable/disable the SSL configurations
|
85
|
+
base.config :ssl_enabled, :validate => :boolean, :default => true
|
86
|
+
|
78
87
|
# If you need to use a custom X.509 CA (.pem certs) specify the path to that here
|
79
88
|
base.config :ssl_certificate_authorities, :validate => :path, :list => :true
|
80
89
|
|
@@ -188,6 +197,13 @@ module LogStash::PluginMixins::HttpClient
|
|
188
197
|
def ssl_options
|
189
198
|
|
190
199
|
options = {}
|
200
|
+
|
201
|
+
unless @ssl_enabled
|
202
|
+
ignored_ssl_settings = original_params.select { |k| k != 'ssl_enabled' && k.start_with?('ssl_') }
|
203
|
+
self.logger.warn("Configured SSL settings are not used when `ssl_enabled` is set to `false`: #{ignored_ssl_settings.keys}") if ignored_ssl_settings.any?
|
204
|
+
return options
|
205
|
+
end
|
206
|
+
|
191
207
|
if @ssl_certificate_authorities&.any?
|
192
208
|
raise LogStash::ConfigurationError, 'Multiple values on `ssl_certificate_authorities` are not supported by this plugin' if @ssl_certificate_authorities.size > 1
|
193
209
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-mixin-http_client'
|
3
|
-
s.version = '7.
|
3
|
+
s.version = '7.5.0'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
|
-
s.summary = "
|
5
|
+
s.summary = "Mixin to provide consistent config deprecation and obsoletion across HTTP plugins"
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
7
7
|
s.authors = ["Elastic"]
|
8
8
|
s.email = 'info@elastic.co'
|
@@ -44,6 +44,16 @@ shared_examples 'a deprecated setting with guidance' do |deprecations_and_guidan
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
shared_examples 'an obsolete setting with guidance' do |deprecations_and_guidance|
|
48
|
+
|
49
|
+
deprecations_and_guidance.each do |obsolete_setting, canonical_setting_name|
|
50
|
+
it "emits an error about the setting `#{obsolete_setting}` now being obsolete and provides guidance to use `#{canonical_setting_name}`" do
|
51
|
+
error_text = /The setting `#{obsolete_setting}` in plugin `with_obsolete` is obsolete and is no longer available. Use `#{canonical_setting_name}` instead/i
|
52
|
+
expect { plugin_class.new(conf)}.to raise_error LogStash::ConfigurationError, error_text
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
47
57
|
shared_examples 'with common ssl options' do
|
48
58
|
describe 'with verify mode' do
|
49
59
|
let(:file) { Stud::Temporary.file }
|
@@ -144,6 +154,33 @@ shared_examples("raise an http config error") do |message|
|
|
144
154
|
end
|
145
155
|
end
|
146
156
|
|
157
|
+
shared_examples 'a client with obsolete ssl options' do
|
158
|
+
describe LogStash::PluginMixins::HttpClient do
|
159
|
+
let(:basic_config) { {} }
|
160
|
+
let(:impl) { plugin_class.new(basic_config) }
|
161
|
+
let(:use_deprecated_config) { true }
|
162
|
+
|
163
|
+
include_examples 'with common ssl options'
|
164
|
+
|
165
|
+
[{:name => 'cacert', :canonical_name => 'ssl_certificate_authorities'},
|
166
|
+
{:name => 'client_cert', :canonical_name => 'ssl_certificate'},
|
167
|
+
{:name => 'client_key', :canonical_name => 'ssl_key'},
|
168
|
+
{:name => "keystore", :canonical_name => 'ssl_keystore_path'},
|
169
|
+
{:name => 'truststore', :canonical_name => 'ssl_truststore_path'},
|
170
|
+
{:name => "keystore_password", :canonical_name => "ssl_keystore_password"},
|
171
|
+
{:name => 'truststore_password', :canonical_name => "ssl_truststore_password"},
|
172
|
+
{:name => "keystore_type", :canonical_name => "ssl_keystore_type"},
|
173
|
+
{:name => 'truststore_type', :canonical_name => 'ssl_truststore_type'}
|
174
|
+
].each do |settings|
|
175
|
+
context "with option #{settings[:name]}" do
|
176
|
+
let(:conf) { basic_config.merge(settings[:name] => 'test_value') }
|
177
|
+
|
178
|
+
it_behaves_like('an obsolete setting with guidance', settings[:name] => settings[:canonical_name])
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
147
184
|
shared_examples 'a client with deprecated ssl options' do
|
148
185
|
describe LogStash::PluginMixins::HttpClient do
|
149
186
|
let(:basic_config) { {} }
|
@@ -339,6 +376,32 @@ shared_examples 'a client with standardized ssl options' do
|
|
339
376
|
end
|
340
377
|
end
|
341
378
|
end
|
379
|
+
|
380
|
+
describe 'with ssl_enabled' do
|
381
|
+
context 'set to false' do
|
382
|
+
let(:basic_config) { super().merge('ssl_enabled' => false) }
|
383
|
+
let(:plugin) { plugin_class.new(basic_config) }
|
384
|
+
|
385
|
+
it 'should not configure the client :ssl' do
|
386
|
+
expect(plugin.client_config[:ssl]).to eq({})
|
387
|
+
end
|
388
|
+
|
389
|
+
context 'and another ssl_* config set' do
|
390
|
+
let(:basic_config) { super().merge('ssl_verification_mode' => 'none') }
|
391
|
+
let(:logger_mock) { double('logger') }
|
392
|
+
|
393
|
+
before(:each) do
|
394
|
+
allow(plugin).to receive(:logger).and_return(logger_mock)
|
395
|
+
end
|
396
|
+
|
397
|
+
it 'should log a warn message' do
|
398
|
+
allow(logger_mock).to receive(:warn)
|
399
|
+
plugin.client_config
|
400
|
+
expect(logger_mock).to have_received(:warn).with('Configured SSL settings are not used when `ssl_enabled` is set to `false`: ["ssl_verification_mode"]')
|
401
|
+
end
|
402
|
+
end
|
403
|
+
end
|
404
|
+
end
|
342
405
|
end
|
343
406
|
end
|
344
407
|
|
@@ -352,6 +415,11 @@ class PluginWithDeprecatedTrue < LogStash::Inputs::Base
|
|
352
415
|
config_name 'with_deprecated'
|
353
416
|
end
|
354
417
|
|
418
|
+
class PluginWithObsoleteTrue < LogStash::Inputs::Base
|
419
|
+
include LogStash::PluginMixins::HttpClient[:with_obsolete => true]
|
420
|
+
config_name 'with_obsolete'
|
421
|
+
end
|
422
|
+
|
355
423
|
class PluginWithDeprecatedFalse < LogStash::Inputs::Base
|
356
424
|
include LogStash::PluginMixins::HttpClient[:with_deprecated => false]
|
357
425
|
config_name 'without_deprecated'
|
@@ -365,6 +433,10 @@ describe PluginWithNoModuleConfig do
|
|
365
433
|
it 'includes DeprecatedSslConfigSupport module' do
|
366
434
|
expect(plugin_class.ancestors).to include(LogStash::PluginMixins::HttpClient::DeprecatedSslConfigSupport)
|
367
435
|
end
|
436
|
+
|
437
|
+
it 'does not include ObsoleteSslConfigSupport module' do
|
438
|
+
expect(plugin_class.ancestors).to_not include(LogStash::PluginMixins::HttpClient::ObsoleteSslConfigSupport)
|
439
|
+
end
|
368
440
|
end
|
369
441
|
|
370
442
|
describe PluginWithDeprecatedFalse do
|
@@ -375,11 +447,20 @@ describe PluginWithDeprecatedFalse do
|
|
375
447
|
it 'does not include DeprecatedSslConfigSupport module' do
|
376
448
|
expect(plugin_class.ancestors).to_not include(LogStash::PluginMixins::HttpClient::DeprecatedSslConfigSupport)
|
377
449
|
end
|
450
|
+
|
451
|
+
it 'does not include ObsoleteSslConfigSupport module' do
|
452
|
+
expect(plugin_class.ancestors).to_not include(LogStash::PluginMixins::HttpClient::ObsoleteSslConfigSupport)
|
453
|
+
end
|
454
|
+
|
378
455
|
end
|
379
456
|
|
380
457
|
describe PluginWithDeprecatedTrue do
|
381
458
|
let(:plugin_class) { PluginWithDeprecatedTrue }
|
382
459
|
|
460
|
+
it 'does not include ObsoleteSslConfigSupport module' do
|
461
|
+
expect(plugin_class.ancestors).to_not include(LogStash::PluginMixins::HttpClient::ObsoleteSslConfigSupport)
|
462
|
+
end
|
463
|
+
|
383
464
|
it_behaves_like 'a client with deprecated ssl options'
|
384
465
|
|
385
466
|
it_behaves_like 'a client with standardized ssl options'
|
@@ -435,4 +516,26 @@ describe PluginWithDeprecatedTrue do
|
|
435
516
|
it 'includes DeprecatedSslConfigSupport module' do
|
436
517
|
expect(plugin_class.ancestors).to include(LogStash::PluginMixins::HttpClient::DeprecatedSslConfigSupport)
|
437
518
|
end
|
519
|
+
end
|
520
|
+
|
521
|
+
describe "PluginWithObsoleteAndDeprecatedTrue" do
|
522
|
+
it 'raises an error when trying to create a class with obsolete and deprecated both true' do
|
523
|
+
expect {
|
524
|
+
class PluginWithObsoleteAndDeprecatedTrue < LogStash::Inputs::Base
|
525
|
+
include LogStash::PluginMixins::HttpClient[:with_obsolete => true, :with_deprecated => true]
|
526
|
+
config_name 'with_obsolete_and_deprecated'
|
527
|
+
end }.to raise_error ArgumentError, "A plugin cannot support deprecated and obsolete SSL settings"
|
528
|
+
end
|
529
|
+
end
|
530
|
+
|
531
|
+
describe PluginWithObsoleteTrue do
|
532
|
+
let(:plugin_class) { PluginWithObsoleteTrue }
|
533
|
+
|
534
|
+
it 'includes ObsoleteSslConfigSupport module' do
|
535
|
+
expect(plugin_class.ancestors).to include(LogStash::PluginMixins::HttpClient::ObsoleteSslConfigSupport)
|
536
|
+
end
|
537
|
+
|
538
|
+
it_behaves_like 'a client with obsolete ssl options'
|
539
|
+
|
540
|
+
it_behaves_like 'a client with standardized ssl options'
|
438
541
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-mixin-http_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -20,8 +20,8 @@ dependencies:
|
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '2.99'
|
22
22
|
name: logstash-core-plugin-api
|
23
|
-
prerelease: false
|
24
23
|
type: :runtime
|
24
|
+
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
@@ -37,8 +37,8 @@ dependencies:
|
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: '0'
|
39
39
|
name: logstash-codec-plain
|
40
|
-
prerelease: false
|
41
40
|
type: :runtime
|
41
|
+
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
@@ -54,8 +54,8 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 1.0.0
|
56
56
|
name: manticore
|
57
|
-
prerelease: false
|
58
57
|
type: :runtime
|
58
|
+
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
@@ -71,8 +71,8 @@ dependencies:
|
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '1.0'
|
73
73
|
name: logstash-mixin-normalize_config_support
|
74
|
-
prerelease: false
|
75
74
|
type: :runtime
|
75
|
+
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
78
|
- - "~>"
|
@@ -85,8 +85,8 @@ dependencies:
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
name: logstash-devutils
|
88
|
-
prerelease: false
|
89
88
|
type: :development
|
89
|
+
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
92
|
- - ">="
|
@@ -99,8 +99,8 @@ dependencies:
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
name: stud
|
102
|
-
prerelease: false
|
103
102
|
type: :development
|
103
|
+
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - ">="
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- README.md
|
122
122
|
- lib/logstash/plugin_mixins/http_client.rb
|
123
123
|
- lib/logstash/plugin_mixins/http_client/deprecated_ssl_config_support.rb
|
124
|
+
- lib/logstash/plugin_mixins/http_client/obsolete_ssl_config_support.rb
|
124
125
|
- logstash-mixin-http_client.gemspec
|
125
126
|
- spec/plugin_mixin/http_client_spec.rb
|
126
127
|
- spec/plugin_mixin/http_client_ssl_spec.rb
|
@@ -143,10 +144,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
144
|
- !ruby/object:Gem::Version
|
144
145
|
version: '0'
|
145
146
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
+
rubygems_version: 3.3.26
|
147
148
|
signing_key:
|
148
149
|
specification_version: 4
|
149
|
-
summary:
|
150
|
+
summary: Mixin to provide consistent config deprecation and obsoletion across HTTP
|
151
|
+
plugins
|
150
152
|
test_files:
|
151
153
|
- spec/plugin_mixin/http_client_spec.rb
|
152
154
|
- spec/plugin_mixin/http_client_ssl_spec.rb
|