Skip to content

Commit

Permalink
password encryption: switch from des3-> aes-256-cbc
Browse files Browse the repository at this point in the history
This updates the algorithm for password encryption in certificates from
the outdated des3 to aes-256-cbc.
  • Loading branch information
bastelfreak committed Jul 18, 2024
1 parent cac0733 commit fd4c1bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/ssl_pkey/openssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def self.generate_key(resource)

def self.to_pem(resource, key)
if resource[:password]
cipher = OpenSSL::Cipher.new('des3')
cipher = OpenSSL::Cipher.new('aes-256-cbc')
key.to_pem(cipher, resource[:password])
else
key.to_pem
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/puppet/provider/ssl_pkey/openssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
it 'creates with given password' do
resource[:password] = '2x$5{'
allow(OpenSSL::PKey::RSA).to receive(:new).with(2048).and_return(key)
allow(OpenSSL::Cipher).to receive(:new).with('des3')
allow(OpenSSL::Cipher).to receive(:new).with('aes-256-cbc')
expect(File).to receive(:write).with('/tmp/foo.key', kind_of(String))
resource.provider.create
end
Expand Down Expand Up @@ -72,7 +72,7 @@
resource[:authentication] = :rsa
resource[:password] = '2x$5{'
allow(OpenSSL::PKey::RSA).to receive(:new).with(2048).and_return(key)
allow(OpenSSL::Cipher).to receive(:new).with('des3')
allow(OpenSSL::Cipher).to receive(:new).with('aes-256-cbc')
expect(File).to receive(:write).with('/tmp/foo.key', kind_of(String))
resource.provider.create
end
Expand Down Expand Up @@ -102,7 +102,7 @@
resource[:authentication] = :dsa
resource[:password] = '2x$5{'
allow(OpenSSL::PKey::DSA).to receive(:new).with(2048).and_return(key)
allow(OpenSSL::Cipher).to receive(:new).with('des3')
allow(OpenSSL::Cipher).to receive(:new).with('aes-256-cbc')
expect(File).to receive(:write).with('/tmp/foo.key', kind_of(String))
resource.provider.create
end
Expand Down

0 comments on commit fd4c1bc

Please sign in to comment.