vault 0.16.0 → 0.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -1
  3. data/LICENSE +2 -0
  4. data/lib/vault/api/approle.rb +3 -0
  5. data/lib/vault/api/auth.rb +11 -3
  6. data/lib/vault/api/auth_tls.rb +3 -0
  7. data/lib/vault/api/auth_token.rb +3 -0
  8. data/lib/vault/api/help.rb +3 -0
  9. data/lib/vault/api/kv.rb +3 -0
  10. data/lib/vault/api/logical.rb +3 -0
  11. data/lib/vault/api/secret.rb +3 -0
  12. data/lib/vault/api/sys/audit.rb +3 -0
  13. data/lib/vault/api/sys/auth.rb +3 -0
  14. data/lib/vault/api/sys/health.rb +3 -0
  15. data/lib/vault/api/sys/init.rb +3 -0
  16. data/lib/vault/api/sys/leader.rb +3 -0
  17. data/lib/vault/api/sys/lease.rb +3 -0
  18. data/lib/vault/api/sys/mount.rb +57 -0
  19. data/lib/vault/api/sys/namespace.rb +3 -0
  20. data/lib/vault/api/sys/policy.rb +3 -0
  21. data/lib/vault/api/sys/quota.rb +3 -0
  22. data/lib/vault/api/sys/seal.rb +3 -0
  23. data/lib/vault/api/sys.rb +3 -0
  24. data/lib/vault/api/transform/alphabet.rb +3 -0
  25. data/lib/vault/api/transform/role.rb +3 -0
  26. data/lib/vault/api/transform/template.rb +3 -0
  27. data/lib/vault/api/transform/transformation.rb +3 -0
  28. data/lib/vault/api/transform.rb +3 -0
  29. data/lib/vault/api.rb +3 -0
  30. data/lib/vault/client.rb +23 -19
  31. data/lib/vault/configurable.rb +3 -0
  32. data/lib/vault/defaults.rb +4 -1
  33. data/lib/vault/encode.rb +3 -0
  34. data/lib/vault/errors.rb +15 -0
  35. data/lib/vault/persistent/connection.rb +3 -0
  36. data/lib/vault/persistent/pool.rb +3 -0
  37. data/lib/vault/persistent/timed_stack_multi.rb +3 -0
  38. data/lib/vault/persistent.rb +30 -22
  39. data/lib/vault/request.rb +3 -0
  40. data/lib/vault/response.rb +3 -0
  41. data/lib/vault/vendor/connection_pool/timed_stack.rb +3 -0
  42. data/lib/vault/vendor/connection_pool/version.rb +3 -0
  43. data/lib/vault/vendor/connection_pool.rb +3 -0
  44. data/lib/vault/version.rb +4 -1
  45. data/lib/vault.rb +9 -5
  46. metadata +21 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46c570463a1aba190e789e5b2516b4140d48961611ff058235d3b9744e6a6b24
4
- data.tar.gz: c84a96cf71d9f405281f56629e0fb68a6ce051740ea46da60e35cabf37d8b44e
3
+ metadata.gz: 476b00af55107f31b54a20b77e1f451aef3d463908a457d7026fe669d0948547
4
+ data.tar.gz: 0072055306b85967a9a49abc230f2b1d5ed67521378825bfa2d7c849948cbc29
5
5
  SHA512:
6
- metadata.gz: 98a20e963ec212e2269d1c28b581c24b356495789b4b37b20ebcb829c17904b518fc32f9cd2dadfcd59b957361410e7aa61f88e7ad419d72533d0ac1bd0ec68d
7
- data.tar.gz: 35f0126a7e7ba6173662222a9006cd02bc2f78d6d674533546b68ad87420f99b1e26f1f160058b2a051c36a5faac219921ab24191f9165212ddc8f15c440e0a6
6
+ metadata.gz: 7d0619e6569b4f7ca9543f04545be9aa2bd0fe89c531eac135458b80b51d0d55a2667eae79290a7aecb389a4893d9fb6841505faffe623e056ff50889633490e
7
+ data.tar.gz: ef620f96b924e63b51deab4021c97d3f1f548722028b41a55a8c9b3f5beca930369b2a7c6f7f3c5b561f4dfc98fd6c4b5e3ed66660bdc053aa8b2c4af316a439
data/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
1
  # Vault Ruby Changelog
