vault 0.19.0 → 0.20.1
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 +28 -1
- data/README.md +115 -12
- data/lib/vault/api/approle.rb +27 -14
- data/lib/vault/api/auth.rb +35 -8
- data/lib/vault/api/auth_tls.rb +1 -1
- data/lib/vault/api/auth_token.rb +1 -1
- data/lib/vault/api/help.rb +1 -1
- data/lib/vault/api/kv.rb +1 -1
- data/lib/vault/api/logical.rb +2 -1
- data/lib/vault/api/secret.rb +1 -1
- data/lib/vault/api/sys/audit.rb +1 -1
- data/lib/vault/api/sys/auth.rb +1 -1
- data/lib/vault/api/sys/health.rb +1 -1
- data/lib/vault/api/sys/init.rb +1 -1
- data/lib/vault/api/sys/leader.rb +7 -2
- data/lib/vault/api/sys/lease.rb +1 -1
- data/lib/vault/api/sys/mount.rb +1 -1
- data/lib/vault/api/sys/namespace.rb +1 -1
- data/lib/vault/api/sys/policy.rb +1 -1
- data/lib/vault/api/sys/quota.rb +1 -1
- data/lib/vault/api/sys/seal.rb +1 -1
- data/lib/vault/api/sys.rb +1 -1
- data/lib/vault/api/transform/alphabet.rb +1 -1
- data/lib/vault/api/transform/role.rb +1 -1
- data/lib/vault/api/transform/template.rb +1 -1
- data/lib/vault/api/transform/transformation.rb +1 -1
- data/lib/vault/api/transform.rb +1 -1
- data/lib/vault/api.rb +1 -1
- data/lib/vault/client.rb +1 -1
- data/lib/vault/configurable.rb +1 -1
- data/lib/vault/defaults.rb +1 -1
- data/lib/vault/encode.rb +2 -2
- data/lib/vault/errors.rb +1 -1
- data/lib/vault/request.rb +1 -1
- data/lib/vault/response.rb +1 -1
- data/lib/vault/version.rb +2 -2
- data/lib/vault.rb +1 -10
- metadata +2 -114
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46acf59f9b079b96d8af544537fc4657b02a04c0fdf9bd613cb46027435a6148
|
|
4
|
+
data.tar.gz: 828e7e36228d6900e8c1be9e7b9d319fb03fe2cb541eabca81a8a5323989a313
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0cc19d71f9f16123ab02539691a932098c39cea39362dc4c5b5e46f42390df23ae367b0ce26fb0a33940daf1af178884982076cd2d0dc92f310e326d4dfb8b8c
|
|
7
|
+
data.tar.gz: 1072fd9dfec4dfab692455b6b06833cb5ce9f9b3bacff3d36773b5491c326b1683ec9b7aa6c55926bf73f08c74a88fbfd71dcf4d778ce6ddf3b2669d04ad527d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
# Vault Ruby Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## v0.20.1 (March 31, 2026)
|
|
6
|
+
|
|
7
|
+
BUG FIXES
|
|
8
|
+
|
|
9
|
+
- Removed explicit `connection_pool` runtime dependency to allow use of connection_pool 3.x for compatibility with sidekiq 8.1+. The gem is already managed as a transitive dependency by `net-http-persistent`, which supports connection_pool 2.2.4+ through 3.x. [GH-393]
|
|
10
|
+
- Hardened STS endpoint parsing in AWS auth by replacing permissive matching with strict HTTPS URI and host validation, preserving supported global, regional, GovCloud, and China endpoints while rejecting malformed inputs. [GH-402]
|
|
11
|
+
|
|
12
|
+
## v0.20.0 (February 4, 2026)
|
|
13
|
+
|
|
14
|
+
IMPROVEMENTS
|
|
15
|
+
|
|
16
|
+
- Added `cluster_address` field to `LeaderStatus` response from `sys/leader` endpoint [GH-204]
|
|
17
|
+
- Updated AppRole `set_role` documentation to include modern parameters like `secret_id_bound_cidrs`, `token_bound_cidrs`, and `token_policies`. Added reference to official Vault API docs for complete parameter list. [GH-220]
|
|
18
|
+
- Added support for custom mount paths in AppRole authentication via `mount:` option [GH-292]
|
|
19
|
+
|
|
20
|
+
BUG FIXES
|
|
21
|
+
|
|
22
|
+
- Fixed `encode_path` incorrectly encoding hyphens (`-`), which caused 403 errors on Vault 1.15+ [GH-350, GH-343]
|
|
23
|
+
- Fixed `FrozenError` when loading the gem with OpenSSL 4.0.0+ by removing modification of `OpenSSL::SSL::SSLContext::DEFAULT_PARAMS`. Modern Ruby (3.1+) already has secure SSL defaults. [GH-366, GH-381]
|
|
24
|
+
- Fixed `Vault.logical.read` throwing `NoMethodError` when Vault responds with HTTP 204 (No Content). Now correctly returns `nil` for empty responses. [GH-241]
|
|
4
25
|
|
|
5
26
|
## v0.19.0 (December 3, 2025)
|
|
6
27
|
|
|
@@ -27,6 +48,12 @@ BUG FIXES
|
|
|
27
48
|
|
|
28
49
|
- Fixed HTTP client shutdown to be lock-protected, ensuring thread-safe access to `@nhp` [GH-329]
|
|
29
50
|
|
|
51
|
+
## v0.18.2 (November 27, 2023)
|
|
52
|
+
|
|
53
|
+
BUG FIXES
|
|
54
|
+
|
|
55
|
+
- Locked aws-sdk gem versions to support EOL Ruby versions [GH-314]
|
|
56
|
+
|
|
30
57
|
## v0.18.1 (September 14, 2023)
|
|
31
58
|
|
|
32
59
|
BUG FIXES
|
data/README.md
CHANGED
|
@@ -63,9 +63,27 @@ Vault.configure do |config|
|
|
|
63
63
|
# ENV["VAULT_SSL_PEM_CONTENTS_BASE64"] then ENV["VAULT_SSL_PEM_CONTENTS"]
|
|
64
64
|
config.ssl_pem_contents = "-----BEGIN ENCRYPTED..."
|
|
65
65
|
|
|
66
|
+
# Passphrase for encrypted PEM files
|
|
67
|
+
config.ssl_pem_passphrase = "my-passphrase"
|
|
68
|
+
|
|
69
|
+
# Custom SSL CA certificate for verification
|
|
70
|
+
config.ssl_ca_cert = "/path/to/ca.crt"
|
|
71
|
+
|
|
72
|
+
# Custom SSL CA certificate directory
|
|
73
|
+
config.ssl_ca_path = "/path/to/ca/directory"
|
|
74
|
+
|
|
75
|
+
# Custom SSL certificate store
|
|
76
|
+
config.ssl_cert_store = OpenSSL::X509::Store.new
|
|
77
|
+
|
|
78
|
+
# Specify SSL ciphers to use
|
|
79
|
+
config.ssl_ciphers = "TLSv1.2:!aNULL:!eNULL"
|
|
80
|
+
|
|
66
81
|
# Use SSL verification, also read as ENV["VAULT_SSL_VERIFY"]
|
|
67
82
|
config.ssl_verify = false
|
|
68
83
|
|
|
84
|
+
# SNI hostname to use for SSL connections
|
|
85
|
+
config.hostname = "vault.example.com"
|
|
86
|
+
|
|
69
87
|
# Timeout the connection after a certain amount of time (seconds), also read
|
|
70
88
|
# as ENV["VAULT_TIMEOUT"]
|
|
71
89
|
config.timeout = 30
|
|
@@ -75,6 +93,10 @@ Vault.configure do |config|
|
|
|
75
93
|
config.ssl_timeout = 5
|
|
76
94
|
config.open_timeout = 5
|
|
77
95
|
config.read_timeout = 30
|
|
96
|
+
|
|
97
|
+
# Connection pool settings for persistent connections
|
|
98
|
+
config.pool_size = 5
|
|
99
|
+
config.pool_timeout = 5
|
|
78
100
|
end
|
|
79
101
|
```
|
|
80
102
|
|
|
@@ -85,6 +107,27 @@ client_1 = Vault::Client.new(address: "https://vault.mycompany.com")
|
|
|
85
107
|
client_2 = Vault::Client.new(address: "https://other-vault.mycompany.com")
|
|
86
108
|
```
|
|
87
109
|
|
|
110
|
+
### Authentication
|
|
111
|
+
|
|
112
|
+
Authenticate using various methods:
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
# LDAP
|
|
116
|
+
Vault.auth.ldap("username", "password")
|
|
117
|
+
|
|
118
|
+
# Username/Password
|
|
119
|
+
Vault.auth.userpass("username", "password")
|
|
120
|
+
|
|
121
|
+
# AppRole
|
|
122
|
+
Vault.auth.approle("role_id", "secret_id")
|
|
123
|
+
|
|
124
|
+
# GitHub token
|
|
125
|
+
Vault.auth.github("github_token")
|
|
126
|
+
|
|
127
|
+
# AWS IAM
|
|
128
|
+
Vault.auth.aws_iam("role_name", credentials_provider, "header_value")
|
|
129
|
+
```
|
|
130
|
+
|
|
88
131
|
And if you want to authenticate with a `AWS EC2` :
|
|
89
132
|
|
|
90
133
|
```ruby
|
|
@@ -156,28 +199,73 @@ Vault.with_retries(Exception) do
|
|
|
156
199
|
end #=> #<Exception>
|
|
157
200
|
```
|
|
158
201
|
|
|
159
|
-
|
|
202
|
+
### KV Secrets Engine
|
|
203
|
+
|
|
204
|
+
Vault's [KV secrets engine](https://developer.hashicorp.com/vault/docs/secrets/kv) has two versions: [v2](https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v2) (versioned, default in Vault 0.10+) and [v1](https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v1) (unversioned). Use `Vault.kv(mount)` for v2 and `Vault.logical` for v1.
|
|
205
|
+
|
|
160
206
|
```ruby
|
|
161
|
-
|
|
162
|
-
|
|
207
|
+
# Check which version your mount uses
|
|
208
|
+
mounts = Vault.sys.mounts
|
|
209
|
+
mounts[:secret].options[:version] #=> "2" or "1"
|
|
163
210
|
```
|
|
164
211
|
|
|
165
|
-
####
|
|
212
|
+
#### KV v2 (versioned secrets)
|
|
213
|
+
|
|
166
214
|
```ruby
|
|
167
|
-
|
|
168
|
-
|
|
215
|
+
# Write and read
|
|
216
|
+
Vault.kv("secret").write("db/creds", username: "admin", password: "secret123")
|
|
217
|
+
secret = Vault.kv("secret").read("db/creds")
|
|
218
|
+
secret.data[:data] #=> { :username => "admin", :password => "secret123" }
|
|
219
|
+
|
|
220
|
+
# Read specific version
|
|
221
|
+
secret = Vault.kv("secret").read("db/creds", 2)
|
|
222
|
+
|
|
223
|
+
# List paths
|
|
224
|
+
Vault.kv("secret").list("db") #=> ["creds"]
|
|
225
|
+
|
|
226
|
+
# Soft delete (can be undeleted)
|
|
227
|
+
Vault.kv("secret").delete("db/creds")
|
|
228
|
+
Vault.kv("secret").delete_versions("db/creds", [1, 2])
|
|
229
|
+
|
|
230
|
+
# Undelete
|
|
231
|
+
Vault.kv("secret").undelete_versions("db/creds", [1])
|
|
232
|
+
|
|
233
|
+
# Permanently destroy
|
|
234
|
+
Vault.kv("secret").destroy_versions("db/creds", [1])
|
|
235
|
+
Vault.kv("secret").destroy("db/creds") # destroys all versions and metadata
|
|
236
|
+
|
|
237
|
+
# Metadata operations
|
|
238
|
+
Vault.kv("secret").write_metadata("db/creds", max_versions: 5)
|
|
239
|
+
metadata = Vault.kv("secret").read_metadata("db/creds")
|
|
169
240
|
```
|
|
170
241
|
|
|
171
|
-
####
|
|
242
|
+
#### KV v1 (unversioned secrets)
|
|
243
|
+
|
|
172
244
|
```ruby
|
|
173
|
-
Vault.logical.
|
|
174
|
-
|
|
245
|
+
Vault.logical.write("secret/db/creds", username: "admin", password: "secret123")
|
|
246
|
+
secret = Vault.logical.read("secret/db/creds")
|
|
247
|
+
secret.data #=> { :username => "admin", :password => "secret123" }
|
|
248
|
+
|
|
249
|
+
Vault.logical.list("secret/db") #=> ["creds"]
|
|
250
|
+
Vault.logical.delete("secret/db/creds") #=> true
|
|
175
251
|
```
|
|
176
252
|
|
|
177
|
-
####
|
|
253
|
+
#### Seal Status
|
|
178
254
|
```ruby
|
|
179
|
-
|
|
180
|
-
|
|
255
|
+
Vault.sys.seal_status
|
|
256
|
+
#=> #<Vault::SealStatus sealed=false, t=1, n=1, progress=0>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Tokens
|
|
260
|
+
|
|
261
|
+
See the [Token Auth API docs](https://developer.hashicorp.com/vault/api-docs/auth/token) for details.
|
|
262
|
+
|
|
263
|
+
```ruby
|
|
264
|
+
# Create, lookup, renew, and revoke
|
|
265
|
+
token = Vault.auth_token.create(policies: ["app-read"], ttl: "1h", renewable: true)
|
|
266
|
+
info = Vault.auth_token.lookup_self
|
|
267
|
+
Vault.auth_token.renew_self(3600)
|
|
268
|
+
Vault.auth_token.revoke("hvs.CAESI...")
|
|
181
269
|
```
|
|
182
270
|
|
|
183
271
|
### Response wrapping
|
|
@@ -206,6 +294,21 @@ wrapped = Vault.auth_token.create(wrap_ttl: "5s")
|
|
|
206
294
|
token = Vault.logical.unwrap_token(wrapped)
|
|
207
295
|
```
|
|
208
296
|
|
|
297
|
+
### API Coverage
|
|
298
|
+
|
|
299
|
+
Available Ruby clients:
|
|
300
|
+
|
|
301
|
+
- `Vault.kv(mount)` - [KV v2 secrets engine](https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v2)
|
|
302
|
+
- `Vault.logical` - [KV v1](https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v1) and generic logical operations
|
|
303
|
+
- `Vault.sys` - [System backend](https://developer.hashicorp.com/vault/api-docs/system) (mounts, policies, seal status, etc.)
|
|
304
|
+
- `Vault.auth` - [Authentication methods](https://developer.hashicorp.com/vault/api-docs/auth) (AWS, AppRole, GitHub, etc.)
|
|
305
|
+
- `Vault.auth_token` - [Token auth](https://developer.hashicorp.com/vault/api-docs/auth/token)
|
|
306
|
+
- `Vault.approle` - [AppRole auth configuration](https://developer.hashicorp.com/vault/api-docs/auth/approle)
|
|
307
|
+
- `Vault.transform` - [Transform secrets engine](https://developer.hashicorp.com/vault/api-docs/secret/transform)
|
|
308
|
+
- `Vault.help` - Interactive help
|
|
309
|
+
|
|
310
|
+
For full API documentation, see [rubydoc.info/gems/vault](https://www.rubydoc.info/gems/vault) or check `spec/integration` for examples
|
|
311
|
+
|
|
209
312
|
|
|
210
313
|
Development
|
|
211
314
|
-----------
|
data/lib/vault/api/approle.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright IBM Corp. 2015, 2025
|
|
2
2
|
# SPDX-License-Identifier: MPL-2.0
|
|
3
3
|
|
|
4
4
|
require "json"
|
|
@@ -24,9 +24,10 @@ module Vault
|
|
|
24
24
|
# @example
|
|
25
25
|
# Vault.approle.set_role("testrole", {
|
|
26
26
|
# secret_id_ttl: "10m",
|
|
27
|
+
# secret_id_bound_cidrs: ["10.0.0.0/8"],
|
|
27
28
|
# token_ttl: "20m",
|
|
28
|
-
#
|
|
29
|
-
#
|
|
29
|
+
# token_policies: ["default", "app-policy"],
|
|
30
|
+
# token_bound_cidrs: ["10.0.0.0/8"],
|
|
30
31
|
# }) #=> true
|
|
31
32
|
#
|
|
32
33
|
# @param [String] name
|
|
@@ -34,29 +35,41 @@ module Vault
|
|
|
34
35
|
# @param [Hash] options
|
|
35
36
|
# @option options [Boolean] :bind_secret_id
|
|
36
37
|
# Require secret_id to be presented when logging in using this AppRole.
|
|
37
|
-
# @option options [String] :
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
# @option options [String] :policies
|
|
41
|
-
# Comma-separated list of policies set on tokens issued via this AppRole.
|
|
38
|
+
# @option options [Array<String>] :secret_id_bound_cidrs
|
|
39
|
+
# Array of CIDR blocks. If set, specifies blocks of IP addresses which
|
|
40
|
+
# can perform the login operation.
|
|
42
41
|
# @option options [String] :secret_id_num_uses
|
|
43
42
|
# Number of times any particular SecretID can be used to fetch a token
|
|
44
43
|
# from this AppRole, after which the SecretID will expire.
|
|
45
44
|
# @option options [Fixnum, String] :secret_id_ttl
|
|
46
45
|
# The number of seconds or a golang-formatted timestamp like "60m" after
|
|
47
46
|
# which any SecretID expires.
|
|
47
|
+
# @option options [Boolean] :local_secret_ids
|
|
48
|
+
# If set, the secret IDs generated using this role will be cluster local.
|
|
49
|
+
# @option options [Array<String>] :token_policies
|
|
50
|
+
# Array of policies to be set on tokens issued using this AppRole.
|
|
51
|
+
# @option options [Array<String>] :token_bound_cidrs
|
|
52
|
+
# Array of CIDR blocks. If set, specifies blocks of IP addresses which
|
|
53
|
+
# can authenticate using tokens generated by this AppRole.
|
|
48
54
|
# @option options [Fixnum, String] :token_ttl
|
|
49
55
|
# The number of seconds or a golang-formatted timestamp like "60m" to set
|
|
50
56
|
# as the TTL for issued tokens and at renewal time.
|
|
51
57
|
# @option options [Fixnum, String] :token_max_ttl
|
|
52
58
|
# The number of seconds or a golang-formatted timestamp like "60m" after
|
|
53
59
|
# which the issued token can no longer be renewed.
|
|
54
|
-
# @option options [Fixnum, String] :
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
+
# @option options [Fixnum, String] :token_explicit_max_ttl
|
|
61
|
+
# If set, tokens created via this role carry an explicit maximum TTL.
|
|
62
|
+
# @option options [Boolean] :token_no_default_policy
|
|
63
|
+
# If set, the default policy will not be set on tokens issued via this role.
|
|
64
|
+
# @option options [Fixnum] :token_num_uses
|
|
65
|
+
# The maximum number of times a generated token may be used.
|
|
66
|
+
# @option options [Fixnum, String] :token_period
|
|
67
|
+
# The maximum allowed period value when a periodic token is requested.
|
|
68
|
+
# @option options [String] :token_type
|
|
69
|
+
# The type of token that should be generated (service, batch, or default).
|
|
70
|
+
#
|
|
71
|
+
# For a complete list of parameters, see the Vault AppRole API documentation:
|
|
72
|
+
# https://developer.hashicorp.com/vault/api-docs/auth/approle
|
|
60
73
|
#
|
|
61
74
|
# @return [true]
|
|
62
75
|
def set_role(name, options = {})
|
data/lib/vault/api/auth.rb
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright IBM Corp. 2015, 2025
|
|
2
2
|
# SPDX-License-Identifier: MPL-2.0
|
|
3
3
|
|
|
4
4
|
require "json"
|
|
5
|
+
require "uri"
|
|
5
6
|
|
|
6
7
|
require_relative "secret"
|
|
7
8
|
require_relative "../client"
|
|
@@ -81,21 +82,32 @@ module Vault
|
|
|
81
82
|
# successful, the resulting token will be stored on the client and used for
|
|
82
83
|
# future requests.
|
|
83
84
|
#
|
|
84
|
-
# @example
|
|
85
|
+
# @example Default mount point
|
|
85
86
|
# Vault.auth.approle(
|
|
86
87
|
# "db02de05-fa39-4855-059b-67221c5c2f63",
|
|
87
88
|
# "6a174c20-f6de-a53c-74d2-6018fcceff64",
|
|
88
89
|
# ) #=> #<Vault::Secret lease_id="">
|
|
89
90
|
#
|
|
91
|
+
# @example Custom mount point
|
|
92
|
+
# Vault.auth.approle(
|
|
93
|
+
# "db02de05-fa39-4855-059b-67221c5c2f63",
|
|
94
|
+
# "6a174c20-f6de-a53c-74d2-6018fcceff64",
|
|
95
|
+
# mount: "my-approle"
|
|
96
|
+
# ) #=> #<Vault::Secret lease_id="">
|
|
97
|
+
#
|
|
90
98
|
# @param [String] role_id
|
|
91
99
|
# @param [String] secret_id (default: nil)
|
|
92
100
|
# It is required when `bind_secret_id` is enabled for the specified role_id
|
|
101
|
+
# @param [Hash] options
|
|
102
|
+
# @option options [String] :mount (default: "approle")
|
|
103
|
+
# The path where the approle auth backend is mounted
|
|
93
104
|
#
|
|
94
105
|
# @return [Secret]
|
|
95
|
-
def approle(role_id, secret_id=nil)
|
|
106
|
+
def approle(role_id, secret_id=nil, options = {})
|
|
107
|
+
mount = options[:mount] || 'approle'
|
|
96
108
|
payload = { role_id: role_id }
|
|
97
109
|
payload[:secret_id] = secret_id if secret_id
|
|
98
|
-
json = client.post("/v1/auth/
|
|
110
|
+
json = client.post("/v1/auth/#{CGI.escape(mount)}/login", JSON.generate(payload))
|
|
99
111
|
secret = Secret.decode(json)
|
|
100
112
|
client.token = secret.auth.client_token
|
|
101
113
|
return secret
|
|
@@ -206,6 +218,7 @@ module Vault
|
|
|
206
218
|
# @param [String] sts_endpoint optional
|
|
207
219
|
# https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html
|
|
208
220
|
# @param [String] route optional
|
|
221
|
+
# The full api path to the auth method's login endpoint, ie `/v1/auth/aws/mycorp/myorg/login`
|
|
209
222
|
# @return [Secret]
|
|
210
223
|
def aws_iam(role, credentials_provider, iam_auth_header_value = nil, sts_endpoint = 'https://sts.amazonaws.com', route = nil)
|
|
211
224
|
require "aws-sigv4"
|
|
@@ -290,7 +303,7 @@ module Vault
|
|
|
290
303
|
# The path to the auth backend to use for the login procedure.
|
|
291
304
|
#
|
|
292
305
|
# @param [String] name optional
|
|
293
|
-
# The named certificate role provided to the login request.
|
|
306
|
+
# The named certificate role provided to the login request.
|
|
294
307
|
#
|
|
295
308
|
# @return [Secret]
|
|
296
309
|
def tls(pem = nil, path = 'cert', name: nil)
|
|
@@ -316,9 +329,23 @@ module Vault
|
|
|
316
329
|
#
|
|
317
330
|
# @return [String] aws region
|
|
318
331
|
def region_from_sts_endpoint(sts_endpoint)
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
332
|
+
uri = URI.parse(sts_endpoint)
|
|
333
|
+
|
|
334
|
+
unless uri.is_a?(URI::HTTPS) && uri.userinfo.nil?
|
|
335
|
+
raise "Unable to parse STS endpoint #{sts_endpoint}"
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
case uri.host
|
|
339
|
+
when "sts.amazonaws.com"
|
|
340
|
+
"us-east-1"
|
|
341
|
+
when /\Asts\.([a-z0-9-]+)\.amazonaws\.com\z/,
|
|
342
|
+
/\Asts\.([a-z0-9-]+)\.amazonaws\.com\.cn\z/
|
|
343
|
+
Regexp.last_match(1)
|
|
344
|
+
else
|
|
345
|
+
raise "Unable to parse STS endpoint #{sts_endpoint}"
|
|
346
|
+
end
|
|
347
|
+
rescue URI::InvalidURIError
|
|
348
|
+
raise "Unable to parse STS endpoint #{sts_endpoint}"
|
|
322
349
|
end
|
|
323
350
|
end
|
|
324
351
|
end
|
data/lib/vault/api/auth_tls.rb
CHANGED
data/lib/vault/api/auth_token.rb
CHANGED
data/lib/vault/api/help.rb
CHANGED
data/lib/vault/api/kv.rb
CHANGED
data/lib/vault/api/logical.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright IBM Corp. 2015, 2025
|
|
2
2
|
# SPDX-License-Identifier: MPL-2.0
|
|
3
3
|
|
|
4
4
|
require_relative "secret"
|
|
@@ -48,6 +48,7 @@ module Vault
|
|
|
48
48
|
def read(path, options = {})
|
|
49
49
|
headers = extract_headers!(options)
|
|
50
50
|
json = client.get("/v1/#{encode_path(path)}", {}, headers)
|
|
51
|
+
return nil if json.nil?
|
|
51
52
|
return Secret.decode(json)
|
|
52
53
|
rescue HTTPError => e
|
|
53
54
|
return nil if e.code == 404
|
data/lib/vault/api/secret.rb
CHANGED
data/lib/vault/api/sys/audit.rb
CHANGED
data/lib/vault/api/sys/auth.rb
CHANGED
data/lib/vault/api/sys/health.rb
CHANGED
data/lib/vault/api/sys/init.rb
CHANGED
data/lib/vault/api/sys/leader.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright IBM Corp. 2015, 2025
|
|
2
2
|
# SPDX-License-Identifier: MPL-2.0
|
|
3
3
|
|
|
4
4
|
module Vault
|
|
@@ -18,6 +18,11 @@ module Vault
|
|
|
18
18
|
# @return [String]
|
|
19
19
|
field :leader_address, as: :address
|
|
20
20
|
|
|
21
|
+
# @!attribute [r] cluster_address
|
|
22
|
+
# URL where the cluster leader is running.
|
|
23
|
+
# @return [String]
|
|
24
|
+
field :leader_cluster_address, as: :cluster_address
|
|
25
|
+
|
|
21
26
|
# @deprecated Use {#ha_enabled?} instead
|
|
22
27
|
def ha?; ha_enabled?; end
|
|
23
28
|
|
|
@@ -35,7 +40,7 @@ module Vault
|
|
|
35
40
|
# Determine the leader status for this vault.
|
|
36
41
|
#
|
|
37
42
|
# @example
|
|
38
|
-
# Vault.sys.leader #=> #<Vault::LeaderStatus ha_enabled=false, is_self=false, leader_address="">
|
|
43
|
+
# Vault.sys.leader #=> #<Vault::LeaderStatus ha_enabled=false, is_self=false, leader_address="", leader_cluster_address="">
|
|
39
44
|
#
|
|
40
45
|
# @return [LeaderStatus]
|
|
41
46
|
def leader
|
data/lib/vault/api/sys/lease.rb
CHANGED
data/lib/vault/api/sys/mount.rb
CHANGED
data/lib/vault/api/sys/policy.rb
CHANGED
data/lib/vault/api/sys/quota.rb
CHANGED
data/lib/vault/api/sys/seal.rb
CHANGED
data/lib/vault/api/sys.rb
CHANGED
data/lib/vault/api/transform.rb
CHANGED
data/lib/vault/api.rb
CHANGED
data/lib/vault/client.rb
CHANGED
data/lib/vault/configurable.rb
CHANGED
data/lib/vault/defaults.rb
CHANGED
data/lib/vault/encode.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright IBM Corp. 2015, 2025
|
|
2
2
|
# SPDX-License-Identifier: MPL-2.0
|
|
3
3
|
|
|
4
4
|
module Vault
|
|
@@ -12,7 +12,7 @@ module Vault
|
|
|
12
12
|
#
|
|
13
13
|
# @return [String]
|
|
14
14
|
def encode_path(path)
|
|
15
|
-
path.b.gsub(%r!([^a-zA-Z0-9_
|
|
15
|
+
path.b.gsub(%r!([^a-zA-Z0-9_.\-/]+)!) { |m|
|
|
16
16
|
'%' + m.unpack('H2' * m.bytesize).join('%').upcase
|
|
17
17
|
}
|
|
18
18
|
end
|
data/lib/vault/errors.rb
CHANGED
data/lib/vault/request.rb
CHANGED
data/lib/vault/response.rb
CHANGED
data/lib/vault/version.rb
CHANGED
data/lib/vault.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright IBM Corp. 2015, 2025
|
|
2
2
|
# SPDX-License-Identifier: MPL-2.0
|
|
3
3
|
|
|
4
4
|
module Vault
|
|
@@ -20,15 +20,6 @@ module Vault
|
|
|
20
20
|
def setup!
|
|
21
21
|
@client = Vault::Client.new
|
|
22
22
|
|
|
23
|
-
# Set secure SSL options
|
|
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)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
|
|
32
23
|
self
|
|
33
24
|
end
|
|
34
25
|
|
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.
|
|
4
|
+
version: 0.20.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Seth Vargo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sigv4
|
|
@@ -38,20 +38,6 @@ dependencies:
|
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: connection_pool
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - "~>"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '2.4'
|
|
48
|
-
type: :runtime
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - "~>"
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '2.4'
|
|
55
41
|
- !ruby/object:Gem::Dependency
|
|
56
42
|
name: net-http-persistent
|
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,104 +58,6 @@ dependencies:
|
|
|
72
58
|
- - ">="
|
|
73
59
|
- !ruby/object:Gem::Version
|
|
74
60
|
version: 4.0.2
|
|
75
|
-
- !ruby/object:Gem::Dependency
|
|
76
|
-
name: bundler
|
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - "~>"
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '2'
|
|
82
|
-
type: :development
|
|
83
|
-
prerelease: false
|
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
-
requirements:
|
|
86
|
-
- - "~>"
|
|
87
|
-
- !ruby/object:Gem::Version
|
|
88
|
-
version: '2'
|
|
89
|
-
- !ruby/object:Gem::Dependency
|
|
90
|
-
name: pry
|
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
|
92
|
-
requirements:
|
|
93
|
-
- - "~>"
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
version: 0.13.1
|
|
96
|
-
type: :development
|
|
97
|
-
prerelease: false
|
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- - "~>"
|
|
101
|
-
- !ruby/object:Gem::Version
|
|
102
|
-
version: 0.13.1
|
|
103
|
-
- !ruby/object:Gem::Dependency
|
|
104
|
-
name: rake
|
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
|
106
|
-
requirements:
|
|
107
|
-
- - "~>"
|
|
108
|
-
- !ruby/object:Gem::Version
|
|
109
|
-
version: '12.0'
|
|
110
|
-
type: :development
|
|
111
|
-
prerelease: false
|
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
-
requirements:
|
|
114
|
-
- - "~>"
|
|
115
|
-
- !ruby/object:Gem::Version
|
|
116
|
-
version: '12.0'
|
|
117
|
-
- !ruby/object:Gem::Dependency
|
|
118
|
-
name: rspec
|
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
|
120
|
-
requirements:
|
|
121
|
-
- - "~>"
|
|
122
|
-
- !ruby/object:Gem::Version
|
|
123
|
-
version: '3.5'
|
|
124
|
-
type: :development
|
|
125
|
-
prerelease: false
|
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
-
requirements:
|
|
128
|
-
- - "~>"
|
|
129
|
-
- !ruby/object:Gem::Version
|
|
130
|
-
version: '3.5'
|
|
131
|
-
- !ruby/object:Gem::Dependency
|
|
132
|
-
name: yard
|
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
|
134
|
-
requirements:
|
|
135
|
-
- - "~>"
|
|
136
|
-
- !ruby/object:Gem::Version
|
|
137
|
-
version: 0.9.24
|
|
138
|
-
type: :development
|
|
139
|
-
prerelease: false
|
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
141
|
-
requirements:
|
|
142
|
-
- - "~>"
|
|
143
|
-
- !ruby/object:Gem::Version
|
|
144
|
-
version: 0.9.24
|
|
145
|
-
- !ruby/object:Gem::Dependency
|
|
146
|
-
name: webmock
|
|
147
|
-
requirement: !ruby/object:Gem::Requirement
|
|
148
|
-
requirements:
|
|
149
|
-
- - "~>"
|
|
150
|
-
- !ruby/object:Gem::Version
|
|
151
|
-
version: 3.8.3
|
|
152
|
-
type: :development
|
|
153
|
-
prerelease: false
|
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
155
|
-
requirements:
|
|
156
|
-
- - "~>"
|
|
157
|
-
- !ruby/object:Gem::Version
|
|
158
|
-
version: 3.8.3
|
|
159
|
-
- !ruby/object:Gem::Dependency
|
|
160
|
-
name: webrick
|
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
|
162
|
-
requirements:
|
|
163
|
-
- - "~>"
|
|
164
|
-
- !ruby/object:Gem::Version
|
|
165
|
-
version: '1.5'
|
|
166
|
-
type: :development
|
|
167
|
-
prerelease: false
|
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
-
requirements:
|
|
170
|
-
- - "~>"
|
|
171
|
-
- !ruby/object:Gem::Version
|
|
172
|
-
version: '1.5'
|
|
173
61
|
description: Vault is a Ruby API client for interacting with a Vault server.
|
|
174
62
|
email:
|
|
175
63
|
- team-vault-devex@hashicorp.com
|