]> git.apps.os.sepia.ceph.com Git - ceph.git/log
ceph.git
15 months agomgr/dashboard: Move features to advanced section 56920/head
Afreen [Thu, 4 Apr 2024 07:41:11 +0000 (13:11 +0530)]
mgr/dashboard: Move features to advanced section

Fixes https://tracker.ceph.com/issues/65207

- Moves "features" section in rbd image create form to "Advanced" section.
- makes rbd configuration section to be expanded by default rather than
  being collapsed as it has only single section. This will improve user experience as it will not
require two clicks.
- updates e2e test

Signed-off-by: Afreen <afreen23.git@gmail.com>
(cherry picked from commit 921a5249fd1b1b2828d055bc92abf2fa428875ce)

15 months agoMerge pull request #56675 from kchheda3/wip-64954-squid
Casey Bodley [Mon, 15 Apr 2024 22:29:21 +0000 (23:29 +0100)]
Merge pull request #56675 from kchheda3/wip-64954-squid

squid: rgw/notification: Fix the notification FilterRule to emit unique key name in json & Log successful delivery of notification event.

Reviewed-by: Yuval Lifshitz <ylifshit@ibm.com>
15 months agoMerge pull request #56720 from ivancich/wip-65339-squid
Casey Bodley [Mon, 15 Apr 2024 22:28:56 +0000 (23:28 +0100)]
Merge pull request #56720 from ivancich/wip-65339-squid

squid: rgw: update options yaml file so LDAP uri isn't an invalid example

Reviewed-by: Casey Bodley <cbodley@redhat.com>
15 months agoMerge pull request #56822 from cbodley/wip-65412-squid
Casey Bodley [Mon, 15 Apr 2024 22:28:18 +0000 (23:28 +0100)]
Merge pull request #56822 from cbodley/wip-65412-squid

squid: rgw/multisite: x-rgw-replicated-at uses dump_time_header()

Reviewed-by: Shilpa Jagannath <smanjara@redhat.com>
15 months agoMerge pull request #56863 from cbodley/wip-65467-squid
Casey Bodley [Mon, 15 Apr 2024 15:48:00 +0000 (16:48 +0100)]
Merge pull request #56863 from cbodley/wip-65467-squid

squid: rgw: user accounts implementation

Reviewed-by: Shilpa Jagannath <smanjara@redhat.com>
15 months agoMerge pull request #56881 from rhcs-dashboard/wip-65465-squid
Ivo Almeida [Mon, 15 Apr 2024 14:39:21 +0000 (15:39 +0100)]
Merge pull request #56881 from rhcs-dashboard/wip-65465-squid

squid: mgr/dashboard: snapshot schedule repeat frequency validation

Reviewed-by: afreen23 <NOT@FOUND>
15 months agoMerge pull request #56861 from rhcs-dashboard/wip-65458-squid
Ivo Almeida [Mon, 15 Apr 2024 08:13:07 +0000 (09:13 +0100)]
Merge pull request #56861 from rhcs-dashboard/wip-65458-squid

squid: mgr/dashboard: fix snap schedule delete retention

Reviewed-by: afreen23 <NOT@FOUND>
15 months agomgr/dashboard: fix repeat frequency validation 56881/head
Ivo Almeida [Tue, 19 Mar 2024 12:44:40 +0000 (12:44 +0000)]
mgr/dashboard: fix repeat frequency validation

Fixed snap schedule repeat frequency validation

Fixes: https://tracker.ceph.com/issues/64980
Signed-off-by: Ivo Almeida <ialmeida@redhat.com>
(cherry picked from commit 92b40f91c07086406103c865af7c645b99d43806)

15 months agoMerge pull request #56871 from zdover23/wip-doc-2024-04-14-backport-56870-to-squid
Anthony D'Atri [Sat, 13 Apr 2024 21:50:59 +0000 (17:50 -0400)]
Merge pull request #56871 from zdover23/wip-doc-2024-04-14-backport-56870-to-squid

squid: doc/cephfs: disambiguate "Reporting Free Space"

15 months agodoc/cephfs: disambiguate "Reporting Free Space" 56871/head
Zac Dover [Sat, 13 Apr 2024 10:48:21 +0000 (20:48 +1000)]
doc/cephfs: disambiguate "Reporting Free Space"

Make a few sentences clearer in doc/cephfs/ceph-auth.rst.

Co-authored-by: Anthony D'Atri <anthony.datri@gmail.com>
Signed-off-by: Zac Dover <zac.dover@proton.me>
(cherry picked from commit 788ccff18149b16cb01947c5bcf3bde380090df0)

15 months agotest/rgw/pubsub: wait_for_queue_to_drain() supports tenant/account topics 56863/head
Casey Bodley [Thu, 11 Apr 2024 19:52:26 +0000 (15:52 -0400)]
test/rgw/pubsub: wait_for_queue_to_drain() supports tenant/account topics

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 400728481e2ba446ac2300565129a4ed55cf63b1)

15 months agoqa/rgw/s3tests: remove 'client.0' from bucket prefix
Casey Bodley [Thu, 4 Apr 2024 17:25:23 +0000 (13:25 -0400)]
qa/rgw/s3tests: remove 'client.0' from bucket prefix

new sns test cases are using this for topic names, but the '.' is not
allowed there:

> api_params = {'Name': 'test-client.0-n3bdgre5el2jk8v-606'}
> botocore.exceptions.ClientError: An error occurred (InvalidArgument) when calling the CreateTopic operation: Name must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 39a2af56d78dd1949434c36367d780cc5f91fe30)

15 months agorgw/notify: populate event userIdentity with account ids
Casey Bodley [Thu, 4 Apr 2024 13:28:00 +0000 (09:28 -0400)]
rgw/notify: populate event userIdentity with account ids

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 24841fbddec68199bbe6cfcc9dc1d2bbc1d84e52)

15 months agotest/rgw/pubsub: test persistent notifications with account user
Casey Bodley [Wed, 3 Apr 2024 22:21:20 +0000 (18:21 -0400)]
test/rgw/pubsub: test persistent notifications with account user

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 43ca67b3d88d900abd6aaa52e84d46d212a936c6)

15 months agorgw/notify: support cross-tenant and cross-account notifications
Casey Bodley [Wed, 3 Apr 2024 20:23:53 +0000 (16:23 -0400)]
rgw/notify: support cross-tenant and cross-account notifications

a bucket's notification configuration may refer to topics from several
different tenants or accounts. when publishing to a given topic, look in
the correct namespace for each topic instead of defaulting to the
requesting user's tenant namespace

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 3a5af5fdfe138f1de385f7637d04398606be4eca)

15 months agorgw/pubsub: forward requests as s->owner instead of s->user
Casey Bodley [Thu, 28 Mar 2024 19:26:10 +0000 (15:26 -0400)]
rgw/pubsub: forward requests as s->owner instead of s->user

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 63e164f4d22999dcdeb34bbe8c879f1b70055def)

15 months agorgw/notify: publish functions use rgw_pubsub_dest::persistent_queue
Casey Bodley [Thu, 28 Mar 2024 17:29:37 +0000 (13:29 -0400)]
rgw/notify: publish functions use rgw_pubsub_dest::persistent_queue

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 64ac1de01f7f26c7af3da481ec522ca7dd188c55)

15 months agodoc/rgw: warn about topics under account migration
Casey Bodley [Wed, 20 Mar 2024 18:43:21 +0000 (14:43 -0400)]
doc/rgw: warn about topics under account migration

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit bfae83c86532eef6041d6d07acb47c02739b8748)

15 months agorgw/pubsub: use rgw_pubsub_dest::persistent_queue for queue oid
Casey Bodley [Wed, 20 Mar 2024 18:16:15 +0000 (14:16 -0400)]
rgw/pubsub: use rgw_pubsub_dest::persistent_queue for queue oid

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 4bac81a2bc540b110003b7e5a86c8670ea2a2cc8)

15 months agorgw/pubsub: RGWPubSub::remove_topic() removes persistent queue
Casey Bodley [Wed, 20 Mar 2024 18:14:29 +0000 (14:14 -0400)]
rgw/pubsub: RGWPubSub::remove_topic() removes persistent queue

move the persistent queue removal into remove_topic() where we have
access to the topic metadata. avoid trying to remove the queue if it
isn't enabled

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 4c50ad69c37110d42f1f68f6e567cdf5ac506a32)

15 months agorgw/pubsub: rgw_pubsub_dest stores persistent queue oid
Casey Bodley [Wed, 20 Mar 2024 17:57:21 +0000 (13:57 -0400)]
rgw/pubsub: rgw_pubsub_dest stores persistent queue oid

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 3ef1ab3de225a472a37e84d3e8abb6fbfcaddaa2)

15 months agorgw/pubsub: add/remove_persistent_topic() takes topic queue, not name
Casey Bodley [Wed, 20 Mar 2024 17:56:25 +0000 (13:56 -0400)]
rgw/pubsub: add/remove_persistent_topic() takes topic queue, not name

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit ba2566a5fee05d5ab75210f6b2ba0dc6bf683256)

15 months agotest/rgw/pubsub: topic policy doesn't deny access to owner
Casey Bodley [Mon, 18 Mar 2024 14:09:19 +0000 (10:09 -0400)]
test/rgw/pubsub: topic policy doesn't deny access to owner

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit a75c3ac8c19870ea58bd195893fdda519106bbf7)

15 months agorgw/pubsub: CreateTopic consults existing topic policy for overwrite
Casey Bodley [Fri, 15 Mar 2024 13:51:36 +0000 (09:51 -0400)]
rgw/pubsub: CreateTopic consults existing topic policy for overwrite

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 9b6fe4ac53fb2a1edf190f271c24a2ff9e0442c9)

15 months agorgw/pubsub: fix DeleteTopic permissions
Casey Bodley [Thu, 14 Mar 2024 19:25:02 +0000 (15:25 -0400)]
rgw/pubsub: fix DeleteTopic permissions

non-account users now consult identity policies with
verify_user_permission() when the topic doesn't exist

account users now consult topic policy when it does exist

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 4568b7a0c74404e0d21fcd221070530684de5066)

15 months agorgw/pubsub: CreateTopic consults identity policies when topic doesn't exist
Casey Bodley [Thu, 14 Mar 2024 19:23:12 +0000 (15:23 -0400)]
rgw/pubsub: CreateTopic consults identity policies when topic doesn't exist

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 8896b227226fad92d280e72cd08210685dd445af)

15 months agorgw/pubsub: CreateTopic requires notification_v2 for accounts
Casey Bodley [Thu, 14 Mar 2024 16:04:08 +0000 (12:04 -0400)]
rgw/pubsub: CreateTopic requires notification_v2 for accounts

the account's topic index is only updated by writes/deletes to v2 topic
metadata

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 7d5b826a4acfbc1df6400b8df990ebfed2c64666)

15 months agorgw/pubsub: avoid allocating hash set of strings for attr search
Casey Bodley [Thu, 14 Mar 2024 15:27:55 +0000 (11:27 -0400)]
rgw/pubsub: avoid allocating hash set of strings for attr search

this unordered_set was not static, so we reinitialized it on every call

replace with a constexpr array of string_views so we can search through
sequential memory that's laid out at compile time

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 70fc1eae8f5492dd30a650d25c3fe03c29a60426)

15 months agorgw/pubsub: add ERR_AUTHORIZATION -> AuthorizationError
Casey Bodley [Tue, 12 Mar 2024 23:05:13 +0000 (19:05 -0400)]
rgw/pubsub: add ERR_AUTHORIZATION -> AuthorizationError

sns docs specify AuthorizationError as the 403 error code rather than
s3's AccessDenied:

    https://docs.aws.amazon.com/sns/latest/api/API_CreateTopic.html#API_CreateTopic_Errors

boto3 sns clients can catch this as AuthorizationErrorException

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit b5d5c55b5440fef27a63f43ea1e431ff2a4393d7)

15 months agorgw/pubsub: return 404 NotFound instead of NoSuchKey
Casey Bodley [Tue, 12 Mar 2024 20:26:44 +0000 (16:26 -0400)]
rgw/pubsub: return 404 NotFound instead of NoSuchKey

repurpose the ERR_NOT_FOUND define which was otherwise unused to
customize the error response for sns apis, which return the NotFound
error code instead of NoSuchKey from s3:

    https://docs.aws.amazon.com/sns/latest/api/API_GetTopicAttributes.html#API_GetTopicAttributes_Errors

this allows boto3 sns clients to catch the NotFoundException as expected

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 2cdddad82ecfc80e03a0b6269eee5981ab5b76f0)

15 months agorgw/pubsub: notifications can refer to topics in other accounts/tenants
Casey Bodley [Tue, 12 Mar 2024 23:08:50 +0000 (19:08 -0400)]
rgw/pubsub: notifications can refer to topics in other accounts/tenants

accounts can use topic policy to grant sns:Publish permissions to other
accounts. the PutBucketNotification op should expect TopicArns from
other accounts. the account name from each TopicArn should be used as
the 'tenant' argument for RGWPubSub's constructor so we look for the
topic in the right namespace

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit a72975821fe36b411982346254a33771f97abb26)

15 months agorgw/pubsub: customize permissions for account users
Casey Bodley [Tue, 12 Mar 2024 22:57:54 +0000 (18:57 -0400)]
rgw/pubsub: customize permissions for account users

for account users, CreateTopic and ListTopics permissions come from
identity policy alone, ignoring the ownership/policy of existing topics

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 5f64631630765a2130249b23bd54de7d46ce0900)

15 months agorgw/pubsub: when present, use account id instead of tenant
Casey Bodley [Tue, 12 Mar 2024 20:25:58 +0000 (16:25 -0400)]
rgw/pubsub: when present, use account id instead of tenant

RGWPubSub provides topic namespace isolation for tenants by adding
prefixes to rados object names and topic metadata keys. accounts use
this the same way

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit e5f5679616af66044f7f952d7762ac6ab06bdf50)

15 months agorgw/rados: add index for account topics
Casey Bodley [Tue, 12 Mar 2024 19:34:44 +0000 (15:34 -0400)]
rgw/rados: add index for account topics

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 47a18487b27064b7b19e60a6bc1647cbec65a043)

15 months agorgw/pubsub: verify_topic_permission handles cross-account access
Casey Bodley [Sat, 9 Mar 2024 16:09:41 +0000 (11:09 -0500)]
rgw/pubsub: verify_topic_permission handles cross-account access

refactor verify_topic_owner_or_policy() to share the same interface
as similar functions like verify_user/bucket/object_permission()
from rgw_common.cc

in addition to the topic resource policy, this now also consults iam
identity policies like user, group, or role policy

for account users, this now implements cross-account policy evaluation.
this only comes into play for sns:Publish permissions though, because
the topics themselves are scoped to the account

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 86da5739e10b0b1665e5f0b9f375df24b12cc449)

15 months agorgw/auth: rgw_common.h exposes evaluate_iam_policies()
Casey Bodley [Sat, 9 Mar 2024 16:05:10 +0000 (11:05 -0500)]
rgw/auth: rgw_common.h exposes evaluate_iam_policies()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 851161166be710ed7dd85c04e6378dcabb4ef92f)

15 months agorgw/pubsub: do init/validation in init_processing()
Casey Bodley [Sat, 9 Mar 2024 16:08:17 +0000 (11:08 -0500)]
rgw/pubsub: do init/validation in init_processing()

verify_permission() should do permission checks and nothing else!

admin/system users ignore errors from verify_permission() and go on to
call execute() regardless. that means that execute() can't rely on any
initialization that happened during verify_permission(), at risk of
crashing on admin/system requests. it also means that any permission
checks in execute() won't get overridden for admin/system users,
breaking their superuser access

by moving all parameter validation and initialization into
init_processing(), we can prepare all the state that verify_permission()
will need to do it's thing

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 88a35fed3507e37ad191995b014cbd5b089280d0)

15 months agorgw/pubsub: replace log messages with error response
Casey Bodley [Tue, 12 Mar 2024 15:05:11 +0000 (11:05 -0400)]
rgw/pubsub: replace log messages with error response

parameter validation errors should be returned to the client instead of
written to the rgw log

also raises the log level for lots of error messages. very few of them
should require admin attention

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 6fe68c58932b6cda6180be91e8a1b5b465e74711)

15 months agorgw/pubsub: use existing s->bucket for notification ops
Casey Bodley [Tue, 12 Mar 2024 16:46:40 +0000 (12:46 -0400)]
rgw/pubsub: use existing s->bucket for notification ops

s->bucket is already initialized during rgw_build_bucket_policies(),
called from RGWHandler::do_init_permissions()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 537a87d7ae7c88aa4be077d236e74f6e3094b599)

15 months agorgw/pubsub: make v2-specific calls private
Casey Bodley [Fri, 8 Mar 2024 20:01:08 +0000 (15:01 -0500)]
rgw/pubsub: make v2-specific calls private

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 0d61382f4fd52e2e76ab8c02f905c2fb7367c31d)

15 months agoPendingReleaseNotes: announce the rgw user account feature
Casey Bodley [Fri, 15 Mar 2024 14:36:46 +0000 (10:36 -0400)]
PendingReleaseNotes: announce the rgw user account feature

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 339981f8b3b9ce6abf5ccb73fcddc222b1a4228d)

15 months agorgw: reject user tenant that looks like an account id
Casey Bodley [Tue, 12 Mar 2024 22:53:05 +0000 (18:53 -0400)]
rgw: reject user tenant that looks like an account id

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 4180724b5a38d560cddfb6cf04b0baa23915e4a6)

15 months agorgw/auth: log each policy that returns Allow or Deny
Casey Bodley [Wed, 6 Mar 2024 23:37:37 +0000 (18:37 -0500)]
rgw/auth: log each policy that returns Allow or Deny

makes it much easier to debug authorization issues when you can see
exactly which policies led to success/failure

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 9057e70d60bf3c22845f2b5e38a2a2633dfbb322)

15 months agorgw/admin: 'user modify' won't change existing account id
Casey Bodley [Wed, 6 Mar 2024 22:43:02 +0000 (17:43 -0500)]
rgw/admin: 'user modify' won't change existing account id

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 750d2d69992fa6fc02d4b7497b5469daa7158ed5)

15 months agorgw/admin: user list accepts --account-id or -name
Casey Bodley [Wed, 6 Mar 2024 22:13:48 +0000 (17:13 -0500)]
rgw/admin: user list accepts --account-id or -name

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 664151ef3866aa95cd1f8a5cbf30856809a4f282)

15 months agorgw: link account root to account user index
Casey Bodley [Tue, 5 Mar 2024 19:28:41 +0000 (14:28 -0500)]
rgw: link account root to account user index

account root users were not linked to the account's user index because
they're not visible to iam apis like ListUsers

but now that 'account rm' is prevented from deleting the account while
users are still present, we want account root users to prevent deletion
too

add root users back to the account user index, but filter them out of
the iam user apis

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit b60335997266932f0a2c26fefc128732c66551a1)

15 months agorgw/auth: expose Identity::get_account()
Casey Bodley [Tue, 5 Mar 2024 18:57:09 +0000 (13:57 -0500)]
rgw/auth: expose Identity::get_account()

now that all identities store an optional account, expose that to the
rest of rgw with get_account(). this cleans up lots of code that
otherwise has to deal with the rgw_owner variant

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 405f93305f0d630a784b2de18a5f263b37362434)

15 months agorgw: validate account user names
Casey Bodley [Mon, 4 Mar 2024 21:46:52 +0000 (16:46 -0500)]
rgw: validate account user names

iam apis have specific requirements for the UserName field. enforce
these requirements for 'user create' and 'user modify' admin ops for
account users

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 119a768ddf6f865d94775bf813c9fa5a25c58956)

15 months agorgw/auth: add account_id and role_id to ops log
Casey Bodley [Thu, 29 Feb 2024 16:12:51 +0000 (11:12 -0500)]
rgw/auth: add account_id and role_id to ops log

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 272a7660ca4ed9b535aaf4607aeaaa46a20e75c7)

15 months agorgw/auth: object ops use new verify_bucket_permission() overload
Casey Bodley [Fri, 1 Mar 2024 14:36:31 +0000 (09:36 -0500)]
rgw/auth: object ops use new verify_bucket_permission() overload

several object operations like PutObject, DeleteObject, etc were handling
policy evaluation manually instead of using the helper functions like
verify_user/bucket/object_permission(), so were missing the cross-policy
evaluation rules for account users

these now call the new 'custom arn' overload of verify_bucket_permission()
for equivalent functionality