2
2
 
3
- ## v0.16.0 (??? ??, 2021)
3
+ ## v?.??.? (Unreleased)
4
+
5
+ ## v0.18.1 (September 14, 2023)
6
+
7
+ BUG FIXES
8
+
9
+ - Restored the ability to use this gem with older Ruby versions that do not have
10
+ the `OpenSSL::SSL::TLS1_2_VERSION` constant.
11
+
12
+ ## v0.18.0 (September 14, 2023)
13
+
14
+ IMPROVEMENTS
15
+
16
+ - Added support for TLS v1.3 by replacing `ssl_version` with `min_version`.
17
+
18
+ ## v0.17.0 (May 11, 2022)
19
+
20
+ IMPROVEMENTS
21
+
22
+ - Added MissingRequiredStateErr error type to refer to 412s returned by Vault 1.10 when the WAL index on the node does not match the index in the Server-Side Consistent Token. This error type can be passed as a parameter to `#with_retries`, and will also be retried automatically when `#with_retries` is used with no parameters.
23
+
24
+ ## v0.16.0 (March 17, 2021)
4
25
 
5
26
  IMPROVEMENTS
6
27
 
data/LICENSE CHANGED
@@ -1,3 +1,5 @@
1
+ Copyright (c) 2015 HashiCorp, Inc.
2
+
1
3
  Mozilla Public License, version 2.0
2
4
 
3
5
  1. Definitions
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  require_relative "secret"
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  require_relative "secret"
@@ -286,12 +289,17 @@ module Vault
286
289
  # @param [String] path (default: 'cert')
287
290
  # The path to the auth backend to use for the login procedure.
288
291
  #
292
+ # @param [String] name optional
293
+ # The named certificate role provided to the login request.
294
+ #
289
295
  # @return [Secret]
290
- def tls(pem = nil, path = 'cert')
296
+ def tls(pem = nil, path = 'cert', name: nil)
291
297
  new_client = client.dup
292
298
  new_client.ssl_pem_contents = pem if !pem.nil?
293
299
 
294
- json = new_client.post("/v1/auth/#{CGI.escape(path)}/login")
300
+ opts = {}
301
+ opts[:name] = name if name
302
+ json = new_client.post("/v1/auth/#{CGI.escape(path)}/login", opts)
295
303
  secret = Secret.decode(json)
296
304
  client.token = secret.auth.client_token
297
305
  return secret
@@ -308,7 +316,7 @@ module Vault
308
316
  #
309
317
  # @return [String] aws region
310
318
  def region_from_sts_endpoint(sts_endpoint)
311
- valid_sts_endpoint = %r{https:\/\/sts\.?(.*).amazonaws.com}.match(sts_endpoint)
319
+ valid_sts_endpoint = %r{https:\/\/sts\.?(.*)\.amazonaws\.com}.match(sts_endpoint)
312
320
  raise "Unable to parse STS endpoint #{sts_endpoint}" unless valid_sts_endpoint
313
321
  valid_sts_endpoint[1].empty? ? 'us-east-1' : valid_sts_endpoint[1]
314
322
  end
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  require_relative "secret"
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  require_relative "secret"
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative "../client"
2
5
  require_relative "../response"
3
6
 
data/lib/vault/api/kv.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative "secret"
2
5
  require_relative "../client"
3
6
  require_relative "../request"
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative "secret"
2
5
  require_relative "../client"
3
6
  require_relative "../request"
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "time"
2
5
 
3
6
  require_relative "../response"
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  module Vault
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  module Vault
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  module Vault
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  module Vault
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class LeaderStatus < Response
3
6
  # @!method ha_enabled?
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class Sys
3
6
  # Renew a lease with the given ID.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  module Vault
@@ -23,6 +26,48 @@ module Vault
23
26
  field :options
24
27
  end
25
28
 
