Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to allow decrypting eyaml (PKCS7) when using JRuby. #62

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ GEM
diff-lcs (1.2.5)
facter (1.7.3)
ffi (1.9.3)
ffi (1.9.3-java)
gherkin (2.12.2)
multi_json (~> 1.3)
gherkin (2.12.2-java)
multi_json (~> 1.3)
hiera (1.2.1)
json_pure
hiera-eyaml-plaintext (0.5)
Expand All @@ -37,6 +40,7 @@ GEM
trollop (2.0)

PLATFORMS
java
ruby

DEPENDENCIES
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Note
====
Contains fix for this issue: https://github.com/TomPoulton/hiera-eyaml/pull/62

See https://github.com/TomPoulton/hiera-eyaml for the original version.

Hiera eyaml
===========

Expand Down
6 changes: 3 additions & 3 deletions hiera-eyaml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'hiera/backend/eyaml'

Gem::Specification.new do |gem|
gem.name = "hiera-eyaml"
gem.name = "clarenceb-hiera-eyaml"
gem.version = Hiera::Backend::Eyaml::VERSION
gem.description = "Hiera backend for decrypting encrypted yaml properties"
gem.description = "Hiera backend for decrypting encrypted yaml properties (Fix for Issue #62)"
gem.summary = "OpenSSL Encryption backend for Hiera"
gem.author = "Tom Poulton"
gem.license = "MIT"

gem.homepage = "http://github.com/TomPoulton/hiera-eyaml"
gem.homepage = "https://github.com/clarenceb/hiera-eyaml"
gem.files = `git ls-files`.split($/).reject { |file| file =~ /^features.*$/ }
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
Expand Down
2 changes: 1 addition & 1 deletion lib/hiera/backend/eyaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Hiera
module Backend
module Eyaml

VERSION = "2.0.0"
VERSION = "2.0.1"
DESCRIPTION = "Hiera-eyaml is a backend for Hiera which provides OpenSSL encryption/decryption for Hiera properties"

class RecoverableError < StandardError
Expand Down
6 changes: 4 additions & 2 deletions lib/hiera/backend/eyaml/encryptors/pkcs7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ def self.create_keys
Utils.ensure_key_dir_exists private_key
Utils.write_important_file :filename => private_key, :content => key.to_pem, :mode => 0600

name = OpenSSL::X509::Name.parse("/")
name = OpenSSL::X509::Name.parse("/DC=org/DC=example/CN=eyaml")
cert = OpenSSL::X509::Certificate.new()
cert.serial = 0
cert.version = 2
cert.subject = name
cert.issuer = cert.subject
cert.not_before = Time.now
cert.not_after = if 1.size == 8 # 64bit
Time.now + 50 * 365 * 24 * 60 * 60
Expand Down Expand Up @@ -102,4 +104,4 @@ def self.create_keys

end

end
end