rake_vault 0.1.0.pre.6 → 0.1.0.pre.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/rake_vault/tasks/app_role_auth.rb +28 -2
- data/lib/rake_vault/token_file.rb +17 -0
- data/lib/rake_vault/version.rb +1 -1
- data/lib/rake_vault.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6032db055b2b867a66d1081a178c1d5626f25940fad1a1a94960c215b8f4458
|
4
|
+
data.tar.gz: 66c88ba88b13102255484142252b59d486540bfdf40a7be82b35c2f194a7572d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a14c7a97440f9d9cdeaa98b79722a60f16bf7ee841090d67ab628a0a2d381b54b381ebad60a603357f2d3e80ca3dbc142038fe3f72a0beeb027fde0902f5b912
|
7
|
+
data.tar.gz: fc8a6608c820a956442d6c9279027f50ae595dbd208b8fee570b41a39d886aee56fd2bd195c29b17e92d1b8681bfddecba71b909f16fb30c9e0bc882890fb5c4
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rake_factory'
|
4
|
+
require_relative '../token_file'
|
4
5
|
|
5
6
|
module RakeVault
|
6
7
|
module Tasks
|
7
8
|
class AppRoleAuth < RakeFactory::Task
|
8
9
|
default_name :login
|
9
|
-
|
10
|
-
|
10
|
+
default_prerequisites(RakeFactory::DynamicValue.new do |t|
|
11
|
+
[t.ensure_task_name]
|
12
|
+
end)
|
13
|
+
default_description(RakeFactory::DynamicValue.new do |_task|
|
14
|
+
'Login with app role using vault'
|
15
|
+
end)
|
16
|
+
parameter :address
|
17
|
+
parameter :ensure_task_name, default: :'vault:ensure'
|
18
|
+
parameter :path, default: 'auth/approle/login'
|
19
|
+
parameter :role_id
|
20
|
+
parameter :secret_id
|
21
|
+
|
22
|
+
action do |task|
|
23
|
+
role_id = task.role_id ? "role_id=#{task.role_id}" : nil
|
24
|
+
secret_id = task.secret_id ? "secret_id=#{task.secret_id}" : nil
|
25
|
+
|
26
|
+
stdout = StringIO.new
|
27
|
+
|
28
|
+
RubyVault.configure(stdout: stdout)
|
29
|
+
RubyVault.write(
|
30
|
+
address: task.address,
|
31
|
+
path: task.path,
|
32
|
+
data: [role_id, secret_id].compact,
|
33
|
+
format: 'json'
|
34
|
+
)
|
35
|
+
RubyVault.reset!
|
36
|
+
RakeVault::TokenFile.write(stdout.string)
|
11
37
|
end
|
12
38
|
end
|
13
39
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RakeVault
|
4
|
+
module TokenFile
|
5
|
+
def self.write(json_string)
|
6
|
+
json = JSON.parse(json_string)
|
7
|
+
token = json['auth']['client_token']
|
8
|
+
RakeVault::TokenFile.write_token_to_file(token)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.write_token_to_file(token)
|
12
|
+
file = File.open('~/.vault-token', 'w')
|
13
|
+
file.write(token)
|
14
|
+
file.close
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/rake_vault/version.rb
CHANGED
data/lib/rake_vault.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_vault
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.
|
4
|
+
version: 0.1.0.pre.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfraBlocks Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored2
|
@@ -283,6 +283,7 @@ files:
|
|
283
283
|
- lib/rake_vault/tasks.rb
|
284
284
|
- lib/rake_vault/tasks/app_role_auth.rb
|
285
285
|
- lib/rake_vault/tasks/oidc_auth.rb
|
286
|
+
- lib/rake_vault/token_file.rb
|
286
287
|
- lib/rake_vault/version.rb
|
287
288
|
- rake_vault.gemspec
|
288
289
|
homepage: https://github.com/infrablocks/rake_vault
|