the eval_identity_or_session_policies() function is no longer exposed by
rgw_common.h to prevent other ops from adding new logic that doesn't
handle cross-account access

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 315ded47868de276de644315767d9ea2fab9c845)

15 months agorgw/auth: add verify_bucket_permission() overload for custom arn
Casey Bodley [Fri, 1 Mar 2024 00:34:05 +0000 (19:34 -0500)]
rgw/auth: add verify_bucket_permission() overload for custom arn

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 071e89b506437da511538c23ebee0d37c5d37745)

15 months agorgw/auth: WebIdentityApplier doesn't create shadow users for account roles
Casey Bodley [Thu, 29 Feb 2024 18:14:57 +0000 (13:14 -0500)]
rgw/auth: WebIdentityApplier doesn't create shadow users for account roles

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 07cdc65579d8c60399cdde73fddc26c36190fcde)

15 months agorgw/auth: pass user policies into identities
Casey Bodley [Mon, 4 Mar 2024 21:10:17 +0000 (16:10 -0500)]
rgw/auth: pass user policies into identities

loading user policies in rgw_build_bucket_policies() doesn't work for
PostObj requests because we haven't authenticated yet at that point

instead, auth engines load/parse policies when they load the user info.
policies are passed into the auth identities and applied to req_state
via modify_request_state() similar to how RoleApplier handles role
policy

this also moves the load_iam_identity_policies() into rgw_auth.cc for
use by transform_old_authinfo()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 582970a69399d989370bb1ced6e42de724509622)

15 months agorgw/auth: auth engines pass optional account info into identities
Casey Bodley [Thu, 29 Feb 2024 15:56:21 +0000 (10:56 -0500)]
rgw/auth: auth engines pass optional account info into identities

the auth identities need the RGWAccountInfo instead of just the account
id so they can fill in the correct ACLOwner::display_name

this also adds account ownership support to WebIdentityApplier for
AssumeRoleWithWebIdentity

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 8e839ef4be0617b0b881c4ec476c31ec260c5157)

15 months agorgw/rados: load attrs with RadosUser
Casey Bodley [Fri, 1 Mar 2024 17:59:29 +0000 (12:59 -0500)]
rgw/rados: load attrs with RadosUser

when auth looks up a user by key, that should also initialize the user's
attrs so we don't have to load them separately

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit ca69e6879358f781fab7bdbcdcbe3e49fdaee81a)

15 months agorgw: make user email matching case-insensitive
Casey Bodley [Sun, 25 Feb 2024 15:04:44 +0000 (10:04 -0500)]
rgw: make user email matching case-insensitive

handle user emails the same way we do account account emails. store
RGWUserInfo::user_email exactly as the user specified it, but convert
the object name to lower-case for case-insensitive matching

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 947390a342208a8348b030a179bc723d866c0104)

15 months agorgw: deny 'account rm' if not empty
Casey Bodley [Sat, 24 Feb 2024 21:32:53 +0000 (16:32 -0500)]
rgw: deny 'account rm' if not empty

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit a4a3cf07cc7eacfdac9870c3b2bb6545b58b3603)

15 months agoqa/rgw: configure sts for all suites that run s3tests
Casey Bodley [Sat, 24 Feb 2024 15:43:14 +0000 (10:43 -0500)]
qa/rgw: configure sts for all suites that run s3tests

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit d853d6dbb939aa5d71ee9dfdee3c47f04a05e27c)

15 months agorgw/iam: Policy takes optional tenant name
Casey Bodley [Thu, 22 Feb 2024 18:16:00 +0000 (13:16 -0500)]
rgw/iam: Policy takes optional tenant name

the iam policy parser takes a tenant string to reject Resource ARNs that
specify resources in other tenants, and prevent wildcards from applying
to other tenants

this is problematic for account users, because cross-account access requires
an identity policy that covers another account's resource. it's the
cross-policy evaluation rules that prevent that from granting access to
things it shouldn't. so for account users, pass a null tenant string to
allow all resource arns

for resource policies, this restriction is unnecessary in the first
place, because the resource policy can only match itself as the resource

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 7d99cbdd09bcad81619b1c4770a663fde2b30563)

15 months agorgw/auth: replace uses of verify_bucket_owner_or_policy()
Casey Bodley [Wed, 21 Feb 2024 23:51:44 +0000 (18:51 -0500)]
rgw/auth: replace uses of verify_bucket_owner_or_policy()

all of the s3 actions that we call verify_bucket_owner_or_policy() for
are already covered by rgw::IAM::op_to_perm(), which maps actions to
acl permissions like RGW_PERM_READ, RGW_PERM_WRITE_ACP etc

that means we can call verify_bucket_permission() as most other bucket
ops do, and rely on its call to verify_bucket_permission_no_policy() to
find the owner's acl grant

i also hadn't implemented the cross-account rules for
verify_bucket_owner_or_policy() yet, and didn't want to

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit b021d0f2f133da6ac9e5972b481094d86802e979)

15 months agorgw/auth: RoleApplier matches paths in role arns
Casey Bodley [Wed, 21 Feb 2024 22:48:20 +0000 (17:48 -0500)]
rgw/auth: RoleApplier matches paths in role arns

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 731bdbc150967bf77a6649d084f0e9a74e6df65b)

