encrypted-databag 0.0.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 +7 -0
- data/bin/create-encrypted-databag +49 -0
- data/bin/show-encrypted-databag +44 -0
- metadata +75 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6368381ec7f20724ca1b43d6de0aabe9f0785d8d
|
4
|
+
data.tar.gz: 09848a34c241e212aacc0155da6273906d14d0e7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0c5eed059b4f9b9d45d9a61e32060e1810d507ea3c537d2eab0027c5a0fb9ff722f1be1fcded455dc9f5a5ac58aedbebeb0d4f866671c94c466f4f13be7bbedb
|
7
|
+
data.tar.gz: 8522b5957789ca0437557075f54fef7d81629fd0ed6490aeea1532b56a9cd0169f45e37c8ba49b827cbb5df728960be95e362d5c34a7caa8252a3e3a0b8b1e36
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require 'chef/encrypted_data_bag_item'
|
5
|
+
require 'json'
|
6
|
+
require 'optparse'
|
7
|
+
|
8
|
+
def syntaxis
|
9
|
+
'Usage: create-encrypted-databag.rb [-h] | -s file -d file -k key'
|
10
|
+
end
|
11
|
+
|
12
|
+
options = {}
|
13
|
+
OptionParser.new do |opts|
|
14
|
+
opts.banner = syntaxis
|
15
|
+
|
16
|
+
opts.on('-s', '--source FILE', 'Clear data bag item to encrypt') do |src|
|
17
|
+
options[:source] = src
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on('-d', '--dest FILE', 'Crypted data bag item') do |dst|
|
21
|
+
options[:destination] = dst
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on('-k', '--secret-file FILE', 'The encryption key') do |k|
|
25
|
+
options[:key] = k
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
|
29
|
+
options[:verbose] = v
|
30
|
+
end
|
31
|
+
end.parse!
|
32
|
+
|
33
|
+
if options == {} then
|
34
|
+
puts syntaxis
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
begin
|
39
|
+
puts options
|
40
|
+
end if options[:verbose]
|
41
|
+
|
42
|
+
secret = Chef::EncryptedDataBagItem.load_secret(File.expand_path(options[:key]))
|
43
|
+
data = JSON.parse(File.read(File.expand_path(options[:source])))
|
44
|
+
encrypted_data = Chef::EncryptedDataBagItem.encrypt_data_bag_item(data, secret)
|
45
|
+
|
46
|
+
File.open(options[:destination], 'w') do |f|
|
47
|
+
f.print encrypted_data.to_json
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require 'chef/encrypted_data_bag_item'
|
5
|
+
require 'json'
|
6
|
+
require 'optparse'
|
7
|
+
require 'pp'
|
8
|
+
|
9
|
+
def syntaxis
|
10
|
+
'Usage: show-encrypted-databag [-h] -s file -k key'
|
11
|
+
end
|
12
|
+
|
13
|
+
options = {}
|
14
|
+
OptionParser.new do |opts|
|
15
|
+
opts.banner = syntaxis
|
16
|
+
|
17
|
+
opts.on('-s', '--source FILE', 'Encrypted data bag item to show') do |src|
|
18
|
+
options[:source] = src
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on('-k', '--secret-file FILE', 'The encryption key') do |k|
|
22
|
+
options[:key] = k
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
|
26
|
+
options[:verbose] = v
|
27
|
+
end
|
28
|
+
end.parse!
|
29
|
+
|
30
|
+
if options.empty? then
|
31
|
+
puts syntaxis
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
|
35
|
+
begin
|
36
|
+
puts options
|
37
|
+
end if options[:verbose]
|
38
|
+
|
39
|
+
secret = Chef::EncryptedDataBagItem.load_secret(File.expand_path(options[:key]))
|
40
|
+
data = JSON.parse(File.read(File.expand_path(options[:source])))
|
41
|
+
encrypted_data = Chef::EncryptedDataBagItem.new(data, secret)
|
42
|
+
|
43
|
+
pp encrypted_data.to_hash
|
44
|
+
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: encrypted-databag
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jorge Moratilla
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: chef
|
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
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: This is a set of tools I wrote to help me with encrpted databag
|
42
|
+
email: jorge@moratilla.com
|
43
|
+
executables:
|
44
|
+
- create-encrypted-databag
|
45
|
+
- show-encrypted-databag
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- bin/create-encrypted-databag
|
50
|
+
- bin/show-encrypted-databag
|
51
|
+
homepage: https://bitbucket.org/jmoratilla/encrypted-databag
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata: {}
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 2.3.0
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: Tool for encrypted databags
|
75
|
+
test_files: []
|