rgw: add support replication actions in policy#61962
Conversation
e54e364 to
504dcd1
Compare
|
jenkins test make check |
|
very cool my only concern is that this might break existing "user-mode" replication policies where the destination bucket relied on s3:PutObject. but you've only recently enabled the policy evaluation here, right? if we don't have to worry about existing reef/squid users, then a release note should suffice separately, objects that fail to sync due to these permission checks will still show |
right, I have added a release note for that.
true, the only thing I can think of is as of offloading perm check for the source object to the source zone (a3f40b4) we can perhaps update the attr if the permission was denied. this could also help to implement |
6d05089 to
a73e3fe
Compare
oh wow, i had no idea that aws requires that "Both source and destination buckets must have versioning enabled." |
maybe the requests from |
Yeah, I had a thread on Slack a while ago trying to discuss why AWS enforces this requirement and whether we should follow suit. Unfortunately, I can't retrieve messages older than 90 days in Slack. The general consensus seems to be that versioning helps maintain the immutability of the replicated objects. This can be useful in cases where replication lags behind and the replication policy changes in the meantime. For instance, if a policy initially specifies replicating objects with the prefix "A," but later changes to "B," objects with the prefix "A" that were uploaded earlier might not be replicated, as the new policy would be applied at the destination and it will get dropped, or if it was based on tags which here perhaps versioning can play a role. On the other hand, from an Object Storage perspective, Apparantly GCS doesn't require you to enable versioning (https://cloud.google.com/storage-transfer/docs/cross-bucket-replication - at least I couldn't find a link saying it's required) - so not sure if this should be something up to the user whether to enable or not. Some discussions around versioning required by AWS for replication:
|
This is already happening in the commit I mentioned (a3f40b4) 👍
yeah if you also agree, we can do so. but perhaps in another PR to make it separate. Although they have dependencies and perhaps new PR could be difficult as this one requires changes from #61828. |
thanks. i can definitely see why immutability helps with async replication. but rgw's default multisite replication for DR has to handle the non-versioned case anyway, so i can also see why Yehuda didn't impose that requirement on bucket replication policy. that said, it would make sad to need more rgw extensions like s3:GetObjectForReplication to make the feature sensible for rgw |
I didn't get this part, I have something like this in my mind: @@ -1100,7 +1108,17 @@ int RGWGetObj::verify_permission(optional_yield y)
if (has_s3_existing_tag || has_s3_resource_tag)
rgw_iam_add_objtags(this, s, has_s3_existing_tag, has_s3_resource_tag);
- if (get_torrent) {
+ // if it's system request and the identity is not the acl owner
+ // then we assume rgwx-uid was passed by the request and so it's a replication request.
+ bool is_replication_request = s->system_request && !s->identity->is_owner_of(s->owner);
+
+ if (is_replication_request) {
+ if (s->object->get_instance().empty()) {
+ action = rgw::IAM::s3GetObjectForReplication;
+ } else {
+ action = rgw::IAM::s3GetObjectVersionForReplication;
+ }
+ } else if (get_torrent) {
if (s->object->get_instance().empty()) {
action = rgw::IAM::s3GetObjectTorrent;
} else {
@@ -1115,7 +1133,18 @@ int RGWGetObj::verify_permission(optional_yield y)
}
if (!verify_object_permission(this, s, action)) {
- return -EACCES;
+ if (is_replication_request) {
+ // fallback to s3:GetObject(Version) if s3:GetObject(Version)ForReplication is not allowed
+ action = s->object->get_instance().empty() ? rgw::IAM::s3GetObject : rgw::IAM::s3GetObjectVersion;
+ if (!verify_object_permission(this, s, action)) {
+ // update the replication status of the object to FAILED
+ set_replication_status_header(this, s->object.get(), y, "FAILED");
+
+ return -EACCES;
+ }
+ } else {
+ return -EACCES;
+ }
}but why do we need to not return btw this only covers object fetching, the destination permissions are being evaluated by the destination zone so perhaps we can implement an API letting destination zones update the status on the source object. not sure how efficient this is going to be. |
sorry, the problem is here: https://github.com/ceph/ceph/blob/7211a69/src/rgw/rgw_process.cc#L226-L231 even if |
a49e8c0 to
16fe78a
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
16fe78a to
d8c5f1e
Compare
e7affff to
fcf4c8a
Compare
b26a7dd to
5a4deae
Compare
In case the uid has no permission to read tagging, the tags should not be replicated. Ref. https://docs.aws.amazon.com/AmazonS3/latest/userguide/setting-repl-config-perm-overview.html Signed-off-by: Seena Fallah <[email protected]>
To replicate objects encrypted via sse-kms objects, s3:GetObjectVersionForReplication is required. Signed-off-by: Seena Fallah <[email protected]>
Signed-off-by: Seena Fallah <[email protected]>
Signed-off-by: Seena Fallah <[email protected]>
Return `Rgwx-Perm-Checked` header as a hint for the destination zone to know whether the perms where considered or not. This is just a backward compatibility for upgrade and can be dropped in T+2 release. Signed-off-by: Seena Fallah <[email protected]>
Signed-off-by: Seena Fallah <[email protected]>
As of a3f40b4 we no longer evaluate perms locally for source bucket, this could cause broken permission evaluation dusring upgrade as one zone is not respecting the perm evaluation based on the `rgwx-perm-check-uid` arg. This can be dropped in T+2 release. Signed-off-by: Seena Fallah <[email protected]>
When copying object from remote source (bucket from another zonegroup) the perms of the source is not evaluated resulting in reading from unauthorized buckets. passing `rgwx-perm-check-uid` will let the source zone evaluates the perm and close this bug. Signed-off-by: Seena Fallah <[email protected]>
Make sure perms are evaluated properly for the source object. Signed-off-by: Seena Fallah <[email protected]>
In rgw_sync_pipe_params, the mode can be either system or user. When in system mode, no user is involved, but the current implementation holds an empty rgw_user, which can cause confusion in pipe_rules::find_basic_info_without_tags(). With this change, rgw_user is now optional, ensuring that when no user is involved, it is explicitly nullopt rather than an empty object. Signed-off-by: Seena Fallah <[email protected]>
As admin propery of a user is something global and nothing related to any other owner, we don't need any comparision. Signed-off-by: Seena Fallah <[email protected]>
If pipe is in user mode and the user is admin, don't check for perms and let it go. Signed-off-by: Seena Fallah <[email protected]>
Signed-off-by: Seena Fallah <[email protected]>
rely on s->system_request to skip rate limiting on forwarded requests as well as normal system user requests. Signed-off-by: Seena Fallah <[email protected]>
@cbodley - I'm just unsure about |
i thought the only purpose of |
right, thanks. as the token is passed by header, it will act like |
With the introduction of is_impersonating in SysReqApplier, RoleApplier can now use the same mechanism to mark when a request has been forwarded by a system user on behalf of another role (e.g., through STS) to mark it as a system request (s->system_request). Signed-off-by: Seena Fallah <[email protected]>
8084542 to
995dc62
Compare
|
|
jenkins test make check arm64 |
|
"utilize is_impersonating for forwarded sts requests" commit looks great |
|
Yay! 😍 |
|
tentacle backport bundled with #63043 |
when replicating objects, the destination bucket needs to have a policy accepting replication actions like
s3:ReplicateObject,s3:ReplicateDelete,s3:ReplicateTagsfor the given Role (for now we use the source bucket's owner uid) to allow the replication happen, otherwise it should reject replicating. https://docs.aws.amazon.com/AmazonS3/latest/userguide/setting-repl-config-perm-overview.htmlThis also closes the missing permission evaluation for delete and deletemarker replication.
Require: #61828Fixes: https://tracker.ceph.com/issues/70093