]> git.apps.os.sepia.ceph.com Git - ceph.git/log
ceph.git
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
15 months agovstart/rgw: add default config for sts
Casey Bodley [Sat, 27 Jan 2024 00:01:24 +0000 (19:01 -0500)]
vstart/rgw: add default config for sts

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/role: support Description for Create/Get/UpdateRole
Casey Bodley [Fri, 26 Jan 2024 17:20:53 +0000 (12:20 -0500)]
rgw/role: support Description for Create/Get/UpdateRole

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: add s3:Get/PutBucketOwnershipControls
Casey Bodley [Fri, 26 Jan 2024 03:04:32 +0000 (22:04 -0500)]
rgw/iam: add s3:Get/PutBucketOwnershipControls

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/sal: remove load_account_role_by_name()
Casey Bodley [Tue, 23 Jan 2024 14:47:58 +0000 (09:47 -0500)]
rgw/sal: remove load_account_role_by_name()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/role: role APIs support account users
Casey Bodley [Tue, 23 Jan 2024 14:22:55 +0000 (09:22 -0500)]
rgw/role: role APIs support account users

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/role: separate dump_iam_role() for iam api
Casey Bodley [Sat, 20 Jan 2024 20:16:00 +0000 (15:16 -0500)]
rgw/role: separate dump_iam_role() for iam api

create a new dump_iam_role() for iam api responses that dumps the subset
of role information presented by the apis

RGWRoleInfo::dump() and decode_json() are used by metadata sync to
transfer role metadata between zones, so must contain all information
about the role

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: add pagination to ListRoles
Casey Bodley [Mon, 15 Jan 2024 17:35:58 +0000 (12:35 -0500)]
rgw/iam: add pagination to ListRoles

rename sal::Driver::get_roles() to list_roles() and add pagination
support for the RGWListRoles op and 'radosgw-admin role list'

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: enable Role apis against account users
Casey Bodley [Mon, 15 Jan 2024 16:11:35 +0000 (11:11 -0500)]
rgw/iam: enable Role apis against account users

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: role apis override init_processing/verify_permission
Casey Bodley [Mon, 15 Jan 2024 01:36:28 +0000 (20:36 -0500)]
rgw/iam: role apis override init_processing/verify_permission

replace get_params() with init_processing() override which runs before
verify_permission(). use this to validate request parameters and load
the existing role if necessary. simplify verify_permission() by
forwarding to RGWRESTOp::verify_permission() which calls check_caps()

simplify inheritence hierarchy by taking cap perm and iam action as
constructor arguments

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: split RGWRestRole member variables
Casey Bodley [Sun, 14 Jan 2024 21:32:19 +0000 (16:32 -0500)]
rgw/iam: split RGWRestRole member variables

move member variables into the subclasses they're needed for

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: RGWUntagRole uses lower/upper bounds for iteration
Casey Bodley [Sun, 14 Jan 2024 21:16:50 +0000 (16:16 -0500)]
rgw/iam: RGWUntagRole uses lower/upper bounds for iteration

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: RGWRestRole::parse_tags() as free function
Casey Bodley [Sun, 14 Jan 2024 21:00:20 +0000 (16:00 -0500)]
rgw/iam: RGWRestRole::parse_tags() as free function

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: AccessKey apis call forward_iam_request_to_master()
Casey Bodley [Sun, 14 Jan 2024 19:06:26 +0000 (14:06 -0500)]
rgw/iam: AccessKey apis call forward_iam_request_to_master()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: User apis call forward_iam_request_to_master()
Casey Bodley [Sun, 14 Jan 2024 18:52:58 +0000 (13:52 -0500)]
rgw/iam: User apis call forward_iam_request_to_master()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw: move forward_iam_request_to_master() to rgw_rest_iam.*
Casey Bodley [Sun, 14 Jan 2024 18:03:49 +0000 (13:03 -0500)]
rgw: move forward_iam_request_to_master() to rgw_rest_iam.*

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/rest: enable iam UserPolicy apis against account users
Casey Bodley [Thu, 11 Jan 2024 23:45:55 +0000 (18:45 -0500)]
rgw/rest: enable iam UserPolicy apis against account users

when the authenticated user belongs to an account:
* operate only on that account's users
* match UserName to user's display_name instead of user_id

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/rest: simplify RGWRestUserPolicy hierarchy
Casey Bodley [Thu, 11 Jan 2024 23:41:03 +0000 (18:41 -0500)]
rgw/rest: simplify RGWRestUserPolicy hierarchy

base class constructor takes `uint64_t action` instead of overriding
the virtual `get_op()` on each subclass

constructor takes `uint32_t perm` instead of deriving separate base
classes RGWUserPolicyRead/Write for check_caps() permission

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/rest: iam user policy api cleanup
Casey Bodley [Thu, 11 Jan 2024 23:06:36 +0000 (18:06 -0500)]
rgw/rest: iam user policy api cleanup

make get_params() virtual and protected. base class always validates
UserName

add common init_processing() function that calls get_params() and loads
the user by UserName. this step happens before verify_permission()

set s->err.message in several error paths

add the xmlns="https://iam.amazonaws.com/doc/2010-05-08/" part to the
responses

return ERR_LIMIT_EXCEEDED instead of ERR_INVALID_REQUEST when
RGWPutUserPolicy exceeds the policy limit

where RGW_ATTR_USER_POLICY is missing, treat it the same way we treat an
empty map of policies. this avoids separate error paths

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/auth: Identity matches account user principals
Casey Bodley [Tue, 2 Jan 2024 23:28:12 +0000 (18:28 -0500)]
rgw/auth: Identity matches account user principals

when a user belongs to an account, they match Principal ARNs by account
id instead of tenant name, and by user name instead user id

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/auth: Identity matches paths in user principals
Casey Bodley [Tue, 2 Jan 2024 22:44:02 +0000 (17:44 -0500)]
rgw/auth: Identity matches paths in user principals

when RGWUserInfo::path is present, use it when matching user principals

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/auth: Identity::is_identity() takes one Principal
Casey Bodley [Tue, 2 Jan 2024 22:11:03 +0000 (17:11 -0500)]
rgw/auth: Identity::is_identity() takes one Principal

take a single Principal instead flat_set<Principal>, and iterate over
calls to is_identity() instead

why?
* it simplifies the logic of each is_identity() function because they
  can use early returns to avoid visiting all of the cases
* Statement::eval_principal() no longer has to allocate a flat_set
  with a single element when the Identity is a role
* rgw::auth::Identity no longer depends on rgw::iam's choice of
  container type

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: rename rgw::auth::Principal::Tenant to Account
Casey Bodley [Tue, 2 Jan 2024 21:05:58 +0000 (16:05 -0500)]
rgw/iam: rename rgw::auth::Principal::Tenant to Account

just changes the name to match its use in AWS, without changing any
behavior in rgw policy parsing/evaluation

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/sal: add interfaces for account roles
Casey Bodley [Sun, 31 Dec 2023 04:35:53 +0000 (23:35 -0500)]
rgw/sal: add interfaces for account roles

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/rados: add rgwrados::roles namespace abstraction for cls_user
Casey Bodley [Sun, 31 Dec 2023 04:32:06 +0000 (23:32 -0500)]
rgw/rados: add rgwrados::roles namespace abstraction for cls_user

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw: init_quota() loads owner quota unconditionally
Casey Bodley [Wed, 20 Dec 2023 21:10:12 +0000 (16:10 -0500)]
rgw: init_quota() loads owner quota unconditionally

now that owners can be accounts, don't default to s->user when s->owner
matches s->bucket_owner

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agoradosgw-admin: quota commands can set account quota
Casey Bodley [Wed, 20 Dec 2023 21:09:09 +0000 (16:09 -0500)]
radosgw-admin: quota commands can set account quota

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: add IAM AccessKey apis
Casey Bodley [Wed, 20 Dec 2023 20:01:00 +0000 (15:01 -0500)]
rgw/iam: add IAM AccessKey apis

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/user: add 'create_date' to RGWAccessKey
Casey Bodley [Wed, 20 Dec 2023 16:25:03 +0000 (11:25 -0500)]
rgw/user: add 'create_date' to RGWAccessKey

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/user: expose functions to generate access/secret keys
Casey Bodley [Wed, 20 Dec 2023 16:03:24 +0000 (11:03 -0500)]
rgw/user: expose functions to generate access/secret keys

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: add initial IAM User apis
Casey Bodley [Mon, 18 Dec 2023 01:33:06 +0000 (20:33 -0500)]
rgw/iam: add initial IAM User apis

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/rest: wrap iam/sns/sts Error responses with ErrorResponse
Casey Bodley [Thu, 11 Jan 2024 22:10:06 +0000 (17:10 -0500)]
rgw/rest: wrap iam/sns/sts Error responses with ErrorResponse

all iam/sns/sts requests wrap the s3 <Error> xml response in another
<ErrorResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">

without this, boto3 fails to fully parse error responses, leading to
generic Unknown ClientError exceptions of the form:
    botocore.exceptions.ClientError: An error occurred (Unknown) when calling the PutUserPolicy operation: Unknown

with the ErrorResponse part, boto3 throws more specific exceptions that
include the error Code and Message:
    botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the PutUserPolicy operation: No such UserName in the account

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/rados: user metadata links to account index
Casey Bodley [Mon, 18 Dec 2023 05:00:36 +0000 (00:00 -0500)]
rgw/rados: user metadata links to account index

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/sal: add interfaces for account users
Casey Bodley [Mon, 18 Dec 2023 02:20:02 +0000 (21:20 -0500)]
rgw/sal: add interfaces for account users

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/rados: add rgwrados::users namespace abstraction for cls_user
Casey Bodley [Mon, 18 Dec 2023 03:49:20 +0000 (22:49 -0500)]
rgw/rados: add rgwrados::users namespace abstraction for cls_user

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/auth: use switch for is_non_s3_op()
Casey Bodley [Mon, 18 Dec 2023 01:25:17 +0000 (20:25 -0500)]
rgw/auth: use switch for is_non_s3_op()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/op: separate IAM ops in enum RGWOpType
Casey Bodley [Sun, 17 Dec 2023 22:47:43 +0000 (17:47 -0500)]
rgw/op: separate IAM ops in enum RGWOpType

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: use enum for action values
Casey Bodley [Sun, 17 Dec 2023 20:17:15 +0000 (15:17 -0500)]
rgw/iam: use enum for action values

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/iam: add iam user metadata (path, create_date, tags)
Casey Bodley [Sun, 17 Dec 2023 20:03:53 +0000 (15:03 -0500)]
rgw/iam: add iam user metadata (path, create_date, tags)

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agotest/cls: add ceph_test_cls_user
Casey Bodley [Sun, 19 Nov 2023 16:32:37 +0000 (11:32 -0500)]
test/cls: add ceph_test_cls_user

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agocls/user: add interfaces to index user account resources
Casey Bodley [Sun, 19 Nov 2023 18:07:20 +0000 (13:07 -0500)]
cls/user: add interfaces to index user account resources

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agocmake: move WITH_RADOSGW checks up to test/CMakeLists.txt
Casey Bodley [Sun, 19 Nov 2023 16:18:53 +0000 (11:18 -0500)]
cmake: move WITH_RADOSGW checks up to test/CMakeLists.txt

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/multisite: RGWBucketMetadataHandler updates linkage on owner change
Casey Bodley [Sun, 17 Dec 2023 18:36:54 +0000 (13:36 -0500)]
rgw/multisite: RGWBucketMetadataHandler updates linkage on owner change

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw: update bucket ownership when adding user to account
Casey Bodley [Sun, 17 Dec 2023 17:11:15 +0000 (12:11 -0500)]
rgw: update bucket ownership when adding user to account

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/rados: Bucket::chown() updates owner on bucket instance
Casey Bodley [Sun, 17 Dec 2023 17:11:06 +0000 (12:11 -0500)]
rgw/rados: Bucket::chown() updates owner on bucket instance

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw: add RGWIdentityType::TYPE_ROOT for account root user
Casey Bodley [Sun, 17 Dec 2023 16:11:13 +0000 (11:11 -0500)]
rgw: add RGWIdentityType::TYPE_ROOT for account root user

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agoqa/rgw: create accounts for random s3test users
Casey Bodley [Sun, 17 Dec 2023 01:52:14 +0000 (20:52 -0500)]
qa/rgw: create accounts for random s3test users

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/acl: create_policy_from_headers() can yield
Casey Bodley [Sat, 16 Dec 2023 23:34:34 +0000 (18:34 -0500)]
rgw/acl: create_policy_from_headers() can yield

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/acl: s3 CanonicalUser grants support account ids
Casey Bodley [Sat, 16 Dec 2023 23:33:14 +0000 (18:33 -0500)]
rgw/acl: s3 CanonicalUser grants support account ids

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/sal: add load_aclowner_by_email()
Casey Bodley [Sat, 16 Dec 2023 17:57:01 +0000 (12:57 -0500)]
rgw/sal: add load_aclowner_by_email()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/sal: move list_buckets() to Driver
Casey Bodley [Sat, 16 Dec 2023 15:47:44 +0000 (10:47 -0500)]
rgw/sal: move list_buckets() to Driver

move User::list_buckets() to Driver and take rgw_owner to serve bucket
listings for account owners

also unifies the user/account stats interfaces around rgw_owner in
Driver

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw: use rgw_owner in RGWBucketInfo
Casey Bodley [Fri, 10 Nov 2023 17:31:11 +0000 (12:31 -0500)]
rgw: use rgw_owner in RGWBucketInfo

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/acl: use rgw_owner for ACLOwner
Casey Bodley [Thu, 7 Dec 2023 19:22:01 +0000 (14:22 -0500)]
rgw/acl: use rgw_owner for ACLOwner

Signed-off-by: Casey Bodley <cbodley@redhat.com>
15 months agorgw/pubsub: use rgw_owner for topic ownership
Casey Bodley [Tue, 12 Dec 2023 21:36:04 +0000 (16:36 -0500)]
rgw/pubsub: use rgw_owner for topic ownership

allow topics to be owned by accounts instead of users. radosgw-admin
topic list can now filter by --account-id

Signed-off-by: Casey Bodley <cbodley@redhat.com>