Skip to content

iam: add tests for account-based IAM apis#537

Merged
cbodley merged 22 commits intoceph:masterfrom
cbodley:wip-iam-user-apis
Apr 12, 2024
Merged

iam: add tests for account-based IAM apis#537
cbodley merged 22 commits intoceph:masterfrom
cbodley:wip-iam-user-apis

Conversation

@cbodley
Copy link
Contributor

@cbodley cbodley commented Dec 19, 2023

renames the test_of_iam label to iam_tenant for the existing tenant-based iam tests

adds new [iam root] and [iam alt root] config sections for account root users, and a new set of iam_account and iam_cross_account test cases that use them

adds pytest fixtures iam_root and iam_alt_root that return the corresponding boto client, with cleanup logic to nuke any created users/roles/etc. all iam resources created by the tests have names starting with iam name prefix = s3-tests- and paths starting with iam path prefix = /s3-tests/ so this cleanup logic doesn't nuke anything else in the aws account

adds account-based test cases for the following iam api categories:

  • User
  • AccessKey
  • UserPolicy
  • Group
  • GroupPolicy
  • Role
  • RolePolicy
  • OpenIDConnectProvider

verified to pass against aws when an account root user's credentials are provided in the [iam] section of s3tests.conf (haven't tested iam_cross_account tests yet)

TODO:

  • assuming another account's role uses same-account rules to access that account's resources
  • assuming another account's role uses cross-account rules to access the original user's resources
  • buckets/objects created by the assumed role belong to the role's account
  • test that identity policy can grant non-root users access to iam account apis

@cbodley cbodley force-pushed the wip-iam-user-apis branch 2 times, most recently from 5ce3342 to 1f14eda Compare December 20, 2023 19:18
@cbodley cbodley force-pushed the wip-iam-user-apis branch 4 times, most recently from afc402d to ac893c5 Compare January 30, 2024 23:20
@cbodley cbodley force-pushed the wip-iam-user-apis branch 3 times, most recently from 6645cbb to 69492d4 Compare February 6, 2024 17:47
@cbodley cbodley changed the title iam: add tests for User apis iam: add tests for account-based IAM apis Feb 6, 2024
@cbodley
Copy link
Contributor Author

cbodley commented Feb 16, 2024

@pritha-srivastava thanks for the review! i updated the pr description with a TODO list of test cases to add

@cbodley cbodley force-pushed the wip-iam-user-apis branch 2 times, most recently from fa13161 to 9fd2f28 Compare February 26, 2024 19:19
@cbodley cbodley force-pushed the wip-iam-user-apis branch from 0aa5442 to 8d2a47a Compare March 4, 2024 21:22
@cbodley cbodley requested a review from alimaredia March 7, 2024 20:45
@cbodley
Copy link
Contributor Author

cbodley commented Mar 7, 2024

hey @alimaredia, i'm close to getting account stuff passing in teuthology. just wanted to get this on your radar

@cbodley cbodley force-pushed the wip-iam-user-apis branch from 682d9b2 to 2a18f9b Compare March 8, 2024 14:46
Signed-off-by: Casey Bodley <cbodley@redhat.com>
cbodley added 13 commits March 10, 2024 10:45
Signed-off-by: Casey Bodley <cbodley@redhat.com>
adds test cases for the following iam actions:
* PutUserPolicy
* GetUserPolicy
* DeleteUserPolicy
* ListUserPolicies

verified to pass against aws when an account root user's credentials are
provided in the [iam] section of s3tests.conf

Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
adds test cases for the following iam actions:
* CreateRole
* GetRole
* ListRoles
* DeleteRole
* UpdateRole

verified to pass against aws when an account root user's credentials are
provided in the [iam] section of s3tests.conf

Signed-off-by: Casey Bodley <cbodley@redhat.com>
adds test cases for the following iam actions:
* PutRolePolicy
* GetRolePolicy
* DeleteRolePolicy
* ListRolePolicies

verified to pass against aws when an account root user's credentials are
provided in the [iam] section of s3tests.conf

Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
test the [iam alt root] user's access to buckets owned by [iam root]
using various policy principals and acl grantees

Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
aws doesn't consult acls for same-account access. rgw doesn't for
account users either

Fixes: ceph#184

Signed-off-by: Casey Bodley <cbodley@redhat.com>
@cbodley cbodley force-pushed the wip-iam-user-apis branch 2 times, most recently from a14065a to 96d6584 Compare March 12, 2024 12:57
@alimaredia
Copy link
Contributor

@cbodley are these still underdevelopment? I see you force pushed just a couple hours ago and I don't see a run linked yet. Have these only been run locally?

@cbodley
Copy link
Contributor Author

cbodley commented Mar 12, 2024

@alimaredia this is ready for review. i'm still iterating on ceph/ceph#54333 to get a clean run. all tests pass locally but i'm working through differences in configuration between rgw/verify rgw/sts etc

Signed-off-by: Casey Bodley <cbodley@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
@cbodley
Copy link
Contributor Author

cbodley commented Mar 15, 2024

@cbodley
Copy link
Contributor Author

cbodley commented Apr 12, 2024

pulled in sns commits from cbodley#1

accounts pr passed qa against this in https://pulpito.ceph.com/cbodley-2024-04-12_12:44:47-rgw-wip-rgw-account-v3-distro-default-smithi/

@cbodley cbodley merged commit 54c1488 into ceph:master Apr 12, 2024
@cbodley cbodley deleted the wip-iam-user-apis branch April 15, 2024 18:10
@cbodley
Copy link
Contributor Author

cbodley commented Apr 15, 2024

haven't cherry-picked for master or squid yet. for squid, i still have one batch pending qa. for main, i'll wait til later in the week

@cbodley
Copy link
Contributor Author

cbodley commented Apr 16, 2024

cherry-picked for ceph-squid

@cbodley
Copy link
Contributor Author

cbodley commented Apr 17, 2024

cherry-picked for ceph-master too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants