From 1b134ec2f725f521d65812cdf84ef665287b48a9 Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Thu, 14 Sep 2023 10:59:01 -0700 Subject: [PATCH 1/2] Support ruby 2.3 This restores support for much older versions of ruby such as 2.3. While these versions are EOL'd, they do still appear in usage in things like embedded chef. It's not a big change to restore functionality, so we've done that. --- lib/vault/client.rb | 10 ++++++++-- lib/vault/persistent.rb | 10 +++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/vault/client.rb b/lib/vault/client.rb index f474db7f..cc82f407 100644 --- a/lib/vault/client.rb +++ b/lib/vault/client.rb @@ -64,6 +64,13 @@ class Client a << PersistentHTTP::Error end.freeze + # Vault requires at least TLS1.2 + MIN_TLS_VERSION = if defined? OpenSSL::SSL::TLS1_2_VERSION + OpenSSL::SSL::TLS1_2_VERSION + else + "TLSv1_2" + end + include Vault::Configurable # Create a new Client with the given options. Any options given take @@ -112,8 +119,7 @@ def pool @nhp.verify_mode = OpenSSL::SSL::VERIFY_PEER - # Vault requires at least TLS1.2 - @nhp.min_version = OpenSSL::SSL::TLS1_2_VERSION + @nhp.min_version = MIN_TLS_VERSION # Only use secure ciphers @nhp.ciphers = ssl_ciphers diff --git a/lib/vault/persistent.rb b/lib/vault/persistent.rb index 3611d945..255f5ef6 100644 --- a/lib/vault/persistent.rb +++ b/lib/vault/persistent.rb @@ -1043,7 +1043,15 @@ def ssl connection connection.use_ssl = true connection.ciphers = @ciphers if @ciphers - connection.min_version = @min_version if @min_version + + if @min_version + if connection.respond_to? :min_version= + connection.min_version = @min_version + else + connection.ssl_version = @min_version + end + end + connection.ssl_timeout = @ssl_timeout if @ssl_timeout connection.verify_depth = @verify_depth From 3428803df82ef2bf72e8838bd2e45ef3b502d141 Mon Sep 17 00:00:00 2001 From: Matthew Sanabria <24284972+sudomateo@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:09:21 -0400 Subject: [PATCH 2/2] Update changelog and version number --- CHANGELOG.md | 7 +++++++ lib/vault/version.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d749b577..af380fed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## v?.??.? (Unreleased) +## v0.18.1 (September 14, 2023) + +BUG FIXES + +- Restored the ability to use this gem with older Ruby versions that do not have + the `OpenSSL::SSL::TLS1_2_VERSION` constant. + ## v0.18.0 (September 14, 2023) IMPROVEMENTS diff --git a/lib/vault/version.rb b/lib/vault/version.rb index 11928b47..bafadb0f 100644 --- a/lib/vault/version.rb +++ b/lib/vault/version.rb @@ -2,5 +2,5 @@ # SPDX-License-Identifier: MPL-2.0 module Vault - VERSION = "0.18.0" + VERSION = "0.18.1" end