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

Do not reveal sensitive Data #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cocker-cc
Copy link

Allow Passwords to be of Puppet-Datatype Sensitive.
Return Sensitive, if Passwords were provided as Sensitive.

lib/puppet/provider/x509_cert/openssl.rb Outdated Show resolved Hide resolved
lib/puppet/provider/x509_request/openssl.rb Outdated Show resolved Hide resolved
manifests/export/pkcs12.pp Outdated Show resolved Hide resolved
Allow Passwords to be of Puppet-Datatype Sensitive.
Return Sensitive, if Passwords were provided as Sensitive.
@@ -10,11 +10,23 @@ def self.private_key(resource)
file = File.read(resource[:private_key])
case resource[:authentication]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this block I was thinking about refactoring it (prior to your change):

cls = case resource[:authentication]
      when :dsa
        OpenSSL::PKey::DSA
      when :rsa
        OpenSSL::PKey::RSA
      when :ec
        OpenSSL::PKey::EC
      else
        raise
      end

cls.new(file, resource[:password])

Then with your change it becomes

cls = case resource[:authentication]
      when :dsa
        OpenSSL::PKey::DSA
      when :rsa
        OpenSSL::PKey::RSA
      when :ec
        OpenSSL::PKey::EC
      else
        raise
      end

if resource[:password].respond_to?(:unwrap)
  Puppet::Pops::Types::PSensitiveType::Sensitive.new(cls.new(file, resource[:password].unwrap))
else
  cls.new(file, resource[:password])
end

But realistically, why don't we use OpenSSL::Pkey.read(file, resource[:password]) to let OpenSSL do the heavy lifting? Is that method unavailable in older versions? If so, how old?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#189 does that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am no Expert with OpenSSL. I suggest to leave that Change in #189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants