]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW: When using Keystone auth for RGW, include the Keystone user in ops log 53365/head
authorAli Masarwa <ali.saed.masarwa@gmail.com>
Thu, 24 Aug 2023 15:40:22 +0000 (18:40 +0300)
committerAli Masarwa <amasarwa@redhat.com>
Mon, 21 Apr 2025 12:56:03 +0000 (15:56 +0300)
Signed-off-by: Ali Masarwa <ali.saed.masarwa@gmail.com>
Signed-off-by: Ali Masarwa <amasarwa@redhat.com>
qa/workunits/rgw/keystone-service-token.sh
src/rgw/rgw_auth.cc
src/rgw/rgw_auth.h
src/rgw/rgw_auth_keystone.cc
src/rgw/rgw_rest_s3.cc

index fc39731ca951cacb50d85a3e83fa51e771bb3e93..df8bfdc8c0e14ac90d3a20ff9c2843559e86e7c0 100755 (executable)
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU Library Public License for more details.
+#
+<<comment Running this script with vstart should be should have these options
+MON=1 OSD=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh -n -d -o 'rgw_keystone_accepted_admin_roles="admin"
+       rgw_keystone_accepted_roles="admin,Member"
+       rgw_keystone_admin_domain="Default"
+       rgw_keystone_admin_password="ADMIN"
+       rgw_keystone_admin_project="admin"
+       rgw_keystone_admin_user="admin"
+       rgw_keystone_api_version=3
+       rgw_keystone_expired_token_cache_expiration=10
+       rgw_keystone_implicit_tenants=true
+       rgw_keystone_service_token_accepted_roles="admin"
+       rgw_keystone_service_token_enabled=true
+       rgw_keystone_url="http://localhost:5000"
+       rgw_swift_account_in_url=true
+       rgw_swift_enforce_content_length=true
+       rgw_swift_versioning_enabled=true'
+comment
 
 source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
 
index 4dee2bf469682b66f06f6c093f4e1e9662dd252c..25d6e1b56b348f45efab20c22ca1346884dc29ec 100644 (file)
@@ -782,6 +782,7 @@ bool rgw::auth::WebIdentityApplier::is_identity(const Principal& p) const
 
 const std::string rgw::auth::RemoteApplier::AuthInfo::NO_SUBUSER;
 const std::string rgw::auth::RemoteApplier::AuthInfo::NO_ACCESS_KEY;
+const std::string rgw::auth::RemoteApplier::AuthInfo::NO_KEYSTONE_USER;
 
 /* rgw::auth::RemoteAuthApplier */
 ACLOwner rgw::auth::RemoteApplier::get_aclowner() const
@@ -954,6 +955,7 @@ void rgw::auth::RemoteApplier::write_ops_log_entry(rgw_log_entry& entry) const
   if (account) {
     entry.account_id = account->id;
   }
+  entry.user = info.keystone_user;
 }
 
 /* TODO(rzarzynski): we need to handle display_name changes. */
index 6632a38e6a61bd15c9754b480f3f25816d4dab5f..d2c32729b20843db3a9407e75d49d97254a10390 100644 (file)
@@ -590,6 +590,7 @@ public:
     const uint32_t acct_type;
     const std::string access_key_id;
     const std::string subuser;
+    const std::string keystone_user;
 
   public:
     enum class acct_privilege_t {
@@ -599,6 +600,7 @@ public:
 
     static const std::string NO_SUBUSER;
     static const std::string NO_ACCESS_KEY;
+    static const std::string NO_KEYSTONE_USER;
 
     AuthInfo(const rgw_user& acct_user,
              const std::string& acct_name,
@@ -606,6 +608,7 @@ public:
              const acct_privilege_t level,
              const std::string access_key_id,
              const std::string subuser,
+             const std::string keystone_user,
              const uint32_t acct_type=TYPE_NONE)
     : acct_user(acct_user),
       acct_name(acct_name),
@@ -613,7 +616,8 @@ public:
       is_admin(acct_privilege_t::IS_ADMIN_ACCT == level),
       acct_type(acct_type),
       access_key_id(access_key_id),
-      subuser(subuser) {
+      subuser(subuser),
+      keystone_user(keystone_user) {
     }
   };
 
index 7f3bd66a1b95cc0d25e78259403860c1792b8efb..4d610ff4b5b60f6441818fcd472dc36f5a9be2bb 100644 (file)
@@ -159,6 +159,7 @@ TokenEngine::get_creds_info(const TokenEngine::token_envelope_t& token
     level,
     rgw::auth::RemoteApplier::AuthInfo::NO_ACCESS_KEY,
     rgw::auth::RemoteApplier::AuthInfo::NO_SUBUSER,
+    token.get_user_name(),
     TYPE_KEYSTONE
 };
 }
@@ -665,6 +666,7 @@ EC2Engine::get_creds_info(const EC2Engine::token_envelope_t& token,
     level,
     access_key_id,
     rgw::auth::RemoteApplier::AuthInfo::NO_SUBUSER,
+    token.get_user_name(),
     TYPE_KEYSTONE
   };
 }
index 1b49b8e995c4e5a6d8a9bdefeb66eae7c2196d8f..98b05cc17dede0b45a39883679928ca59dbbd3dc 100644 (file)
@@ -6749,6 +6749,7 @@ rgw::auth::s3::LDAPEngine::get_creds_info(const rgw::RGWToken& token) const noex
     acct_privilege_t::IS_PLAIN_ACCT,
     rgw::auth::RemoteApplier::AuthInfo::NO_ACCESS_KEY,
     rgw::auth::RemoteApplier::AuthInfo::NO_SUBUSER,
+    rgw::auth::RemoteApplier::AuthInfo::NO_KEYSTONE_USER,
     TYPE_LDAP
   };
 }
@@ -6893,6 +6894,7 @@ rgw::auth::s3::STSEngine::get_creds_info(const STS::SessionToken& token) const n
     (token.is_admin) ? acct_privilege_t::IS_ADMIN_ACCT: acct_privilege_t::IS_PLAIN_ACCT,
     token.access_key_id,
     rgw::auth::RemoteApplier::AuthInfo::NO_SUBUSER,
+    rgw::auth::RemoteApplier::AuthInfo::NO_KEYSTONE_USER,
     token.acct_type
   };
 }