scireum / s3ninja

S3 ninja emulates the Amazon S3 API for developement and test purposes
MIT License
493 stars 91 forks source link

I can't create a public bucket with curl #196

Closed jianjungki closed 1 year ago

jianjungki commented 2 years ago
curl --location --request PUT 'http://localhost:9444/testtest9&noAuth=true' \
--header 'x-amz-acl: public-read-write' \
--header 'Content-Type: text/plain' \
--data-raw '<?xml version="1.0" encoding="UTF-8"?>
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
   <LocationConstraint>us-west-1</LocationConstraint>
</CreateBucketConfiguration>'

in aws document x-amz-acl is the access right header for s3, but it's not work? or something wrong with my command?

Because I'm using the s3blob, so I need to finish the bucket creation after unit test.

s3://test?endpoint=http://127.0.0.1:9444/s3&s3ForcePathStyle=true&disableSSL=true&region=http://127.0.0.1:9444/s3

And I don't know how to set the credentials in my s3 url for s3blob

jakobvogel commented 1 year ago

Hello @jianjungki! Thanks for reporting this. Please excuse my super-late reaction. As described here, S3 Ninja does not properly support ACLs.

However, you can check out https://github.com/scireum/s3ninja/pull/219 where I use a non-standard URL to make the bucket public by calling http://<host>/ui/<bucket>/?make-public

I understand that this is not a nice solution, but it works. Unfortunately, we are not able to implement ACL support at this time, but we would happily accept PRs. 😇

Also, I can not provide support for the software tool that you use, I am afraid.

jakobvogel commented 1 year ago

With #222, creation of public buckets will be possible by setting header x-amz-acl: public-read-write. In the AWS S3 SDK, this will look like:

client.createBucket(new CreateBucketRequest(bucketName).withCannedAcl(CannedAccessControlList.PublicReadWrite));