Restricting Bucket Access to Specified IP Addresses
Scenario
This case describes how to restrict the source IP addresses that can access an OBS bucket. The following shows how to deny a client access whose source IP address is within the range of 114.115.1.0/24.
Recommended Configuration
Bucket policy
Procedure
- In the navigation pane of OBS Console, choose Buckets.
- In the bucket list, click the bucket name you want to go to the Overview page.
- In the navigation pane, choose Permissions > Bucket Policy.
- On the Bucket Policies page, click Create.
- Locate the row containing Custom policy and click Create Custom Policy.
- Configure parameters for a bucket policy. Figure 1 Configuring bucket policy parameters
Table 1 Parameter description Parameter
Description
Policy View
Set this parameter based on your own habits. Example: Visual editor.
Policy Name
Name of the custom policy
Policy Content
- Select Deny.
- Parameters under Principal:
- Principal: Select Anonymous user.
- User Policy: Select Include specified users.
- Parameters under Resources:
- Resource: Select both Current bucket and Object in bucket.
- Object in bucket: Select All objects.
- Resource Policy: Select Include specified resources.
- Parameters under Actions:
- Select *, which indicates that all operations can be performed.
- Conditional Operator: Select IpAddress.
- Key: Select SourceIp.
- Value: Set it to 114.115.1.0/24. NOTE:
Use commas (,) to separate multiple IP addresses.
Verification
Initiate an access request from an IP address within the range of 114.115.1.0/24. The access is denied. Initiate an access request from an IP address outside the range of 114.115.1.0/24. The access is allowed.
Scenario
To allow only a specified IP address to access the OBS bucket, set Condition Operator to NotIpAddress and specify the allowed IP address as the Value.
Last Article: Allowing IAM Users to View Only Authorized Buckets
Next Article: Best Practices for Enterprise Data Access Control
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.