29
+ class MountTune < Response
30
+ # @!attribute [r] description
31
+ # Specifies the description of the mount.
32
+ # @return [String]
33
+ field :description
34
+
35
+ # @!attribute [r] default_lease_ttl
36
+ # Specifies the default time-to-live.
37
+ # @return [Fixnum]
38
+ field :default_lease_ttl
39
+
40
+ # @!attribute [r] max_lease_ttl
41
+ # Specifies the maximum time-to-live.
42
+ # @return [Fixnum]
43
+ field :max_lease_ttl
44
+
45
+ # @!attribute [r] audit_non_hmac_request_keys
46
+ # Specifies the comma-separated list of keys that will not be HMAC'd by audit devices in the request data object.
47
+ # @return [Array<String>]
48
+ field :audit_non_hmac_request_keys
49
+
50
+ # @!attribute [r] audit_non_hmac_response_keys
51
+ # Specifies the comma-separated list of keys that will not be HMAC'd by audit devices in the response data object.
52
+ # @return [Array<String>]
53
+ field :audit_non_hmac_response_keys
54
+
55
+ # @!attribute [r] listing_visibility
56
+ # Specifies whether to show this mount in the UI-specific listing endpoint.
57
+ # @return [String]
58
+ field :listing_visibility
59
+
60
+ # @!attribute [r] passthrough_request_headers
61
+ # Comma-separated list of headers to whitelist and pass from the request to the plugin.
62
+ # @return [Array<String>]
63
+ field :passthrough_request_headers
64
+
65
+ # @!attribute [r] allowed_response_headers
66
+ # Comma-separated list of headers to whitelist, allowing a plugin to include them in the response.
67
+ # @return [Array<String>]
68
+ field :allowed_response_headers
69
+ end
70
+
26
71
  class Sys < Request
27
72
  # List all mounts in the vault.
28
73
  #
@@ -57,6 +102,18 @@ module Vault
57
102
  return true
58
103
  end
59
104
 
105
+ # Get the mount tunings at a given path.
106
+ #
107
+ # @example
108
+ # Vault.sys.get_mount_tune("pki") #=> { :pki => #<struct Vault::MountTune default_lease_ttl=2764800> }
109
+ #
110
+ # @return [MountTune]
111
+ def get_mount_tune(path)
112
+ json = client.get("/v1/sys/mounts/#{encode_path(path)}/tune")
113
+ json = json[:data] if json[:data]
114
+ return MountTune.decode(json)
115
+ end
116
+
60
117
  # Tune a mount at the given path.
61
118
  #
62
119
  # @example
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class Namespace < Response
3
6
  # @!attribute [r] id
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  module Vault
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class Quota < Response
3
6
  # @!attribute [r] name
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "json"
2
5
 
3
6
  module Vault
data/lib/vault/api/sys.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative "../client"
2
5
  require_relative "../request"
3
6
  require_relative "../response"
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative '../../request'
2
5
  require_relative '../../response'
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative '../../request'
2
5
  require_relative '../../response'
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative '../../request'
2
5
  require_relative '../../response'
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative '../../request'
2
5
  require_relative '../../response'
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative '../client'
2
5
  require_relative '../request'
3
6
 
data/lib/vault/api.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  module API
3
6
  require_relative "api/approle"
data/lib/vault/client.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "cgi"
2
5
  require "json"
3
6
  require "uri"
@@ -45,6 +48,7 @@ module Vault
45
48
 
46
49
  # Failed to reach the server (aka bad URL)
47
50
  a << Errno::ECONNREFUSED
51
+ a << Errno::EADDRNOTAVAIL
48
52
 
49
53
  # Failed to read body or no response body given
50
54
  a << EOFError
@@ -60,10 +64,12 @@ module Vault
60
64
  a << PersistentHTTP::Error
61
65
  end.freeze
62
66
 
63
- # Indicates a requested operation is not possible due to security
64
- # concerns.
65
- class SecurityError < RuntimeError
66
- end
67
+ # Vault requires at least TLS1.2
68
+ MIN_TLS_VERSION = if defined? OpenSSL::SSL::TLS1_2_VERSION
69
+ OpenSSL::SSL::TLS1_2_VERSION
70
+ else
71
+ "TLSv1_2"
72
+ end
67
73
 
68
74
  include Vault::Configurable
69
75
 
@@ -113,8 +119,7 @@ module Vault
113
119
 
114
120
  @nhp.verify_mode = OpenSSL::SSL::VERIFY_PEER
115
121
 
116
- # Vault requires TLS1.2
117
- @nhp.ssl_version = "TLSv1_2"
122
+ @nhp.min_version = MIN_TLS_VERSION
118
123
 
119
124
  # Only use secure ciphers
120
125
  @nhp.ciphers = ssl_ciphers
@@ -245,10 +250,6 @@ module Vault
245
250
  request.basic_auth uri.user, uri.password
246
251
  end
247
252
 
248
- if proxy_address and uri.scheme.downcase == "https"
249
- raise SecurityError, "no direct https connection to vault"
250
- end
251
-
252
253
  # Get a list of headers
253
254
  headers = DEFAULT_HEADERS.merge(headers)
254
255
 
@@ -387,17 +388,20 @@ module Vault
387
388
  # the response object from the request
388
389
  def error(response)
389
390
  if response.body && response.body.match("missing client token")
390
- raise MissingTokenError
391
- end
392
-
393
- # Use the correct exception class
394
- case response
395
- when Net::HTTPClientError
391
+ # Vault 1.10+ no longer returns "missing" client token" so we use HTTPClientError
396
392
  klass = HTTPClientError
397
- when Net::HTTPServerError
398
- klass = HTTPServerError
399
393
  else
400
- klass = HTTPError
394
+ # Use the correct exception class
395
+ case response
396
+ when Net::HTTPPreconditionFailed
397
+ raise MissingRequiredStateError.new
398
+ when Net::HTTPClientError
399
+ klass = HTTPClientError
400
+ when Net::HTTPServerError
401
+ klass = HTTPServerError
402
+ else
403
+ klass = HTTPError
404
+ end
401
405
  end
402
406
 
403
407
  if (response.content_type || '').include?("json")
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative "defaults"
2
5
 
3
6
  module Vault
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require "pathname"
2
5
  require "base64"
3
6
 
@@ -35,7 +38,7 @@ module Vault
35
38
 
36
39
  # The set of exceptions that are detect and retried by default
37
40
  # with `with_retries`
38
- RETRIED_EXCEPTIONS = [HTTPServerError]
41
+ RETRIED_EXCEPTIONS = [HTTPServerError, MissingRequiredStateError]
39
42
 
40
43
  class << self
41
44
  # The list of calculated options for this configurable.
data/lib/vault/encode.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  module EncodePath
3
6
 
data/lib/vault/errors.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class VaultError < RuntimeError; end
3
6
 
@@ -22,6 +25,18 @@ EOH
22
25
  end
23
26
  end
24
27
 
28
+ class MissingRequiredStateError < VaultError
29
+ def initialize
30
+ super <<-EOH
31
+ The performance standby node does not yet have the
32
+ most recent index state required to authenticate
33
+ the request.
34
+
35
+ Generally, the request should be retried with the with_retries clause.
36
+ EOH
37
+ end
38
+ end
39
+
25
40
  class HTTPConnectionError < VaultError
26
41
  attr_reader :address
27
42
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  ##
2
5
  # A Net::HTTP connection wrapper that holds extra information for managing the
3
6
  # connection's lifetime.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class PersistentHTTP::Pool < Vault::ConnectionPool # :nodoc:
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class PersistentHTTP::TimedStackMulti < ConnectionPool::TimedStack # :nodoc:
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  # Vendored and modified from github.com/drbrain/net-http-persistent
2
5
  #
3
6
  require 'net/http'
@@ -71,11 +74,11 @@ autoload :OpenSSL, 'openssl'
71
74
  # #ca_path :: Directory with certificate-authorities
72
75
  # #cert_store :: An SSL certificate store
73
76
  # #ciphers :: List of SSl ciphers allowed
77
+ # #min_version :: Minimum SSL version to use
74
78
  # #private_key :: The client's SSL private key
75
79
  # #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
76
80
  # connection
77
81
  # #ssl_timeout :: SSL session lifetime
78
- # #ssl_version :: Which specific SSL version to use
79
82
  # #verify_callback :: For server certificate verification
80
83
  # #verify_depth :: Depth of certificate verification
81
84
  # #verify_mode :: How connections should be verified
@@ -364,6 +367,11 @@ class PersistentHTTP
364
367
 
365
368
  attr_reader :name
366
369
 
370
+ ##
371
+ # Minimum SSL version to use.
372
+
373
+ attr_reader :min_version
374
+
367
375
  ##
368
376
  # Seconds to wait until a connection is opened. See Net::HTTP#open_timeout
369
377
 
@@ -434,14 +442,6 @@ class PersistentHTTP
434
442
 
435
443
  attr_reader :ssl_timeout
436
444
 
437
- ##
438
- # SSL version to use.
439
- #
440
- # By default, the version will be negotiated automatically between client
441
- # and server. Ruby 1.9 and newer only.
442
-
443
- attr_reader :ssl_version
444
-
445
445
  ##
446
446
  # Where this instance's last-use times live in the thread local variables
447
447
 
@@ -528,9 +528,9 @@ class PersistentHTTP
528
528
  @ca_file = nil
529
529
  @ca_path = nil
530
530
  @ciphers = nil
531
+ @min_version = nil
531
532
  @private_key = nil
532
533
  @ssl_timeout = nil
533
- @ssl_version = nil
534
534
  @verify_callback = nil
535
535
  @verify_depth = nil
536
536
  @verify_mode = nil
@@ -603,10 +603,10 @@ class PersistentHTTP
603
603
  def connection_for uri
604
604
  use_ssl = uri.scheme.downcase == 'https'
605
605
 
606
- net_http_args = [uri.host, uri.port]
606
+ net_http_args = [uri.hostname, uri.port]
607
607
 
608
608
  net_http_args.concat @proxy_args if
609
- @proxy_uri and not proxy_bypass? uri.host, uri.port
609
+ @proxy_uri and not proxy_bypass? uri.hostname, uri.port
610
610
 
611
611
  connection = @pool.checkout net_http_args
612
612
 
@@ -715,7 +715,7 @@ class PersistentHTTP
715
715
  # Returns the HTTP protocol version for +uri+
716
716
 
717
717
  def http_version uri
718
- @http_versions["#{uri.host}:#{uri.port}"]
718
+ @http_versions["#{uri.hostname}:#{uri.port}"]
719
719
  end
720
720
 
721
721
  ##
@@ -798,7 +798,7 @@ class PersistentHTTP
798
798
 
799
799
  if @proxy_uri then
