Allowing IAM Users to View Only Authorized Buckets

Scenario

This topic explains how to use the Enterprise Project Management Service (EPS) to authorize an IAM user under a HUAWEI CLOUD account to operate specified buckets, so that the user can view only the specified buckets and perform authorized operations on OBS Console. In this way, bucket permissions can be isolated.

In this case, the IAM user test-user is authorized to view only bucket example on OBS Console and has only the upload permission (obs:object:PutObject), object listing permission (obs:bucket:ListBucket), and bucket listing permission (obs:bucket:ListAllMyBuckets). With these permissions, user test-user can upload objects.

Recommended Configuration

Use EPS to isolate permissions.

Configuration Precautions

  • If an IAM user is authorized for an action through both IAM and EPS, the authorization result is subject to IAM configuration.

    Examples:

    1. If the bucket listing permission (obs:bucket:ListAllMyBuckets) is authorized through both IAM and EPS, the final permission authorization is subject to the IAM configuration. As a result, this authorization allows the user to list all buckets including those that do not belong to the enterprise project.

    2. For the upload permission (obs:object:PutObject), if Allow is configured in IAM and Deny is configured in the enterprise project, Allow takes effect, that is, objects can be uploaded.

  • If the OBS Viewer permission is configured for an IAM user in IAM and this user's group is added to the enterprise project, the IAM user cannot list buckets after logging in to OBS.
  • After the configuration is complete, it is normal if the system still displays a message indicating that you do not have required permissions, because OBS Console also calls other APIs for advanced settings, but you can still perform the allowed read/write operations.

Procedure

  1. Log in to the console and choose Enterprise > Project Management on the top navigation bar. Create an enterprise project named test-project under the authorized account. For details, see Creating an Enterprise Project.
  2. Add bucket example-001 to test-project, the project created in 1. For details, see Adding Resources to an Enterprise Project For more information, see Figure 1.

    If you need to authorize permissions involving multiple buckets, migrate all the required buckets to the enterprise project.

    Figure 1 Adding buckets to an enterprise project

  3. Choose Permissions > Users. Click Assign Permissions. Add user test-user (not in any user group) to the enterprise project. For details, see Figure 2.

    Figure 2 Authorizing permissions to an enterprise user.

  4. Click Next and attach policies to test-user so that the user has the permissions defined in the policy in the test-project enterprise project.

    1. Determine whether to activate the default policy or create a policy. You can select from all available policies, custom policies, or system policies, or you can create a custom policy.
      • For details about how to create custom policies, see Creating a Custom Policy. Figure 3 shows the custom permissions configured in this example, including the upload permission (obs:object:PutObject), object listing permission (obs:bucket:ListBucket), and bucket listing permission (obs:bucket:ListAllMyBuckets).
      • For details about OBS system permissions, see Table 1.
        Figure 3 Configuring a custom policy

        Do not attach the same policy to user group in the IAM configuration. Otherwise, the permission authorization is subject to the IAM configuration.

    2. Select the required policies. The selected policies will appear in the Selected box. For details, see Figure 4.
    Figure 4 Adding a custom policy

  5. Click OK. The permission configuration is finished. The successfully assigned permissions will appear in the list.

    After finishing the configuration in EPS, you do not need to configure the IAM custom or system policies.

Verification

  1. Log in to OBS Console as user test-user.
  2. Find the only bucket example-001 in the bucket list, as shown in Figure 5.

    Figure 5 Verifying the permission configuration

  3. Click bucket example-001 to go to the overview page and select Objects in the navigation pane. Other objects in the bucket are displayed.

    Figure 6 Viewing objects of bucket example-001

    After the configuration is complete, it is normal if the system still displays a message indicating that you do not have required permissions, because OBS Console also calls other APIs for advanced settings, but you can still perform the allowed read/write operations.

  4. Upload file 111.txt to bucket example-001. The file upload succeeds, indicating that the permission configuration is successful.

    Figure 7 Uploading a file

    If some other permissions, such as downloading or deleting an object, are required, hover your cursor over the username and choose Identity and Access Management > Permissions, and then repeat the operations above to configure custom policies as needed.