From c523c600611a316ee7db7055f7a0980201dc2b1f Mon Sep 17 00:00:00 2001 From: Norm Traxler Date: Fri, 2 Aug 2019 16:20:57 +0000 Subject: [PATCH 1/3] Re-indroduce ssl_certificate_validation option --- CHANGELOG.md | 3 +++ README.md | 3 +++ lib/logstash/plugin_mixins/http_client.rb | 9 +++++++++ logstash-mixin-http_client.gemspec | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f96b618..85d789c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 8.0.0 + - Re-indroduce ssl_certificate_validation option + ## 7.0.0 - Removed obsolete ssl_certificate_verify option diff --git a/README.md b/README.md index 8be4de9..d052b2d 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ config :keepalive, :validate => :boolean, :default => true # How many times should the client retry a failing URL? Default is 3 config :automatic_retries, :validate => :number, :default => 3 +# If you need to disable certificate hostname validation, set to false +config :ssl_certificate_validation, :validate => :boolean, :default => true + # If you need to use a custom X.509 CA (.pem certs) specify the path to that here config :ca_path, :validate => :path diff --git a/lib/logstash/plugin_mixins/http_client.rb b/lib/logstash/plugin_mixins/http_client.rb index bbe6d49..7a50afd 100644 --- a/lib/logstash/plugin_mixins/http_client.rb +++ b/lib/logstash/plugin_mixins/http_client.rb @@ -52,6 +52,9 @@ def setup_http_client_config # See https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html#setValidateAfterInactivity(int)[these docs for more info] config :validate_after_inactivity, :validate => :number, :default => 200 + # If you need to disable certificate hostname validation, set to false + config :ssl_certificate_validation, :validate => :boolean, :default => true + # If you need to use a custom X.509 CA (.pem certs) specify the path to that here config :cacert, :validate => :path @@ -139,6 +142,12 @@ def client_config c[:ssl][:ca_file] = @cacert end + if !@ssl_certificate_validation + c[:ssl].merge!( + :verify => false + ) + end + if @truststore c[:ssl].merge!( :truststore => @truststore, diff --git a/logstash-mixin-http_client.gemspec b/logstash-mixin-http_client.gemspec index 21b1e61..6fdc9bf 100644 --- a/logstash-mixin-http_client.gemspec +++ b/logstash-mixin-http_client.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'logstash-mixin-http_client' - s.version = '7.0.0' + s.version = '8.0.0' s.licenses = ['Apache License (2.0)'] s.summary = "AWS mixins to provide a unified interface for Amazon Webservice" 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" From b379f462dd33b4f34928552601c1e00a5d858bf0 Mon Sep 17 00:00:00 2001 From: Norm Traxler Date: Fri, 2 Aug 2019 16:25:48 +0000 Subject: [PATCH 2/3] Revert "Re-indroduce ssl_certificate_validation option" This reverts commit c523c600611a316ee7db7055f7a0980201dc2b1f. --- CHANGELOG.md | 3 --- README.md | 3 --- lib/logstash/plugin_mixins/http_client.rb | 9 --------- logstash-mixin-http_client.gemspec | 2 +- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85d789c..f96b618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,3 @@ -## 8.0.0 - - Re-indroduce ssl_certificate_validation option - ## 7.0.0 - Removed obsolete ssl_certificate_verify option diff --git a/README.md b/README.md index d052b2d..8be4de9 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,6 @@ config :keepalive, :validate => :boolean, :default => true # How many times should the client retry a failing URL? Default is 3 config :automatic_retries, :validate => :number, :default => 3 -# If you need to disable certificate hostname validation, set to false -config :ssl_certificate_validation, :validate => :boolean, :default => true - # If you need to use a custom X.509 CA (.pem certs) specify the path to that here config :ca_path, :validate => :path diff --git a/lib/logstash/plugin_mixins/http_client.rb b/lib/logstash/plugin_mixins/http_client.rb index 7a50afd..bbe6d49 100644 --- a/lib/logstash/plugin_mixins/http_client.rb +++ b/lib/logstash/plugin_mixins/http_client.rb @@ -52,9 +52,6 @@ def setup_http_client_config # See https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html#setValidateAfterInactivity(int)[these docs for more info] config :validate_after_inactivity, :validate => :number, :default => 200 - # If you need to disable certificate hostname validation, set to false - config :ssl_certificate_validation, :validate => :boolean, :default => true - # If you need to use a custom X.509 CA (.pem certs) specify the path to that here config :cacert, :validate => :path @@ -142,12 +139,6 @@ def client_config c[:ssl][:ca_file] = @cacert end - if !@ssl_certificate_validation - c[:ssl].merge!( - :verify => false - ) - end - if @truststore c[:ssl].merge!( :truststore => @truststore, diff --git a/logstash-mixin-http_client.gemspec b/logstash-mixin-http_client.gemspec index 6fdc9bf..21b1e61 100644 --- a/logstash-mixin-http_client.gemspec +++ b/logstash-mixin-http_client.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'logstash-mixin-http_client' - s.version = '8.0.0' + s.version = '7.0.0' s.licenses = ['Apache License (2.0)'] s.summary = "AWS mixins to provide a unified interface for Amazon Webservice" 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" From d9865bcbaf42d7c712b582c331a910314f12894c Mon Sep 17 00:00:00 2001 From: Norm Traxler Date: Fri, 2 Aug 2019 17:28:47 +0000 Subject: [PATCH 3/3] Revert "Revert "Re-indroduce ssl_certificate_validation option"" This reverts commit b379f462dd33b4f34928552601c1e00a5d858bf0. --- CHANGELOG.md | 3 +++ README.md | 3 +++ lib/logstash/plugin_mixins/http_client.rb | 9 +++++++++ logstash-mixin-http_client.gemspec | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f96b618..85d789c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 8.0.0 + - Re-indroduce ssl_certificate_validation option + ## 7.0.0 - Removed obsolete ssl_certificate_verify option diff --git a/README.md b/README.md index 8be4de9..d052b2d 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ config :keepalive, :validate => :boolean, :default => true # How many times should the client retry a failing URL? Default is 3 config :automatic_retries, :validate => :number, :default => 3 +# If you need to disable certificate hostname validation, set to false +config :ssl_certificate_validation, :validate => :boolean, :default => true + # If you need to use a custom X.509 CA (.pem certs) specify the path to that here config :ca_path, :validate => :path diff --git a/lib/logstash/plugin_mixins/http_client.rb b/lib/logstash/plugin_mixins/http_client.rb index bbe6d49..7a50afd 100644 --- a/lib/logstash/plugin_mixins/http_client.rb +++ b/lib/logstash/plugin_mixins/http_client.rb @@ -52,6 +52,9 @@ def setup_http_client_config # See https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html#setValidateAfterInactivity(int)[these docs for more info] config :validate_after_inactivity, :validate => :number, :default => 200 + # If you need to disable certificate hostname validation, set to false + config :ssl_certificate_validation, :validate => :boolean, :default => true + # If you need to use a custom X.509 CA (.pem certs) specify the path to that here config :cacert, :validate => :path @@ -139,6 +142,12 @@ def client_config c[:ssl][:ca_file] = @cacert end + if !@ssl_certificate_validation + c[:ssl].merge!( + :verify => false + ) + end + if @truststore c[:ssl].merge!( :truststore => @truststore, diff --git a/logstash-mixin-http_client.gemspec b/logstash-mixin-http_client.gemspec index 21b1e61..6fdc9bf 100644 --- a/logstash-mixin-http_client.gemspec +++ b/logstash-mixin-http_client.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'logstash-mixin-http_client' - s.version = '7.0.0' + s.version = '8.0.0' s.licenses = ['Apache License (2.0)'] s.summary = "AWS mixins to provide a unified interface for Amazon Webservice" 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"