hiera-eyaml-cli 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4a32e3cb7f30cf2938a0c2f26e363032eae49c72eb6deedcfd7365502e3806f9
4
+ data.tar.gz: 8de78fbac96d6f0058c5bc6156d2356ae95ba18a0fdcf9d24a3e8fd13cf46a04
5
+ SHA512:
6
+ metadata.gz: ef91f58cbf75d55430847dc793833df17af09d37cafd8956588bf1fb40b450c37c6a45bf7ee25d93c4f0751a9a9dd44c4f9f2958bc83673c0214e35d7138b78b
7
+ data.tar.gz: 04617d1bfb936512aff658465e3e81b2971d5a9bcde3f59343af6c669600caf8aa13c1bbc5be850c834329a3e0593faacf645c7ad9219593a39f6a0e38553f37
@@ -0,0 +1,16 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v2.4.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: requirements-txt-fixer
9
+ - repo: local
10
+ hooks:
11
+ - id: rubocop
12
+ name: rubocop
13
+ entry: rubocop --auto-correct
14
+ types: [ruby]
15
+ language: ruby
16
+ additional_dependencies: ['rubocop:0.63.1']
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
1
+ Metrics/AbcSize:
2
+ Max: 30
3
+ Metrics/BlockLength:
4
+ Max: 30
5
+ Metrics/CyclomaticComplexity:
6
+ Max: 10
7
+ Metrics/MethodLength:
8
+ Max: 30
9
+ Metrics/LineLength:
10
+ IgnoreCopDirectives: true
11
+ Style/Documentation:
12
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org/'
2
+
3
+ gem 'hiera-eyaml', '>=1.3.8'
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2019 Ethan Smith
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'hiera/backend/eyaml/encryptors/cli/version'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = 'hiera-eyaml-cli'
7
+ gem.version = Hiera::Backend::Eyaml::Encryptors::Cli::VERSION
8
+ gem.description = 'cli encryptor for use with hiera-eyaml'
9
+ gem.summary = 'Encryption plugin for hiera-eyaml backend for Hiera'
10
+ gem.author = 'Ethan Smith'
11
+ gem.license = 'MIT'
12
+
13
+ gem.homepage = 'http://github.com/ethanhs/hiera-eyaml-cli'
14
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
15
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.require_paths = ['lib']
17
+
18
+ gem.add_dependency('hiera-eyaml', '>=1.3.8')
19
+ end
@@ -0,0 +1,62 @@
1
+ require 'Open3'
2
+
3
+ class Hiera
4
+ module Backend
5
+ module Eyaml
6
+ module Encryptors
7
+ class Cli < Encryptor
8
+ self.tag = 'cli'
9
+
10
+ self.options = {
11
+ encrypt_command: {
12
+ desc: 'Command to run to encrypt data (takes data on stdin)',
13
+ type: :string
14
+ },
15
+ decrypt_command: {
16
+ desc: 'Command to run to decrypt data (takes data on stdin)',
17
+ type: :string
18
+ }
19
+ }
20
+
21
+
22
+ def self.encrypt_command
23
+ encrypt_command = option :encrypt_command
24
+ if encrypt_command.nil? || encrypt_command.empty?
25
+ raise ArgumentError, 'No encryption command configured!'
26
+ end
27
+ encrypt_command
28
+ end
29
+
30
+ def self.decrypt_command
31
+ decrypt_command = option :decrypt_command
32
+ if decrypt_command.nil? || decrypt_command.empty?
33
+ raise ArgumentError, 'No decryption command configured!'
34
+ end
35
+ decrypt_command
36
+ end
37
+
38
+ def self.encrypt(plaintext)
39
+ out, status = Open3.capture2(self.encrypt_command, :stdin_data=>plaintext)
40
+ if status != 0
41
+ raise 'Call to encrypt subcommand failed'
42
+ end
43
+ out
44
+ end
45
+
46
+ def self.decrypt(ciphertext)
47
+ out, status = Open3.capture2(self.decrypt_command, :stdin_data=>ciphertext)
48
+ if status != 0
49
+ raise 'Call to decrypt subcommand failed'
50
+ end
51
+ out
52
+ end
53
+
54
+ def self.create_keys
55
+ STDERR.puts 'This encryptor does not support creation of keys'
56
+ end
57
+
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,3 @@
1
+ require 'hiera/backend/eyaml/encryptors/cli'
2
+
3
+ Hiera::Backend::Eyaml::Encryptors::Cli.register
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hiera-eyaml-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Ethan Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hiera-eyaml
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.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.3.8
27
+ description: cli encryptor for use with hiera-eyaml
28
+ email:
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".pre-commit-config.yaml"
34
+ - ".rubocop.yml"
35
+ - Gemfile
36
+ - LICENSE
37
+ - hiera-eyaml-cli.gemspec
38
+ - lib/hiera/backend/eyaml/encryptors/cli.rb
39
+ - lib/hiera/backend/eyaml/encryptors/cli/eyaml_init.rb
40
+ homepage: http://github.com/ethanhs/hiera-eyaml-cli
41
+ licenses:
42
+ - MIT
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubygems_version: 3.0.3
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: Encryption plugin for hiera-eyaml backend for Hiera
63
+ test_files: []