hiera-gosecret 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ac515df9e60bea11edf33c55fcee36c06de08d5a
4
+ data.tar.gz: 02ea8bfbc1746496a6fbf0a61e4c26dfbcf472c7
5
+ SHA512:
6
+ metadata.gz: 01cffadb998359a3687d264bc283d9c661b05ff6ffdce5ffbd89a985b0788c89779184fb93fb84b0a72c2176ea0e22207fed1ccdd3d687bbd09d0c7f3e74714e
7
+ data.tar.gz: f24de8d0a33af9003221ddf71d58aa36a3febf906fcee83f7cca024da4072e3508f4aaf5d86f23a1409b57c44b1fa00e94bb5f420284cdf4c8923ace8d54ed08
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2014 Cimpress
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/bin/gosecret ADDED
Binary file
@@ -0,0 +1,41 @@
1
+ ##
2
+ ## Look up key in other backends and return decrypted value if it's a gosecret
3
+ ## otherwise return nil
4
+ ##
5
+ ## :gosecret:keydir must be defined in config
6
+ ##
7
+ require "base64"
8
+
9
+ class Hiera
10
+ module Backend
11
+ class Gosecret_backend
12
+
13
+ @backends = nil
14
+
15
+ def initialize(cache=nil)
16
+ @backends = []
17
+ Config[:backends].each do |p|
18
+ next if p == "gosecret"
19
+ backend = p.slice(0,1).capitalize + p.slice(1..-1) + "_backend"
20
+ @backends.push(Hiera::Backend.const_get(backend).new()) if Hiera::Backend.const_defined?(backend)
21
+ end
22
+ end
23
+
24
+ def lookup(key, scope, order_override, resolution_type)
25
+ answer = nil
26
+ @backends.each do |b|
27
+ answer = b.lookup(key, scope, order_override, resolution_type)
28
+ break if answer != nil
29
+ end
30
+ decrypt(answer) if answer != nil and answer.is_a? String and answer.start_with? "[gosecret|"
31
+ end
32
+
33
+ GOSECRET_REGEX = /\[(gosecret(\|[^\]\|]*){4})\]/
34
+
35
+ def decrypt(value)
36
+ `gosecret -keystore=#{Config[:gosecret][:keydir]} -mode=decrypt -value="#{value}"`
37
+ end
38
+
39
+ end
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hiera-gosecret
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Calvin Leung Huang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Hiera backend for decrypting gosecret-encrypted values
14
+ email:
15
+ executables:
16
+ - gosecret
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - LICENSE
21
+ - bin/gosecret
22
+ - lib/hiera/backend/gosecret_backend.rb
23
+ homepage: http://github.com/Cimpress-MCP/hiera-gosecret
24
+ licenses:
25
+ - Apache 2.0
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.4.3
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Hiera gosecret backend
47
+ test_files: []