15 months agorgw/auth: RoleApplier matches account principals
Casey Bodley [Wed, 21 Feb 2024 20:55:09 +0000 (15:55 -0500)]
rgw/auth: RoleApplier matches account principals

account principals of the form ``arn:aws:iam::123456789012:root``
or ``123456789012`` delegate authority to the account, which means that
it applies to all of the account's users and roles

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit b824bed2a89c31898fbcf772bcbfd326937f7dab)

15 months agorgw/acl: always fill in DisplayName for account owners/grants
Casey Bodley [Wed, 21 Feb 2024 19:04:43 +0000 (14:04 -0500)]
rgw/acl: always fill in DisplayName for account owners/grants

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 1a1f3a0b94e575981cb568c4f8db2f383ab5314f)

15 months agorgw/auth: AssumeRole uses role account as owner
Casey Bodley [Tue, 20 Feb 2024 22:46:06 +0000 (17:46 -0500)]
rgw/auth: AssumeRole uses role account as owner

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit aeecbe14d00cb0da974ff1f5e5505ca220fecd3d)

15 months agorgw/iam: fix DeleteRolePolicyResponse
Casey Bodley [Sun, 18 Feb 2024 14:16:06 +0000 (09:16 -0500)]
rgw/iam: fix DeleteRolePolicyResponse

should only be written on success

was misspelled as DeleteRolePoliciesResponse which boto doesn't like:

botocore.parsers.ResponseParserError: Unable to parse response (junk after document element: line 1, column 159), invalid XML received. Further retries may su
cceed:
b'<DeleteRolePoliciesResponse><ResponseMetadata><RequestId>tx0000082c62511b240fd3d-0065d20f66-4129-a2</RequestId></ResponseMetadata></DeleteRolePoliciesResponse><?xml version="1.0" encoding="UTF-8"?><ErrorResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/"><Error><Code>NoSuchEntity</Code><Message>The requested PolicyName was not found</Message><RequestId>tx0000082c62511b240fd3d-0065d20f66-4129-a2</RequestId><HostId>4129-a2-a</HostId></Error></ErrorResponse>'

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 27b97b81470911d6fdde7378dfb6c0d0ce927a33)

15 months agotest/rgw/multisite: test sync of iam-related metadata
Casey Bodley [Fri, 16 Feb 2024 15:36:21 +0000 (10:36 -0500)]
test/rgw/multisite: test sync of iam-related metadata

use boto3 for iam connection

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 3e99f4b4520a9e1c5452d3b95ec85a84fc0d940a)

15 months agorgw: forward_to_master() passes rgw_owner for effective uid header
Casey Bodley [Mon, 19 Feb 2024 22:31:55 +0000 (17:31 -0500)]
rgw: forward_to_master() passes rgw_owner for effective uid header

when s3 requests get forwarded to the master zone in multisite, we sign
them as the multisite system user because we need to extend the s3
protocol. for example, CreateBucket requests issues by a system user
include an extra response body that encodes the RGWBucketInfo. this way,
the secondary zone can recreate exactly the same bucket that the master
zone did

these forwarded requests include a header like "rgwx-uid: myuserid" to
request that the system user impersonate the given uid. this isn't
necessary for authorization, because the system user overrides
permission checks already. but it's important for resource ownership -
the result of a forwarded CreateBucket request should be a bucket owned
by "myuserid", not the system user

because this "rgwx-uid" header is concerned with ownership, we pass the
string encoding of rgw_owner instead of rgw_user. on the receiving side,
we parse this header in SysReqApplier and override get_aclowner() to
expose it

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 8d50f6103ff481a6ef4bf7c894e1d4329eefcf49)

15 months agorgw/iam: RGWRoleMetadataHandler creates with exclusive=false
Casey Bodley [Sat, 17 Feb 2024 22:58:11 +0000 (17:58 -0500)]
rgw/iam: RGWRoleMetadataHandler creates with exclusive=false

metadata sync needs to be able to overwrite existing role metadata

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 1c3f201af21b526b1295d57bf344bf1b0a73c257)

15 months agorgw/iam: only RGWDeleteRole returns ERR_DELETE_CONFLICT
Casey Bodley [Sat, 17 Feb 2024 22:53:21 +0000 (17:53 -0500)]
rgw/iam: only RGWDeleteRole returns ERR_DELETE_CONFLICT

metadata sync calls RadosRole::delete_obj() after the role is deleted on
the metadata master zone. the role was verified to be empty there, so
metadata sync needs to delete the role anyway

only the iam DeleteRole api should require policies to be removed first

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 51d36c3f60f77f9c2c32d4764ad66c90df67bacd)

15 months agorgw/iam: use retry_raced_role_write() for Role apis
Casey Bodley [Sat, 17 Feb 2024 19:51:11 +0000 (14:51 -0500)]
rgw/iam: use retry_raced_role_write() for Role apis

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 03c30e3e25ca8ec288a01ed4a12e2b5c4226ef67)

15 months agorgw/iam: UserPolicy apis use forward_iam_request_to_master()
Casey Bodley [Sat, 17 Feb 2024 17:48:32 +0000 (12:48 -0500)]
rgw/iam: UserPolicy apis use forward_iam_request_to_master()

