Skip to content

Commit

Permalink
(CONT-1035) Alter logic of pw_hash
Browse files Browse the repository at this point in the history
The method as it is currently is causing issues with certain customers crypto setups
  • Loading branch information
david22swan committed Jun 14, 2023
1 parent 1dee9ef commit 8d525d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/puppet/parser/functions/pw_hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@

# handle weak implementations of String#crypt
# dup the string to get rid of frozen status for testing
if (+'test').crypt('$1$1') == '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
if RUBY_PLATFORM == 'java'
# puppetserver bundles Apache Commons Codec
org.apache.commons.codec.digest.Crypt.crypt(password.to_java_bytes, salt)
elsif (+'test').crypt('$1$1') == '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
password.crypt(salt)
else
# JRuby < 1.7.17
# MS Windows and other systems that don't support enhanced salts
raise Puppet::ParseError, 'system does not support enhanced salts' unless RUBY_PLATFORM == 'java'

# puppetserver bundles Apache Commons Codec
org.apache.commons.codec.digest.Crypt.crypt(password.to_java_bytes, salt)
raise Puppet::ParseError, 'system does not support enhanced salts'
end
end

0 comments on commit 8d525d2

Please sign in to comment.