-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
base: master
Are you sure you want to change the base?
Conversation
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] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#189 does that.
There was a problem hiding this comment.
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
Allow Passwords to be of Puppet-Datatype
Sensitive
.Return
Sensitive
, if Passwords were provided asSensitive
.