800
800
  @proxy_args = [
801
- @proxy_uri.host,
801
+ @proxy_uri.hostname,
802
802
  @proxy_uri.port,
803
803
  unescape(@proxy_uri.user),
804
804
  unescape(@proxy_uri.password),
@@ -973,7 +973,7 @@ class PersistentHTTP
973
973
  end
974
974
  end
975
975
 
976
- @http_versions["#{uri.host}:#{uri.port}"] ||= response.http_version
976
+ @http_versions["#{uri.hostname}:#{uri.port}"] ||= response.http_version
977
977
 
978
978
  response
979
979
  end
@@ -1043,8 +1043,16 @@ class PersistentHTTP
1043
1043
  connection.use_ssl = true
1044
1044
 
1045
1045
  connection.ciphers = @ciphers if @ciphers
1046
+
1047
+ if @min_version
1048
+ if connection.respond_to? :min_version=
1049
+ connection.min_version = @min_version
1050
+ else
1051
+ connection.ssl_version = @min_version
1052
+ end
1053
+ end
1054
+
1046
1055
  connection.ssl_timeout = @ssl_timeout if @ssl_timeout
1047
- connection.ssl_version = @ssl_version if @ssl_version
1048
1056
 
1049
1057
  connection.verify_depth = @verify_depth
1050
1058
  connection.verify_mode = @verify_mode
@@ -1098,19 +1106,19 @@ application:
1098
1106
  end
1099
1107
 
1100
1108
  ##
1101
- # SSL session lifetime
1109
+ # Minimum SSL version to use
1102
1110
 
1103
- def ssl_timeout= ssl_timeout
1104
- @ssl_timeout = ssl_timeout
1111
+ def min_version= min_version
1112
+ @min_version = min_version
1105
1113
 
1106
1114
  reconnect_ssl
1107
1115
  end
1108
1116
 
1109
1117
  ##
1110
- # SSL version to use
1118
+ # SSL session lifetime
1111
1119
 
1112
- def ssl_version= ssl_version
1113
- @ssl_version = ssl_version
1120
+ def ssl_timeout= ssl_timeout
1121
+ @ssl_timeout = ssl_timeout
1114
1122
 
1115
1123
  reconnect_ssl
1116
1124
  end
data/lib/vault/request.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class Request
3
6
  attr_reader :client
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class Response
3
6
  # Defines a new field. This is designed to be used by the subclass as a
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require 'thread'
2
5
  require 'timeout'
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  class ConnectionPool
3
6
  VERSION = "2.2.0"
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  require_relative 'connection_pool/version'
2
5
  require_relative 'connection_pool/timed_stack'
3
6
 
data/lib/vault/version.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
- VERSION = "0.16.0"
5
+ VERSION = "0.18.2"
3
6
  end
data/lib/vault.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
1
4
  module Vault
2
5
  require_relative "vault/errors"
3
6
  require_relative "vault/client"
@@ -18,12 +21,13 @@ module Vault
18
21
  @client = Vault::Client.new
19
22
 
20
23
  # Set secure SSL options
21
- OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options].tap do |opts|
22
- opts &= ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS if defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS)
23
- opts |= OpenSSL::SSL::OP_NO_COMPRESSION if defined?(OpenSSL::SSL::OP_NO_COMPRESSION)
24
- opts |= OpenSSL::SSL::OP_NO_SSLv2 if defined?(OpenSSL::SSL::OP_NO_SSLv2)
25
- opts |= OpenSSL::SSL::OP_NO_SSLv3 if defined?(OpenSSL::SSL::OP_NO_SSLv3)
24
+ OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.tap do |opts|
25
+ opts[:options] &= ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS if defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS)
26
+ opts[:options] |= OpenSSL::SSL::OP_NO_COMPRESSION if defined?(OpenSSL::SSL::OP_NO_COMPRESSION)
27
+ opts[:options] |= OpenSSL::SSL::OP_NO_SSLv2 if defined?(OpenSSL::SSL::OP_NO_SSLv2)
28
+ opts[:options] |= OpenSSL::SSL::OP_NO_SSLv3 if defined?(OpenSSL::SSL::OP_NO_SSLv3)
26
29
  end
30
+
27
31
 
28
32
  self
29
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-17 00:00:00.000000000 Z
11
+ date: 2023-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sigv4
@@ -108,9 +108,23 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 3.8.3
111
+ - !ruby/object:Gem::Dependency
112
+ name: webrick
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.5'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.5'
111
125
  description: Vault is a Ruby API client for interacting with a Vault server.
112
126
  email:
113
- - sethvargo@gmail.com
127
+ - team-vault-devex@hashicorp.com
114
128
  executables: []
115
129
  extensions: []
116
130
  extra_rdoc_files: []
@@ -164,7 +178,7 @@ homepage: https://github.com/hashicorp/vault-ruby
164
178
  licenses:
165
179
  - MPL-2.0
166
180
  metadata: {}
167
- post_install_message:
181
+ post_install_message:
168
182
  rdoc_options: []
169
183
  require_paths:
170
184
  - lib
@@ -179,8 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  requirements: []
182
- rubygems_version: 3.2.3
183
- signing_key:
196
+ rubygems_version: 3.4.10
197
+ signing_key:
184
198
  specification_version: 4
185
199
  summary: Vault is a Ruby API client for interacting with a Vault server.
186
200
  test_files: []