fix signature mismatch errors when PutUserPolicy/DeleteUserPolicy are
forwarded in multisite

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 02b90ad3ca7e93ad193483c69adf79539e720a56)

15 months agorgw/iam: use retry_raced_user_write() for User/AccessKey apis
Casey Bodley [Sat, 17 Feb 2024 16:42:12 +0000 (11:42 -0500)]
rgw/iam: use retry_raced_user_write() for User/AccessKey apis

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 91c0a628f0aadd99ae5edb10ba69d2c2bcf29cd1)

15 months agorgw/role: use CreateDate from forwarded CreateRole response
Casey Bodley [Thu, 15 Feb 2024 23:53:16 +0000 (18:53 -0500)]
rgw/role: use CreateDate from forwarded CreateRole response

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 53c4339d7d877d6cbe863a59f0d0dab096e30707)

15 months agorgw: 'user stats' redirects to 'account stats'
Casey Bodley [Thu, 15 Feb 2024 20:00:43 +0000 (15:00 -0500)]
rgw: 'user stats' redirects to 'account stats'

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 333620c8f9ce1e3394e4a7c0d1274601d69dd943)

15 months agorgw: bucket list --uid redirects to account buckets
Casey Bodley [Thu, 15 Feb 2024 19:59:54 +0000 (14:59 -0500)]
rgw: bucket list --uid redirects to account buckets

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 5569f381c7917f7ef139e76559696a5b23c6bf32)

15 months agodoc/radosgw: add awscli examples
Casey Bodley [Wed, 7 Feb 2024 14:44:18 +0000 (09:44 -0500)]
doc/radosgw: add awscli examples

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 9b3d18917dcb0375371a603b71aa95e525650137)

15 months agodoc/radosgw: document iam managed policies
Casey Bodley [Fri, 2 Feb 2024 17:47:22 +0000 (12:47 -0500)]
doc/radosgw: document iam managed policies

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit be4ba49ee6e8667db2c6ef499ae3f6c23f058ff6)

15 months agodoc/radosgw: start on iam/account docs
Casey Bodley [Wed, 20 Dec 2023 03:11:05 +0000 (22:11 -0500)]
doc/radosgw: start on iam/account docs

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 019f1a83cbcf08b2ba3894ef6d64a14146ba6293)

15 months agorgw/iam: load and evaluate group policies
Casey Bodley [Sun, 11 Feb 2024 17:24:05 +0000 (12:24 -0500)]
rgw/iam: load and evaluate group policies

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit f660d8b48a2b773e11c2e72a122d1255a889749d)

15 months agorgw: rename iam_user_policies to iam_identity_policies
Casey Bodley [Sun, 11 Feb 2024 17:29:44 +0000 (12:29 -0500)]
rgw: rename iam_user_policies to iam_identity_policies

identity policies can come from iam groups and roles too

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 27fb7178509e1fb8dde132044a0446149ccb6e17)

15 months agorgw/iam: add Group/GroupPolicy APIs
Casey Bodley [Sun, 11 Feb 2024 17:21:45 +0000 (12:21 -0500)]
rgw/iam: add Group/GroupPolicy APIs

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 386276ed00e3619e119bdd18d6fe20b656d2f05d)

15 months agorgw/iam: ListUserPolicies supports Marker/MaxItems
Casey Bodley [Sun, 11 Feb 2024 17:17:14 +0000 (12:17 -0500)]
rgw/iam: ListUserPolicies supports Marker/MaxItems

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 6284745661f25c6db0ba5077237c035002153948)

15 months agorgw/sal: add backend interfaces for group metadata
Casey Bodley [Sun, 11 Feb 2024 17:15:41 +0000 (12:15 -0500)]
rgw/sal: add backend interfaces for group metadata

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 3683a4097fc42f514c5310fc2078d7ef8e0561eb)

15 months agorgw: add struct RGWGroupInfo
Casey Bodley [Fri, 9 Feb 2024 23:05:21 +0000 (18:05 -0500)]
rgw: add struct RGWGroupInfo

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit b0a1fd07ba27ef93e50571ba5dae9abad6c6db72)

15 months agorgw/iam: OpenIDConnectProvider apis support account users
Casey Bodley [Tue, 6 Feb 2024 22:54:12 +0000 (17:54 -0500)]
rgw/iam: OpenIDConnectProvider apis support account users

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 0a28af9f433b39c99d7343c3cc73ee4862036c70)

15 months agorgw/sal: remove virtual class RGWOIDCProvider
Casey Bodley [Tue, 6 Feb 2024 14:32:27 +0000 (09:32 -0500)]
rgw/sal: remove virtual class RGWOIDCProvider

class RGWOIDCProvider was doing a lot of different things, so i've split
out its responsibilities:

* move data members and encoding into new struct RGWOIDCProviderInfo,
  and add ceph-dencoder hooks for regression testing
* remove RGWOIDCProvider class and add load/store/delete/list functions
  to the sal::Driver interface
* rgw_rest_oidc_provider.cc handles most of the parameter validation,
  ARN parsing, and json formatting

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 8c328aa1c7d0f4b934daa08f5361a2fe83d091a6)

15 months agorgw/iam: refactor OIDC ops
Casey Bodley [Mon, 5 Feb 2024 22:49:42 +0000 (17:49 -0500)]
rgw/iam: refactor OIDC ops

