Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NC | NSFS | IAM | Fix issue in update_access_key and delete_access_key #8233

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

shirady
Copy link
Contributor

@shirady shirady commented Jul 25, 2024

Explain the changes

  1. Fix an issue related to update_access_key and delete_access_key when --user-name flag is not passed, but the access-key-id exists in IAM account of the root account which was the requesting account.
  2. Add a function _throw_error_no_such_entity_access_key for this error and use it.
  3. Fix indentation in functions: _throw_error_delete_conflict and _throw_error_perform_action_from_root_accounts_manager_on_iam_user.

Issues: Fixed #xxx / Gap #xxx

List of known GAPs:

  1. Change the IamError class to have a template message.

Testing Instructions:

Unit Tests:

Please run: sudo npx jest test_accountspace_fs.test.js

Manual Tests:

  1. Create the root user account with the CLI: 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.
  2. Start the NSFS server with: sudo node src/cmd/nsfs --debug 5 --https_port_iam 7005
    Notes:
  • Before starting the server please add this line: process.env.NOOBAA_LOG_LEVEL = 'nsfs'; in the endpoint.js (before the condition if (process.env.NOOBAA_LOG_LEVEL) {)
  • I Change the config.NSFS_CHECK_BUCKET_BOUNDARIES = false; //SDSD because I'm using the /tmp/ and not /private/tmp/.
  1. Create the alias for IAM service: 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'.
  2. Use AWS CLI to create an IAM account:
    s3-nc-user-1-iam iam create-user --user-name Bob
    s3-nc-user-1-iam iam create-access-key --user-name Bob (save the access-key-id, we will use it in next steps).
  3. Run: s3-nc-user-1-iam iam update-access-key --access-key-id <access-key-id-of-Bob> --status Inactive #without --user-name Bob (should throw an error NoSuchEntity).
  4. Run: s3-nc-user-1-iam iam delete-access-key --access-key-id <access-key-id-of-Bob> #without --user-name Bob (should throw an error NoSuchEntity).
  • Doc added/updated
  • Tests added

@shirady shirady changed the title NC | NSFS | IAM | Fix issue in update_access_key and `delete_access_key NC | NSFS | IAM | Fix issue in update_access_key and delete_access_key Jul 25, 2024
@shirady shirady self-assigned this Jul 25, 2024
Copy link
Contributor

@alphaprinz alphaprinz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a test that sends the wrong user name?
Otherwise LGTM, just some typos.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Jul 28, 2024
@shirady shirady requested a review from alphaprinz July 28, 2024 09:09
@shirady shirady mentioned this pull request Jul 28, 2024
2 tasks
Copy link
Contributor

@alphaprinz alphaprinz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

1. Fix an issue related to update_access_key and delete_access_key when --user-name flag is not passed, but the access-key-id exists in IAM account of the root account which was the requesting account.
2. Add a function _throw_error_no_such_entity_access_key for this error and use it.
3. Fix indentation in functions: _throw_error_delete_conflict and _throw_error_perform_action_from_root_accounts_manager_on_iam_user.

Signed-off-by: shirady <57721533 [email protected]>
@shirady shirady merged commit 909e29f into noobaa:master Jul 30, 2024
10 checks passed
@shirady shirady deleted the nsfs-iam-username-issue branch July 30, 2024 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants