Skip to content

Amazon S3 does not work #6724

Closed
Closed

Description

@isdn

Hello.

The Amazon S3 module does not work in version 6. I have tried the stable release as well as today's build.
Here are the issues.

The following code in apps/files_external/lib/amazons3.php causes the error "Exception: The request signature we calculated does not match the signature you provided. Check your key and signing method." (the access credentials are correct, I checked them via s3cmd and under v.5):

            if (!$this->file_exists('.')) {
                    $result = $this->connection->putObject(array(
                            'Bucket' => $this->bucket,
                            'Key'    => '.',
                            'Body'   => '',
                            'ContentType' => 'httpd/unix-directory',
                            'ContentLength' => 0
                    ));
                    $this->testTimeout();
            }

I am not sure about this code purpose. I suppose, the connection should be checked via the headBucket() call. For example:

            try {
                    $result = $this->connection->headBucket(array(
                            'Bucket' => $this->bucket
                    ));
            } catch (S3Exception $e) {
                    \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
                    throw new \Exception("Check status : head bucket failed.");
            }

Even if that code is changed, the folder, defined in setting, is not displayed in "Files". I.e. the storage is not accessible.

All this is working fine in the latest version 5. So, it appears that something was broken in v.6.

Activity

  1. isdn commented on Jan 11, 2014

    @isdn
    Author

    Also, as a small Amazon S3 module improvement, I would suggest the SSE option implementation.

    http://docs.aws.amazon.com/AmazonS3/latest/dev/SSEUsingPHPSDK.html

    It's quite simple and does not require significant code changes.

  2. PVince81 commented on Jan 12, 2014

    @PVince81
    Contributor

    @isdn I got this as well trying to access a US bucket from Europe...
    @ser72 was able to access it directly from the US.

    Strange that it does work in OC 5 for you.

  3. isdn commented on Jan 12, 2014

    @isdn
    Author

    @PVince81 I used the same bucket in eu-west-1 in both cases (and I am accessing it from Europe) with OC5/OC6.
    I also tried setting the region and/or hostname explicitly to point OC6 to the right region, but this didn't help.
    PS:
    As for the server config - I checked this on two servers - one is a live VPS (nginx + PHP 5.5.3), and the other is a VM on my laptop (Apache + PHP 5.5.3).

  4. rvangijlswijk commented on Jan 26, 2014

    @rvangijlswijk

    I have the same issue. Strange thing is, on an Amazon EC2 instance with owncloud 6.0.0 adding an S3 external storage worked flawlessly.
    I installed a new EC2 instance with owncloud 6.0.0 a while ago, and the same night I also installed owncloud on a VPS from a different provider. This gave me the error mentioned above:

    The request signature we calculated does not match the signature you provided. Check your key and signing method.
    

    This error shows up as error roughly every minute and as fatal every time I try to re-add the S3 storage.

    I tried changing the Amazon security keys, trying new ones, removing old ones, re-adding etc.. to no avail.

    What bothers me is that adding the storage worked perfectly on an owncloud installation on an EC2 instance. To clarify, the instance was an EC2 micro instance, located in the EU region. The S3 storage bucket is a EU bucket as well.

    Would it be possible that this error is caused due to different php.ini settings or missing php extensions? Unfortunately I do not have access to the EC2 instance anymore and am thus not able to compare settings at the moment.

  5. karlitschek commented on Jan 26, 2014

    @karlitschek
    Contributor

    @PVince81 @ser72 Do you have an idea?

  6. rrepolona commented on Jan 30, 2014

    @rrepolona

    i have the same issue too,

    Fatal - files_external - Exception: The request signature we calculated does not match the signature you provided. Check your key and signing method.

    my owncloud version is 6.0.1 (Stable)

    how about on version 5?

  7. jstenquist commented on Jan 30, 2014

    @jstenquist

    I have this same issue, running 6.0.1 (stable). I have s3cmd working fine from the command line.

    JSON returns valid.

    {"data":{"message":false},"status":"success"}

  8. ser72 commented on Feb 7, 2014

    @ser72

    @PVince81 Beta user is having same issue. He is mounting to a "local" S3 rather than actual Amazon's S3.

    I was able to mount to Amazon's S3 without issue -- not sure about a "local" S3.

    From Beta user:

    I'm getting meaningless

    ownCloud[2998]: {files_external} Exception:

    entries in my logs whenever I change the configuration and there's a red square next to the configuration in the admin panel.

    The S3 share works with DragonDisk and s3cmd.

  9. DeepDiver1975 commented on Feb 7, 2014

    @DeepDiver1975
    Contributor

    @ser72 what local S3 product are we talking about? Regarding the meaningless Exception: maybe increasing the log level can help?

  10. ser72 commented on Feb 7, 2014

    @ser72

    @DeepDiver1975 Requested information on the local S3 product.

    Log levels are increased to maximum already

  11. sfabel commented on Feb 10, 2014

    @sfabel

    Beta Tester here. We're using the RADOSGW coming with

    ceph version 0.61.4 (1669132fcfc27d0c0b5e5bb93ade59d147e23404)

    Hope this helps?

    On Fri, Feb 7, 2014 at 2:53 AM, Steve Robinson [email protected]:

    @DeepDiver1975 https://github.com/DeepDiver1975 Requested information
    on the local S3 product.

    Log levels are increased to maximum already

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/6724#issuecomment-34434039
    .

    Be true to your work, your word and your friend. - H.D. Thoreau
    Never tell a lie when you can bullshit your way through. - E. Ambler, Dirty
    Story

  12. tdb commented on Mar 13, 2014

    @tdb

    I have the same problem with both Amazon S3 and Ceph (using radosgw). I believe it's related to the first code bloke referred to by @isdn in the original post. In both cases I get a bucket created, but it fails on the checking and creating of the . directory.

    In Ceph I get a 403 error (@ser72 - I got that meaningless exception too until I upgraded to 6.0.2, then I get the 403). And with Amazon S3 I get that error messages that @rvangijlswijk and @rrepolona referred to.

    After some debugging I believe the issue is to do with the API stripping the . out. I used Ceph (radosgw) to do this because I can control both ends, unlike with Amazon S3. Here's an example of the header used to calculate the authorization digest:

    PUT
    1B2M2Y8AsgTpgAmY7PhCfg==
    httpd/unix-directory
    Thu, 13 Mar 2014 12:25:04 +0000
    /owncloud4/
    

    The bucket name is owncloud4, and notice there's no . after it? The digest for the above does not match what's sent in the request. But if I add a . after the last slash, it is.

    So this tells me that whatever calculates the digest to put in the header is doing it before the . is stripped out by something further down the line. Looks like a bug in the API? Or maybe you're just not supposed to do this?

    In any case, I can't really understand what ownCloud is trying to do in the first place, but hopefully someone with more understanding there can work out the intention behind this code block, and then maybe we can fix it.

  13. RPDiep commented on Mar 16, 2014

    @RPDiep

    I have the very same issue, also with radosgw.
    I've been able to confirm above theory by basically disabling the above check on line 119:
    I've replaced '.' by 'dir' on lines 119 and 122 .
    Now, the object gets created ( as 'dir' ). The check succeeds and I'm presented with a nice green dot instead of a red square.
    Still the directory doesn't show up under files, however.
    Hope this helps a bit in finding the culprit.

  14. tdb commented on Mar 16, 2014

    @tdb

    @RPDiep I tried the same, and although that makes the initial tests pass, it still doesn't work. Something else further down the line is also looking for a . directory. That's probably why it tests for . in the constructor.

  15. RPDiep commented on Mar 16, 2014

    @RPDiep

    @tim: I did the edit not to fix it, but to prove that the '.' is indeed the
    problem here. I've copied the 'dir' object to '.' and that still doesn't
    help any further.

  16. 8 remaining items

  17. sfabel commented on Jun 19, 2014

    @sfabel

    This is really annoying and stopping our rollout of 6.0.3. @karlitschek @ser72

  18. PVince81 commented on Jun 20, 2014

    @PVince81
    Contributor

    There seems to be a PR for that already #8195
    Could you guys try out that patch ?

  19. added this to the ownCloud 7 CE milestone on Jun 24, 2014
  20. craigpg commented on Jun 26, 2014

    @craigpg

    Keeping in oC 7.0 CE

  21. self-assigned this
    on Jun 30, 2014
  22. sfabel commented on Jun 30, 2014

    @sfabel

    @PVince81 - thanks, we will try. Lots of stuff going on and several bugs with OC6 that need to be addressed at our end here. Is this patch in 6.0.4 already because we've upgraded to that version Friday.

  23. PVince81 commented on Jul 1, 2014

    @PVince81
    Contributor

    That patch/PR is not merged yet, which means it hasn't been released yet.
    Still needs testing.

  24. butonic commented on Jul 4, 2014

    @butonic
    Contributor

    I successfully reproduced and fixed this issue by changing <root> to / in PR #8195. Testers needed!

  25. DeepDiver1975 commented on Jul 8, 2014

    @DeepDiver1975
    Contributor

    fixed by #9509 for oc7

  26. DeepDiver1975 commented on Jul 8, 2014

    @DeepDiver1975
    Contributor

    will be fixed with oc7 and oc6.0.5

  27. PVince81 commented on Jul 10, 2014

    @PVince81
    Contributor

    I'd like to ask whoever tried with the old version of the patch to try again with the new version in #9509, because the approach was slightly modified.
    Instead of using "" it now uses "/" as root.

    Please try again with that PR.
    Or you can try with the stable7 branch where the patch is on.

    Thanks.

  28. locked as resolved and limited conversation to collaborators on Aug 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions