NSFS | NC | IAM Service - Accounts Permission When No Bucket Policy#8175
Merged
Merged
Conversation
adbef9f to
cd8909b
Compare
764d0ca to
86b2e88
Compare
romayalon
approved these changes
Jul 15, 2024
86b2e88 to
07efca5
Compare
guymguym
requested changes
Jul 16, 2024
07efca5 to
868a624
Compare
868a624 to
748167e
Compare
guymguym
reviewed
Jul 23, 2024
1d24f6f to
31deb5c
Compare
guymguym
approved these changes
Jul 25, 2024
31deb5c to
5e4e47a
Compare
1. Add more properties to nsfs_bucket_schema (not required) and update the new_bucket_defaults in BucketSpaceFS:
- creator = creator is the account ID that created this bucket (internal information).
Notes: Currently we do not allow IAM accounts to create a bucket (temporary), it will be changed after we have the config structure, therefore in the future, we could see the IAM account ID in the creator property.
2. Change the condition in authorize_request_policy (in s3_rest) and has_bucket_action_permission (in bucketspace_fs) for the same root account (alternative for ownership when there is no bucket policy).
Those next changes are not related to IAM, but were raised as a part of the code review:
3. In authorize_request_policy (in s3_rest) remove the condition req.object_sdk.nsfs_config_root from the owner condition.
4. In has_bucket_action_permission (in bucketspace_fs) change the condition of is_owner from account name to id.
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
5e4e47a to
c65e20d
Compare
Contributor
Author
Internal Documentation of the PR:Before adding the limitation of bucket creation on IAM accounts - the options were discussed in this PR related to the function
Therefore, we add the limitation for creating a bucket by the IAM account, that we will remove once we could get the root account config by ID. |
2 tasks
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explain the changes
nsfs_bucket_schema(not required) and update thenew_bucket_defaultsinBucketSpaceFS:creator= creator is the account ID that created this bucket (internal information).Notes: Currently we do not allow IAM accounts to create a bucket (temporary), it will be changed after we have the config structure, therefore in the future, we could see the IAM account ID in the creator property.
authorize_request_policy(ins3_rest) andhas_bucket_action_permission(inbucketspace_fs) for the same root account (alternative for ownership when there is no bucket policy).Those next changes are not related to IAM, but were raised as a part of the code review:
3. In
authorize_request_policy(ins3_rest) remove the conditionreq.object_sdk.nsfs_config_rootfrom the owner condition.4. In
has_bucket_action_permission(inbucketspace_fs) change the condition ofis_ownerfrom account name to id.Issues:
List of GAPs:
Testing Instructions:
Unit Tests
Please run:
sudo NC_CORETEST=true node ./node_modules/mocha/bin/mocha ./src/test/unit_tests/test_bucketspace_fs.js.npx jest test_nc_nsfs_bucket_schema_validation.test.js.Manual Tests:
sudo node src/cmd/manage_nsfs account add --name shira-1001 --new_buckets_path /tmp/nsfs_root1 --access_key <access-key> --secret_key <secret-key> --uid <uid> --gid <gid>Note: before creating the account need to give permission to the
new_buckets_path:chmod 777 /tmp/nsfs_root1.sudo node src/cmd/nsfs --debug 5 --https_port_iam 7005Notes:
process.env.NOOBAA_LOG_LEVEL = 'nsfs';in the endpoint.js (before the conditionif (process.env.NOOBAA_LOG_LEVEL) {)config.NSFS_CHECK_BUCKET_BOUNDARIES = false; //SDSDbecause I'm using the/tmp/and not/private/tmp/.alias s3-nc-user-1-iam='AWS_ACCESS_KEY_ID=<access-key> AWS_SECRET_ACCESS_KEY=<secret-key> aws --no-verify-ssl --endpoint-url https://localhost:7005'.user1:
s3-nc-user-1-iam iam create-user --user-name Bob+s3-nc-user-1-iam iam create-access-key --user-name Bobuser2:
s3-nc-user-1-iam iam create-user --user-name Robert+s3-nc-user-1-iam iam create-access-key --user-name Robertalias s3-nc-user-1-s3-regular='AWS_ACCESS_KEY_ID=<access-key> AWS_SECRET_ACCESS_KEY=<secret-key> aws --no-verify-ssl --endpoint-url https://localhost:6443'(using different port). (the second one will bes3-nc-user-2-s3-regular).s3-nc-user-1-s3-regular s3 ls,s3-nc-user-2-s3-regular s3 lss3-nc-user-1-s3 s3 mb s3://bucket-01s3-nc-user-1-s3-regular s3 ls,s3-nc-user-2-s3-regular s3 ls.s3-nc-user-2-s3-regular s3 rb s3://bucket-01/.