Help Center> Object Storage Service> Permissions Configuration Guide> Introduction to OBS Permission Control

Introduction to OBS Permission Control

By default, OBS resources (buckets and objects) are private. Only resource owners can access their OBS resources. Without authorization, other users cannot access OBS. OBS permission control refers to granting permissions to other accounts or IAM users by editing access policies. For example, if you have a bucket, you can authorize another IAM user to upload objects to your bucket. You can also open buckets to non-public cloud users, so that anyone can access your buckets as public resources over the Internet. OBS offers multiple methods to help you to assign the resource permissions to others. Resource owners can formulate different permissions control schemes based on service requirements to ensure data security.

OBS Permission Control Model

OBS provides multiple permission control mechanisms, including IAM permissions, bucket policies, object ACLs, and bucket ACLs. Table 1 describes the mechanisms and application scenarios.

Figure 1 OBS permission control mechanisms
Table 1 OBS permission control mechanisms and application scenarios

Method

Description

Scenario

IAM Permissions

IAM permissions define the actions that can be performed on your cloud resources. In other words, IAM permissions specify what actions are allowed or denied. After an IAM user is created, the administrator needs to add the user to a group. IAM can grant the user group required OBS access permissions, and then all users in the group automatically inherit the permissions of the user group.

  • Controlling permissions to cloud resources as a whole under an account
  • Controlling permissions to all OBS buckets and objects under an account
  • Controlling permissions to specified cloud resources under an account

Bucket Policy

A bucket policy is attached to a bucket and objects in the bucket. Bucket owners can use bucket policies to grant IAM users or other accounts the permissions to operate buckets and objects in the buckets. Bucket policies supplement, and in many cases, replace ACLs of buckets and objects.

  • You can use bucket policies to grant other HUAWEI CLOUD accounts the permissions to access OBS resources.
  • You can configure different bucket policies to grant IAM users different access permissions to different buckets.

Object ACL

Controls access to objects for accounts or user groups. Object owners can configure the object access control list (ACL) to grant basic read and write permissions to specified accounts or user groups.

NOTE:
  • By default, an object ACL is created upon the creation of the object. The object owner has full control over the object.
  • The owner of an object is the account that uploads the object, who may not be the owner of the bucket where the object belongs. For example, account B is granted the permission to access a bucket of account A, and account B uploads a file to the bucket. In that case, instead of the bucket owner account A, account B is the owner of the object. By default, account A is not allowed to access this object and cannot read or modify the object ACL.
  • If object-level access control is required, a bucket policy can be used to grant the access permission to an object or a set of objects. After the access permission is granted to an object set, it is not practical to configure a bucket policy to grant the access permission to an object in the object set separately. Then the object ACL is recommended for easier permission control over single objects.
  • An object is accessed through a URL. Generally, if you want to grant anonymous users the permission to read an object through a URL, use the object ACL.

Bucket ACL

Controls access to buckets for accounts or user groups. Bucket owners can configure the bucket ACL to grant basic read and write permissions to specified accounts or user groups.

NOTE:
  • By default, a bucket ACL is created upon the creation of the bucket. The bucket owner has full control over the bucket.
  • Bucket ACLs do not provide fine-grained permission control. Generally, IAM permissions and bucket policies are recommended.
  • Granting an account with the read and write access to a bucket, so that data in the bucket can be shared or the bucket can be mounted. For example, if account A grants the bucket read and write permissions to account B, then account B can access the bucket by using the API and SDK, and can add an external bucket through OBS Browser+.
  • Grant the log delivery user group with the write access to the target bucket, so that access logs can be delivered to the target bucket.

Relationship Between OBS Permissions and IAM Permissions

OBS provides multiple permission control mechanisms, including time-limited access to objects, object ACLs, bucket ACLs, and bucket policies. Some service-level permissions (for example, creating a bucket and listing all buckets) cannot be configured through OBS and can only be configured on IAM. OBS permissions apply only to resources (buckets and objects). To grant both OBS service-level and resource-level permissions, you must use IAM permissions or both IAM and OBS permissions.

Figure 2 Relationship between OBS permissions and IAM permissions

OBS Permission Control Elements

The following factors determine the authorization result:

  • Principal (authorized user)
  • Effect
  • Resource
  • Action
  • Condition

For details about elements, see Bucket Policy Parameters.

Table 2 describes elements in different permission control mechanisms.

Table 2 OBS permission control elements in different permission control mechanisms

Method

Principal

Supported Effect

Authorized Resource

Authorized Action

Condition Configuration

IAM Permissions

IAM user

  • Allow
  • Deny

All or specified OBS resources

All permissions to access OBS

Supported

Bucket Policy

  • Account
  • IAM user
  • Anonymous users
  • Allow
  • Deny

Specified bucket and resources in the bucket

All permissions to access OBS

Supported

Object ACL

  • Account
  • Anonymous users

Allow

Specified object

  • Obtains the content and metadata of a specified object.
  • Obtains the content and metadata of an object with a specified version.
  • Obtains information about an object ACL.
  • Obtains information about the ACL for an object of a specified version.
  • Configures an object ACL.
  • Configures the ACL for an object of a specified version.

