]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/keystone: EC2Engine uses reject() for ERR_SIGNATURE_NO_MATCH
authorCasey Bodley <cbodley@redhat.com>
Tue, 26 Sep 2023 16:16:52 +0000 (12:16 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 2 Oct 2023 20:06:23 +0000 (16:06 -0400)
ERR_SIGNATURE_NO_MATCH means that we found the given access key in
keystone, so we should use reject() instead of deny() to prevent
other engines like LocalEngine from looking up the access key again

this change causes us to return the SignatureDoesNotMatch error expected
by s3test case test_list_buckets_bad_auth()

Fixes: https://tracker.ceph.com/issues/62989
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 71b2070b744455ddd94d6a19dc3faf9c938c71ad)

src/rgw/rgw_auth_keystone.cc

index 4930a06bea88ed6c77e8cbe9b2cd880079d6d6a5..035b4c30204116252f9edff18d28bf8dedd3e097 100644 (file)
@@ -659,6 +659,12 @@ rgw::auth::Engine::result_t EC2Engine::authenticate(
   auto [t, secret_key, failure_reason] =
     get_access_token(dpp, access_key_id, string_to_sign, signature, signature_factory);
   if (! t) {
+    if (failure_reason == -ERR_SIGNATURE_NO_MATCH) {
+      // we looked up a secret but it didn't generate the same signature as
+      // the client. since we found this access key in keystone, we should
+      // reject the request instead of trying other engines
+      return result_t::reject(failure_reason);
+    }
     return result_t::deny(failure_reason);
   }