diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mixlib/authentication/http_authentication_request.rb | 2 | ||||
-rw-r--r-- | lib/mixlib/authentication/null_logger.rb | 4 | ||||
-rw-r--r-- | lib/mixlib/authentication/signatureverification.rb | 28 | ||||
-rw-r--r-- | lib/mixlib/authentication/signedheaderauth.rb | 6 | ||||
-rw-r--r-- | lib/mixlib/authentication/version.rb | 2 |
5 files changed, 21 insertions, 21 deletions
diff --git a/lib/mixlib/authentication/http_authentication_request.rb b/lib/mixlib/authentication/http_authentication_request.rb index b573d2d..32b8e72 100644 --- a/lib/mixlib/authentication/http_authentication_request.rb +++ b/lib/mixlib/authentication/http_authentication_request.rb @@ -72,7 +72,7 @@ module Mixlib unless @request_signature @request_signature = headers.find_all { |h| h[0].to_s =~ /^x_ops_authorization_/ } .sort { |x, y| x.to_s[/\d+/].to_i <=> y.to_s[/\d+/].to_i }.map { |i| i[1] }.join("\n") - Mixlib::Authentication::Log.debug "Reconstituted (user-supplied) request signature: #{@request_signature}" + Mixlib::Authentication::Log.trace "Reconstituted (user-supplied) request signature: #{@request_signature}" end @request_signature end diff --git a/lib/mixlib/authentication/null_logger.rb b/lib/mixlib/authentication/null_logger.rb index 2bc9e31..579b1e2 100644 --- a/lib/mixlib/authentication/null_logger.rb +++ b/lib/mixlib/authentication/null_logger.rb @@ -4,7 +4,7 @@ module Mixlib attr_accessor :level - %i{debug info warn error fatal}.each do |method_name| + %i{trace debug info warn error fatal}.each do |method_name| class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) def #{method_name}(msg=nil, &block) true @@ -12,7 +12,7 @@ module Mixlib METHOD_DEFN end - %i{debug? info? warn? error? fatal?}.each do |method_name| + %i{trace? debug? info? warn? error? fatal?}.each do |method_name| class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) def #{method_name} false diff --git a/lib/mixlib/authentication/signatureverification.rb b/lib/mixlib/authentication/signatureverification.rb index 898e05b..33094d2 100644 --- a/lib/mixlib/authentication/signatureverification.rb +++ b/lib/mixlib/authentication/signatureverification.rb @@ -76,7 +76,7 @@ module Mixlib # X-Ops-Content-Hash: # X-Ops-Authorization-#{line_number} def authenticate_request(user_secret, time_skew = (15 * 60)) - Mixlib::Authentication.logger.debug "Initializing header auth : #{request.inspect}" + Mixlib::Authentication.logger.trace "Initializing header auth : #{request.inspect}" @user_secret = user_secret @allowed_time_skew = time_skew # in seconds @@ -149,15 +149,15 @@ module Mixlib (request_decrypted_block == candidate_block) end - # Keep the debug messages lined up so it's easy to scan them - Mixlib::Authentication.logger.debug("Verifying request signature:") - Mixlib::Authentication.logger.debug(" Expected Block is: '#{candidate_block}'") - Mixlib::Authentication.logger.debug("Decrypted block is: '#{request_decrypted_block}'") - Mixlib::Authentication.logger.debug("Signatures match? : '#{@valid_signature}'") + # Keep the trace messages lined up so it's easy to scan them + Mixlib::Authentication.logger.trace("Verifying request signature:") + Mixlib::Authentication.logger.trace(" Expected Block is: '#{candidate_block}'") + Mixlib::Authentication.logger.trace("Decrypted block is: '#{request_decrypted_block}'") + Mixlib::Authentication.logger.trace("Signatures match? : '#{@valid_signature}'") @valid_signature rescue => e - Mixlib::Authentication.logger.debug("Failed to verify request signature: #{e.class.name}: #{e.message}") + Mixlib::Authentication.logger.trace("Failed to verify request signature: #{e.class.name}: #{e.message}") @valid_signature = false end @@ -168,10 +168,10 @@ module Mixlib def verify_content_hash @valid_content_hash = (content_hash == hashed_body) - # Keep the debug messages lined up so it's easy to scan them - Mixlib::Authentication.logger.debug("Expected content hash is: '#{hashed_body}'") - Mixlib::Authentication.logger.debug(" Request Content Hash is: '#{content_hash}'") - Mixlib::Authentication.logger.debug(" Hashes match?: #{@valid_content_hash}") + # Keep the trace messages lined up so it's easy to scan them + Mixlib::Authentication.logger.trace("Expected content hash is: '#{hashed_body}'") + Mixlib::Authentication.logger.trace(" Request Content Hash is: '#{content_hash}'") + Mixlib::Authentication.logger.trace(" Hashes match?: #{@valid_content_hash}") @valid_content_hash end @@ -211,11 +211,11 @@ module Mixlib # Any file that's included in the request is hashed if it's there. Otherwise, # we hash the body. if file_param - Mixlib::Authentication.logger.debug "Digesting file_param: '#{file_param.inspect}'" + Mixlib::Authentication.logger.trace "Digesting file_param: '#{file_param.inspect}'" @hashed_body = digester.hash_file(file_param, digest) else body = request.raw_post - Mixlib::Authentication.logger.debug "Digesting body: '#{body}'" + Mixlib::Authentication.logger.trace "Digesting body: '#{body}'" @hashed_body = digester.hash_string(body, digest) end end @@ -232,7 +232,7 @@ module Mixlib def timestamp_within_bounds?(time1, time2) time_diff = (time2 - time1).abs is_allowed = (time_diff < @allowed_time_skew) - Mixlib::Authentication.logger.debug "Request time difference: #{time_diff}, within #{@allowed_time_skew} seconds? : #{!!is_allowed}" + Mixlib::Authentication.logger.trace "Request time difference: #{time_diff}, within #{@allowed_time_skew} seconds? : #{!!is_allowed}" is_allowed end end diff --git a/lib/mixlib/authentication/signedheaderauth.rb b/lib/mixlib/authentication/signedheaderauth.rb index 8cc8119..c9102dd 100644 --- a/lib/mixlib/authentication/signedheaderauth.rb +++ b/lib/mixlib/authentication/signedheaderauth.rb @@ -118,7 +118,7 @@ module Mixlib header_hash[key] = signature_lines[idx] end - Mixlib::Authentication.logger.debug "Header hash: #{header_hash.inspect}" + Mixlib::Authentication.logger.trace "Header hash: #{header_hash.inspect}" header_hash end @@ -239,7 +239,7 @@ module Mixlib memo[field_name.to_sym] = field_value.strip memo end - Mixlib::Authentication.logger.debug "Parsed signing description: #{parts.inspect}" + Mixlib::Authentication.logger.trace "Parsed signing description: #{parts.inspect}" parts end @@ -260,7 +260,7 @@ module Mixlib # @return [String] def do_sign(rsa_key, digest, sign_algorithm, sign_version, use_ssh_agent) string_to_sign = canonicalize_request(sign_algorithm, sign_version) - Mixlib::Authentication.logger.debug "String to sign: '#{string_to_sign}'" + Mixlib::Authentication.logger.trace "String to sign: '#{string_to_sign}'" case sign_version when "1.3" if use_ssh_agent diff --git a/lib/mixlib/authentication/version.rb b/lib/mixlib/authentication/version.rb index a1d0ffe..e631d07 100644 --- a/lib/mixlib/authentication/version.rb +++ b/lib/mixlib/authentication/version.rb @@ -15,6 +15,6 @@ module Mixlib module Authentication - VERSION = "1.4.2" + VERSION = "2.0.0" end end |