Movatterモバイル変換


[0]ホーム

URL:


Blocking public access to your Amazon S3 storage - Amazon Simple Storage Service
DocumentationAmazon Simple Storage Service (S3)User Guide
Block public accesssettingsPerformingblock public access operations on an access pointThe meaning of"public"Using IAM Access Analyzer for S3 to review publicbucketsPermissionsConfiguring block publicaccess

Blocking public access to your Amazon S3storage

The Amazon S3 Block Public Access feature provides settings for access points, buckets, and accounts tohelp you manage public access to Amazon S3 resources. By default, new buckets, access points, and objectsdon't allow public access. However, users can modify bucket policies, access point policies, orobject permissions to allow public access. S3 Block Public Access settings override thesepolicies and permissions so that you can limit public access to these resources.

With S3 Block Public Access, account administrators and bucket owners can easily set upcentralized controls to limit public access to their Amazon S3 resources that are enforcedregardless of how the resources are created.

For instructions on configuring public block access, seeConfiguring block publicaccess.

When Amazon S3 receives a request to access a bucket or an object, it determines whether thebucket or the bucket owner's account has a block public access setting applied. If therequest was made through an access point, Amazon S3 also checks for block public access settings for theaccess point. If there is an existing block public access setting that prohibits the requestedaccess, Amazon S3 rejects the request.

Amazon S3 Block Public Access provides four settings. These settings are independent and can beused in any combination. Each setting can be applied to an access point, a bucket, or an entireAWS account. If the block public access settings for the access point, bucket, or account differ,then Amazon S3 applies the most restrictive combination of the access point, bucket, and accountsettings.

When Amazon S3 evaluates whether an operation is prohibited by a block public access setting,it rejects any request that violates an access point, bucket, or account setting.

Public access isgranted to buckets and objects through access control lists (ACLs), access point policies, bucket policies, orall. To help ensure that all of your Amazon S3 access points, buckets, and objects have theirpublic access blocked, we recommend that you turn on all four settings for block publicaccess for your account. Additionally, we recommend that you also turn on all four settings for each bucket to comply with AWS Security Hub Foundational Security Best Practices control S3.8. These settings block public access for all current and futurebuckets and access points.

Before applying these settings, verify that your applications will workcorrectly without public access. If you require some level of public access to yourbuckets or objects, for example to host a static website as described atHosting a static website using Amazon S3, you can customize theindividual settings to suit your storage use cases.

Enabling Block Public Access helps protect your resources by preventing public access frombeing granted through the resource policies or access control lists (ACLs) that aredirectly attached to S3 resources. In addition to enabling Block Public Access,carefully inspect the following policies to confirm that they don't grant publicaccess:

  • Identity-based policies attached to associated AWS principals (for example, IAM roles)

  • Resource-based policies attached to associated AWS resources (for example, AWS Key Management Service (KMS) keys)

Block public accesssettings

S3 Block Public Access provides four settings. You can apply these settings in anycombination to individual access points, buckets, or entire AWS accounts. If you apply asetting to an account, it applies to all buckets and access points that are owned by thataccount. Similarly, if you apply a setting to a bucket, it applies to all access pointsassociated with that bucket.

The following table contains the available settings.

NameDescription
BlockPublicAcls

Setting this option toTRUE causes the followingbehavior:

  • PutBucketAcl andPutObjectAcl calls fail if the specifiedaccess control list (ACL) is public.

  • PutObject calls fail if the request includes a public ACL.

  • If this setting is applied to an account, thenPUT Bucket calls fail ifthe request includes a public ACL.

When this setting is set toTRUE, the specified operations fail (whethermade through the REST API, AWS CLI, or AWS SDKs). However, existingpolicies and ACLs for buckets and objects aren't modified. Thissetting enables you to protect against public access while allowingyou to audit, refine, or otherwise alter the existing policies andACLs for your buckets and objects.

IgnorePublicAcls

Setting this option toTRUE causes Amazon S3 to ignore all public ACLs on abucket and any objects that it contains. This setting enables you tosafely block public access granted by ACLs while still allowingPutObject calls that include a public ACL (asopposed toBlockPublicAcls, which rejectsPutObject calls that include a public ACL).Enabling this setting doesn't affect the persistence of any existingACLs and doesn't prevent new public ACLs from being set.

BlockPublicPolicy

Setting this option toTRUE for a bucket causes Amazon S3 to reject calls toPutBucketPolicy if the specified bucket policyallows public access. Setting this option toTRUE for abucket also causes Amazon S3 to reject calls toPutAccessPointPolicy for all of the bucket'ssame-account access points if the specified policy allows public access.

Setting this option toTRUE for an access point causes Amazon S3 to reject calls toPutAccessPointPolicy andPutBucketPolicy that are made through the access point ifthe specified policy (for either the access point or the underlying bucket)allows public access.

You can use this setting to allow users to manage access point and bucketpolicies without allowing them to publicly share the bucket or theobjects it contains. Enabling this setting doesn't affect existingaccess point or bucket policies.

RestrictPublicBuckets

