csexton / captured-mac

Captured
http://www.capturedapp.com
MIT License
5 stars 1 forks source link

Test Connection on Custom S3 Endpoints #28

Closed csexton closed 8 years ago

csexton commented 8 years ago

Beta Tester reported:

On Thu, Feb 11, 2016 at 9:42 AM, Cullen King wrote:

Gave the new version a shot, I like it much better (not laggy, doesn't stall my options bar), but I can't get it to work with amazon s3: image one more piece of information: my secret key has a + sign in it. i've had issues with a few different clients when there are characters in the key that might need escaping. if i weren't a lazy bastard i'd generate a new key without a special character to see if that helped ;)

Then followed up with:

From Cullen King on Feb 18, 2016 at 03:38 pm

I got it figured out. Problem was captured doesn't like a bucket with a directory when checking credentials. It will error. But, if you set the bucket and directory and just save, it will work. Would be nice to have some sort of debugging info pop up :)

In regard to the S3 clone I use (ceph and radosgw), I did a little more testing. Using wireshark I was able to see that my machine makes a DNS request to S3 even though I have my own endpoints setup. Seems like it is doing credential check against amazon even when I have my own endpoints setup:

public url: https://cos.ridewithgps.com/captured s3 endpoint: https://cos.ridewithgps.com

Sounds like two issues:

  1. Use the custom endpoint on the test connection feature
  2. Strip the directory from the url
csexton commented 8 years ago

Fixed the first issue, now I use the custom endpoint. But turns out that S3 in eu-central-1 won't accept HMAC-SHA1 that captured uses to sign the request, instead they need AWS4-HMAC-SHA256. :rage1:

image

So looks like I may need to figure out how to do the following:

http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-authentication-HTTPPOST.html

There is a guide to implementing it here:

http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-other

csexton commented 8 years ago

http://czak.pl/2015/09/15/s3-rest-api-with-curl.html

csexton commented 8 years ago

Fixed in #30