Bucket Policies

New in version Luminous.

The Ceph Object Gateway supports a subset of the Amazon S3 policylanguage applied to buckets.

Creation and Removal

Bucket policies are managed through standard S3 operations rather thanradosgw-admin.

For example, one may use s3cmd to set or delete a policy thus:

  1. $ cat > examplepol
  2. {
  3. "Version": "2012-10-17",
  4. "Statement": [{
  5. "Effect": "Allow",
  6. "Principal": {"AWS": ["arn:aws:iam::usfolks:user/fred"]},
  7. "Action": "s3:PutObjectAcl",
  8. "Resource": [
  9. "arn:aws:s3:::happybucket/*"
  10. ]
  11. }]
  12. }
  13.  
  14. $ s3cmd setpolicy examplepol s3://happybucket
  15. $ s3cmd delpolicy s3://happybucket

Limitations

Currently, we support only the following actions:

  • s3:AbortMultipartUpload

  • s3:CreateBucket

  • s3:DeleteBucketPolicy

  • s3:DeleteBucket

  • s3:DeleteBucketWebsite

  • s3:DeleteObject

  • s3:DeleteObjectVersion

  • s3:DeleteReplicationConfiguration

  • s3:GetAccelerateConfiguration

  • s3:GetBucketAcl

  • s3:GetBucketCORS

  • s3:GetBucketLocation

  • s3:GetBucketLogging

  • s3:GetBucketNotification

  • s3:GetBucketPolicy

  • s3:GetBucketRequestPayment

  • s3:GetBucketTagging

  • s3:GetBucketVersioning

  • s3:GetBucketWebsite

  • s3:GetLifecycleConfiguration

  • s3:GetObjectAcl

  • s3:GetObject

  • s3:GetObjectTorrent

  • s3:GetObjectVersionAcl

  • s3:GetObjectVersion

  • s3:GetObjectVersionTorrent

  • s3:GetReplicationConfiguration

  • s3:ListAllMyBuckets

  • s3:ListBucketMultipartUploads

  • s3:ListBucket

  • s3:ListBucketVersions

  • s3:ListMultipartUploadParts

  • s3:PutAccelerateConfiguration

  • s3:PutBucketAcl

  • s3:PutBucketCORS

  • s3:PutBucketLogging

  • s3:PutBucketNotification

  • s3:PutBucketPolicy

  • s3:PutBucketRequestPayment

  • s3:PutBucketTagging

  • s3:PutBucketVersioning

  • s3:PutBucketWebsite

  • s3:PutLifecycleConfiguration

  • s3:PutObjectAcl

  • s3:PutObject

  • s3:PutObjectVersionAcl

  • s3:PutReplicationConfiguration

  • s3:RestoreObject

We do not yet support setting policies on users, groups, or roles.

We use the RGW ‘tenant’ identifier in place of the Amazon twelve-digitaccount ID. In the future we may allow you to assign an account ID toa tenant, but for now if you want to use policies between AWS S3 andRGW S3 you will have to use the Amazon account ID as the tenant ID whencreating users.

Under AWS, all tenants share a single namespace. RGW gives everytenant its own namespace of buckets. There may be an option to enablean AWS-like ‘flat’ bucket namespace in future versions. At present, toaccess a bucket belonging to another tenant, address it as“tenant:bucket” in the S3 request.

In AWS, a bucket policy can grant access to another account, and thataccount owner can then grant access to individual users with userpermissions. Since we do not yet support user, role, and grouppermissions, account owners will currently need to grant accessdirectly to individual users, and granting an entire account access toa bucket grants access to all users in that account.

Bucket policies do not yet support string interpolation.

For all requests, condition keys we support are:- aws:CurrentTime- aws:EpochTime- aws:PrincipalType- aws:Referer- aws:SecureTransport- aws:SourceIp- aws:UserAgent- aws:username

We support certain s3 condition keys for bucket and object requests.

New in version Mimic.

PermissionCondition KeysComments
s3:createBuckets3:x-amz-acls3:x-amz-grant-<perm>where perm is one ofread/write/read-acpwrite-acp/full-control
s3:ListBucket &s3:ListBucketVersionss3:prefix
s3:delimiter
s3:max-keys
s3:PutBucketAcls3:x-amz-acls3:x-amz-grant-<perm>
PermissionCondition KeysComments
s3:PutObjects3:x-amz-acl & s3:x-amz-grant-<perm>
s3:x-amz-copy-source
s3:x-amz-server-side-encryption
s3:x-amz-server-side-encryption-aws-kms-key-id
s3:x-amz-metadata-directivePUT & COPY tooverwrite/preservemetadata in COPYrequests
s3:RequestObjectTag/<tag-key>
s3:PutObjectAcls3:PutObjectVersionAcls3:x-amz-acl & s3-amz-grant-<perm>
s3:ExistingObjectTag/<tag-key>
s3:PutObjectTagging &s3:PutObjectVersionTaggings3:RequestObjectTag/<tag-key>
s3:ExistingObjectTag/<tag-key>
s3:GetObject &s3:GetObjectVersions3:ExistingObjectTag/<tag-key>
s3:GetObjectAcl &s3:GetObjectVersionAcls3:ExistingObjectTag/<tag-key>
s3:GetObjectTagging &s3:GetObjectVersionTaggings3:ExistingObjectTag/<tag-key>
s3:DeleteObjectTagging &s3:DeleteObjectVersionTaggings3:ExistingOBjectTag/<tag-key>

More may be supported soon as we integrate with the recently rewrittenAuthentication/Authorization subsystem.

Swift

There is no way to set bucket policies under Swift, but bucketpolicies that have been set govern Swift as well as S3 operations.

Swift credentials are matched against Principals specified in a policyin a way specific to whatever backend is being used.