Puppet Function: apache::apache_pw_hash
- Defined in:
- lib/puppet/functions/apache/apache_pw_hash.rb
- Function type:
- Ruby 4.x API
Overview
Hashes a password in a format suitable for htpasswd files read by apache.
Currently uses SHA-hashes, because although this format is considered insecure, its the most secure format supported by the most platforms.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/puppet/functions/apache/apache_pw_hash.rb', line 5 Puppet::Functions.create_function(:'apache::apache_pw_hash') do dispatch :apache_pw_hash do required_param 'String[1]', :password return_type 'String' end def apache_pw_hash(password) require 'base64' '{SHA}' + Base64.strict_encode64(Digest::SHA1.digest(password)) end end |