Setting this option toTRUE restricts access to anaccess point or bucket with a public policy to only AWS service principalsand authorized users within the bucket owner's account and access pointowner's account. This setting blocks all cross-account access to theaccess point or bucket (except by AWS service principals), while stillallowing users within the account to manage the access point orbucket.

Enabling this setting doesn't affect existing access point or bucketpolicies, except that Amazon S3 blocks public and cross-account accessderived from any public access point or bucket policy, including non-publicdelegation to specific accounts.

Performingblock public access operations on an access point

To perform block public access operations on an access point, use the AWS CLI services3control.

The meaning of"public"

ACLs

Amazon S3 considers a bucket or object ACL public if it grants anypermissions to members of the predefinedAllUsers orAuthenticatedUsers groups. For more informationabout predefined groups, seeAmazon S3 predefinedgroups.

Bucket policies

When evaluating a bucket policy, Amazon S3 begins by assuming that the policy is public. Itthen evaluates the policy to determine whether it qualifies as non-public. To beconsidered non-public, a bucket policy must grant access only to fixed values(values that don't contain a wildcard oran AWS Identity and Access ManagementPolicy Variable) for one or more of the following:

For more information about bucket policies, seeBucket policies for Amazon S3.

When usingmultivalued context keys, you must use theForAllValues orForAnyValue set operators.

How Amazon S3 evaluates a bucketpolicy that contains both public and non-public access grants

This example shows how Amazon S3 evaluates a bucket policy that contains bothpublic and non-public access grants.

Suppose that a bucket has a policy that grants access to a set of fixedprincipals. Under the previously described rules, this policy isn't public.Thus, if you enable theRestrictPublicBuckets setting, the policyremains in effect as written, becauseRestrictPublicBuckets onlyapplies to buckets that have public policies. However, if you add a publicstatement to the policy,RestrictPublicBuckets takes effect on thebucket. It allows only AWS service principals and authorized users of thebucket owner's account to access the bucket.

As an example, suppose that a bucket owned by "Account-1" has a policy thatcontains the following:

This policy qualifies as public because of the third statement. With thispolicy in place andRestrictPublicBuckets enabled, Amazon S3 allowsaccess only by CloudTrail. Even though statement 2 isn't public, Amazon S3 disables accessby "Account-2." This is because statement 3 renders the entire policy public, soRestrictPublicBuckets applies. As a result, Amazon S3 disablescross-account access, even though the policy delegates access to a specificaccount, "Account-2." But if you remove statement 3 from the policy, then thepolicy doesn't qualify as public, andRestrictPublicBuckets nolonger applies. Thus, "Account-2" regains access to the bucket, even if youleaveRestrictPublicBuckets enabled.

Access points

Amazon S3 evaluates block public access settings slightly differently for access pointscompared to buckets. The rules that Amazon S3 applies to determine when an access point policy ispublic are generally the same for access points as for buckets, except in the followingsituations:

Using IAM Access Analyzer for S3 to review publicbuckets

You can use IAM Access Analyzer for S3 to review buckets with bucket ACLs, bucket policies, or access pointpolicies that grant public access. IAM Access Analyzer for S3 alerts you to buckets that are configuredto allow access to anyone on the internet or other AWS accounts, includingAWS accounts outside of your organization. For each public or shared bucket, youreceive findings that report the source and level of public or shared access.

In IAM Access Analyzer for S3, you can block all public access to a bucket with asingle click. You can also drill down into bucket-level permission settings to configuregranular levels of access. For specific and verified use cases that require public orshared access, you can acknowledge and record your intent for the bucket to remainpublic or shared by archiving the findings for the bucket.

In rare cases, IAM Access Analyzer for S3 and Amazon S3 block public access evaluation might differ on whether abucket is public. This behavior occurs because Amazon S3 block public access performsvalidation on the existence of actions in addition to evaluating public access. Supposethat the bucket policy contains anAction statement that allows publicaccess for an action that isn't supported by Amazon S3 (for example,s3:NotASupportedAction). In this case, Amazon S3 block public accessevaluates the bucket as public because such a statement could potentially make thebucket public if the action later becomes supported. In cases where Amazon S3 block publicaccess and IAM Access Analyzer for S3 differ in their evaluations, we recommend reviewing the bucketpolicy and removing any unsupported actions.

For more information about IAM Access Analyzer for S3, seeReviewing bucket access using IAM Access Analyzer for S3.

Permissions

To use Amazon S3 Block Public Access features, you must have the followingpermissions.

OperationRequired permissions
GET bucket policy statuss3:GetBucketPolicyStatus
GET bucket Block Public Access settingss3:GetBucketPublicAccessBlock
PUT bucket Block Public Access settingss3:PutBucketPublicAccessBlock
DELETE bucket Block Public Access settingss3:PutBucketPublicAccessBlock
GET account Block Public Access settingss3:GetAccountPublicAccessBlock
PUT account Block Public Access settingss3:PutAccountPublicAccessBlock
DELETE account Block Public Access settingss3:PutAccountPublicAccessBlock
PUT access point Block Public Access settingss3:CreateAccessPoint

Configuring block publicaccess

For more information about configuring block public access for your AWS account, your Amazon S3buckets, and your access points, see the following topics:

Policy examples
Configuring account settings

[8]
ページ先頭

©2009-2025 Movatter.jp