Not supported

Bucket ACL

  • Account
  • Anonymous users
  • Log delivery user groups

Allow

Specified bucket

  • Identifies whether a bucket exists.
  • Lists objects in a bucket, and gets the bucket metadata.
  • Lists versioned objects in a bucket.
  • Lists multipart upload tasks.
  • Performs PUT upload, POST upload, and multipart upload, initialization of uploaded parts, and merging of parts.
  • Deletes an Object.
  • Deletes an object of a specified version.
  • Obtains bucket ACL information.
  • Configures a bucket ACL.
  • Obtains object content.
  • Obtains object metadata.

Not supported

How to Select IAM Permissions, Bucket Policies, and ACLs

Based on the advantages and disadvantages of the three elements, you are advised to preferentially use IAM permissions and bucket policies.

  • Select IAM permissions in the following scenarios:
    • Grant the same permissions to numerous IAM users under the same account.
    • Grant the same permissions to all OBS resources or multiple buckets.
    • Configure OBS service-level permissions, such as creating and listing buckets.
    • Restrict the permissions of temporary access keys used for temporarily authorized access to OBS.
  • Select bucket policies in the following scenarios:
    • Grant permissions across accounts or grant permissions to anonymous users.
    • Grant different permissions to different IAM users under the same account.
  • Still do not know how to select?

    Determine which problem you care more about:

    • What the user can do - IAM permissions recommended

      You can search for an IAM user and check the permissions of the user group to which the user belongs to know what the user can do.

    • Who can access an OBS bucket - Bucket policies recommended

      You can query the bucket and check the bucket policy to know who can access the bucket.

You are advised to use the same element, because as the number of IAM permissions and bucket policies increase, permission maintenance becomes more difficult.

When to Select an ACL?

  • As a supplement to IAM permissions and bucket policies:

    IAM permissions and bucket policies have granted access permissions to an object set, but you want to grant access permissions to a single object.

  • To allow an object to be accessible to all anonymous Internet users, configuring object ACL operations is more convenient.

    When uploading an object, you can use the ACL header to specify the read and write permissions of the object.

Relationship Between Bucket ACLs and Bucket Policies

Bucket ACLs are used to control basic read and write access to buckets. Custom settings of bucket policies support more actions that can be performed on buckets. Bucket policies are a supplement to bucket ACLs. In most cases, you can directly use bucket policies to manage access to a bucket. Relationship Between Bucket Policies and Bucket ACLs shows the mapping between bucket ACL access permissions and bucket policy actions.

OBS Permission Control Principles

  • Least privilege

    Only the minimum permissions required for executing tasks are granted to IAM users or accounts. For example, if an IAM user only needs to upload and download objects to a specified directory, you can assign the user the read and write permissions to the directory instead of the whole bucket.

  • Separation of duties

    You are advised to use different IAM users under the same account to manage OBS resources and permissions. For example, use IAM user A to manage permissions, and use other IAM users to manage OBS resources.

  • Restricted conditions

    Configure refined conditions for bucket policies to restrict scenarios where a bucket policy takes effect, in order to enhance the security of resources in a bucket. For example, OBS is configured to accept only access requests from a specific IP address.

How Does the Authorization Mechanism Work When There Is Conflicts Between Access Control Methods?

In the OBS permission control elements, there are allow and deny effects, which indicate the permission to allow or deny an operation.

Based on the least-privilege principle, decisions default to deny, and an explicit deny statement always takes precedence over an allow statement. For example, IAM permissions grant a user access to an object, a bucket policy denies the user's access to that object, and there is no ACL. Then access will be denied.

If no method specifies an allow statement, then the request will be denied by default. Only if no method specifies a deny statement and one or more methods specify an allow statement, will the request be allowed. For example, if a bucket has multiple bucket policies with allow statements, the adding of a new bucket policy with an allow statement will simply add the allowed permissions to the bucket, but the adding of a new bucket policy with a deny statement will result in a re-arrangement of the permissions. The deny statement will take precedence over allow statements, even the denied permissions are allowed in other bucket policies.

Figure 3 Authorization process

Figure 4 is a matrix of the IAM permissions, bucket policies, and ACLs (allow and deny effects).

Figure 4 Matrix of the IAM permissions, bucket policies, and ACLs (allow and deny effects)

Concepts

  • Account: An account is automatically created when you register with HUAWEI CLOUD. This account has full access permissions for the resources and IAM users under the account.
  • IAM user: A user created by the administrator in IAM. An IAM user may be an employee, a system, or an application. An IAM user has access permissions to specified resources. IAM users have identity credentials (passwords and access keys) and can log in to the management console or call APIs.
  • Anonymous user: A common visitor who has not registered with HUAWEI CLOUD.
  • A log delivery user group: A user group who only delivers access logs of buckets and objects to the specified target bucket. OBS does not create or upload any file to a bucket automatically. Therefore, if you want to record access logs for a bucket, you need to grant the log delivery user group the permissions to deliver the access logs to your specified target bucket. This user group is only used to deliver internal logs of OBS.