omnivault 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +17 -2
- data/README.md +25 -49
- data/Rakefile +6 -2
- data/bin/omnivault +10 -0
- data/ext/mkrf_conf.rb +17 -0
- data/lib/omnivault.rb +3 -2
- data/lib/omnivault/abstract_vault.rb +49 -9
- data/lib/omnivault/apple_keychain.rb +11 -14
- data/lib/omnivault/cli.rb +83 -0
- data/lib/omnivault/pws.rb +11 -14
- data/lib/omnivault/v1_credential_provider.rb +22 -0
- data/lib/omnivault/v2_credential_provider.rb +18 -0
- data/lib/omnivault/version.rb +1 -1
- data/omnivault.gemspec +7 -4
- data/spec/omnivault/abstract_vault_spec.rb +36 -0
- data/test/install-bats.sh +8 -0
- data/test/linux.bats +26 -0
- data/test/osx.bats +26 -0
- metadata +89 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 361c058018a7a70bd62b0e7ceb01774feb0d9875
|
4
|
+
data.tar.gz: 1d94ffb860e487476c11c82a0975bbd8f3e89408
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e296df72737a57880f7924bf1317f6e20777c43551ea1c010a0be5a1849a43d9f016ca2589d2d6f20651e47c17408c91ec1bf2792ca588d6eb15afb8497bf3b3
|
7
|
+
data.tar.gz: 89ec90a7965a6a7d724c4f9259bda44278dd3a53c4e2fb054eece69f755570464b8d37df6ec1dea4a4db7be560de758c2ee5d8a9761d237eb2a532488b71cf9f
|
data/.travis.yml
CHANGED
@@ -1,2 +1,17 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
sudo: true
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
matrix:
|
5
|
+
include:
|
6
|
+
- os: osx
|
7
|
+
env:
|
8
|
+
- BATS_TEST=test/osx.bats
|
9
|
+
- os: linux
|
10
|
+
env:
|
11
|
+
- BATS_TEST=test/linux.bats
|
12
|
+
before_install:
|
13
|
+
- sudo test/install-bats.sh
|
14
|
+
script:
|
15
|
+
- bundle exec rake
|
16
|
+
- rake build && gem install pkg/omnivault-*.gem
|
17
|
+
- BUNDLE_GEMFILE= bats $BATS_TEST
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[![Build Status](https://travis-ci.org/aptible/omnivault.png?branch=master)](https://travis-ci.org/aptible/omnivault)
|
5
5
|
[![Dependency Status](https://gemnasium.com/aptible/omnivault.png)](https://gemnasium.com/aptible/omnivault)
|
6
6
|
|
7
|
-
A Ruby library to abstract keychain functionality for storing and retrieiving arbitrary secrets from a variety of password vaults.
|
7
|
+
A Ruby library and CLI tool to abstract keychain functionality for storing and retrieiving arbitrary secrets from a variety of password vaults.
|
8
8
|
|
9
9
|
Omnivault supports simple key-value secret retrieval with the following password vaults:
|
10
10
|
|
@@ -15,15 +15,29 @@ Additionally, it supports automatic credential setup for the following libraries
|
|
15
15
|
|
16
16
|
* AWS Ruby SDK (`aws-sdk-v1`, `aws-sdk`)
|
17
17
|
|
18
|
-
## Installation
|
18
|
+
## Installation and Usage (CLI Tool)
|
19
19
|
|
20
|
-
|
20
|
+
To install for CLI usage, simply run `gem install omnivault` and then refer to `omnivault help` for usage:
|
21
|
+
|
22
|
+
```
|
23
|
+
Commands:
|
24
|
+
omnivault env [-v VAULT] # Print secret values from vault as source-able ENV variables
|
25
|
+
omnivault exec [-v VAULT] COMMAND # Execute command with secret values as ENV variables
|
26
|
+
omnivault help [COMMAND] # Describe available commands or one specific command
|
27
|
+
omnivault ls [-v VAULT] # List all secret keys from vault
|
28
|
+
omnivault set [-v VAULT] KEY1=value1 [KEY2=value2 ...] # Set one or more secret values in vault
|
29
|
+
omnivault unset [-v VAULT] KEY1 [KEY2 ...] # Unset one or more secret values in vault
|
30
|
+
```
|
31
|
+
|
32
|
+
## Installation (Library)
|
33
|
+
|
34
|
+
Add the following line(s) to your application's Gemfile.
|
21
35
|
|
22
36
|
gem 'omnivault'
|
23
37
|
|
24
38
|
And then run `bundle install`.
|
25
39
|
|
26
|
-
## Usage
|
40
|
+
## Usage (Library)
|
27
41
|
|
28
42
|
To initialize the the Omnivault, run:
|
29
43
|
|
@@ -36,7 +50,8 @@ This will determine an appropriate provider using the following logic:
|
|
36
50
|
* If the ENV variable `VAULT` is set, it will use that provider, i.e.,
|
37
51
|
- Apple Keychain for `VAULT=apple`
|
38
52
|
- PWS for `VAULT=pws`
|
39
|
-
* If no ENV variable is set, it will try to use Apple Keychain first
|
53
|
+
* If no ENV variable is set, it will try to use Apple Keychain first on OS X, then PWS. If not on OS X only PWS will be
|
54
|
+
used.
|
40
55
|
|
41
56
|
Then, to use Omnivault, you can:
|
42
57
|
|
@@ -56,51 +71,12 @@ Omnivault provides a `configure_aws!` method, which can be used to automatically
|
|
56
71
|
omnivault.configure_aws!
|
57
72
|
```
|
58
73
|
|
59
|
-
To use this feature, you'll need to set
|
60
|
-
|
61
|
-
### Apple Keychain
|
62
|
-
|
63
|
-
To set up AWS credentials using `aws-keychain-util`:
|
64
|
-
|
65
|
-
1. `gem install -N aws-keychain-util`
|
66
|
-
2. `aws-creds init`
|
67
|
-
3. `aws-creds add`
|
68
|
-
|
69
|
-
- Use 'default' for the account name
|
70
|
-
- Leave the MFA ARN blank
|
71
|
-
|
72
|
-
4. (Optional) Add the following file as `aws` somewhere on your `PATH` with higher precedence than `/usr/local/bin`. (`$HOME/.bin` is a good choice.) Make it executable by running `chmod +x aws-safe`.
|
73
|
-
|
74
|
-
#!/bin/bash
|
75
|
-
# $HOME/.bin/aws
|
74
|
+
To use this feature, you'll need to set the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` secrets in Omnivault:
|
76
75
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
/usr/local/bin/aws $@
|
81
|
-
|
82
|
-
|
83
|
-
### PWS
|
84
|
-
|
85
|
-
On Linux, you can use PWS instead:
|
86
|
-
|
87
|
-
1. `gem install -N aws-pws`
|
88
|
-
2. `aws-pws init`
|
89
|
-
3. (Optional) Add the following file as `aws` somewhere on your `PATH` with higher precedence than `/usr/local/bin`.
|
90
|
-
|
91
|
-
#!/bin/bash
|
92
|
-
# $HOME/.bin/aws
|
93
|
-
|
94
|
-
set -e
|
95
|
-
|
96
|
-
export $(aws-pws cat)
|
97
|
-
/usr/local/bin/aws $@
|
98
|
-
|
99
|
-
## TODO
|
76
|
+
```
|
77
|
+
omnivault set AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=...
|
78
|
+
```
|
100
79
|
|
101
|
-
* Add support for 1Password keychains.
|
102
|
-
* Write RSpec unit tests.
|
103
|
-
* Remove dependence on AWS-specific gems directly
|
104
80
|
|
105
81
|
## Contributing
|
106
82
|
|
@@ -113,6 +89,6 @@ On Linux, you can use PWS instead:
|
|
113
89
|
|
114
90
|
MIT License, see [LICENSE](LICENSE.md) for details.
|
115
91
|
|
116
|
-
Copyright (c)
|
92
|
+
Copyright (c) 2017 [Aptible](https://www.aptible.com), Frank Macreery, and contributors.
|
117
93
|
|
118
94
|
[<img src="https://s.gravatar.com/avatar/f7790b867ae619ae0496460aa28c5861?s=60" style="border-radius: 50%;" alt="@fancyremarker" />](https://github.com/fancyremarker)
|
data/Rakefile
CHANGED
data/bin/omnivault
ADDED
data/ext/mkrf_conf.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/command'
|
3
|
+
require 'rubygems/dependency_installer'
|
4
|
+
|
5
|
+
begin
|
6
|
+
Gem::Command.build_args = ARGV
|
7
|
+
rescue NoMethodError
|
8
|
+
end
|
9
|
+
|
10
|
+
inst = Gem::DependencyInstaller.new
|
11
|
+
begin
|
12
|
+
inst.install 'ruby-keychain' if RbConfig::CONFIG['host_os'] =~ /darwin/
|
13
|
+
rescue => e
|
14
|
+
puts e.message
|
15
|
+
puts e.backtrace
|
16
|
+
exit 1
|
17
|
+
end
|
data/lib/omnivault.rb
CHANGED
@@ -5,7 +5,8 @@ require_relative 'omnivault/apple_keychain'
|
|
5
5
|
require_relative 'omnivault/pws'
|
6
6
|
|
7
7
|
module Omnivault
|
8
|
-
def self.autodetect
|
9
|
-
Omnivault::AbstractVault.from_env ||
|
8
|
+
def self.autodetect(name = 'default')
|
9
|
+
Omnivault::AbstractVault.from_env(name) ||
|
10
|
+
Omnivault::AbstractVault.for_platform(name)
|
10
11
|
end
|
11
12
|
end
|
@@ -1,22 +1,62 @@
|
|
1
1
|
module Omnivault
|
2
2
|
class AbstractVault
|
3
|
-
def self.from_env
|
3
|
+
def self.from_env(name = 'default')
|
4
4
|
case ENV['VAULT']
|
5
|
-
when 'apple', 'AppleKeychain'
|
6
|
-
AppleKeychain.new
|
5
|
+
when 'apple', 'keychain', 'AppleKeychain'
|
6
|
+
AppleKeychain.new(name)
|
7
7
|
when 'pws', 'PWS'
|
8
|
-
PWS.new
|
8
|
+
PWS.new(name)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.for_platform
|
12
|
+
def self.for_platform(name = 'default')
|
13
13
|
if (/darwin/ =~ RUBY_PLATFORM).nil?
|
14
|
-
PWS.new
|
14
|
+
PWS.new(name)
|
15
15
|
else
|
16
|
-
AppleKeychain.new
|
16
|
+
AppleKeychain.new(name)
|
17
17
|
end
|
18
|
-
rescue LoadError
|
19
|
-
|
18
|
+
rescue LoadError => e
|
19
|
+
puts e.message
|
20
|
+
puts e.backtrace
|
21
|
+
PWS.new(name)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Either aws-sdk and/or aws-sdk-v1 must be required BEFORE calling
|
25
|
+
# Omnivault::AbstractVault#configure_aws!
|
26
|
+
def configure_aws!
|
27
|
+
if defined?(Aws)
|
28
|
+
require_relative 'v2_credential_provider'
|
29
|
+
|
30
|
+
provider = V2CredentialProvider.new(self)
|
31
|
+
Aws.config[:credentials] = provider
|
32
|
+
end
|
33
|
+
|
34
|
+
if defined?(AWS)
|
35
|
+
require_relative 'v1_credential_provider'
|
36
|
+
|
37
|
+
provider = V1CredentialProvider.new(self)
|
38
|
+
AWS.config(credential_provider: provider)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize(_name = 'default')
|
43
|
+
raise NotImplementedError, 'Must invoke from subclass'
|
44
|
+
end
|
45
|
+
|
46
|
+
def entries
|
47
|
+
raise NotImplementedError, 'Must invoke from subclass'
|
48
|
+
end
|
49
|
+
|
50
|
+
def fetch(key)
|
51
|
+
entries[key]
|
52
|
+
end
|
53
|
+
|
54
|
+
def store(_key, _value)
|
55
|
+
raise NotImplementedError, 'Must invoke from subclass'
|
56
|
+
end
|
57
|
+
|
58
|
+
def remove(_key)
|
59
|
+
raise NotImplementedError, 'Must invoke from subclass'
|
20
60
|
end
|
21
61
|
end
|
22
62
|
end
|
@@ -1,25 +1,22 @@
|
|
1
1
|
module Omnivault
|
2
2
|
class AppleKeychain < AbstractVault
|
3
|
-
|
3
|
+
attr_accessor :keychain
|
4
|
+
|
5
|
+
def initialize(name = 'default')
|
4
6
|
# Need to require within initializer, to avoid LoadError on
|
5
7
|
# non-Apple platforms
|
6
8
|
require 'keychain'
|
7
|
-
|
9
|
+
|
10
|
+
@keychain = open_or_create_keychain(name)
|
8
11
|
end
|
9
12
|
|
10
13
|
def entries
|
11
|
-
keychain = open_or_create_keychain
|
12
14
|
Hash[keychain.generic_passwords.all.map do |item|
|
13
15
|
[item.label, item.password]
|
14
16
|
end]
|
15
17
|
end
|
16
18
|
|
17
|
-
def fetch(key)
|
18
|
-
entries[key]
|
19
|
-
end
|
20
|
-
|
21
19
|
def store(key, value)
|
22
|
-
keychain = open_or_create_keychain
|
23
20
|
if (entry = keychain.generic_passwords.where(label: key).all.first)
|
24
21
|
entry.password = value
|
25
22
|
entry.save!
|
@@ -32,18 +29,18 @@ module Omnivault
|
|
32
29
|
end
|
33
30
|
end
|
34
31
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
32
|
+
def remove(key)
|
33
|
+
entry = keychain.generic_passwords.where(label: key).all.first
|
34
|
+
entry.delete
|
38
35
|
end
|
39
36
|
|
40
37
|
private
|
41
38
|
|
42
|
-
def open_or_create_keychain(name
|
43
|
-
keychain = Keychain.open("
|
39
|
+
def open_or_create_keychain(name)
|
40
|
+
keychain = Keychain.open("omnivault-#{name}.keychain")
|
44
41
|
return keychain if keychain.exists?
|
45
42
|
|
46
|
-
Keychain.create("
|
43
|
+
Keychain.create("omnivault-#{name}.keychain")
|
47
44
|
end
|
48
45
|
end
|
49
46
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'omnivault'
|
3
|
+
require 'shellwords'
|
4
|
+
|
5
|
+
module Omnivault
|
6
|
+
class CLI < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
# Forward return codes on failures.
|
10
|
+
def self.exit_on_failure?
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.default_options
|
15
|
+
option :vault, aliases: '-v', default: 'default'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.default_option_desc
|
19
|
+
'[-v VAULT]'
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "set #{default_option_desc} KEY1=value1 [KEY2=value2 ...]",
|
23
|
+
'Set one or more secret values in vault'
|
24
|
+
default_options
|
25
|
+
def set(*args)
|
26
|
+
raise ArgumentError, 'Wrong number of arguments' if args.empty?
|
27
|
+
|
28
|
+
hash = Hash[args.map { |arg| arg.split('=', 2) }]
|
29
|
+
hash.each do |key, value|
|
30
|
+
vault_by_name(options[:vault]).store(key, value)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "unset #{default_option_desc} KEY1 [KEY2 ...]",
|
35
|
+
'Unset one or more secret values in vault'
|
36
|
+
default_options
|
37
|
+
def unset(*args)
|
38
|
+
raise ArgumentError, 'Wrong number of arguments' if args.empty?
|
39
|
+
|
40
|
+
vault = vault_by_name(options[:vault])
|
41
|
+
missing = args - vault.entries.keys
|
42
|
+
raise Thor::Error, "Keys not found: #{missing.join(', ')}" if missing.any?
|
43
|
+
args.each do |key|
|
44
|
+
vault.remove(key)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "env #{default_option_desc}",
|
49
|
+
'Print secret values from vault as source-able ENV variables'
|
50
|
+
default_options
|
51
|
+
def env
|
52
|
+
vault_by_name(options[:vault]).entries.each do |key, value|
|
53
|
+
say "#{key}=#{Shellwords.escape(value)}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "exec #{default_option_desc} COMMAND",
|
58
|
+
'Execute command with secret values as ENV variables'
|
59
|
+
default_options
|
60
|
+
def exec(*args)
|
61
|
+
vault_by_name(options[:vault]).entries.each do |key, value|
|
62
|
+
ENV[key] = value
|
63
|
+
end
|
64
|
+
system(*args)
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "ls #{default_option_desc}",
|
68
|
+
'List all secret keys from vault'
|
69
|
+
default_options
|
70
|
+
def ls
|
71
|
+
vault_by_name(options[:vault]).entries.keys.each do |key|
|
72
|
+
say key
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def vault_by_name(name)
|
79
|
+
@vaults ||= {}
|
80
|
+
@vaults[name] ||= Omnivault.autodetect(name)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/omnivault/pws.rb
CHANGED
@@ -1,27 +1,24 @@
|
|
1
|
-
require 'aws/pws'
|
2
|
-
require 'aws/pws/credential_provider'
|
3
|
-
|
4
1
|
module Omnivault
|
5
2
|
class PWS < AbstractVault
|
6
|
-
attr_accessor :
|
3
|
+
attr_accessor :cli, :raw_data
|
7
4
|
|
8
|
-
def
|
9
|
-
|
10
|
-
|
5
|
+
def initialize(name = 'default')
|
6
|
+
require 'pws'
|
7
|
+
|
8
|
+
@cli ||= ::PWS.new(namespace: name)
|
9
|
+
@raw_data = @cli.instance_variable_get(:@data)
|
11
10
|
end
|
12
11
|
|
13
|
-
def
|
14
|
-
|
12
|
+
def entries
|
13
|
+
Hash[raw_data.map { |k, v| [k, v[:password]] }]
|
15
14
|
end
|
16
15
|
|
17
16
|
def store(key, value)
|
18
|
-
|
19
|
-
@client.cli.add(key, value)
|
17
|
+
cli.add(key, value)
|
20
18
|
end
|
21
19
|
|
22
|
-
def
|
23
|
-
|
24
|
-
AWS.config(credential_provider: provider)
|
20
|
+
def remove(key)
|
21
|
+
cli.remove(key)
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'aws-sdk-v1'
|
2
|
+
|
3
|
+
module Omnivault
|
4
|
+
class V1CredentialProvider
|
5
|
+
include AWS::Core::CredentialProviders::Provider
|
6
|
+
|
7
|
+
attr_accessor :vault
|
8
|
+
|
9
|
+
def initialize(vault)
|
10
|
+
@vault = vault
|
11
|
+
end
|
12
|
+
|
13
|
+
# rubocop:disable AccessorMethodName
|
14
|
+
def get_credentials
|
15
|
+
{
|
16
|
+
access_key_id: vault.fetch('AWS_ACCESS_KEY_ID'),
|
17
|
+
secret_access_key: vault.fetch('AWS_SECRET_ACCESS_KEY')
|
18
|
+
}
|
19
|
+
end
|
20
|
+
# rubocop:enable AccessorMethodName
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'aws-sdk'
|
2
|
+
|
3
|
+
module Omnivault
|
4
|
+
class V2CredentialProvider
|
5
|
+
include Aws::CredentialProvider
|
6
|
+
|
7
|
+
attr_accessor :vault
|
8
|
+
|
9
|
+
def initialize(vault)
|
10
|
+
@vault = vault
|
11
|
+
end
|
12
|
+
|
13
|
+
def credentials
|
14
|
+
Aws::Credentials.new(vault.fetch('AWS_ACCESS_KEY_ID'),
|
15
|
+
vault.fetch('AWS_SECRET_ACCESS_KEY'))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/omnivault/version.rb
CHANGED
data/omnivault.gemspec
CHANGED
@@ -16,16 +16,19 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
spec.files = `git ls-files`.split($RS)
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
20
|
spec.test_files = spec.files.grep(%r{^spec/})
|
20
21
|
spec.require_paths = ['lib']
|
22
|
+
spec.extensions = 'ext/mkrf_conf.rb'
|
21
23
|
|
22
|
-
spec.add_dependency '
|
23
|
-
|
24
|
-
# aws-keychain-util is an optional dependency if using Mac OS X.
|
25
|
-
# spec.add_dependency 'aws-keychain-util'
|
24
|
+
spec.add_dependency 'thor'
|
25
|
+
spec.add_dependency 'pws'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'bundler'
|
28
28
|
spec.add_development_dependency 'aptible-tasks'
|
29
29
|
spec.add_development_dependency 'rake'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 2.0'
|
31
|
+
spec.add_development_dependency 'aws-sdk', '~> 2'
|
32
|
+
spec.add_development_dependency 'aws-sdk-v1'
|
33
|
+
spec.add_development_dependency 'pry'
|
31
34
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Omnivault::AbstractVault do
|
4
|
+
before do
|
5
|
+
# Override parent class initialization exception in tests
|
6
|
+
described_class.send(:define_method, :initialize) {}
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#configure_aws!' do
|
10
|
+
before do
|
11
|
+
allow(subject).to receive(:entries) do
|
12
|
+
{
|
13
|
+
'AWS_ACCESS_KEY_ID' => 'id',
|
14
|
+
'AWS_SECRET_ACCESS_KEY' => 'secret'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'configures credentials for aws-sdk-v1' do
|
20
|
+
require 'aws-sdk-v1'
|
21
|
+
subject.configure_aws!
|
22
|
+
v1_credentials = AWS.config.credential_provider.credentials
|
23
|
+
expect(v1_credentials[:access_key_id]).to eq 'id'
|
24
|
+
expect(v1_credentials[:secret_access_key]).to eq 'secret'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'configures credentials for aws-sdk-v2' do
|
28
|
+
require 'aws-sdk'
|
29
|
+
subject.configure_aws!
|
30
|
+
|
31
|
+
v2_credentials = Aws.config[:credentials].credentials
|
32
|
+
expect(v2_credentials.access_key_id).to eq 'id'
|
33
|
+
expect(v2_credentials.secret_access_key).to eq 'secret'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/test/linux.bats
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env bats
|
2
|
+
|
3
|
+
setup() {
|
4
|
+
echo 'foobar
|
5
|
+
foobar' | pws -bats add FOO bar
|
6
|
+
}
|
7
|
+
|
8
|
+
teardown() {
|
9
|
+
rm -f $HOME/.pws-bats
|
10
|
+
}
|
11
|
+
|
12
|
+
@test "It should install the ruby-keychain gem" {
|
13
|
+
run gem list ruby-keychain
|
14
|
+
[[ ! "$output" =~ "ruby-keychain" ]]
|
15
|
+
}
|
16
|
+
|
17
|
+
@test "It should print secrets via omnivault env" {
|
18
|
+
run bash -c "echo foobar | omnivault env -v bats"
|
19
|
+
echo $output > $HOME/bats.out
|
20
|
+
[[ "$output" =~ "FOO=bar" ]]
|
21
|
+
}
|
22
|
+
|
23
|
+
@test "It should run a shell with secrets in ENV via omnivault exec" {
|
24
|
+
run bash -c "echo foobar | omnivault exec -v bats env"
|
25
|
+
[[ "$output" =~ "FOO=bar" ]]
|
26
|
+
}
|
data/test/osx.bats
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env bats
|
2
|
+
|
3
|
+
setup() {
|
4
|
+
security create-keychain -p foobar omnivault-bats.keychain
|
5
|
+
security add-generic-password -A -a FOO -s FOO -w bar omnivault-bats.keychain
|
6
|
+
security unlock-keychain -p foobar omnivault-bats.keychain
|
7
|
+
}
|
8
|
+
|
9
|
+
teardown() {
|
10
|
+
rm -f $HOME/Library/Keychains/omnivault-bats.keychain
|
11
|
+
}
|
12
|
+
|
13
|
+
@test "It should install the ruby-keychain gem" {
|
14
|
+
run gem list ruby-keychain
|
15
|
+
[[ "$output" =~ "ruby-keychain" ]]
|
16
|
+
}
|
17
|
+
|
18
|
+
@test "It should print secrets via omnivault env" {
|
19
|
+
run omnivault env -v bats
|
20
|
+
[[ "$output" =~ "FOO=bar" ]]
|
21
|
+
}
|
22
|
+
|
23
|
+
@test "It should run a shell with secrets in ENV via omnivault exec" {
|
24
|
+
run omnivault exec -v bats env
|
25
|
+
[[ "$output" =~ "FOO=bar" ]]
|
26
|
+
}
|
metadata
CHANGED
@@ -1,106 +1,173 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnivault
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pws
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: aptible-tasks
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - ~>
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '2.0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - ~>
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '2.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: aws-sdk
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: aws-sdk-v1
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
83
139
|
description: Abstract password vault for multiple providers
|
84
140
|
email:
|
85
141
|
- frank@macreery.com
|
86
|
-
executables:
|
87
|
-
|
142
|
+
executables:
|
143
|
+
- omnivault
|
144
|
+
extensions:
|
145
|
+
- ext/mkrf_conf.rb
|
88
146
|
extra_rdoc_files: []
|
89
147
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .rspec
|
92
|
-
- .travis.yml
|
148
|
+
- ".gitignore"
|
149
|
+
- ".rspec"
|
150
|
+
- ".travis.yml"
|
93
151
|
- Gemfile
|
94
152
|
- LICENSE.md
|
95
153
|
- README.md
|
96
154
|
- Rakefile
|
155
|
+
- bin/omnivault
|
156
|
+
- ext/mkrf_conf.rb
|
97
157
|
- lib/omnivault.rb
|
98
158
|
- lib/omnivault/abstract_vault.rb
|
99
159
|
- lib/omnivault/apple_keychain.rb
|
160
|
+
- lib/omnivault/cli.rb
|
100
161
|
- lib/omnivault/pws.rb
|
162
|
+
- lib/omnivault/v1_credential_provider.rb
|
163
|
+
- lib/omnivault/v2_credential_provider.rb
|
101
164
|
- lib/omnivault/version.rb
|
102
165
|
- omnivault.gemspec
|
166
|
+
- spec/omnivault/abstract_vault_spec.rb
|
103
167
|
- spec/spec_helper.rb
|
168
|
+
- test/install-bats.sh
|
169
|
+
- test/linux.bats
|
170
|
+
- test/osx.bats
|
104
171
|
homepage: https://github.com/aptible/omnivault
|
105
172
|
licenses:
|
106
173
|
- MIT
|
@@ -111,19 +178,20 @@ require_paths:
|
|
111
178
|
- lib
|
112
179
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
180
|
requirements:
|
114
|
-
- -
|
181
|
+
- - ">="
|
115
182
|
- !ruby/object:Gem::Version
|
116
183
|
version: '0'
|
117
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
185
|
requirements:
|
119
|
-
- -
|
186
|
+
- - ">="
|
120
187
|
- !ruby/object:Gem::Version
|
121
188
|
version: '0'
|
122
189
|
requirements: []
|
123
190
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.4
|
191
|
+
rubygems_version: 2.6.4
|
125
192
|
signing_key:
|
126
193
|
specification_version: 4
|
127
194
|
summary: Abstract password vault for multiple providers
|
128
195
|
test_files:
|
196
|
+
- spec/omnivault/abstract_vault_spec.rb
|
129
197
|
- spec/spec_helper.rb
|