rearrange the RGWRESTOp subclasses so that the base RGWRestOIDCProvider
can provide a simple verify_permission() that works the same for all
derived ops

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit fcbc684e44abc0b336682a8f1d3b2ed072a9a359)

15 months agovstart/rgw: add account users for s3-tests
Casey Bodley [Tue, 30 Jan 2024 20:04:37 +0000 (15:04 -0500)]
vstart/rgw: add account users for s3-tests

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit d704540d630f6a8b1e1287e9593139661d95164d)

15 months agoradosgw-admin: add commands for managed policy
Casey Bodley [Mon, 5 Feb 2024 18:57:16 +0000 (13:57 -0500)]
radosgw-admin: add commands for managed policy

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 93522666a0d0ea6f6840107254344fcdf3d89dfc)

15 months agorgw/iam: AttachRolePolicy adds managed role policy
Casey Bodley [Fri, 2 Feb 2024 15:53:14 +0000 (10:53 -0500)]
rgw/iam: AttachRolePolicy adds managed role policy

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 390cdaa45ee923dde2de3e5b8077537c741fe5d9)

15 months agorgw/iam: AttachUserPolicy adds managed user policy
Casey Bodley [Thu, 1 Feb 2024 22:41:08 +0000 (17:41 -0500)]
rgw/iam: AttachUserPolicy adds managed user policy

implement iam apis AttachUserPolicy, DetachUserPolicy, and
ListAttachedUserPolicies to manipulate managed user policy

the set of managed policy ARNs is stored in the user attr
RGW_ATTR_MANAGED_POLICY

for incoming requests, the policies from RGW_ATTR_MANAGED_POLICY are
added to s->iam_user_policies at the same time as RGW_ATTR_USER_POLICY

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit bf64bc624dff5200964cd9763a4d6466edfe07e7)

15 months agorgw/iam: add get_managed_policy() factory function
Casey Bodley [Thu, 1 Feb 2024 19:58:22 +0000 (14:58 -0500)]
rgw/iam: add get_managed_policy() factory function

add definitions for the following managed policy ARNs:

* arn:aws:iam::aws:policy/IAMFullAccess
* arn:aws:iam::aws:policy/IAMReadOnlyAccess
* arn:aws:iam::aws:policy/AmazonSNSFullAccess
* arn:aws:iam::aws:policy/AmazonSNSReadOnlyAccess
* arn:aws:iam::aws:policy/AmazonS3FullAccess
* arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess

factory function get_managed_policy() returns a parsed Policy for the
requested ARN if available

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit ccb6c38d8ea28d337430efc6e660b24896e75f17)

15 months agorgw/iam: add lots of actions needed for managed policies
Casey Bodley [Thu, 1 Feb 2024 19:56:28 +0000 (14:56 -0500)]
rgw/iam: add lots of actions needed for managed policies

in order to parse managed policies, we have to recognize all of the
actions and wildcards they use

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 0fb3ac33937b5873a6cd4c0baadebc1a07f9a218)

15 months agorgw/iam: Policy() takes string instead of bufferlist
Casey Bodley [Thu, 1 Feb 2024 18:10:00 +0000 (13:10 -0500)]
rgw/iam: Policy() takes string instead of bufferlist

the constructor immediately called bufferlist::to_str() to convert it
into a string; just take string so callers don't have to convert it

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit db09c0956a531ad8c026e9b5f924ab32bfb95514)

15 months agorgw: evaluate_iam_policies() handles account root user
Casey Bodley [Thu, 1 Feb 2024 02:51:25 +0000 (21:51 -0500)]
rgw: evaluate_iam_policies() handles account root user

> By default, all requests are implicitly denied with the exception of
> the AWS account root user, which has full access.

the account root user turns an implicit deny from identity policy into
an allow, though other policies can still deny explicitly

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 180f0b7b66a37e4aa5221e68882d009bed686b58)

15 months agorgw/auth: account users match account arns
Casey Bodley [Tue, 30 Jan 2024 23:14:28 +0000 (18:14 -0500)]
rgw/auth: account users match account arns

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 8ce9c0769f0de31ac4a827684aef4f6f441a369f)

15 months agorgw: add cross-account policy evaluation
Casey Bodley [Sat, 27 Jan 2024 20:56:09 +0000 (15:56 -0500)]
rgw: add cross-account policy evaluation

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 9b3507c95be6128f348ca0b482646dbd7e709b3c)

15 months agorgw: add generic evaluate_iam_policies()
Casey Bodley [Sat, 27 Jan 2024 20:55:27 +0000 (15:55 -0500)]
rgw: add generic evaluate_iam_policies()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 2a5abafaeee9c3ebe8776db1e6b91031a5b8e088)

15 months agorgw: verify_permission logs acl grants
Casey Bodley [Sat, 27 Jan 2024 19:20:53 +0000 (14:20 -0500)]
rgw: verify_permission logs acl grants

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit be35990b85c6b486434d022c77d87fe49db05f12)

15 months agorgw: adapt verify_user_permission() for account users
Casey Bodley [Sat, 27 Jan 2024 00:02:39 +0000 (19:02 -0500)]
rgw: adapt verify_user_permission() for account users

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit cb81a429fdeca31c3ae28d85d331f2a3052baaa1)