ae_vault 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4b7a08bbd379a6a3eb3dad1c07de9793f0d6dea220b3cbddb21bdb241b083a6f
4
+ data.tar.gz: ed5afbc45f2dbfb44155afacbbb94f50c8ab2cc5c58735e0dc635e2bdd1fe95c
5
+ SHA512:
6
+ metadata.gz: 42421ba15686013f87a4df04b33142f080f8235e1ab19f33ebf757225b2f9a9b82700377caab073823a8463550fe72fe8d959d435c7862a29f469cde200e75c8
7
+ data.tar.gz: 5907f00705913728fe1d3f9ff01ea9a393b7f95cb1474799b3deaca2f30c7fa9febc764702b5b5ac9ac853e49f5a21235ec97aec5b7e906ff3fb9156c31cf36b
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in ae_vault.gemspec
6
+ gemspec
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ae_vault (0.1.0)
5
+ vault
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ aws-eventstream (1.0.3)
11
+ aws-sigv4 (1.1.1)
12
+ aws-eventstream (~> 1.0, >= 1.0.2)
13
+ minitest (5.14.0)
14
+ rake (13.0.1)
15
+ vault (0.13.0)
16
+ aws-sigv4
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ ae_vault!
23
+ bundler
24
+ minitest (~> 5.0)
25
+ rake
26
+
27
+ BUNDLED WITH
28
+ 1.17.3
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 AppFolio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,47 @@
1
+ # AeVault
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ae_vault`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'ae_vault'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install ae_vault
22
+
23
+ ## Usage
24
+
25
+ The `VAULT_ADDR` and `VAULT_TOKEN` environment variables need to be set.
26
+
27
+ ### Verify Manifest
28
+
29
+ ```
30
+ %> ae_vault_verify_manifest <path_to_manifest.yml>
31
+ ```
32
+
33
+ ### Resolve Manifest
34
+
35
+ ```
36
+ %> ae_vault_resolve_manifest <path_to_manifest.yml>
37
+ ```
38
+
39
+ ## Development
40
+
41
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
42
+
43
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
44
+
45
+ ## Contributing
46
+
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ae_vault.
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,39 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "ae_vault/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ae_vault"
8
+ spec.version = AeVault::VERSION
9
+ spec.authors = ["Paul Kmiec"]
10
+ spec.email = ["paul.kmiec@appfolio.com"]
11
+
12
+ spec.summary = %q{Scripts to verify / resolve secret manifest}
13
+ spec.description = %q{Scripts to verify / resolve secret manifest}
14
+ spec.homepage = "https://github.com/appfolio/ae_vault"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_dependency "vault"
35
+
36
+ spec.add_development_dependency "bundler"
37
+ spec.add_development_dependency "rake"
38
+ spec.add_development_dependency "minitest", "~> 5.0"
39
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ae_vault"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'vault'
4
+ require 'yaml'
5
+ require 'json'
6
+
7
+ def read_secret(value)
8
+ group, secret_key = value.split('/', 2)
9
+ Vault.kv(group).read(secret_key).data[:value]
10
+ end
11
+
12
+ def resolve(manifest)
13
+ result = {}
14
+
15
+ manifest.each do |key, value|
16
+ if value.is_a?(Hash)
17
+ result[key] = resolve(value)
18
+ else
19
+ result[key] = read_secret(value)
20
+ end
21
+ end
22
+
23
+ result
24
+ end
25
+
26
+ manifest = YAML.load_file(ARGV[0])
27
+ puts resolve(manifest).to_json
28
+
29
+
30
+
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'vault'
4
+ require 'yaml'
5
+
6
+ def secret_exists?(value)
7
+ group, secret_key = value.split('/', 2)
8
+ result = Vault.kv(group).list(File.dirname(secret_key))
9
+ result.include?(File.basename(secret_key))
10
+ end
11
+
12
+ def verify(manifest)
13
+ result = []
14
+
15
+ manifest.each do |key, value|
16
+ if value.is_a?(Hash)
17
+ result += verify(value)
18
+ else
19
+ result << value unless secret_exists?(value)
20
+ end
21
+ end
22
+
23
+ result
24
+ end
25
+
26
+ manifest = YAML.load_file(ARGV[0])
27
+ result = verify(manifest)
28
+ if result.empty?
29
+ puts "Manifest is verified in #{ENV['VAULT_ADDR']}!"
30
+ else
31
+ puts "The following are missing in #{ENV['VAULT_ADDR']}:"
32
+ puts result
33
+ exit 1
34
+ end
35
+
36
+
@@ -0,0 +1,6 @@
1
+ require "ae_vault/version"
2
+
3
+ module AeVault
4
+ class Error < StandardError; end
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,3 @@
1
+ module AeVault
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ae_vault
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Paul Kmiec
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-03-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: vault
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description: Scripts to verify / resolve secret manifest
70
+ email:
71
+ - paul.kmiec@appfolio.com
72
+ executables:
73
+ - ae_vault_resolve_manifest.rb
74
+ - ae_vault_verify_manifest.rb
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - Gemfile
79
+ - Gemfile.lock
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - ae_vault.gemspec
84
+ - bin/console
85
+ - bin/setup
86
+ - exe/ae_vault_resolve_manifest.rb
87
+ - exe/ae_vault_verify_manifest.rb
88
+ - lib/ae_vault.rb
89
+ - lib/ae_vault/version.rb
90
+ homepage: https://github.com/appfolio/ae_vault
91
+ licenses: []
92
+ metadata:
93
+ homepage_uri: https://github.com/appfolio/ae_vault
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubygems_version: 3.0.6
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Scripts to verify / resolve secret manifest
113
+ test_files: []